summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/AllResourceFiles.msa79
-rw-r--r--Tools/CCode/Source/Common/CommonLib.c516
-rw-r--r--Tools/CCode/Source/Common/CommonLib.h139
-rw-r--r--Tools/CCode/Source/Common/Compress.h94
-rw-r--r--Tools/CCode/Source/Common/Crc32.c326
-rw-r--r--Tools/CCode/Source/Common/Crc32.h54
-rw-r--r--Tools/CCode/Source/Common/Decompress.c923
-rw-r--r--Tools/CCode/Source/Common/Decompress.h162
-rw-r--r--Tools/CCode/Source/Common/EfiCompress.c1597
-rw-r--r--Tools/CCode/Source/Common/EfiCustomizedCompress.h141
-rw-r--r--Tools/CCode/Source/Common/EfiUtilityMsgs.c755
-rw-r--r--Tools/CCode/Source/Common/EfiUtilityMsgs.h137
-rw-r--r--Tools/CCode/Source/Common/FvLib.c782
-rw-r--r--Tools/CCode/Source/Common/FvLib.h181
-rw-r--r--Tools/CCode/Source/Common/MyAlloc.c516
-rw-r--r--Tools/CCode/Source/Common/MyAlloc.h222
-rw-r--r--Tools/CCode/Source/Common/ParseInf.c638
-rw-r--r--Tools/CCode/Source/Common/ParseInf.h234
-rw-r--r--Tools/CCode/Source/Common/SimpleFileParsing.c1457
-rw-r--r--Tools/CCode/Source/Common/SimpleFileParsing.h120
-rw-r--r--Tools/CCode/Source/Common/TianoCompress.c1752
-rw-r--r--Tools/CCode/Source/Common/WinNtInclude.h73
-rw-r--r--Tools/CCode/Source/Common/build.xml65
-rw-r--r--Tools/CCode/Source/CompressDll/CompressDll.c105
-rw-r--r--Tools/CCode/Source/CompressDll/CompressDll.h22
-rw-r--r--Tools/CCode/Source/CompressDll/build.xml88
-rw-r--r--Tools/CCode/Source/CreateMtFile/CreateMtFile.c297
-rw-r--r--Tools/CCode/Source/CreateMtFile/build.xml69
-rw-r--r--Tools/CCode/Source/CustomizedCompress/CustomizedCompress.c146
-rw-r--r--Tools/CCode/Source/CustomizedCompress/build.xml73
-rw-r--r--Tools/CCode/Source/EfiCompress/EfiCompressMain.c226
-rw-r--r--Tools/CCode/Source/EfiCompress/build.xml69
-rw-r--r--Tools/CCode/Source/EfiRom/EfiRom.c1580
-rw-r--r--Tools/CCode/Source/EfiRom/build.xml69
-rw-r--r--Tools/CCode/Source/FlashMap/FlashDefFile.c2850
-rw-r--r--Tools/CCode/Source/FlashMap/FlashDefFile.h281
-rw-r--r--Tools/CCode/Source/FlashMap/FlashMap.c820
-rw-r--r--Tools/CCode/Source/FlashMap/Microcode.c334
-rw-r--r--Tools/CCode/Source/FlashMap/Microcode.h87
-rw-r--r--Tools/CCode/Source/FlashMap/Symbols.c648
-rw-r--r--Tools/CCode/Source/FlashMap/Symbols.h124
-rw-r--r--Tools/CCode/Source/FlashMap/build.xml75
-rw-r--r--Tools/CCode/Source/FwImage/build.xml72
-rw-r--r--Tools/CCode/Source/FwImage/fwimage.c1132
-rw-r--r--Tools/CCode/Source/GenAcpiTable/GenAcpiTable.c743
-rw-r--r--Tools/CCode/Source/GenAcpiTable/build.xml71
-rw-r--r--Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c524
-rw-r--r--Tools/CCode/Source/GenBsfFixup/build.xml127
-rw-r--r--Tools/CCode/Source/GenBsfImage/GenBsfImage.c3532
-rw-r--r--Tools/CCode/Source/GenBsfImage/GenBsfImage.h632
-rw-r--r--Tools/CCode/Source/GenBsfImage/build.xml126
-rw-r--r--Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c326
-rw-r--r--Tools/CCode/Source/GenCRC32Section/GenCRC32Section.h63
-rw-r--r--Tools/CCode/Source/GenCRC32Section/build.xml68
-rw-r--r--Tools/CCode/Source/GenCapsuleHdr/CreateGuid.c50
-rw-r--r--Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c2728
-rw-r--r--Tools/CCode/Source/GenCapsuleHdr/build.xml71
-rw-r--r--Tools/CCode/Source/GenDepex/DepexParser.c903
-rw-r--r--Tools/CCode/Source/GenDepex/DepexParser.h26
-rw-r--r--Tools/CCode/Source/GenDepex/GenDepex.c933
-rw-r--r--Tools/CCode/Source/GenDepex/GenDepex.h71
-rw-r--r--Tools/CCode/Source/GenDepex/build.xml67
-rw-r--r--Tools/CCode/Source/GenFfsFile/GenFfsFile.c2694
-rw-r--r--Tools/CCode/Source/GenFfsFile/GenFfsFile.h36
-rw-r--r--Tools/CCode/Source/GenFfsFile/SimpleFileParsing.c969
-rw-r--r--Tools/CCode/Source/GenFfsFile/build.xml70
-rw-r--r--Tools/CCode/Source/GenFvImage/Ebc/PeCoffLoaderEx.c57
-rw-r--r--Tools/CCode/Source/GenFvImage/GenFvImageExe.c317
-rw-r--r--Tools/CCode/Source/GenFvImage/GenFvImageExe.h98
-rw-r--r--Tools/CCode/Source/GenFvImage/GenFvImageLib.c2762
-rw-r--r--Tools/CCode/Source/GenFvImage/GenFvImageLib.h142
-rw-r--r--Tools/CCode/Source/GenFvImage/GenFvImageLibInternal.h172
-rw-r--r--Tools/CCode/Source/GenFvImage/build.xml126
-rw-r--r--Tools/CCode/Source/GenFvMap/GenFvMap.cpp666
-rw-r--r--Tools/CCode/Source/GenFvMap/build.xml88
-rw-r--r--Tools/CCode/Source/GenSection/GenSection.c981
-rw-r--r--Tools/CCode/Source/GenSection/GenSection.h42
-rw-r--r--Tools/CCode/Source/GenSection/build.xml70
-rw-r--r--Tools/CCode/Source/GenTEImage/GenTEImage.c974
-rw-r--r--Tools/CCode/Source/GenTEImage/build.xml71
-rw-r--r--Tools/CCode/Source/GuidChk/CommonUtils.h57
-rw-r--r--Tools/CCode/Source/GuidChk/FileSearch.c285
-rw-r--r--Tools/CCode/Source/GuidChk/FileSearch.h108
-rw-r--r--Tools/CCode/Source/GuidChk/GuidChk.c2400
-rw-r--r--Tools/CCode/Source/GuidChk/GuidList.c186
-rw-r--r--Tools/CCode/Source/GuidChk/UtilsMsgs.c490
-rw-r--r--Tools/CCode/Source/GuidChk/UtilsMsgs.h106
-rw-r--r--Tools/CCode/Source/GuidChk/build.xml83
-rw-r--r--Tools/CCode/Source/Include/Common/BaseTypes.h212
-rw-r--r--Tools/CCode/Source/Include/Common/Capsule.h67
-rw-r--r--Tools/CCode/Source/Include/Common/Dependency.h50
-rw-r--r--Tools/CCode/Source/Include/Common/EfiImage.h716
-rw-r--r--Tools/CCode/Source/Include/Common/FirmwareFileSystem.h98
-rw-r--r--Tools/CCode/Source/Include/Common/FirmwareVolumeHeader.h109
-rw-r--r--Tools/CCode/Source/Include/Common/FirmwareVolumeImageFormat.h277
-rw-r--r--Tools/CCode/Source/Include/Common/InternalFormRepresentation.h422
-rw-r--r--Tools/CCode/Source/Include/Common/MultiPhase.h84
-rw-r--r--Tools/CCode/Source/Include/Common/UefiBaseTypes.h85
-rw-r--r--Tools/CCode/Source/Include/Common/Variable.h78
-rw-r--r--Tools/CCode/Source/Include/Common/WorkingBlockHeader.h47
-rw-r--r--Tools/CCode/Source/Include/Guid/AcpiTableStorage.h30
-rw-r--r--Tools/CCode/Source/Include/Guid/Apriori.h32
-rw-r--r--Tools/CCode/Source/Include/Guid/Capsule.h43
-rw-r--r--Tools/CCode/Source/Include/Guid/FirmwareFileSystem.h40
-rw-r--r--Tools/CCode/Source/Include/Ia32/ProcessorBind.h167
-rw-r--r--Tools/CCode/Source/Include/IndustryStandard/Acpi.h124
-rw-r--r--Tools/CCode/Source/Include/IndustryStandard/Acpi1_0.h297
-rw-r--r--Tools/CCode/Source/Include/IndustryStandard/Acpi2_0.h533
-rw-r--r--Tools/CCode/Source/Include/IndustryStandard/Acpi3_0.h681
-rw-r--r--Tools/CCode/Source/Include/IndustryStandard/EfiPci.h58
-rw-r--r--Tools/CCode/Source/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h52
-rw-r--r--Tools/CCode/Source/Include/IndustryStandard/pci22.h543
-rw-r--r--Tools/CCode/Source/Include/IndustryStandard/pci23.h25
-rw-r--r--Tools/CCode/Source/Include/IndustryStandard/pci30.h45
-rw-r--r--Tools/CCode/Source/Include/Library/PeCoffLib.h131
-rw-r--r--Tools/CCode/Source/Include/Library/PrintLib.h406
-rw-r--r--Tools/CCode/Source/Include/Protocol/DevicePath.h94
-rw-r--r--Tools/CCode/Source/Include/Protocol/GuidedSectionExtraction.h102
-rw-r--r--Tools/CCode/Source/Include/Protocol/Hii.h1024
-rw-r--r--Tools/CCode/Source/Include/Protocol/UgaDraw.h168
-rw-r--r--Tools/CCode/Source/Include/X64/ProcessorBind.h193
-rwxr-xr-xTools/CCode/Source/MakeDeps/MakeDeps.c1338
-rwxr-xr-xTools/CCode/Source/MakeDeps/build.xml70
-rwxr-xr-xTools/CCode/Source/ModifyInf/ModifyInf.c379
-rw-r--r--Tools/CCode/Source/ModifyInf/build.xml69
-rw-r--r--Tools/CCode/Source/Pccts/CHANGES_FROM_131.txt522
-rw-r--r--Tools/CCode/Source/Pccts/CHANGES_FROM_133.txt2448
-rw-r--r--Tools/CCode/Source/Pccts/CHANGES_FROM_133_BEFORE_MR13.txt3666
-rw-r--r--Tools/CCode/Source/Pccts/CHANGES_SUMMARY.txt2049
-rw-r--r--Tools/CCode/Source/Pccts/KNOWN_PROBLEMS.txt241
-rw-r--r--Tools/CCode/Source/Pccts/MPW_Read_Me21
-rw-r--r--Tools/CCode/Source/Pccts/NOTES.bcc184
-rw-r--r--Tools/CCode/Source/Pccts/NOTES.msvc189
-rw-r--r--Tools/CCode/Source/Pccts/README159
-rw-r--r--Tools/CCode/Source/Pccts/RIGHTS26
-rw-r--r--Tools/CCode/Source/Pccts/antlr/AntlrMS.mak233
-rw-r--r--Tools/CCode/Source/Pccts/antlr/AntlrPPC.mak101
-rw-r--r--Tools/CCode/Source/Pccts/antlr/README19
-rw-r--r--Tools/CCode/Source/Pccts/antlr/antlr.1209
-rw-r--r--Tools/CCode/Source/Pccts/antlr/antlr.c3564
-rw-r--r--Tools/CCode/Source/Pccts/antlr/antlr.g2586
-rw-r--r--Tools/CCode/Source/Pccts/antlr/antlr.r787
-rw-r--r--Tools/CCode/Source/Pccts/antlr/antlr1.txt264
-rw-r--r--Tools/CCode/Source/Pccts/antlr/bits.c1025
-rw-r--r--Tools/CCode/Source/Pccts/antlr/build.c813
-rw-r--r--Tools/CCode/Source/Pccts/antlr/build.xml136
-rw-r--r--Tools/CCode/Source/Pccts/antlr/dumpcycles.c67
-rw-r--r--Tools/CCode/Source/Pccts/antlr/dumpnode.c423
-rw-r--r--Tools/CCode/Source/Pccts/antlr/egman.c328
-rw-r--r--Tools/CCode/Source/Pccts/antlr/err.c538
-rw-r--r--Tools/CCode/Source/Pccts/antlr/fcache.c123
-rw-r--r--Tools/CCode/Source/Pccts/antlr/fset.c1555
-rw-r--r--Tools/CCode/Source/Pccts/antlr/fset2.c2250
-rw-r--r--Tools/CCode/Source/Pccts/antlr/gen.c4797
-rw-r--r--Tools/CCode/Source/Pccts/antlr/generic.h286
-rw-r--r--Tools/CCode/Source/Pccts/antlr/globals.c484
-rw-r--r--Tools/CCode/Source/Pccts/antlr/hash.c221
-rw-r--r--Tools/CCode/Source/Pccts/antlr/hash.h73
-rw-r--r--Tools/CCode/Source/Pccts/antlr/lex.c878
-rw-r--r--Tools/CCode/Source/Pccts/antlr/main.c1747
-rw-r--r--Tools/CCode/Source/Pccts/antlr/makefile218
-rw-r--r--Tools/CCode/Source/Pccts/antlr/makefile.cygwin219
-rw-r--r--Tools/CCode/Source/Pccts/antlr/makefile196
-rw-r--r--Tools/CCode/Source/Pccts/antlr/misc.c1864
-rw-r--r--Tools/CCode/Source/Pccts/antlr/mode.h12
-rw-r--r--Tools/CCode/Source/Pccts/antlr/mrhoist.c3030
-rw-r--r--Tools/CCode/Source/Pccts/antlr/parser.dlg1387
-rw-r--r--Tools/CCode/Source/Pccts/antlr/pred.c821
-rw-r--r--Tools/CCode/Source/Pccts/antlr/proto.h852
-rw-r--r--Tools/CCode/Source/Pccts/antlr/scan.c5735
-rw-r--r--Tools/CCode/Source/Pccts/antlr/stdpccts.h31
-rw-r--r--Tools/CCode/Source/Pccts/antlr/syn.h390
-rw-r--r--Tools/CCode/Source/Pccts/antlr/tokens.h246
-rw-r--r--Tools/CCode/Source/Pccts/build.xml49
-rw-r--r--Tools/CCode/Source/Pccts/dlg/DlgMS.mak121
-rw-r--r--Tools/CCode/Source/Pccts/dlg/DlgPPC.mak84
-rw-r--r--Tools/CCode/Source/Pccts/dlg/automata.c353
-rw-r--r--Tools/CCode/Source/Pccts/dlg/build.xml127
-rw-r--r--Tools/CCode/Source/Pccts/dlg/dlg.179
-rw-r--r--Tools/CCode/Source/Pccts/dlg/dlg.h250
-rw-r--r--Tools/CCode/Source/Pccts/dlg/dlg.r275
-rw-r--r--Tools/CCode/Source/Pccts/dlg/dlg1.txt132
-rw-r--r--Tools/CCode/Source/Pccts/dlg/dlg_a.c1414
-rw-r--r--Tools/CCode/Source/Pccts/dlg/dlg_p.c959
-rw-r--r--Tools/CCode/Source/Pccts/dlg/dlg_p.g614
-rw-r--r--Tools/CCode/Source/Pccts/dlg/err.c99
-rw-r--r--Tools/CCode/Source/Pccts/dlg/main.c281
-rw-r--r--Tools/CCode/Source/Pccts/dlg/makefile156
-rw-r--r--Tools/CCode/Source/Pccts/dlg/makefile.cygwin157
-rw-r--r--Tools/CCode/Source/Pccts/dlg/makefile163
-rw-r--r--Tools/CCode/Source/Pccts/dlg/mode.h4
-rw-r--r--Tools/CCode/Source/Pccts/dlg/output.c850
-rw-r--r--Tools/CCode/Source/Pccts/dlg/parser.dlg398
-rw-r--r--Tools/CCode/Source/Pccts/dlg/relabel.c217
-rw-r--r--Tools/CCode/Source/Pccts/dlg/stdpccts.h26
-rw-r--r--Tools/CCode/Source/Pccts/dlg/support.c240
-rw-r--r--Tools/CCode/Source/Pccts/dlg/tokens.h133
-rw-r--r--Tools/CCode/Source/Pccts/h/AParser.cpp871
-rw-r--r--Tools/CCode/Source/Pccts/h/AParser.h376
-rw-r--r--Tools/CCode/Source/Pccts/h/ASTBase.cpp256
-rw-r--r--Tools/CCode/Source/Pccts/h/ASTBase.h122
-rw-r--r--Tools/CCode/Source/Pccts/h/ATokPtr.h88
-rw-r--r--Tools/CCode/Source/Pccts/h/ATokPtrImpl.h88
-rw-r--r--Tools/CCode/Source/Pccts/h/AToken.h325
-rw-r--r--Tools/CCode/Source/Pccts/h/ATokenBuffer.cpp374
-rw-r--r--Tools/CCode/Source/Pccts/h/ATokenBuffer.h109
-rw-r--r--Tools/CCode/Source/Pccts/h/ATokenStream.h51
-rw-r--r--Tools/CCode/Source/Pccts/h/BufFileInput.cpp100
-rw-r--r--Tools/CCode/Source/Pccts/h/BufFileInput.h53
-rw-r--r--Tools/CCode/Source/Pccts/h/DLG_stream_input.h98
-rw-r--r--Tools/CCode/Source/Pccts/h/DLexer.h191
-rw-r--r--Tools/CCode/Source/Pccts/h/DLexerBase.cpp302
-rw-r--r--Tools/CCode/Source/Pccts/h/DLexerBase.h198
-rw-r--r--Tools/CCode/Source/Pccts/h/PBlackBox.h134
-rw-r--r--Tools/CCode/Source/Pccts/h/PCCTSAST.cpp684
-rw-r--r--Tools/CCode/Source/Pccts/h/PCCTSAST.h143
-rw-r--r--Tools/CCode/Source/Pccts/h/SList.h72
-rw-r--r--Tools/CCode/Source/Pccts/h/antlr.h807
-rw-r--r--Tools/CCode/Source/Pccts/h/ast.c345
-rw-r--r--Tools/CCode/Source/Pccts/h/ast.h121
-rw-r--r--Tools/CCode/Source/Pccts/h/charbuf.h46
-rw-r--r--Tools/CCode/Source/Pccts/h/charptr.c58
-rw-r--r--Tools/CCode/Source/Pccts/h/charptr.h48
-rw-r--r--Tools/CCode/Source/Pccts/h/config.h1
-rw-r--r--Tools/CCode/Source/Pccts/h/dlgauto.h504
-rw-r--r--Tools/CCode/Source/Pccts/h/dlgdef.h128
-rw-r--r--Tools/CCode/Source/Pccts/h/err.h1170
-rw-r--r--Tools/CCode/Source/Pccts/h/int.h37
-rw-r--r--Tools/CCode/Source/Pccts/h/pccts_assert.h10
-rw-r--r--Tools/CCode/Source/Pccts/h/pccts_iostream.h10
-rw-r--r--Tools/CCode/Source/Pccts/h/pccts_istream.h10
-rw-r--r--Tools/CCode/Source/Pccts/h/pccts_setjmp.h10
-rw-r--r--Tools/CCode/Source/Pccts/h/pccts_stdarg.h10
-rw-r--r--Tools/CCode/Source/Pccts/h/pccts_stdio.h10
-rw-r--r--Tools/CCode/Source/Pccts/h/pccts_stdlib.h10
-rw-r--r--Tools/CCode/Source/Pccts/h/pccts_string.h10
-rw-r--r--Tools/CCode/Source/Pccts/h/pcctscfg.h359
-rw-r--r--Tools/CCode/Source/Pccts/h/pcnames.bat11
-rw-r--r--Tools/CCode/Source/Pccts/h/slist.cpp116
-rw-r--r--Tools/CCode/Source/Pccts/history.ps473
-rw-r--r--Tools/CCode/Source/Pccts/history.txt186
-rw-r--r--Tools/CCode/Source/Pccts/makefile66
-rw-r--r--Tools/CCode/Source/Pccts/support/genmk/genmk.c1063
-rw-r--r--Tools/CCode/Source/Pccts/support/genmk/genmk_old.c762
-rw-r--r--Tools/CCode/Source/Pccts/support/genmk/makefile29
-rw-r--r--Tools/CCode/Source/Pccts/support/rexpr/makefile19
-rw-r--r--Tools/CCode/Source/Pccts/support/rexpr/rexpr.c586
-rw-r--r--Tools/CCode/Source/Pccts/support/rexpr/rexpr.h30
-rw-r--r--Tools/CCode/Source/Pccts/support/rexpr/test.c19
-rw-r--r--Tools/CCode/Source/Pccts/support/set/set.c816
-rw-r--r--Tools/CCode/Source/Pccts/support/set/set.h121
-rw-r--r--Tools/CCode/Source/Pccts/support/sym/sym.c402
-rw-r--r--Tools/CCode/Source/Pccts/support/sym/template.h41
-rw-r--r--Tools/CCode/Source/PeCoffLoader/BasePeCoff.c1060
-rw-r--r--Tools/CCode/Source/PeCoffLoader/Common/EfiImage.h701
-rw-r--r--Tools/CCode/Source/PeCoffLoader/Ia32/PeCoffLoaderEx.c56
-rw-r--r--Tools/CCode/Source/PeCoffLoader/Ipf/PeCoffLoaderEx.c249
-rw-r--r--Tools/CCode/Source/PeCoffLoader/X64/PeCoffLoaderEx.c57
-rw-r--r--Tools/CCode/Source/PeCoffLoader/build.xml153
-rw-r--r--Tools/CCode/Source/PeiRebase/PeiRebaseExe.c1010
-rw-r--r--Tools/CCode/Source/PeiRebase/PeiRebaseExe.h158
-rw-r--r--Tools/CCode/Source/PeiRebase/build.xml108
-rw-r--r--Tools/CCode/Source/SecApResetVectorFixup/SecApResetVectorFixup.c531
-rw-r--r--Tools/CCode/Source/SecApResetVectorFixup/SecApResetVectorFixup.h104
-rw-r--r--Tools/CCode/Source/SecApResetVectorFixup/build.xml69
-rw-r--r--Tools/CCode/Source/SecFixup/SecFixup.c371
-rw-r--r--Tools/CCode/Source/SecFixup/SecFixup.h146
-rw-r--r--Tools/CCode/Source/SecFixup/build.xml69
-rw-r--r--Tools/CCode/Source/SetStamp/SetStamp.c527
-rw-r--r--Tools/CCode/Source/SetStamp/build.xml69
-rw-r--r--Tools/CCode/Source/SplitFile/SplitFile.c185
-rw-r--r--Tools/CCode/Source/SplitFile/build.xml68
-rw-r--r--Tools/CCode/Source/StrGather/StrGather.c2584
-rw-r--r--Tools/CCode/Source/StrGather/StrGather.h87
-rw-r--r--Tools/CCode/Source/StrGather/StringDB.c2759
-rw-r--r--Tools/CCode/Source/StrGather/StringDB.h136
-rw-r--r--Tools/CCode/Source/StrGather/build.xml71
-rw-r--r--Tools/CCode/Source/String/PrintLib.c674
-rw-r--r--Tools/CCode/Source/String/PrintLibInternal.c142
-rw-r--r--Tools/CCode/Source/String/PrintLibInternal.h101
-rw-r--r--Tools/CCode/Source/String/String.c732
-rw-r--r--Tools/CCode/Source/String/build.xml94
-rw-r--r--Tools/CCode/Source/Strip/Strip.c174
-rw-r--r--Tools/CCode/Source/Strip/build.xml68
-rw-r--r--Tools/CCode/Source/TianoTools.msa326
-rw-r--r--Tools/CCode/Source/VfrCompile/EfiVfr.h181
-rw-r--r--Tools/CCode/Source/VfrCompile/VfrCompile.g3529
-rw-r--r--Tools/CCode/Source/VfrCompile/VfrServices.cpp758
-rw-r--r--Tools/CCode/Source/VfrCompile/VfrServices.h227
-rw-r--r--Tools/CCode/Source/VfrCompile/build.xml123
-rw-r--r--Tools/CCode/Source/ZeroDebugData/ZeroDebugData.c433
-rw-r--r--Tools/CCode/Source/ZeroDebugData/build.xml68
-rw-r--r--Tools/CCode/Source/build.xml272
-rw-r--r--Tools/Conf/BuildMacro.xml1466
-rw-r--r--Tools/Conf/FrameworkDatabase.template37
-rw-r--r--Tools/Conf/Migration/Guid.csv102
-rw-r--r--Tools/Conf/Migration/Library.csv189
-rw-r--r--Tools/Conf/Migration/Macro.csv178
-rw-r--r--Tools/Conf/Migration/PkgGuid.csv3
-rw-r--r--Tools/Conf/Migration/Ppi.csv28
-rw-r--r--Tools/Conf/Migration/Protocol.csv154
-rw-r--r--Tools/Conf/Migration/R8Lib.c980
-rw-r--r--Tools/Conf/target.template71
-rw-r--r--Tools/Conf/tools_def.template715
-rw-r--r--Tools/Java/Source/CheckTools/CheckTools.msa39
-rw-r--r--Tools/Java/Source/CheckTools/build.xml42
-rw-r--r--Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/CheckTools.java292
-rw-r--r--Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/ToolChecks.java851
-rw-r--r--Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/ToolInfo.java185
-rw-r--r--Tools/Java/Source/Common/Common.msa48
-rw-r--r--Tools/Java/Source/Common/build.xml64
-rw-r--r--Tools/Java/Source/Common/org/tianocore/common/cache/FileTimeStamp.java83
-rw-r--r--Tools/Java/Source/Common/org/tianocore/common/definitions/EdkDefinitions.java111
-rw-r--r--Tools/Java/Source/Common/org/tianocore/common/definitions/ToolDefinitions.java105
-rw-r--r--Tools/Java/Source/Common/org/tianocore/common/exception/EdkException.java49
-rw-r--r--Tools/Java/Source/Common/org/tianocore/common/logger/DefaultLogger.java44
-rw-r--r--Tools/Java/Source/Common/org/tianocore/common/logger/EdkLog.java112
-rw-r--r--Tools/Java/Source/Common/org/tianocore/common/logger/LogMethod.java27
-rw-r--r--Tools/Java/Source/ContextTool/ContextTool.msa31
-rw-r--r--Tools/Java/Source/ContextTool/build.xml55
-rw-r--r--Tools/Java/Source/ContextTool/org/tianocore/context/ContextMain.java48
-rw-r--r--Tools/Java/Source/ContextTool/org/tianocore/context/HelpInfo.java144
-rw-r--r--Tools/Java/Source/ContextTool/org/tianocore/context/ParseParameter.java276
-rw-r--r--Tools/Java/Source/ContextTool/org/tianocore/context/TargetFile.java403
-rw-r--r--Tools/Java/Source/Cpptasks/CppTasks.msa219
-rw-r--r--Tools/Java/Source/Cpptasks/build.xml58
-rw-r--r--Tools/Java/Source/Cpptasks/cpptasks.mf7
-rw-r--r--Tools/Java/Source/Cpptasks/cpptasks.tasks1
-rw-r--r--Tools/Java/Source/Cpptasks/cpptasks.types9
-rw-r--r--Tools/Java/Source/Cpptasks/javadoc.xml30
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AboutCCTask.java49
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ArchEnum.java72
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerDef.java118
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerEnum.java54
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AssemblerDef.java237
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AssemblerEnum.java53
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CCTask.java1749
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CCTaskProgressMonitor.java56
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CPUEnum.java71
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CUtil.java461
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerDef.java556
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerEnum.java221
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerParam.java33
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DependencyInfo.java86
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DependencyTable.java609
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerDef.java243
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerMap.java218
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerProtocolEnum.java50
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/FileVisitor.java27
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerDef.java549
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerEnum.java106
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerParam.java33
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OSFamilyEnum.java59
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ObjectFileCollector.java42
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OptimizationEnum.java82
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OutputTypeEnum.java48
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/PrecompileDef.java215
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/PrecompileExceptDef.java80
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorDef.java714
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorEnumValue.java47
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorParam.java100
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/RuntimeType.java26
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/SourceHistory.java51
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/SubsystemEnum.java34
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetDef.java228
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetHistory.java58
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetHistoryTable.java426
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetInfo.java127
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetMatcher.java117
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/VersionInfo.java550
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSCCompiler.java215
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSLibrarian.java160
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSLinker.java166
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandCCompiler.java135
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandCfgParser.java70
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandLibrarian.java200
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandLinker.java264
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandProcessor.java219
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandResourceCompiler.java130
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/CfgFilenameState.java46
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/ConsumeToSpaceOrNewLine.java30
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/QuoteBranchState.java35
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java138
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java82
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java77
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractAslcompiler.java75
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractAssembler.java72
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractCompiler.java205
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java85
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java129
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Aslcompiler.java23
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AslcompilerConfiguration.java29
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Assembler.java23
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AssemblerConfiguration.java29
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java122
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompiler.java226
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompilerConfiguration.java93
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAssembler.java326
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAssemblerConfiguration.java123
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCCompiler.java42
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCompiler.java435
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCompilerConfiguration.java216
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineFortranCompiler.java42
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java404
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinkerConfiguration.java119
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Compiler.java24
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CompilerConfiguration.java64
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/LinkType.java134
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Linker.java57
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/LinkerConfiguration.java31
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCCompiler.java43
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCompiler.java104
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCompiler.java49
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Processor.java73
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/ProcessorConfiguration.java52
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/ProgressMonitor.java31
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioAslcompiler.java70
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioAssembler.java84
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java50
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java136
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java86
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java127
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioLibrarian.java36
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioLinker.java44
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java113
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioProcessor.java90
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java117
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java106
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java323
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccAssembler.java76
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java243
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java152
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccLibrarian.java41
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccLinker.java210
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccProcessor.java299
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GppLinker.java203
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/LdLinker.java57
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccCCompiler.java273
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccLibrarian.java69
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java234
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccProcessor.java288
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java228
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/LdLinker.java83
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccCCompiler.java245
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLibrarian.java43
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLinker.java215
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccProcessor.java305
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GppLinker.java210
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java60
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java104
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCLinker.java100
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java111
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ibm/VisualAgeLinker.java75
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java58
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java55
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java58
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java55
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelProcessor.java51
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Aslcompiler.java66
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32CCompiler.java53
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Librarian.java38
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Linker.java46
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin64CCompiler.java53
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390CCompiler.java157
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390Linker.java201
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390Processor.java71
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccCompiler.java124
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccLinker.java202
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccProcessor.java71
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParser.java67
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParserState.java41
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/BranchState.java46
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CParser.java78
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CaseInsensitiveLetterState.java87
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FilenameState.java41
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FortranParser.java106
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/LetterState.java80
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/Parser.java28
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/PostE.java41
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrCaseInsensitiveLetterState.java83
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrLetterState.java75
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java109
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89Linker.java125
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89Processor.java116
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java119
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java100
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxCCompiler.java192
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxLibrarian.java162
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxLinker.java181
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/AslcompilerArgument.java30
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/AssemblerArgument.java30
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/CommandLineArgument.java122
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/CompilerArgument.java28
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalFileSet.java84
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalPath.java92
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/DefineArgument.java38
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/DefineSet.java199
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/FlexLong.java59
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/IncludePath.java38
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LibrarySet.java290
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LibraryTypeEnum.java48
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LinkerArgument.java28
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/SystemIncludePath.java45
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/SystemLibrarySet.java37
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/UndefineArgument.java153
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java297
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineArgument.java34
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineCompiler.java45
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java333
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineMapping.java87
-rw-r--r--Tools/Java/Source/DbTools/DbTools.msa31
-rw-r--r--Tools/Java/Source/DbTools/build.xml42
-rw-r--r--Tools/Java/Source/DbTools/src/org/tianocore/DbTools/DbCmds.java501
-rw-r--r--Tools/Java/Source/DbTools/src/org/tianocore/DbTools/DbTool.java24
-rw-r--r--Tools/Java/Source/DbTools/src/org/tianocore/DbTools/UpdateDb.java594
-rw-r--r--Tools/Java/Source/FrameworkTasks/FrameworkTasks.msa81
-rw-r--r--Tools/Java/Source/FrameworkTasks/build.xml53
-rw-r--r--Tools/Java/Source/FrameworkTasks/frameworktasks.tasks25
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java78
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressHeader.java77
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java213
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java192
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Database.java30
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java194
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiDefine.java56
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java376
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsHeader.java185
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsTypes.java115
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java65
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java848
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java198
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java194
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCRC32SectionTask.java142
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java341
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenDepexTask.java167
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java1010
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java274
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java398
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java253
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java368
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/IncludePath.java26
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Input.java24
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/InputFile.java24
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java381
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java221
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/NestElement.java366
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java290
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java196
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java224
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java116
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Section.java26
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SetStampTask.java162
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SkipExt.java24
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java195
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java471
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java197
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java266
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ToolArg.java151
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java213
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java195
-rw-r--r--Tools/Java/Source/FrameworkWizard/FrameworkWizard.msa224
-rw-r--r--Tools/Java/Source/FrameworkWizard/MANIFEST.MF2
-rw-r--r--Tools/Java/Source/FrameworkWizard/build.xml46
-rw-r--r--Tools/Java/Source/FrameworkWizard/rsc/resources/images/No.JPGbin1205 -> 0 bytes
-rw-r--r--Tools/Java/Source/FrameworkWizard/rsc/resources/images/Yes.JPGbin1106 -> 0 bytes
-rw-r--r--Tools/Java/Source/FrameworkWizard/rsc/resources/images/logo.gifbin3920 -> 0 bytes
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java161
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java1291
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java3789
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java228
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java809
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SplashScreen.java106
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java508
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java139
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java304
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java746
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java1123
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java193
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java300
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java37
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IFileFilter.java91
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/Identification.java113
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningFileType.java71
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java231
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.java75
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java231
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java74
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformList.java217
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformType.java74
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigId.java55
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java155
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java301
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/OpenFile.java95
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java334
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Sort.java378
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java715
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/XmlConfig.java40
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java1050
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java651
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java657
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java124
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/GuidId.java76
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/LibraryClassId.java76
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdFindResultId.java76
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdId.java76
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PpiId.java76
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/ProtocolId.java76
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java318
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ExitConfirm.java263
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java227
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDefaultMutableTreeNode.java280
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDesktopManager.java76
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java163
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java264
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java216
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ITree.java231
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/StarLabel.java64
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java203
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListCellRenderer.java76
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java84
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListModel.java67
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListener.java104
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java86
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java89
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java261
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java54
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java100
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java58
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java21
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java40
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java93
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java60
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java36
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java960
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java40
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java127
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java38
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java334
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java641
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java294
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java349
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java374
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java351
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java362
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java483
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java315
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java417
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesIdentification.java89
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java96
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsIdentification.java93
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsVector.java95
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsIdentification.java89
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java96
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java114
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java97
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsIdentification.java152
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java174
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsIdentification.java112
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java97
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesIdentification.java89
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java96
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java103
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java97
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassIdentification.java147
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java105
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java170
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesIdentification.java89
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java97
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java175
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java98
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdIdentification.java74
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdVector.java97
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisIdentification.java123
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java97
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsIdentification.java123
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java97
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesIdentification.java100
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java100
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesIdentification.java89
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java96
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesIdentification.java100
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java97
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java472
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBuildOptions.java493
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java469
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java537
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java655
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java465
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java469
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java471
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java485
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java485
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java479
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java514
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java515
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java491
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java469
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java472
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java1696
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java445
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BuildOptionsDlg.java495
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java452
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java546
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java948
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java465
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java461
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java511
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java589
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java611
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java441
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java493
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java523
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java547
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java458
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java498
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java64
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java445
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java98
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java1885
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java941
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java816
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java931
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java517
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java579
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java1242
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java148
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java146
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java61
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java42
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java2242
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java774
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java3818
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java3239
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java1084
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java368
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java786
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java2240
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java1043
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java265
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java244
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java229
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java119
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java93
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java277
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java132
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java413
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java157
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java1152
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java329
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/Workspace.java153
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java958
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java217
-rw-r--r--Tools/Java/Source/GenBuild/GenBuild.msa89
-rw-r--r--Tools/Java/Source/GenBuild/GenBuild.tasks8
-rw-r--r--Tools/Java/Source/GenBuild/build.xml56
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/FfsProcess.java526
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/FileProcess.java286
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java415
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java858
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildThread.java242
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java523
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java2303
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java261
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/autogen/CommonDefinition.java285
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/exception/AutoGenException.java40
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/exception/GenBuildException.java40
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/exception/PcdAutogenException.java35
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/exception/PlatformPcdPreprocessBuildException.java36
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/exception/XmlParseException.java35
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java421
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java950
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java708
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/DpFile.java130
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/DpFileList.java64
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java283
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java948
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/OnDependency.java145
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/OutputManager.java201
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/Spd.java273
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java2356
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/VariableTask.java71
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/id/FpdModuleIdentification.java130
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/id/Identification.java128
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/id/ModuleIdentification.java251
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java118
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java113
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java384
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java1740
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PlatformPcdPreprocessActionForBuilding.java359
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ConfigReader.java114
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java127
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainElement.java54
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainInfo.java347
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainKey.java278
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainMap.java328
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/tools/ModuleItem.java140
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/tools/PackageItem.java88
-rw-r--r--Tools/Java/Source/Merge/Merge.msa32
-rw-r--r--Tools/Java/Source/Merge/build.xml44
-rw-r--r--Tools/Java/Source/Merge/readme.txt48
-rw-r--r--Tools/Java/Source/Merge/src/org/tianocore/Merge/CombineMsa.java2007
-rw-r--r--Tools/Java/Source/Merge/src/org/tianocore/Merge/Merge.java24
-rw-r--r--Tools/Java/Source/Merge/src/org/tianocore/Merge/MergeCmd.java211
-rw-r--r--Tools/Java/Source/MigrationTools/MANIFEST.MF2
-rw-r--r--Tools/Java/Source/MigrationTools/MigrationTools.msa51
-rw-r--r--Tools/Java/Source/MigrationTools/build.xml54
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/Common.java255
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/Critic.java239
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java505
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/FirstPanel.java305
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/Func.java73
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/Guid.java77
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java54
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/MigrationTool.java195
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java177
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java430
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java425
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java166
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java294
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/PathIterator.java56
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java504
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/UI.java32
-rw-r--r--Tools/Java/Source/PcdTools/PcdTools.msa48
-rw-r--r--Tools/Java/Source/PcdTools/build.xml54
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/action/BuildAction.java61
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java992
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java353
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java162
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java313
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/ModulePcdInfoFromFpd.java48
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/SkuInstance.java50
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/Token.java960
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java105
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java512
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/BuildActionException.java33
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/EntityException.java31
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/PlatformPcdPreprocessException.java36
-rw-r--r--Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/UIException.java31
-rw-r--r--Tools/Java/Source/SurfaceArea/SurfaceArea.msa38
-rw-r--r--Tools/Java/Source/SurfaceArea/build.xml220
-rw-r--r--Tools/OldBuildEnv107
-rwxr-xr-xTools/Python/Calc-Deps.py217
-rwxr-xr-xTools/Python/ContextTool.py600
-rw-r--r--Tools/Python/Doxyfile259
-rwxr-xr-xTools/Python/EdkIIWorkspace.py148
-rwxr-xr-xTools/Python/Fd.py582
-rwxr-xr-xTools/Python/GenMake.py114
-rwxr-xr-xTools/Python/InstallFar.py328
-rwxr-xr-xTools/Python/Install_Python_OSX.sh16
-rwxr-xr-xTools/Python/ListWorkspace.py47
-rwxr-xr-xTools/Python/MkFar.py230
-rwxr-xr-xTools/Python/WorkspaceRoutines.py61
-rwxr-xr-xTools/Python/XmlRoutines.py195
-rw-r--r--Tools/Python/buildgen/AntTasks.py84
-rw-r--r--Tools/Python/buildgen/BuildConfig.py185
-rw-r--r--Tools/Python/buildgen/BuildFile.py582
-rw-r--r--Tools/Python/buildgen/FrameworkElement.py523
-rw-r--r--Tools/Python/buildgen/SurfaceAreaElement.py1555
-rw-r--r--Tools/Python/buildgen/module_build_path.txt5
-rw-r--r--Tools/Python/buildgen/platform_build_path.txt5
-rw-r--r--Tools/Python/far-template48
-rw-r--r--Tools/Tools.spd45
-rw-r--r--Tools/XMLSchema/FarManifest.xsd223
-rw-r--r--Tools/XMLSchema/FrameworkDataAttributes.xsd297
-rw-r--r--Tools/XMLSchema/FrameworkDataElements.xsd939
-rw-r--r--Tools/XMLSchema/FrameworkDataTypes.xsd561
-rw-r--r--Tools/XMLSchema/FrameworkHeaders.xsd112
-rw-r--r--Tools/XMLSchema/FrameworkPlatformDataElements.xsd437
-rw-r--r--Tools/XMLSchema/FrameworkPlatformDataTypes.xsd124
-rw-r--r--Tools/XMLSchema/NamingConvention.xsd186
-rw-r--r--Tools/XMLSchema/SurfaceArea.xsd135
-rw-r--r--Tools/XMLSchema/SurfaceArea.xsdconfig16
-rwxr-xr-xTools/bin/ContextTool14
-rw-r--r--Tools/bin/ContextTool.bat73
-rwxr-xr-xTools/bin/FrameworkWizard13
-rw-r--r--Tools/bin/FrameworkWizard.bat74
-rwxr-xr-xTools/bin/MigrationTools13
-rw-r--r--Tools/bin/MigrationTools.bat74
-rw-r--r--Tools/bin/SAVerify.bat55
-rwxr-xr-xTools/bin/build12
-rw-r--r--Tools/bin/build.bat39
-rwxr-xr-xTools/bin/ckt13
-rw-r--r--Tools/bin/ckt.bat73
-rw-r--r--Tools/bin/dbtool13
-rw-r--r--Tools/bin/dbtool.bat73
-rw-r--r--Tools/bin/fixdb13
-rw-r--r--Tools/bin/fixdb.bat73
-rwxr-xr-xTools/bin/fw13
-rw-r--r--Tools/bin/fw.bat74
-rwxr-xr-xTools/bin/merge14
-rw-r--r--Tools/bin/merge.bat73
-rw-r--r--Tools/build.xml246
-rw-r--r--Tools/gcc/README.txt35
-rwxr-xr-xTools/gcc/mingw64-gcc-build163
-rw-r--r--Tools/gcc/tianoCross-gcc-4.0141
-rw-r--r--Tools/gcc/tianoCross-gcc-4.1145
896 files changed, 0 insertions, 297375 deletions
diff --git a/Tools/AllResourceFiles.msa b/Tools/AllResourceFiles.msa
deleted file mode 100755
index f0ab31e7d4..0000000000
--- a/Tools/AllResourceFiles.msa
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
- <MsaHeader>
- <ModuleName>Edk_II_Resources</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>5d6c499e-53fd-430e-9285-2d7811b924e8</GuidValue>
- <Version>2.0</Version>
- <Abstract>This is the EDK II Tool Resources Module</Abstract>
- <Description>
- This Module provides the EFI/Tiano Tool resources that are used
- by Tiano Tools. These resources do not require compilation.
- </Description>
- <Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
- <License>
-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.
- </License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <NonProcessedFiles>
- <Filename>AllResourceFiles.msa</Filename>
- <Filename>build.xml</Filename>
- <Filename>bin/build</Filename>
- <Filename>bin/build.bat</Filename>
- <Filename>bin/ckt</Filename>
- <Filename>bin/ckt.bat</Filename>
- <Filename>bin/ContextTool</Filename>
- <Filename>bin/ContextTool.bat</Filename>
- <Filename>bin/dbtool</Filename>
- <Filename>bin/dbtool.bat</Filename>
- <Filename>bin/fixdb</Filename>
- <Filename>bin/fixdb.bat</Filename>
- <Filename>bin/FrameworkWizard</Filename>
- <Filename>bin/FrameworkWizard.bat</Filename>
- <Filename>bin/fw</Filename>
- <Filename>bin/fw.bat</Filename>
- <Filename>bin/merge</Filename>
- <Filename>bin/merge.bat</Filename>
- <Filename>bin/MigrationTools</Filename>
- <Filename>bin/MigrationTools.bat</Filename>
- <Filename>bin/SAVerify.bat</Filename>
- <Filename>Conf/BuildMacro.xml</Filename>
- <Filename>Conf/FrameworkDatabase.template</Filename>
- <Filename>Conf/target.template</Filename>
- <Filename>Conf/tools_def.template</Filename>
- <Filename>Conf/Migration/Guid.csv</Filename>
- <Filename>Conf/Migration/Library.csv</Filename>
- <Filename>Conf/Migration/Macro.csv</Filename>
- <Filename>Conf/Migration/PkgGuid.csv</Filename>
- <Filename>Conf/Migration/Ppi.csv</Filename>
- <Filename>Conf/Migration/Protocol.csv</Filename>
- <Filename>Conf/Migration/R8Lib.c</Filename>
- <Filename>gcc/README.txt</Filename>
- <Filename>gcc/tianoCross-gcc-4.0</Filename>
- <Filename>gcc/tianoCross-gcc-4.1</Filename>
- <Filename>XMLSchema/FarManifest.xsd</Filename>
- <Filename>XMLSchema/FrameworkDataAttributes.xsd</Filename>
- <Filename>XMLSchema/FrameworkDataElements.xsd</Filename>
- <Filename>XMLSchema/FrameworkDataTypes.xsd</Filename>
- <Filename>XMLSchema/FrameworkHeaders.xsd</Filename>
- <Filename>XMLSchema/FrameworkPlatformDataElements.xsd</Filename>
- <Filename>XMLSchema/FrameworkPlatformDataTypes.xsd</Filename>
- <Filename>XMLSchema/NamingConvention.xsd</Filename>
- <Filename>XMLSchema/SurfaceArea.xsd</Filename>
- <Filename>XMLSchema/SurfaceArea.xsdconfig</Filename>
- </NonProcessedFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/CCode/Source/Common/CommonLib.c b/Tools/CCode/Source/Common/CommonLib.c
deleted file mode 100644
index 4ae5542b8b..0000000000
--- a/Tools/CCode/Source/Common/CommonLib.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- CommonLib.c
-
-Abstract:
-
- Common Library Functions
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "CommonLib.h"
-
-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 (InputFileName, "rb");
- if (InputFile == NULL) {
- printf ("ERROR: Could not open input file \"%s\".\n", InputFileName);
- return EFI_ABORTED;
- }
- //
- // Go to the end so that we can determine the file size
- //
- if (fseek (InputFile, 0, SEEK_END)) {
- printf ("ERROR: System error reading input file \"%s\".\n", InputFileName);
- fclose (InputFile);
- return EFI_ABORTED;
- }
- //
- // Get the file size
- //
- FileSize = ftell (InputFile);
- if (FileSize == -1) {
- printf ("ERROR: System error parsing input file \"%s\".\n", 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)) {
- printf ("ERROR: System error reading input file \"%s\".\n", 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) {
- printf ("ERROR: Reading file \"%s\"%i.\n", InputFileName);
- fclose (InputFile);
- free (*InputFileImage);
- *InputFileImage = NULL;
- return EFI_ABORTED;
- }
- //
- // Close the file
- //
- fclose (InputFile);
-
- 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) {
- printf ("ERROR: PrintGuid called with a NULL value.\n");
- return EFI_INVALID_PARAMETER;
- }
-
- printf (
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
- 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) {
- printf ("ERROR: PrintGuidToBuffer() called with a NULL value\n");
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferLen < PRINTED_GUID_BUFFER_SIZE) {
- printf ("ERORR: PrintGuidToBuffer() called with invalid buffer size\n");
- return EFI_BUFFER_TOO_SMALL;
- }
-
- if (Uppercase) {
- sprintf (
- Buffer,
- "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- 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 (
- Buffer,
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- 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
diff --git a/Tools/CCode/Source/Common/CommonLib.h b/Tools/CCode/Source/Common/CommonLib.h
deleted file mode 100644
index 40d35356e7..0000000000
--- a/Tools/CCode/Source/Common/CommonLib.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- CommonLib.h
-
-Abstract:
-
- Common library assistance routines.
-
---*/
-
-#ifndef _EFI_COMMON_LIB_H
-#define _EFI_COMMON_LIB_H
-
-#include <Common/UefiBaseTypes.h>
-
-#ifndef _MAX_PATH
-#define _MAX_PATH 500
-#endif
-
-#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
-//
-// 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
- )
-;
-
-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
- )
-;
-
-#define ASSERT(x) assert(x)
-
-#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
-
-#endif
diff --git a/Tools/CCode/Source/Common/Compress.h b/Tools/CCode/Source/Common/Compress.h
deleted file mode 100644
index 7366e720e2..0000000000
--- a/Tools/CCode/Source/Common/Compress.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2006, 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.
-
-Module Name:
-
- Compress.h
-
-Abstract:
-
- Header file for compression routine.
- Providing both EFI and Tiano Compress algorithms.
-
---*/
-
-#ifndef _COMPRESS_H_
-#define _COMPRESS_H_
-
-#include <string.h>
-#include <stdlib.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/Tools/CCode/Source/Common/Crc32.c b/Tools/CCode/Source/Common/Crc32.c
deleted file mode 100644
index 4ae5eb486b..0000000000
--- a/Tools/CCode/Source/Common/Crc32.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- crc32.c
-
-Abstract:
-
- CalcuateCrc32 routine.
-
---*/
-
-#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 contaning 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/Tools/CCode/Source/Common/Crc32.h b/Tools/CCode/Source/Common/Crc32.h
deleted file mode 100644
index ec48cdd478..0000000000
--- a/Tools/CCode/Source/Common/Crc32.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- Crc32.h
-
-Abstract:
-
- Header file for CalcuateCrc32 routine
-
---*/
-
-#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 contaning 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/Tools/CCode/Source/Common/Decompress.c b/Tools/CCode/Source/Common/Decompress.c
deleted file mode 100644
index 07b2b8c883..0000000000
--- a/Tools/CCode/Source/Common/Decompress.c
+++ /dev/null
@@ -1,923 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- Decompress.c
-
-Abstract:
-
- Decompressor. Algorithm Ported from OPSD code (Decomp.asm)
- for Efi and Tiano compress algorithm.
-
---*/
-
-#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) (Sd->mBitBuf << NumOfBits);
-
- while (NumOfBits > Sd->mBitCount) {
-
- Sd->mBitBuf |= (UINT32) (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;
-
- for (Index = 1; Index <= 16; Index++) {
- Count[Index] = 0;
- }
-
- for (Index = 0; Index < NumOfChar; Index++) {
- 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 = (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));
-
- for (Char = 0; Char < NumOfChar; Char++) {
-
- Len = BitLen[Char];
- if (Len == 0) {
- continue;
- }
-
- NextCode = (UINT16) (Start[Len] + Weight[Len]);
-
- if (Len <= TableBits) {
-
- 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;
-
- 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);
- CharC--;
- while ((INT16) (CharC) >= 0) {
- Sd->mPTLen[Index++] = 0;
- CharC--;
- }
- }
- }
-
- while (Index < nn) {
- 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) {
- Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
- if (Sd->mOutBuf >= Sd->mOrigSize) {
- return ;
- }
-
- BytesRemain--;
- }
- }
- }
-
- 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 successull retrieved.
- EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- UINT8 *Src;
-
- *ScratchSize = sizeof (SCRATCH_DATA);
-
- Src = Source;
- if (SrcSize < 8) {
- return EFI_INVALID_PARAMETER;
- }
-
- *DstSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
- 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 successfull
- 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) {
- 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 successull 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 successull 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 successfull
- 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 successfull
- EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- mPbit = MAXPBIT;
- return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
-}
diff --git a/Tools/CCode/Source/Common/Decompress.h b/Tools/CCode/Source/Common/Decompress.h
deleted file mode 100644
index 5984e0be35..0000000000
--- a/Tools/CCode/Source/Common/Decompress.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*++
-
-Copyright (c) 2006, 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.
-
-Module Name:
-
- Decompress.h
-
-Abstract:
-
- Header file for compression routine
-
---*/
-
-#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 successull 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 successfull
- 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 successull 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 successfull
- 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
- );
-#endif
diff --git a/Tools/CCode/Source/Common/EfiCompress.c b/Tools/CCode/Source/Common/EfiCompress.c
deleted file mode 100644
index 87f52fd48f..0000000000
--- a/Tools/CCode/Source/Common/EfiCompress.c
+++ /dev/null
@@ -1,1597 +0,0 @@
-/*++
-
-Copyright (c) 2006, 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.
-
-Module Name:
-
- EfiCompress.c
-
-Abstract:
-
- 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.
-
---*/
-
-#include "Compress.h"
-
-
-//
-// Macro Definitions
-//
-
-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], mCTable[4096], 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
-
-Argements: (VOID)
-
-Returns:
-
- EFI_SUCCESS - Memory is allocated successfully
- EFI_OUT_OF_RESOURCES - Allocation fails
-
---*/
-{
- UINT32 i;
-
- mText = malloc (WNDSIZ * 2 + MAXMATCH);
- 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));
-
- 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. Travese 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
-
-Argments:
-
- 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/Tools/CCode/Source/Common/EfiCustomizedCompress.h b/Tools/CCode/Source/Common/EfiCustomizedCompress.h
deleted file mode 100644
index af26b6f12a..0000000000
--- a/Tools/CCode/Source/Common/EfiCustomizedCompress.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- EfiCustomizedCompress.h
-
-Abstract:
-
- Header file for Customized compression routine
-
---*/
-
-#ifndef _EFICUSTOMIZEDCOMPRESS_H
-#define _EFICUSTOMIZEDCOMPRESS_H
-
-#include <Common/UefiBaseTypes.h>
-
-EFI_STATUS
-SetCustomizedCompressionType (
- IN CHAR8 *Type
- )
-;
-
-/*++
-
-Routine Description:
-
-The implementation of Customized SetCompressionType().
-
-Arguments:
- Type - The type if compression.
-
-Returns:
-
- EFI_SUCCESS - The type has been set.
- EFI_UNSUPPORTED - This type is unsupported.
-
-
---*/
-EFI_STATUS
-CustomizedGetInfo (
- IN VOID *Source,
- IN UINT32 SrcSize,
- OUT UINT32 *DstSize,
- OUT UINT32 *ScratchSize
- )
-;
-
-/*++
-
-Routine Description:
-
- The implementation of Customized 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 successull retrieved.
- EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
-EFI_STATUS
-CustomizedDecompress (
- 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 Customized Decompress().
-
-Arguments:
-
- This - The protocol instance pointer
- 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 successfull
- EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
-EFI_STATUS
-CustomizedCompress (
- IN UINT8 *SrcBuffer,
- IN UINT32 SrcSize,
- IN UINT8 *DstBuffer,
- IN OUT UINT32 *DstSize
- )
-;
-
-/*++
-
-Routine Description:
-
- The Customized 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.
-
---*/
-
-#endif
diff --git a/Tools/CCode/Source/Common/EfiUtilityMsgs.c b/Tools/CCode/Source/Common/EfiUtilityMsgs.c
deleted file mode 100644
index 566d214cab..0000000000
--- a/Tools/CCode/Source/Common/EfiUtilityMsgs.c
+++ /dev/null
@@ -1,755 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- EfiUtilityMsgs.c
-
-Abstract:
-
- EFI tools utility functions to display warning, error, and informational
- messages.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
-
-#include "EfiUtilityMsgs.h"
-
-#define MAX_LINE_LEN 200
-
-//
-// Declare module globals for keeping track of the the utility's
-// name and other settings.
-//
-static STATUS mStatus = STATUS_SUCCESS;
-static CHAR8 mUtilityName[50] = { 0 };
-static UINT32 mDebugMsgMask = 0;
-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
-PrintMessage (
- CHAR8 *Type,
- CHAR8 *FileName,
- UINT32 LineNumber,
- UINT32 MessageCode,
- CHAR8 *Text,
- CHAR8 *MsgFmt,
- va_list List
- );
-
-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
- utilty 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);
- //
- // Set status accordingly
- //
- if (mStatus < STATUS_ERROR) {
- mStatus = STATUS_ERROR;
- }
-}
-
-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);
- //
- // Set status accordingly
- //
- if (mStatus < STATUS_ERROR) {
- mStatus = STATUS_ERROR;
- }
-}
-
-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);
- //
- // Set 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;
- //
- // 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);
- //
- // Set status accordingly
- //
- if (mStatus < STATUS_WARNING) {
- mStatus = STATUS_WARNING;
- }
-}
-
-void
-DebugMsg (
- CHAR8 *FileName,
- UINT32 LineNumber,
- UINT32 MsgMask,
- CHAR8 *Text,
- CHAR8 *MsgFmt,
- ...
- )
-/*++
-
-Routine Description:
- Print a warning 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)
-
- MsgMask - an application-specific bitmask that, in combination with mDebugMsgMask,
- determines if the debug message gets printed.
-
- 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 mask is not applicable, then do nothing.
- //
- if ((MsgMask != 0) && ((mDebugMsgMask & MsgMask) == 0)) {
- return ;
- }
-
- va_start (List, MsgFmt);
- PrintMessage ("debug", FileName, LineNumber, 0, Text, MsgFmt, List);
- va_end (List);
-}
-
-static
-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 preceed 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;
- //
- // 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 if (mUtilityName[0] != 0) {
- Cptr = mUtilityName;
- } else {
- Cptr = "Unknown utility";
- }
-
- strcpy (Line, Cptr);
- if (LineNumber != 0) {
- sprintf (Line2, "(%d)", LineNumber);
- strcat (Line, Line2);
- }
- //
- // Have to print an error code or Visual Studio won't find the
- // message for you. It has to be decimal digits too.
- //
- sprintf (Line2, " : %s %c%04d", Type, toupper (Type[0]), MessageCode);
- strcat (Line, Line2);
- fprintf (stdout, "%s", Line);
- //
- // If offending text was provided, then print it
- //
- if (Text != NULL) {
- fprintf (stdout, ": %s ", Text);
- }
- //
- // Print formatted message if provided
- //
- if (MsgFmt != NULL) {
- vsprintf (Line2, MsgFmt, List);
- fprintf (stdout, ": %s", Line2);
- }
-
- fprintf (stdout, "\n");
-}
-
-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 messags.
-
-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;
- return ;
- } else {
- strcpy (mUtilityName, UtilityName);
- }
- } 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
-SetDebugMsgMask (
- UINT32 DebugMask
- )
-/*++
-
-Routine Description:
- Set the debug printing mask. This is used by the DebugMsg() function
- to determine when/if a debug message should be printed.
-
-Arguments:
- DebugMask - bitmask, specific to the calling application
-
-Returns:
- NA
-
---*/
-{
- mDebugMsgMask = DebugMask;
-}
-
-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
- )
-{
- char *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/Tools/CCode/Source/Common/EfiUtilityMsgs.h b/Tools/CCode/Source/Common/EfiUtilityMsgs.h
deleted file mode 100644
index a76b822675..0000000000
--- a/Tools/CCode/Source/Common/EfiUtilityMsgs.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- EfiUtilityMsgs.h
-
-Abstract:
-
- Defines and prototypes for common EFI utility error and debug messages.
-
---*/
-
-#ifndef _EFI_UTILITY_MSGS_H_
-#define _EFI_UTILITY_MSGS_H_
-
-#include <Common/UefiBaseTypes.h>
-
-//
-// 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;
-
-#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
-Error (
- CHAR8 *FileName,
- UINT32 LineNumber,
- UINT32 ErrorCode,
- CHAR8 *OffendingText,
- CHAR8 *MsgFmt,
- ...
- )
-;
-
-void
-Warning (
- CHAR8 *FileName,
- UINT32 LineNumber,
- UINT32 ErrorCode,
- CHAR8 *OffendingText,
- CHAR8 *MsgFmt,
- ...
- )
-;
-
-void
-DebugMsg (
- CHAR8 *FileName,
- UINT32 LineNumber,
- UINT32 MsgLevel,
- CHAR8 *OffendingText,
- CHAR8 *MsgFmt,
- ...
- )
-;
-
-void
-SetDebugMsgMask (
- UINT32 MsgMask
- )
-;
-
-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/Tools/CCode/Source/Common/FvLib.c b/Tools/CCode/Source/Common/FvLib.c
deleted file mode 100644
index f526a30e1a..0000000000
--- a/Tools/CCode/Source/Common/FvLib.c
+++ /dev/null
@@ -1,782 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2006, 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.
-
-Module Name:
-
- FvLib.c
-
-Abstract:
-
- These functions assist in parsing and manipulating a Firmware Volume.
-
---*/
-
-//
-// 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;
- 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 + GetLength (CurrentFile->Size) > (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 + GetLength (CurrentFile->Size) > (UINTN) mFvHeader + mFvLength)
- ) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Get next file, compensate for 8 byte alignment if necessary.
- //
- *NextFile = (EFI_FFS_FILE_HEADER *) (((UINTN) CurrentFile + GetLength (CurrentFile->Size) + 0x07) & (-1 << 3));
-
- //
- // Verify file is in this FV.
- //
- if (((UINTN) *NextFile + sizeof (EFI_FFS_FILE_HEADER) >= (UINTN) mFvHeader + mFvLength) ||
- ((UINTN) *NextFile + GetLength ((*NextFile)->Size) > (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;
-
- //
- // 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;
- }
- //
- // 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, 0, "error parsing the FV", NULL);
- 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, 0, "error parsing the FV", NULL);
- 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 Instace 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, 0, "error parsing FV", NULL);
- 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, 0, "error parsing the FV", NULL);
- return EFI_ABORTED;
- }
- }
-
- *File = NULL;
- return EFI_SUCCESS;
-}
-
-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.
- The function will not handle encapsulating sections.
-
-Arguments:
-
- File The file to search.
- SectionType Type of file to search for.
- Instance Instace 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, 0, "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 + sizeof (EFI_FFS_FILE_HEADER));
-
- //
- // Loop as long as we have a valid file
- //
- while ((UINTN) CurrentSection.CommonHeader < (UINTN) File + GetLength (File->Size)) {
- if (CurrentSection.CommonHeader->Type == SectionType) {
- SectionCount++;
- }
-
- if (SectionCount == Instance) {
- *Section = CurrentSection;
- return EFI_SUCCESS;
- }
- //
- // Find next section (including compensating for alignment issues.
- //
- CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((((UINTN) CurrentSection.CommonHeader) + GetLength (CurrentSection.CommonHeader->Size) + 0x03) & (-1 << 2));
- }
- //
- // 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, 0, "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, 0, "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_HEADER BlankHeader;
- UINT8 Checksum;
- UINT32 FileLength;
- UINT32 OccupiedFileLength;
- EFI_FFS_FILE_TAIL *Tail;
- UINT8 SavedChecksum;
- UINT8 SavedState;
- UINT8 FileGuidString[80];
- UINT32 TailSize;
- //
- // 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;
- }
- //
- // Check if we have free space
- //
- if (ErasePolarity) {
- memset (&BlankHeader, -1, sizeof (EFI_FFS_FILE_HEADER));
- } else {
- memset (&BlankHeader, 0, sizeof (EFI_FFS_FILE_HEADER));
- }
-
- if (memcmp (&BlankHeader, FfsHeader, sizeof (EFI_FFS_FILE_HEADER)) == 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);
- if (FfsHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailSize = sizeof (EFI_FFS_FILE_TAIL);
- } else {
- TailSize = 0;
- }
- //
- // Verify file header checksum
- //
- SavedState = FfsHeader->State;
- FfsHeader->State = 0;
- SavedChecksum = FfsHeader->IntegrityCheck.Checksum.File;
- FfsHeader->IntegrityCheck.Checksum.File = 0;
- Checksum = CalculateSum8 ((UINT8 *) FfsHeader, sizeof (EFI_FFS_FILE_HEADER));
- FfsHeader->State = SavedState;
- FfsHeader->IntegrityCheck.Checksum.File = SavedChecksum;
- if (Checksum != 0) {
- Error (NULL, 0, 0, FileGuidString, "invalid FFS file header checksum");
- return EFI_ABORTED;
- }
- //
- // Verify file checksum
- //
- if (FfsHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
- //
- // Verify file data checksum
- //
- FileLength = GetLength (FfsHeader->Size);
- OccupiedFileLength = (FileLength + 0x07) & (-1 << 3);
- Checksum = CalculateSum8 ((UINT8 *) FfsHeader, FileLength - TailSize);
- Checksum = (UINT8) (Checksum - FfsHeader->State);
- if (Checksum != 0) {
- Error (NULL, 0, 0, FileGuidString, "invalid FFS file checksum");
- return EFI_ABORTED;
- }
- } else {
- //
- // File does not have a checksum
- // Verify contents are 0x5A as spec'd
- //
- if (FfsHeader->IntegrityCheck.Checksum.File != FFS_FIXED_CHECKSUM) {
- Error (NULL, 0, 0, FileGuidString, "invalid fixed FFS file header checksum");
- return EFI_ABORTED;
- }
- }
- //
- // Check if the tail is present and verify it if it is.
- //
- if (FfsHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- //
- // Verify tail is complement of integrity check field in the header.
- //
- Tail = (EFI_FFS_FILE_TAIL *) ((UINTN) FfsHeader + GetLength (FfsHeader->Size) - sizeof (EFI_FFS_FILE_TAIL));
- if (FfsHeader->IntegrityCheck.TailReference != (EFI_FFS_FILE_TAIL)~(*Tail)) {
- Error (NULL, 0, 0, FileGuidString, "invalid FFS file tail");
- return EFI_ABORTED;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-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_FVB_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/Tools/CCode/Source/Common/FvLib.h b/Tools/CCode/Source/Common/FvLib.h
deleted file mode 100644
index 1ad1e812dd..0000000000
--- a/Tools/CCode/Source/Common/FvLib.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- FvLib.h
-
-Abstract:
-
- These functions assist in parsing and manipulating a Firmware Volume.
-
---*/
-
-#ifndef _EFI_FV_LIB_H
-#define _EFI_FV_LIB_H
-
-//
-// Include files
-//
-#include <string.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-#include <Common/FirmwareFileSystem.h>
-#include <Common/FirmwareVolumeHeader.h>
-#include <Common/MultiPhase.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
- )
-;
-
-/*++
-
-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/Tools/CCode/Source/Common/MyAlloc.c b/Tools/CCode/Source/Common/MyAlloc.c
deleted file mode 100644
index 39fddf7428..0000000000
--- a/Tools/CCode/Source/Common/MyAlloc.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- MyAlloc.c
-
-Abstract:
-
- File for memory allocation tracking functions.
-
---*/
-
-#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 || Line == 0) {
- printf (
- "\nMyCheck(Final=%u, File=%xh, Line=%u)"
- "Invalid parameter(s).\n",
- Final,
- File,
- Line
- );
-
- exit (1);
- }
-
- if (strlen (File) == 0) {
- printf (
- "\nMyCheck(Final=%u, File=%s, Line=%u)"
- "Invalid parameter.\n",
- Final,
- File,
- 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,
- Line,
- Tmp->File,
- Tmp->Line,
- Tmp->Size,
- *(UINT32 *) (Tmp->Buffer),
- *(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,
- Line
- );
-
- for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) {
- printf (
- "File=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
- Tmp->File,
- Tmp->Line,
- Tmp->Size,
- *(UINT32 *) (Tmp->Buffer),
- *(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 (Size == 0 || File == NULL || Line == 0) {
- printf (
- "\nMyAlloc(Size=%u, File=%xh, Line=%u)"
- "\nInvalid parameter(s).\n",
- Size,
- File,
- Line
- );
-
- exit (1);
- }
-
- Len = strlen (File);
- if (Len == 0) {
- printf (
- "\nMyAlloc(Size=%u, File=%s, Line=%u)"
- "\nInvalid parameter.\n",
- Size,
- File,
- Line
- );
-
- exit (1);
- }
- //
- // Check the allocation list for corruption.
- //
- MyCheck (0, __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",
- Size,
- File,
- Line
- );
-
- exit (1);
- }
- //
- // Fill in the new entry.
- //
- Tmp->File = ((UINT8 *) Tmp) + sizeof (MY_ALLOC_STRUCT);
- strcpy (Tmp->File, 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 (Size == 0 || File == NULL || Line == 0) {
- printf (
- "\nMyRealloc(Ptr=%xh, Size=%u, File=%xh, Line=%u)"
- "\nInvalid parameter(s).\n",
- Ptr,
- Size,
- File,
- Line
- );
-
- exit (1);
- }
-
- if (strlen (File) == 0) {
- printf (
- "\nMyRealloc(Ptr=%xh, Size=%u, File=%s, Line=%u)"
- "\nInvalid parameter.\n",
- Ptr,
- Size,
- File,
- 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=%xh, Size=%u, File=%s, Line=%u)"
- "\nCould not find buffer.\n",
- Ptr,
- Size,
- File,
- 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, __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 || Line == 0) {
- printf (
- "\nMyFree(Ptr=%xh, File=%xh, Line=%u)"
- "\nInvalid parameter(s).\n",
- Ptr,
- File,
- Line
- );
-
- exit (1);
- }
-
- if (strlen (File) == 0) {
- printf (
- "\nMyFree(Ptr=%xh, File=%s, Line=%u)"
- "\nInvalid parameter.\n",
- Ptr,
- File,
- Line
- );
-
- exit (1);
- }
- //
- // Freeing NULL is always valid.
- //
- if (Ptr == NULL) {
- return ;
- }
- //
- // Fail if nothing is allocated.
- //
- if (MyAllocData == NULL) {
- printf (
- "\nMyFree(Ptr=%xh, File=%s, Line=%u)"
- "\nCalled before memory allocated.\n",
- Ptr,
- File,
- Line
- );
-
- exit (1);
- }
- //
- // Check for corrupted allocation list.
- //
- MyCheck (0, __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=%xh, File=%s, Line=%u)\n"
- "\nNot found.\n",
- Ptr,
- File,
- 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/Tools/CCode/Source/Common/MyAlloc.h b/Tools/CCode/Source/Common/MyAlloc.h
deleted file mode 100644
index 9697012d7d..0000000000
--- a/Tools/CCode/Source/Common/MyAlloc.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- MyAlloc.h
-
-Abstract:
-
- Header file for memory allocation tracking functions.
-
---*/
-
-#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/Tools/CCode/Source/Common/ParseInf.c b/Tools/CCode/Source/Common/ParseInf.c
deleted file mode 100644
index 6f5900e897..0000000000
--- a/Tools/CCode/Source/Common/ParseInf.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- ParseInf.c
-
-Abstract:
-
- This contains some useful functions for parsing INF files.
-
---*/
-
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include "ParseInf.h"
-
-#ifndef _MAX_PATH
-#define _MAX_PATH 500
-#endif
-
-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 _MAX_PATH 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_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_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_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_PATH];
- CHAR8 *CurrentToken;
- BOOLEAN ParseError;
- BOOLEAN ReadError;
- UINTN Occurrance;
-
- //
- // 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
- //
- Occurrance = 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_PATH) == NULL) {
- //
- // Error reading from input file
- //
- ReadError = TRUE;
- break;
- }
- //
- // Get the first non-whitespace string
- //
- CurrentToken = strtok (InputBuffer, " \t\n");
- if (CurrentToken == 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 == Occurrance) {
- //
- // Copy the contents following the =
- //
- CurrentToken = strtok (NULL, "= \t\n");
- if (CurrentToken == NULL) {
- //
- // Nothing found, parsing error
- //
- ParseError = TRUE;
- } else {
- //
- // Copy the current token to the output value
- //
- strcpy (Value, CurrentToken);
- return EFI_SUCCESS;
- }
- } else {
- //
- // Increment the occurrance found
- //
- Occurrance++;
- }
- }
- } while (
- !ParseError &&
- !ReadError &&
- InputFile->CurrentFilePointer < InputFile->Eof &&
- CurrentToken[0] != '[' &&
- Occurrance <= 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;
- UINTN Data1;
- UINTN Data2;
- UINTN Data3;
- UINTN Data4[8];
-
- if (AsciiGuidBuffer == NULL || GuidBuffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Scan the guid string into the buffer
- //
- Index = sscanf (
- AsciiGuidBuffer,
- "%08x-%04x-%04x-%02x%02x-%02hx%02hx%02hx%02hx%02hx%02hx",
- &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) {
- printf ("ERROR: Malformed GUID \"%s\".\n\n", 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 preceeded 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 HexNumber;
- CHAR8 CurrentChar;
-
- //
- // Initialize the result
- //
- HexNumber = 0;
-
- //
- // Add each character to the result
- //
- if (IsHex || (AsciiString[0] == '0' && (AsciiString[1] == 'x' || AsciiString[1] == 'X'))) {
- //
- // Verify string is a hex number
- //
- for (Index = 2; Index < strlen (AsciiString); Index++) {
- if (isxdigit (AsciiString[Index]) == 0) {
- return EFI_ABORTED;
- }
- }
- //
- // Convert the hex string.
- //
- for (Index = 2; AsciiString[Index] != '\0'; Index++) {
- CurrentChar = AsciiString[Index];
- HexNumber *= 16;
- if (CurrentChar >= '0' && CurrentChar <= '9') {
- HexNumber += CurrentChar - '0';
- } else if (CurrentChar >= 'a' && CurrentChar <= 'f') {
- HexNumber += CurrentChar - 'a' + 10;
- } else if (CurrentChar >= 'A' && CurrentChar <= 'F') {
- HexNumber += CurrentChar - 'A' + 10;
- } else {
- //
- // Unrecognized character
- //
- return EFI_ABORTED;
- }
- }
-
- *ReturnValue = HexNumber;
- } else {
- //
- // Verify string is a number
- //
- for (Index = 0; Index < strlen (AsciiString); Index++) {
- if (isdigit (AsciiString[Index]) == 0) {
- return EFI_ABORTED;
- }
- }
-
- *ReturnValue = atol (AsciiString);
- }
-
- 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_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_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_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/Tools/CCode/Source/Common/ParseInf.h b/Tools/CCode/Source/Common/ParseInf.h
deleted file mode 100644
index ff986352c6..0000000000
--- a/Tools/CCode/Source/Common/ParseInf.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- ParseInf.h
-
-Abstract:
-
- Header file for helper functions useful for parsing INF files.
-
---*/
-
-#ifndef _EFI_PARSE_INF_H
-#define _EFI_PARSE_INF_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
-//
-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 _MAX_PATH 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_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 preceeded 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_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
-
---*/
-#endif
diff --git a/Tools/CCode/Source/Common/SimpleFileParsing.c b/Tools/CCode/Source/Common/SimpleFileParsing.c
deleted file mode 100644
index 73b74cd0ff..0000000000
--- a/Tools/CCode/Source/Common/SimpleFileParsing.c
+++ /dev/null
@@ -1,1457 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- SimpleFileParsing.c
-
-Abstract:
-
- Generic but simple file parsing routines.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.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 MAX_LINE_LEN 400
-
-#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;
- T_CHAR *FileBuffer;
- T_CHAR *FileBufferPtr;
- unsigned int FileSize;
- char FileName[MAX_PATH];
- unsigned int LineNum;
- BOOLEAN EndOfFile;
- BOOLEAN SkipToHash;
- struct _SOURCE_FILE *Previous;
- struct _SOURCE_FILE *Next;
- T_CHAR ControlCharacter;
-} SOURCE_FILE;
-
-typedef struct {
- T_CHAR *FileBufferPtr;
-} FILE_POSITION;
-
-//
-// Keep all our module globals in this structure
-//
-static struct {
- SOURCE_FILE SourceFile;
- BOOLEAN VerboseFile;
- BOOLEAN VerboseToken;
-} mGlobals;
-
-static
-unsigned int
-t_strcmp (
- T_CHAR *Buffer,
- T_CHAR *Str
- );
-
-static
-unsigned int
-t_strncmp (
- T_CHAR *Str1,
- T_CHAR *Str2,
- int Len
- );
-
-static
-unsigned int
-t_strlen (
- T_CHAR *Str
- );
-
-static
-void
-RewindFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-BOOLEAN
-IsWhiteSpace (
- SOURCE_FILE *SourceFile
- );
-
-static
-unsigned int
-SkipWhiteSpace (
- SOURCE_FILE *SourceFile
- );
-
-static
-BOOLEAN
-EndOfFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-void
-PreprocessFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-T_CHAR *
-t_strcpy (
- T_CHAR *Dest,
- T_CHAR *Src
- );
-
-static
-STATUS
-ProcessIncludeFile (
- SOURCE_FILE *SourceFile,
- SOURCE_FILE *ParentSourceFile
- );
-
-static
-STATUS
-ParseFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-FILE *
-FindFile (
- char *FileName,
- char *FoundFileName,
- unsigned int FoundFileNameLen
- );
-
-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;
-}
-
-unsigned
-int
-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;
-}
-
-T_CHAR *
-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 (
- char *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 (
- T_CHAR *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.
-
---*/
-{
- unsigned int 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 (
- T_CHAR *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.
-
---*/
-{
- unsigned int Len;
- SkipWhiteSpace (&mGlobals.SourceFile);
- if (EndOfFile (&mGlobals.SourceFile)) {
- return FALSE;
- }
-
- if ((Len = t_strcmp (mGlobals.SourceFile.FileBufferPtr, Str)) > 0) {
- if (isalnum (mGlobals.SourceFile.FileBufferPtr[Len])) {
- return FALSE;
- }
-
- mGlobals.SourceFile.FileBufferPtr += Len;
- if (mGlobals.VerboseToken) {
- printf ("Token: '%s'\n", Str);
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOLEAN
-SFPGetNextToken (
- T_CHAR *Str,
- unsigned int 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:
- Preceeding white space is ignored.
- The parser's buffer pointer is advanced past the end of the
- token.
-
---*/
-{
- unsigned int Index;
- T_CHAR 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 (
- T_CHAR *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 (
- T_CHAR *Str
- )
-{
- unsigned int Len;
- T_CHAR *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 (
- unsigned int *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
-
---*/
-{
- SkipWhiteSpace (&mGlobals.SourceFile);
- if (EndOfFile (&mGlobals.SourceFile)) {
- return FALSE;
- }
-
- if (isdigit (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 (mGlobals.SourceFile.FileBufferPtr[2])) {
- return FALSE;
- }
-
- mGlobals.SourceFile.FileBufferPtr += 2;
- sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", Value);
- while (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) {
- mGlobals.SourceFile.FileBufferPtr++;
- }
-
- return TRUE;
- } else {
- *Value = atoi (mGlobals.SourceFile.FileBufferPtr);
- while (isdigit (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 unsigned int NestDepth = 0;
- char 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", NestDepth * 2, ' ', SourceFile->FileName);
- fprintf (stdout, "Parent source file = '%s'\n", ParentSourceFile);
- }
-
- //
- // Make sure we didn't exceed our maximum nesting depth
- //
- if (NestDepth > MAX_NEST_DEPTH) {
- Error (NULL, 0, 0, SourceFile->FileName, "max nesting depth (%d) exceeded", 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 (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 = %d (0x%X)\n", SourceFile->FileSize, SourceFile->FileSize);
- }
-
- fseek (SourceFile->Fptr, 0, SEEK_SET);
- SourceFile->FileBuffer = (T_CHAR *) malloc (SourceFile->FileSize + sizeof (T_CHAR));
- if (SourceFile->FileBuffer == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- fread ((void *) SourceFile->FileBuffer, SourceFile->FileSize, 1, SourceFile->Fptr);
- SourceFile->FileBuffer[(SourceFile->FileSize / sizeof (T_CHAR))] = 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 = %d (0x%X)\n", SourceFile->FileSize, SourceFile->FileSize);
- RewindFile (SourceFile);
- }
-}
-
-BOOLEAN
-SFPGetQuotedString (
- T_CHAR *Str,
- int 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
-T_CHAR *
-GetQuotedString (
- SOURCE_FILE *SourceFile,
- BOOLEAN Optional
- )
-{
- T_CHAR *String;
- T_CHAR *Start;
- T_CHAR *Ptr;
- unsigned int 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 = (T_CHAR *) malloc ((Len + 1) * sizeof (T_CHAR));
- if (String == NULL) {
- Error (NULL, 0, 0, "memory allocation failed", 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 (T_CHAR)) {
- SourceFile->EndOfFile = TRUE;
- return TRUE;
- }
-
- if (SourceFile->EndOfFile) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-#if 0
-static
-void
-ProcessTokenInclude (
- SOURCE_FILE *SourceFile
- )
-{
- char IncludeFileName[MAX_PATH];
- char *To;
- unsigned int 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 = (T_CHAR) SourceFile->FileBufferPtr[0];
- To++;
- }
-
- SourceFile->FileBufferPtr++;
- }
-
- if (!ReportedError) {
- *To = 0;
- memset ((char *) &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;
- }
-}
-
-unsigned int
-SkipWhiteSpace (
- SOURCE_FILE *SourceFile
- )
-{
- unsigned int 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
-unsigned int
-t_strcmp (
- T_CHAR *Buffer,
- T_CHAR *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
-
---*/
-{
- unsigned int Len;
-
- Len = 0;
- while (*Str && (*Str == *Buffer)) {
- Buffer++;
- Str++;
- Len++;
- }
-
- if (*Str) {
- return 0;
- }
-
- return Len;
-}
-
-static
-unsigned int
-t_strlen (
- T_CHAR *Str
- )
-{
- unsigned int Len;
- Len = 0;
- while (*Str) {
- Len++;
- Str++;
- }
-
- return Len;
-}
-
-static
-unsigned int
-t_strncmp (
- T_CHAR *Str1,
- T_CHAR *Str2,
- int Len
- )
-{
- while (Len > 0) {
- if (*Str1 != *Str2) {
- return Len;
- }
-
- Len--;
- Str1++;
- Str2++;
- }
-
- return 0;
-}
-
-static
-T_CHAR *
-t_strcpy (
- T_CHAR *Dest,
- T_CHAR *Src
- )
-{
- T_CHAR *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 (
- T_CHAR *Buffer,
- UINT32 BufferLen
- )
-{
- UINT32 Len;
- Len = 0;
- while (!EndOfFile (&mGlobals.SourceFile) && (BufferLen > 0)) {
- if (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) {
- *Buffer = mGlobals.SourceFile.FileBufferPtr[0];
- Buffer++;
- Len++;
- BufferLen--;
- mGlobals.SourceFile.FileBufferPtr++;
- } else {
- break;
- }
- }
- //
- // Null terminate if we can
- //
- if ((Len > 0) && (BufferLen > 0)) {
- *Buffer = 0;
- }
-
- return Len;
-}
-
-BOOLEAN
-SFPGetGuid (
- int 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
-
---*/
-{
- UINT32 Value32;
- UINT32 Index;
- FILE_POSITION FPos;
- T_CHAR TempString[20];
- T_CHAR TempString2[3];
- T_CHAR *From;
- T_CHAR *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/Tools/CCode/Source/Common/SimpleFileParsing.h b/Tools/CCode/Source/Common/SimpleFileParsing.h
deleted file mode 100644
index 7cf25a6bf8..0000000000
--- a/Tools/CCode/Source/Common/SimpleFileParsing.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- SimpleFileParsing.h
-
-Abstract:
-
- Function prototypes and defines for the simple file parsing routines.
-
---*/
-
-#ifndef _SIMPLE_FILE_PARSING_H_
-#define _SIMPLE_FILE_PARSING_H_
-
-#include <Common/UefiBaseTypes.h>
-
-#define T_CHAR char
-
-STATUS
-SFPInit (
- VOID
- )
-;
-
-STATUS
-SFPOpenFile (
- char *FileName
- )
-;
-
-BOOLEAN
-SFPIsKeyword (
- T_CHAR *Str
- )
-;
-
-BOOLEAN
-SFPIsToken (
- T_CHAR *Str
- )
-;
-
-BOOLEAN
-SFPGetNextToken (
- T_CHAR *Str,
- unsigned int Len
- )
-;
-
-BOOLEAN
-SFPGetGuidToken (
- T_CHAR *Str,
- UINT32 Len
- )
-;
-
-#define PARSE_GUID_STYLE_5_FIELDS 0
-
-BOOLEAN
-SFPGetGuid (
- int GuidStyle,
- EFI_GUID *Value
- )
-;
-
-BOOLEAN
-SFPSkipToToken (
- T_CHAR *Str
- )
-;
-
-BOOLEAN
-SFPGetNumber (
- unsigned int *Value
- )
-;
-
-BOOLEAN
-SFPGetQuotedString (
- T_CHAR *Str,
- int Length
- )
-;
-
-BOOLEAN
-SFPIsEOF (
- VOID
- )
-;
-
-STATUS
-SFPCloseFile (
- VOID
- )
-;
-
-unsigned
-int
-SFPGetLineNumber (
- VOID
- )
-;
-
-T_CHAR *
-SFPGetFileName (
- VOID
- )
-;
-
-#endif // #ifndef _SIMPLE_FILE_PARSING_H_
diff --git a/Tools/CCode/Source/Common/TianoCompress.c b/Tools/CCode/Source/Common/TianoCompress.c
deleted file mode 100644
index dc78e7ad85..0000000000
--- a/Tools/CCode/Source/Common/TianoCompress.c
+++ /dev/null
@@ -1,1752 +0,0 @@
-/*++
-
-Copyright (c) 2006, 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.
-
-Module Name:
-
- TianoCompress.c
-
-Abstract:
-
- 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.
-
---*/
-
-#include "Compress.h"
-
-//
-// Macro Definitions
-//
-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], mCTable[4096], 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 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
-
-Argements:
- VOID
-
-Returns:
-
- EFI_SUCCESS - Memory is allocated successfully
- EFI_OUT_OF_RESOURCES - Allocation fails
-
---*/
-{
- UINT32 Index;
-
- mText = malloc (WNDSIZ * 2 + MAXMATCH);
- 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));
-
- 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. Travese 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/Tools/CCode/Source/Common/WinNtInclude.h b/Tools/CCode/Source/Common/WinNtInclude.h
deleted file mode 100644
index 80e45b4ad6..0000000000
--- a/Tools/CCode/Source/Common/WinNtInclude.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*--
-
-Copyright (c) 2006, 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.
-
-Module Name:
- WinNtInclude.h
-
-Abstract:
- Include file for the WinNt Library
-
---*/
-
-#ifndef __WIN_NT_INCLUDE_H__
-#define __WIN_NT_INCLUDE_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 stil
-// 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)
-
-#define GUID _WINNT_DUP_GUID_____
-#define _LIST_ENTRY _WINNT_DUP_LIST_ENTRY_FORWARD
-#define LIST_ENTRY _WINNT_DUP_LIST_ENTRY
-#define InterlockedIncrement _WINNT_DUP_InterlockedIncrement
-#define InterlockedDecrement _WINNT_DUP_InterlockedDecrement
-#define InterlockedCompareExchange64 _WINNT_DUP_InterlockedCompareExchange64
-#undef UNALIGNED
-#undef CONST
-#undef VOID
-
-#ifndef __GNUC__
-#include "windows.h"
-#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
-
-//
-// 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
diff --git a/Tools/CCode/Source/Common/build.xml b/Tools/CCode/Source/Common/build.xml
deleted file mode 100644
index 38ae477296..0000000000
--- a/Tools/CCode/Source/Common/build.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="CommonTools.lib" basedir=".">
-<!--
- EDK Common Tools Library
- Copyright (c) 2006, Intel Corporation
--->
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="tmp" value="tmp"/>
- <property name="LibName" value="CommonTool"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/Common/tmp"/>
-
- <target name="CommonTools.lib" depends="init, ToolsLibrary">
- <echo message="The EDK Tool Library: ${LibName} build has completed."/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool Library: ${LibName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="ToolsLibrary" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${LIB_DIR}/CommonTools"
- outtype="static"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
- <compilerarg value="-fPIC" if="x86_64_linux"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
-
- <fileset dir="${basedir}/Common"
- includes="*.c" />
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only from ${BUILD_DIR}"/>
- <delete dir="${BUILD_DIR}"/>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Library: ${LibName}${ext_static}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${LIB_DIR}/${LibName}${ext_static}"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/CompressDll/CompressDll.c b/Tools/CCode/Source/CompressDll/CompressDll.c
deleted file mode 100644
index 00cff5649f..0000000000
--- a/Tools/CCode/Source/CompressDll/CompressDll.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/** @file
- Compression DLL used by PCD Tools
-
- Copyright (c) 2006, 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.
-
-**/
-#if defined(__GNUC__)
-typedef long long __int64;/*For cygwin build*/
-#endif
-#include "CompressDll.h"
-#include "Compress.h"
-
-extern
-EFI_STATUS
-EfiCompress (
- IN UINT8 *SrcBuffer,
- IN UINT32 SrcSize,
- IN UINT8 *DstBuffer,
- IN OUT UINT32 *DstSize
- );
-
-JNIEXPORT jbyteArray JNICALL Java_org_tianocore_framework_tasks_Compress_CallCompress
-(JNIEnv *env, jobject obj, jbyteArray SourceBuffer, jint SourceSize, jstring path)
-{
- char* DestBuffer;
- int DestSize;
- int Result;
- char *InputBuffer;
- jbyteArray OutputBuffer;
- jbyte *TempByte;
-
- DestSize = 0;
- DestBuffer = NULL;
-
- TempByte = (*env)->GetByteArrayElements(env, SourceBuffer, 0);
- InputBuffer = (char*) TempByte;
-
-
- //
- // First call compress function and get need buffer size
- //
-
- Result = EfiCompress (
- (char*) InputBuffer,
- SourceSize,
- DestBuffer,
- &DestSize
- );
-
- if (Result = EFI_BUFFER_TOO_SMALL) {
- DestBuffer = malloc (DestSize);
- }
-
- //
- // Second call compress and get the DestBuffer value
- //
- Result = EfiCompress(
- (char*) InputBuffer,
- SourceSize,
- DestBuffer,
- &DestSize
- );
-
- //
- // new a MV array to store the return compressed buffer
- //
- OutputBuffer = (*env)->NewByteArray(env, DestSize);
- (*env)->SetByteArrayRegion(env, OutputBuffer,0, DestSize, (jbyte*) DestBuffer);
-
- //
- // Free Ouputbuffer.
- //
- free (DestBuffer);
-
-
- if (Result != 0) {
- return NULL;
- } else {
- return OutputBuffer;
- }
-}
-
-#ifdef _MSC_VER
-BOOLEAN
-__stdcall
-DllMainCRTStartup(
- unsigned int hDllHandle,
- unsigned int nReason,
- void* Reserved
-)
-{
- return TRUE;
-}
-#else
-#ifdef __GNUC__
-#endif
-#endif
-
diff --git a/Tools/CCode/Source/CompressDll/CompressDll.h b/Tools/CCode/Source/CompressDll/CompressDll.h
deleted file mode 100644
index fa3b83cd10..0000000000
--- a/Tools/CCode/Source/CompressDll/CompressDll.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-
-#include <jni.h>
-/* Header for class org_tianocore_frameworktasks_Compress */
-
-#ifndef _Included_org_tianocore_framework_tasks_Compress
-#define _Included_org_tianocore_framework_tasks_Compress
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: org_tianocore_frameworktasks_Compress
- * Method: CallCompress
- * Signature: ([BILjava/lang/String;)[B
- */
-JNIEXPORT jbyteArray JNICALL Java_org_tianocore_framework_tasks_Compress_CallCompress
- (JNIEnv *, jobject, jbyteArray, jint, jstring);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/Tools/CCode/Source/CompressDll/build.xml b/Tools/CCode/Source/CompressDll/build.xml
deleted file mode 100644
index 1b0e281103..0000000000
--- a/Tools/CCode/Source/CompressDll/build.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK CompressDll Tool Library
- Copyright (c) 2006, Intel Corporation
--->
-
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <property name="LibName" value="CompressDll"/>
- <property name="FileSet" value="CompressDll.c CompressDll.h"/>
- <property name="LibFileSet" value="CompressDll.c DepexParser.h"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${WORKSPACE}/Tools/CCode/Source/${LibName}/tmp"/>
-
- <target name="GenTool" depends="init,Lib" >
- <echo message="The EDK Tool Library: ${LibName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool Library: ${LibName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Lib" depends="init">
- <cc name="${ToolChain}"
- objdir="${BUILD_DIR}"
- outtype="shared"
- debug="true"
- optimize="speed"
- outfile="${BIN_DIR}/${LibName}"
- outputfileproperty="result"
- >
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
- <fileset dir="${LibName}" includes="${LibFileSet}" defaultexcludes="TRUE" excludes="*.xml *.inf"/>
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <includepath path="${env.JAVA_HOME}/include"/>
- <includepath path="${env.JAVA_HOME}/include/linux" if="gcc"/>
- <includepath path="${env.JAVA_HOME}/include/win32" if="cygwin"/>
- <includepath path="${env.JAVA_HOME}/include/win32" if="msft"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- <syslibset libs="kernel32" if="msft"/>
- <linkerarg value="-mno-cygwin" if="cygwin"/>
- <linkerarg value="--add-stdcall-alias" if="cygwin"/>
- </cc>
- <if>
- <available file="${result}.manifest"/>
- <then>
- <exec executable="mt.exe">
- <arg value="-manifest"/>
- <arg value="${result}.manifest"/>
- <arg value="-outputresource:${result};2"/>
- </exec>
- </then>
- </if>
- <copy file="${result}" tofile="${BIN_DIR}/CompressDll.dll"/>
- <chmod file="${BIN_DIR}/CompressDll.dll" perm="ugo+x"/>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${LibName}${ext_dynamic}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${LibName}.*"/>
- </delete>
- </target>
-</project>
diff --git a/Tools/CCode/Source/CreateMtFile/CreateMtFile.c b/Tools/CCode/Source/CreateMtFile/CreateMtFile.c
deleted file mode 100644
index 8bb07293e3..0000000000
--- a/Tools/CCode/Source/CreateMtFile/CreateMtFile.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-
-Module Name:
-
- CreateMtFile.c
-
-Abstract:
-
- Simple utility to create a pad file containing fixed data.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <Common/UefiBaseTypes.h>
-
-#define UTILITY_NAME "CreateMtFile"
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 1
-
-typedef struct {
- INT8 *OutFileName;
- INT8 ByteValue;
- UINT32 FileSize;
-} OPTIONS;
-
-static
-EFI_STATUS
-ProcessArgs (
- IN INT32 Argc,
- IN INT8 *Argv[],
- IN OUT OPTIONS *Options
- );
-
-static
-void
-Usage (
- VOID
- );
-
-static
-void
-Version (
- VOID
- );
-
-int
-main (
- IN INT32 Argc,
- IN INT8 *Argv[]
- )
-/*++
-
-Routine Description:
-
- Main entry point for this utility.
-
-Arguments:
-
- Standard C entry point args Argc and Argv
-
-Returns:
-
- EFI_SUCCESS if good to go
-
---*/
-// GC_TODO: ] - add argument and description to function comment
-// GC_TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// GC_TODO: EFI_DEVICE_ERROR - add return value to function comment
-// GC_TODO: EFI_DEVICE_ERROR - add return value to function comment
-{
- FILE *OutFptr;
- OPTIONS Options;
-
- //
- // Process the command-line arguments.
- //
- if (ProcessArgs (Argc, Argv, &Options) != EFI_SUCCESS) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Open the output file
- //
- if ((OutFptr = fopen (Options.OutFileName, "wb")) == NULL) {
- printf (" ERROR: Could not open output file '%s' for writing\n", Options.OutFileName);
- return EFI_DEVICE_ERROR;
- }
- //
- // Write the pad bytes. Do it the slow way (one at a time) for now.
- //
- while (Options.FileSize > 0) {
- if (fwrite (&Options.ByteValue, 1, 1, OutFptr) != 1) {
- fclose (OutFptr);
- printf (" ERROR: Failed to write to output file\n");
- return EFI_DEVICE_ERROR;
- }
-
- Options.FileSize--;
- }
- //
- // Close the file
- //
- fclose (OutFptr);
- return EFI_SUCCESS;
-}
-
-static
-EFI_STATUS
-ProcessArgs (
- IN INT32 Argc,
- IN INT8 *Argv[],
- IN OUT OPTIONS *Options
- )
-/*++
-
-Routine Description:
-
- Process the command line arguments.
-
-Arguments:
-
- Argc - argument count as passed in to the entry point function
- Argv - array of arguments as passed in to the entry point function
- Options - stucture of where to put the values of the parsed arguments
-
-Returns:
-
- EFI_SUCCESS if everything looks good
- EFI_INVALID_PARAMETER otherwise
-
---*/
-// GC_TODO: ] - add argument and description to function comment
-{
- UINT32 Multiplier;
-
- //
- // Clear the options
- //
- memset ((char *) Options, 0, sizeof (OPTIONS));
-
- //
- // Skip program name
- //
- Argv++;
- Argc--;
-
- if (Argc < 1) {
- Usage();
- return EFI_INVALID_PARAMETER;
- }
-
- if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
- (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
- Usage();
- return EFI_INVALID_PARAMETER;
- }
-
- if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
- Version();
- return EFI_INVALID_PARAMETER;
- }
-
- if (Argc < 2) {
- Usage ();
- return EFI_INVALID_PARAMETER;
- }
- //
- // If first arg is dash-option, then print usage.
- //
- if (Argv[0][0] == '-') {
- Usage ();
- return EFI_INVALID_PARAMETER;
- }
- //
- // First arg is file name
- //
- Options->OutFileName = Argv[0];
- Argc--;
- Argv++;
-
- //
- // Second arg is file size. Allow 0x1000, 0x100K, 1024, 1K
- //
- Multiplier = 1;
- if ((Argv[0][strlen (Argv[0]) - 1] == 'k') || (Argv[0][strlen (Argv[0]) - 1] == 'K')) {
- Multiplier = 1024;
- }
-
- //
- // Check for negtive size
- //
- if (Argv[0][0] == '-') {
- printf("ERROR: File size should be non-negtive.\n");
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Look for 0x prefix on file size
- //
- if ((Argv[0][0] == '0') && ((Argv[0][1] == 'x') || (Argv[0][1] == 'X'))) {
- if (sscanf (Argv[0], "%x", &Options->FileSize) != 1) {
- printf ("ERROR: Invalid file size '%s'\n", Argv[0]);
- Usage ();
- return EFI_INVALID_PARAMETER;
- }
- //
- // Otherwise must be a decimal number
- //
- } else {
- if (sscanf (Argv[0], "%d", &Options->FileSize) != 1) {
- printf ("ERROR: Invalid file size '%s'\n", Argv[0]);
- Usage ();
- return EFI_INVALID_PARAMETER;
- }
- }
-
- Options->FileSize *= Multiplier;
- //
- // Assume byte value of 0xff
- //
- Options->ByteValue = (INT8) (UINT8) 0xFF;
- return EFI_SUCCESS;
-}
-
-
-static
-void
-Version(
- void
- )
-/*++
-
-Routine Description:
-
- Print out version information for this utility.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -EDK utility to create a pad file containing fixed data\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2006 Intel Corporation. All rights reserved.\n");
-}
-
-//
-// Print utility usage info
-//
-static
-void
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- Version();
-
- printf ("\nUsage: %s OutFileName FileSize \n\
- where: \n\
- OutFileName is the name of the output file to generate \n\
- FileSize is the size of the file to create \n\
- Examples: \n\
- %s OutFile.bin 32K \n\
- %s OutFile.bin 0x1000 \n",UTILITY_NAME, UTILITY_NAME, UTILITY_NAME);
-}
-
diff --git a/Tools/CCode/Source/CreateMtFile/build.xml b/Tools/CCode/Source/CreateMtFile/build.xml
deleted file mode 100644
index 3be4c902aa..0000000000
--- a/Tools/CCode/Source/CreateMtFile/build.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK CreateMtFile Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="CreateMtFile"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/CustomizedCompress/CustomizedCompress.c b/Tools/CCode/Source/CustomizedCompress/CustomizedCompress.c
deleted file mode 100644
index 0dc66128c9..0000000000
--- a/Tools/CCode/Source/CustomizedCompress/CustomizedCompress.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- CustomizedCompress.c
-
-Abstract:
-
- Header file for Customized compression routine
-
---*/
-
-#include <Common/UefiBaseTypes.h>
-
-EFI_STATUS
-SetCustomizedCompressionType (
- IN CHAR8 *Type
- )
-/*++
-
-Routine Description:
-
-The implementation of Customized SetCompressionType().
-
-Arguments:
- Type - The type if compression.
-
-Returns:
-
- EFI_SUCCESS - The type has been set.
- EFI_UNSUPPORTED - This type is unsupported.
-
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-CustomizedGetInfo (
- IN VOID *Source,
- IN UINT32 SrcSize,
- OUT UINT32 *DstSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
-The implementation of Customized 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 successull retrieved.
- EFI_INVALID_PARAMETER - The source data is corrupted
- EFI_UNSUPPORTED - The operation is unsupported.
-
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-CustomizedDecompress (
- 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 Customized Decompress().
-
-Arguments:
-
- This - The protocol instance pointer
- 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 successfull
- EFI_INVALID_PARAMETER - The source data is corrupted
- EFI_UNSUPPORTED - The operation is unsupported.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-CustomizedCompress (
- IN UINT8 *SrcBuffer,
- IN UINT32 SrcSize,
- IN UINT8 *DstBuffer,
- IN OUT UINT32 *DstSize
- )
-/*++
-
-Routine Description:
-
- The Customized 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_UNSUPPORTED - The operation is unsupported.
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/Tools/CCode/Source/CustomizedCompress/build.xml b/Tools/CCode/Source/CustomizedCompress/build.xml
deleted file mode 100644
index 35bffa4987..0000000000
--- a/Tools/CCode/Source/CustomizedCompress/build.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenLib" basedir="." name="CustomizedCompressLibrary">
-<!--
- EDK Customized Compress Library
- Copyright (c) 2006, Intel Corporation
--->
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LibName" value="CustomizedCompress"/>
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/CustomizedCompress/tmp"/>
-
- <target name="GenLib" depends="init, CustomizedCompress">
- <echo message="The EDK Tool Library ${LibName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool Library: ${LibName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="CustomizedCompress" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${LIB_DIR}/${LibName}"
- outtype="static"
- debug="true"
- optimize="speed">
-
- <fileset dir="${basedir}/CustomizedCompress"
- includes="*.c"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- </cc>
- <if>
- <istrue value="msft"/>
- <then>
- <exec dir="${BUILD_DIR}" executable="lib" failonerror="false">
- <arg line="/NOLOGO *.lib /OUT:${LIB_DIR}/CustomizedCompress${ext_static}"/>
- </exec>
- </then>
- </if>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Library: ${LibName}${ext_static}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${LIB_DIR}/${LibName}${ext_static}"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/EfiCompress/EfiCompressMain.c b/Tools/CCode/Source/EfiCompress/EfiCompressMain.c
deleted file mode 100644
index db27a33a5b..0000000000
--- a/Tools/CCode/Source/EfiCompress/EfiCompressMain.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-
-Module Name:
-
- EfiCompressMain.c
-
-Abstract:
-
- The main function for the compression utility.
-
---*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#include <Common/UefiBaseTypes.h>
-#include "Compress.h"
-
-#define UTILITY_NAME "EfiCompress"
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 1
-
-void
-Version(
- void
- )
-/*++
-
-Routine Description:
-
- Print out version information for EfiCompress.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Efi File Compress Utility\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 2005-2006 Intel Corporation. All rights reserved.\n");
-}
-
-void
-Usage(
- void
- )
-/*++
-
-Routine Description:
-
- Print out usage information for EfiCompress.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- Version();
- printf ("\nUsage: %s Inputfile Outputfile\n", UTILITY_NAME);
-}
-
-
-int
-main (
- INT32 argc,
- CHAR8 *argv[]
- )
-/*++
-
-Routine Description:
-
- Compresses the input files
-
-Arguments:
-
- argc - number of arguments passed into the command line.
- argv[] - files to compress and files to output compressed data to.
-
-Returns:
-
- int: 0 for successful execution of the function.
-
---*/
-{
- EFI_STATUS Status;
- FILE *infile;
- FILE *outfile;
- UINT32 SrcSize;
- UINT32 DstSize;
- UINT8 *SrcBuffer;
- UINT8 *DstBuffer;
- UINT8 Buffer[8];
-
- //
- // Added for makefile debug - KCE
- //
- INT32 arg_counter;
-
- SrcBuffer = DstBuffer = NULL;
- infile = outfile = NULL;
-
- if (argc == 1) {
- Usage();
- goto Done;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- goto Done;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- goto Done;
- }
-
- if (argc != 3) {
- Usage();
- goto Done;
- }
-
- if ((outfile = fopen (argv[2], "wb")) == NULL) {
- printf ("Can't open output file\n");
- goto Done;
- }
-
- if ((infile = fopen (argv[1], "rb")) == NULL) {
- printf ("Can't open input file\n");
- goto Done;
- }
- //
- // Get the size of source file
- //
- SrcSize = 0;
- while (fread (Buffer, 1, 1, infile)) {
- SrcSize++;
-
- }
- //
- // Read in the source data
- //
- if ((SrcBuffer = malloc (SrcSize)) == NULL) {
- printf ("Can't allocate memory\n");
- goto Done;
- }
-
- rewind (infile);
- if (fread (SrcBuffer, 1, SrcSize, infile) != SrcSize) {
- printf ("Can't read from source\n");
- goto Done;
- }
- //
- // Get destination data size and do the compression
- //
- DstSize = 0;
- Status = EfiCompress (SrcBuffer, SrcSize, DstBuffer, &DstSize);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- if ((DstBuffer = malloc (DstSize)) == NULL) {
- printf ("Can't allocate memory\n");
- goto Done;
- }
-
- Status = EfiCompress (SrcBuffer, SrcSize, DstBuffer, &DstSize);
- }
-
- if (EFI_ERROR (Status)) {
- printf ("Compress Error\n");
- goto Done;
- }
-
- printf ("\nOrig Size = %ld\n", SrcSize);
- printf ("Comp Size = %ld\n", DstSize);
-
- if (DstBuffer == NULL) {
- printf ("No destination to write to.\n");
- goto Done;
- }
- //
- // Write out the result
- //
- if (fwrite (DstBuffer, 1, DstSize, outfile) != DstSize) {
- printf ("Can't write to destination file\n");
- }
-
-Done:
- if (SrcBuffer) {
- free (SrcBuffer);
- }
-
- if (DstBuffer) {
- free (DstBuffer);
- }
-
- if (infile) {
- fclose (infile);
- }
-
- if (outfile) {
- fclose (outfile);
- }
-
- return 0;
-}
diff --git a/Tools/CCode/Source/EfiCompress/build.xml b/Tools/CCode/Source/EfiCompress/build.xml
deleted file mode 100644
index 32826d2908..0000000000
--- a/Tools/CCode/Source/EfiCompress/build.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK EfiCompress Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="EfiCompress"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/EfiRom/EfiRom.c b/Tools/CCode/Source/EfiRom/EfiRom.c
deleted file mode 100644
index 4041c5078d..0000000000
--- a/Tools/CCode/Source/EfiRom/EfiRom.c
+++ /dev/null
@@ -1,1580 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-Module Name:
-
- EfiRom.c
-
-Abstract:
-
- Utility program to create an EFI option ROM image from binary and
- EFI PE32 files.
-
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h> // for PE32 structure definitions
-#include <Common/MultiPhase.h>
-
-#include <IndustryStandard/pci22.h> // for option ROM header structures
-
-#include "Compress.h"
-#include "CommonLib.h"
-
-//
-// Version of this utility
-//
-#define UTILITY_NAME "EfiRom"
-#define UTILITY_MAJOR_VERSION 2
-#define UTILITY_MINOR_VERSION 5
-
-//
-// Define some status return values
-//
-#define STATUS_SUCCESS 0
-#define STATUS_WARNING 1
-#define STATUS_ERROR 2
-
-//
-// Define the max length of a filename
-//
-#define MAX_PATH 200
-
-#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;
- INT8 *FileName;
- UINT32 FileFlags;
- UINT32 ClassCode;
- UINT16 CodeRevision;
-} FILE_LIST;
-
-//
-// Use this to track our command-line options
-//
-typedef struct {
- INT8 OutFileName[MAX_PATH];
- INT8 NoLast;
- INT8 Verbose;
- INT8 DumpOption;
- UINT8 DevIdValid;
- UINT8 VendIdValid;
- UINT16 VendId;
- UINT16 DevId;
- 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;
- char *Name;
-} STRING_LOOKUP;
-
-static STRING_LOOKUP mMachineTypes[] = {
- EFI_IMAGE_MACHINE_IA32,
- "IA32",
- EFI_IMAGE_MACHINE_IA64,
- "IA64",
- EFI_IMAGE_MACHINE_EBC,
- "EBC",
- 0,
- NULL
-};
-
-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
- );
-
-static
-void
-Usage (
- VOID
- );
-
-static
-int
-ParseCommandLine (
- int Argc,
- char *Argv[],
- OPTIONS *Options
- );
-
-static
-int
-CheckPE32File (
- FILE *Fptr,
- UINT16 *MachineType,
- UINT16 *SubSystem
- );
-
-static
-int
-ProcessEfiFile (
- FILE *OutFptr,
- FILE_LIST *InFile,
- UINT16 VendId,
- UINT16 DevId,
- UINT32 *Size
- );
-
-static
-int
-ProcessBinFile (
- FILE *OutFptr,
- FILE_LIST *InFile,
- UINT32 *Size
- );
-
-static
-void
-DumpImage (
- FILE_LIST *InFile
- );
-
-char *
-GetMachineTypeStr (
- UINT16 MachineType
- );
-
-static
-char *
-GetSubsystemTypeStr (
- UINT16 SubsystemType
- );
-
-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
-
---*/
-// GC_TODO: ] - add argument and description to function comment
-{
- INT8 *Ext;
- FILE *FptrOut;
- UINT32 Status;
- FILE_LIST *FList;
- UINT32 TotalSize;
- UINT32 Size;
-
- Status = STATUS_SUCCESS;
- FptrOut = NULL;
-
- //
- // Parse the command line arguments
- //
- if (ParseCommandLine (Argc, Argv, &mOptions)) {
- return STATUS_ERROR;
- }
- //
- // If dumping an image, then do that and quit
- //
- if (mOptions.DumpOption) {
- DumpImage (mOptions.FileList);
- 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]) {
- strcpy (mOptions.OutFileName, mOptions.FileList->FileName);
- //
- // Find the last . on the line and replace the filename extension with
- // the default
- //
- for (Ext = mOptions.OutFileName + strlen (mOptions.OutFileName) - 1;
- (Ext >= mOptions.OutFileName) && (*Ext != '.') && (*Ext != '\\');
- 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;
- fprintf (
- stdout,
- "ERROR: Input and output file names must be different - %s = %s\n",
- FList->FileName,
- mOptions.OutFileName
- );
- goto BailOut;
- }
- }
- //
- // Now open our output file
- //
- if ((FptrOut = fopen (mOptions.OutFileName, "w+b")) == NULL) {
- fprintf (stdout, "ERROR: Failed to open output file %s\n", 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) {
- if (mOptions.Verbose) {
- fprintf (stdout, "Processing EFI file %s\n", FList->FileName);
- }
-
- Status = ProcessEfiFile (FptrOut, FList, mOptions.VendId, mOptions.DevId, &Size);
- } else if (FList->FileFlags & FILE_FLAG_BINARY) {
- if (mOptions.Verbose) {
- fprintf (stdout, "Processing binary file %s\n", FList->FileName);
- }
-
- Status = ProcessBinFile (FptrOut, FList, &Size);
- } else {
- fprintf (stdout, "ERROR: File not specified as EFI or binary: %s\n", FList->FileName);
- Status = STATUS_ERROR;
- }
-
- if (mOptions.Verbose) {
- fprintf (stdout, " Output size = 0x%X\n", Size);
- }
-
- if (Status != STATUS_SUCCESS) {
- break;
- }
-
- TotalSize += Size;
- }
- //
- // Check total size
- //
- if (TotalSize > MAX_OPTION_ROM_SIZE) {
- fprintf (
- stdout,
- "ERROR: Option ROM image size exceeds limit 0x%X bytes\n",
- MAX_OPTION_ROM_SIZE
- );
- Status = STATUS_ERROR;
- }
-
-BailOut:
- if (FptrOut != NULL) {
- fclose (FptrOut);
- }
- //
- // Clean up our file list
- //
- while (mOptions.FileList != NULL) {
- FList = mOptions.FileList->Next;
- free (mOptions.FileList);
- mOptions.FileList = FList;
- }
-
- return Status;
-}
-
-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 *PciDs;
- UINT32 Index;
- UINT8 ByteCheckSum;
-
- Status = STATUS_SUCCESS;
-
- //
- // Try to open the input file
- //
- if ((InFptr = fopen (InFile->FileName, "rb")) == NULL) {
- fprintf (stdout, "ERROR: Failed to open input file %s\n", 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) {
- fprintf (stdout, " File size = 0x%X\n", FileSize);
- }
-
- fseek (InFptr, 0, SEEK_SET);
- Buffer = (INT8 *) malloc (FileSize);
- if (Buffer == NULL) {
- fprintf (stdout, "ERROR: Memory allocation failed\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
-
- if (fread (Buffer, FileSize, 1, InFptr) != 1) {
- fprintf (stdout, "ERROR: Failed to read all bytes from input file\n");
- 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) {
- fprintf (
- stdout,
- "ERROR: Option ROM image %s size exceeds limit 0x%X bytes\n",
- 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) {
- fprintf (stdout, "ERROR: ROM image file has invalid ROM signature\n");
- 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)) {
- fprintf (stdout, "ERROR: Invalid PCI data structure offset\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
-
- PciDs = (PCI_DATA_STRUCTURE *) (Buffer + RomHdr->PcirOffset);
- if (PciDs->Signature != PCI_DATA_STRUCTURE_SIGNATURE) {
- fprintf (stdout, "ERROR: PCI data structure has invalid signature\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
- //
- // If this is the last image, then set the LAST bit unless requested not
- // to via the command-line -l argument. Otherwise, make sure you clear it.
- //
- if ((InFile->Next == NULL) && (mOptions.NoLast == 0)) {
- PciDs->Indicator = INDICATOR_LAST;
- } else {
- PciDs->Indicator = 0;
- }
-
- ByteCheckSum = 0;
- for (Index = 0; Index < FileSize - 1; Index++) {
- ByteCheckSum = (UINT8) (ByteCheckSum + Buffer[Index]);
- }
-
- Buffer[FileSize - 1] = (UINT8) ((~ByteCheckSum) + 1);
- fprintf (stdout, "CheckSUm = %02x\n", (UINT32) Buffer[FileSize - 1]);
-
- //
- // Now copy the input file contents out to the output file
- //
- if (fwrite (Buffer, FileSize, 1, OutFptr) != 1) {
- fprintf (stdout, "ERROR: Failed to write all file bytes to output file\n");
- 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) {
- fprintf (stdout, "Error processing binary file %s\n", 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 PciDs;
- UINT32 FileSize;
- UINT32 CompressedFileSize;
- UINT8 *Buffer;
- UINT8 *CompressedBuffer;
- UINT8 *TempBufferPtr;
- UINT32 TotalSize;
- UINT32 HeaderSize;
- UINT16 MachineType;
- UINT16 SubSystem;
- UINT32 HeaderPadBytes;
-
- //
- // Try to open the input file
- //
- if ((InFptr = fopen (InFile->FileName, "rb")) == NULL) {
- fprintf (stdout, "ERROR: Failed to open input file %s\n", 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;
- }
-
- HeaderSize = sizeof (PCI_DATA_STRUCTURE) + HeaderPadBytes + sizeof (EFI_PCI_EXPANSION_ROM_HEADER);
- if (mOptions.Verbose) {
- fprintf (stdout, " File size = 0x%X\n", 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 = (INT8 *) malloc (FileSize);
- if (Buffer == NULL) {
- fprintf (stdout, "ERROR: Memory allocation failed\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
-
- fseek (InFptr, 0, SEEK_SET);
- if (fread (Buffer, FileSize, 1, InFptr) != 1) {
- fprintf (stdout, "ERROR: Failed to read all bytes from input file\n");
- 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) {
- //
- // Allocate a buffer into which we can compress the image, compress it,
- // and use that size as the new size.
- //
- CompressedBuffer = (INT8 *) malloc (FileSize);
- if (CompressedBuffer == NULL) {
- fprintf (stdout, "ERROR: Memory allocation failed\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
-
- CompressedFileSize = FileSize;
- Status = EfiCompress (Buffer, FileSize, CompressedBuffer, &CompressedFileSize);
- if (Status != STATUS_SUCCESS) {
- fprintf (stdout, "ERROR: Compression failed\n");
- goto BailOut;
- }
- //
- // Now compute the size, then swap buffer pointers.
- //
- if (mOptions.Verbose) {
- fprintf (stdout, " Comp size = 0x%X\n", 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;
- }
- //
- // Check size
- //
- if (TotalSize > MAX_OPTION_ROM_SIZE) {
- fprintf (
- stdout,
- "ERROR: Option ROM image %s size exceeds limit 0x%X bytes\n",
- 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;
- 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
- //
- memset (&PciDs, 0, sizeof (PCI_DATA_STRUCTURE));
-
- PciDs.Signature = PCI_DATA_STRUCTURE_SIGNATURE;
- PciDs.VendorId = VendId;
- PciDs.DeviceId = DevId;
- PciDs.Length = (UINT16) sizeof (PCI_DATA_STRUCTURE);
- PciDs.Revision = 0;
- //
- // Class code and code revision from the command line (optional)
- //
- PciDs.ClassCode[0] = (UINT8) InFile->ClassCode;
- PciDs.ClassCode[1] = (UINT8) (InFile->ClassCode >> 8);
- PciDs.ClassCode[2] = (UINT8) (InFile->ClassCode >> 16);
- PciDs.ImageLength = RomHdr.InitializationSize;
- PciDs.CodeRevision = InFile->CodeRevision;
- PciDs.CodeType = PCI_CODE_TYPE_EFI_IMAGE;
-
- //
- // If this is the last image, then set the LAST bit unless requested not
- // to via the command-line -l argument.
- //
- if ((InFile->Next == NULL) && (mOptions.NoLast == 0)) {
- PciDs.Indicator = INDICATOR_LAST;
- }
- //
- // Write the ROM header to the output file
- //
- if (fwrite (&RomHdr, sizeof (RomHdr), 1, OutFptr) != 1) {
- fprintf (stdout, "ERROR: Failed to write ROM header to output file\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
-
- //
- // Write pad bytes to align the PciDs
- //
- while (HeaderPadBytes > 0) {
- if (putc (0, OutFptr) == EOF) {
- fprintf (stdout, "ERROR: Failed to write ROM header pad bytes to output file\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
-
- HeaderPadBytes--;
- }
- //
- // Write the PCI data structure header to the output file
- //
- if (fwrite (&PciDs, sizeof (PciDs), 1, OutFptr) != 1) {
- fprintf (stdout, "ERROR: Failed to write PCI ROM header to output file\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
- //
- // Keep track of how many bytes left to write
- //
- TotalSize -= HeaderSize;
-
- //
- // Now dump the input file's contents to the output file
- //
- if (fwrite (Buffer, FileSize, 1, OutFptr) != 1) {
- fprintf (stdout, "ERROR: Failed to write all file bytes to output file\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
-
- TotalSize -= FileSize;
- //
- // Pad the rest of the image to make it a multiple of 512 bytes
- //
- while (TotalSize > 0) {
- if (putc (~0, OutFptr) == EOF) {
- fprintf (stdout, "ERROR: Failed to write trailing pad bytes output file\n");
- Status = STATUS_ERROR;
- goto BailOut;
- }
-
- TotalSize--;
- }
-
-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) {
- fprintf (stdout, "Error processing EFI file %s\n", InFile->FileName);
- }
-
- return Status;
-}
-
-static
-int
-CheckPE32File (
- FILE *Fptr,
- UINT16 *MachineType,
- UINT16 *SubSystem
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- Fptr - GC_TODO: add argument description
- MachineType - GC_TODO: add argument description
- SubSystem - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- /*++
-
-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_FILE_HEADER FileHdr;
- EFI_IMAGE_OPTIONAL_HEADER OptionalHdr;
- UINT32 PESig;
-
- //
- // Position to the start of the file
- //
- fseek (Fptr, 0, SEEK_SET);
-
- //
- // Read the DOS header
- //
- if (fread (&DosHeader, sizeof (DosHeader), 1, Fptr) != 1) {
- fprintf (stdout, "ERROR: Failed to read the DOS stub from the input file\n");
- return STATUS_ERROR;
- }
- //
- // Check the magic number (0x5A4D)
- //
- if (DosHeader.e_magic != EFI_IMAGE_DOS_SIGNATURE) {
- fprintf (stdout, "ERROR: Input file does not appear to be a PE32 image (magic number)\n");
- return STATUS_ERROR;
- }
- //
- // Position into the file and check the PE signature
- //
- fseek (Fptr, (long) DosHeader.e_lfanew, SEEK_SET);
- if (fread (&PESig, sizeof (PESig), 1, Fptr) != 1) {
- fprintf (stdout, "ERROR: Failed to read PE signature bytes from input file\n");
- return STATUS_ERROR;
- }
- //
- // Check the PE signature in the header "PE\0\0"
- //
- if (PESig != EFI_IMAGE_NT_SIGNATURE) {
- fprintf (stdout, "ERROR: Input file does not appear to be a PE32 image (signature)\n");
- return STATUS_ERROR;
- }
- //
- // Read the file header and stuff their MachineType
- //
- if (fread (&FileHdr, sizeof (FileHdr), 1, Fptr) != 1) {
- fprintf (stdout, "ERROR: Failed to read PE file header from input file\n");
- return STATUS_ERROR;
- }
-
- memcpy ((char *) MachineType, &FileHdr.Machine, 2);
-
- //
- // Read the optional header so we can get the subsystem
- //
- if (fread (&OptionalHdr, sizeof (OptionalHdr), 1, Fptr) != 1) {
- fprintf (stdout, "ERROR: Failed to read COFF optional header from input file\n");
- return STATUS_ERROR;
- }
-
- *SubSystem = OptionalHdr.Subsystem;
- if (mOptions.Verbose) {
- fprintf (stdout, " Got subsystem = 0x%X from image\n", (int) *SubSystem);
- }
- //
- // Good to go
- //
- 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;
-
- FileFlags = 0;
-
- //
- // Clear out the options
- //
- memset ((char *) Options, 0, sizeof (OPTIONS));
-
- //
- // To avoid compile warnings
- //
- FileList = PrevFileList = NULL;
-
- 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 ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
- (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- //
- // Process until no more arguments
- //
- while (Argc > 0) {
- if ((Argv[0][0] == '-') || (Argv[0][0] == '/')) {
- //
- // To simplify string comparisons, replace slashes with dashes
- //
- Argv[0][0] = '-';
-
- //
- // Vendor ID specified with -v
- //
- if (stricmp (Argv[0], "-v") == 0) {
- //
- // Make sure there's another parameter
- //
- if (Argc > 1) {
- Options->VendId = (UINT16) strtol (Argv[1], NULL, 16);
- Options->VendIdValid = 1;
- } else {
- fprintf (
- stdout,
- "ERROR: Missing Vendor ID with %s\n\n",
- Argv[0]
- );
- Usage ();
- return STATUS_ERROR;
- }
-
- Argv++;
- Argc--;
- } else if (stricmp (Argv[0], "-d") == 0) {
- //
- // Device ID specified with -d
- // Make sure there's another parameter
- //
- if (Argc > 1) {
- Options->DevId = (UINT16) strtol (Argv[1], NULL, 16);
- Options->DevIdValid = 1;
- } else {
- fprintf (
- stdout,
- "ERROR: Missing Device ID with %s\n\n",
- Argv[0]
- );
- Usage ();
- return STATUS_ERROR;
- }
-
- Argv++;
- Argc--;
- } else if (stricmp (Argv[0], "-o") == 0) {
- //
- // Output filename specified with -o
- // Make sure there's another parameter
- //
- if (Argc > 1) {
- strcpy (Options->OutFileName, Argv[1]);
- } else {
- fprintf (
- stdout,
- "ERROR: Missing output file name with %s\n\n",
- Argv[0]
- );
- Usage ();
- return STATUS_ERROR;
- }
-
- Argv++;
- Argc--;
- } else if ((stricmp (Argv[0], "-h") == 0) || (strcmp (Argv[0], "-?") == 0)) {
- //
- // Help option
- //
- Usage ();
- return STATUS_ERROR;
- } else if (stricmp (Argv[0], "-b") == 0) {
- //
- // Specify binary files with -b
- //
- FileFlags = (FileFlags &~FILE_FLAG_EFI) | FILE_FLAG_BINARY;
- } else if ((stricmp (Argv[0], "-e") == 0) || (stricmp (Argv[0], "-ec") == 0)) {
- //
- // Specify EFI files with -e. Specify EFI-compressed with -ec.
- //
- FileFlags = (FileFlags &~FILE_FLAG_BINARY) | 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 -l
- //
- } else if (stricmp (Argv[0], "-l") == 0) {
- Options->NoLast = 1;
- } else if (stricmp (Argv[0], "-p") == 0) {
- //
- // -v for verbose would have been nicer, but it's already used. Let's use
- // -p for prolix (wordy) output
- //
- Options->Verbose = 1;
- } else if (stricmp (Argv[0], "-dump") == 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->DevIdValid = 1;
- FileFlags = FILE_FLAG_BINARY;
- } else if (stricmp (Argv[0], "-cc") == 0) {
- //
- // Class code value for the next file in the list.
- // Make sure there's another parameter
- //
- if (Argc > 1) {
- //
- // No error checking on the return value. Could check for LONG_MAX,
- // LONG_MIN, or 0 class code value if desired. Check range (3 bytes)
- // at least.
- //
- ClassCode = (UINT32) strtol (Argv[1], NULL, 16);
- if (ClassCode & 0xFF000000) {
- fprintf (stdout, "ERROR: Class code %s out of range\n", Argv[1]);
- return STATUS_ERROR;
- }
- } else {
- fprintf (
- stdout,
- "ERROR: Missing class code value with %s\n\n",
- Argv[0]
- );
- Usage ();
- return STATUS_ERROR;
- }
-
- Argv++;
- Argc--;
- } else if (stricmp (Argv[0], "-rev") == 0) {
- //
- // Code revision in the PCI data structure. The value is for the next
- // file in the list.
- // Make sure there's another parameter
- //
- if (Argc > 1) {
- //
- // No error checking on the return value. Could check for LONG_MAX,
- // LONG_MIN, or 0 value if desired. Check range (2 bytes)
- // at least.
- //
- CodeRevision = (UINT32) strtol (Argv[1], NULL, 16);
- if (CodeRevision & 0xFFFF0000) {
- fprintf (stdout, "ERROR: Code revision %s out of range\n", Argv[1]);
- return STATUS_ERROR;
- }
- } else {
- fprintf (
- stdout,
- "ERROR: Missing code revision value with %s\n\n",
- Argv[0]
- );
- Usage ();
- return STATUS_ERROR;
- }
-
- Argv++;
- Argc--;
- } else {
- fprintf (stdout, "ERROR: Invalid option specified: %s\n\n", Argv[0]);
- Usage ();
- return STATUS_ERROR;
- }
- } 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) {
- fprintf (stdout, "ERROR: Missing -e or -b with input file %s\n", Argv[0]);
- return STATUS_ERROR;
- }
- //
- // Create a new file structure
- //
- FileList = (FILE_LIST *) malloc (sizeof (FILE_LIST));
- if (FileList == NULL) {
- fprintf (stdout, "ERROR: Memory allocation failure\n");
- return STATUS_ERROR;
- }
-
- memset ((char *) FileList, 0, sizeof (FILE_LIST));
- FileList->FileName = Argv[0];
- FileList->FileFlags = FileFlags;
- if (Options->FileList == NULL) {
- Options->FileList = FileList;
- } else {
- if (PrevFileList == NULL) {
- PrevFileList = FileList;
- } else {
- PrevFileList->Next = FileList;
- }
- }
-
- PrevFileList = FileList;
- //
- // Set the class code and code revision for this file, then reset the values.
- //
- FileList->ClassCode = ClassCode;
- FileList->CodeRevision = (UINT16) CodeRevision;
- ClassCode = 0;
- CodeRevision = 0;
- }
- //
- // Next argument
- //
- Argv++;
- Argc--;
- }
- //
- // Make sure they specified a device ID and vendor ID
- //
- if (!Options->VendIdValid) {
- fprintf (stdout, "ERROR: Missing Vendor ID on command line\n\n");
- Usage ();
- return STATUS_ERROR;
- }
-
- if (!Options->DevIdValid) {
- fprintf (stdout, "ERROR: Missing Device ID on command line\n\n");
- Usage ();
- return STATUS_ERROR;
- }
- //
- // Must have specified some files
- //
- if (Options->FileList == NULL) {
- fprintf (stdout, "ERROR: Missing input file name\n");
- Usage ();
- return STATUS_ERROR;
- }
-
- return 0;
-}
-
-static
-void
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- Print version information for this utility.
-
-Arguments:
-
- None.
-
-Returns:
-
- Nothing.
---*/
-{
- printf ("%s v%d.%d -EDK utility to create an option ROM image from a list of input files\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2006 Intel Corporation. All rights reserved.\n");
-}
-
-static
-void
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Print usage information for this utility.
-
-Arguments:
-
- None.
-
-Returns:
-
- Nothing.
-
---*/
-{
- int Index;
- static const char *Msg[] = {
- "\nUsage: efirom {-p} [-v VendorId] [-d DeviceId] {-o OutFileName} ",
- " [-e|-b] [FileName(s)]",
- " where:",
- " VendorId - required hex PCI Vendor ID for the device",
- " DeviceId - required hex PCI Device ID for the device",
- " OutFileName - optional output file name. Default is the first input",
- " file name with a "DEFAULT_OUTPUT_EXTENSION " file extension",
- " FileNames - input PE32 or binary file name(s)",
- " BinFileName - input binary file name(s)",
- " -p - for verbose output",
- " -l - to not automatically set the LAST bit on the last file",
- " -b - following FileNames are binary files",
- " -e - following FileNames are EFI PE32 image files",
- " -ec - following FileNames are EFI PE32 image files, and should",
- " be compressed by this utility",
- " -cc ClassCode - to use hex ClassCode in the PCI data structure header for",
- " the following FileName",
- " -rev Revision - to use hex Revision in the PCI data structure header for",
- " the following FileName",
- " -dump - to dump the headers of an existing option ROM image",
- " -h,--help,-?,/? - to display help messages",
- " -V,--version - to display version information",
- "",
- "Example usage: EfiRom -v 0xABCD -d 0x1234 -b File1.bin File2.bin -e File1.efi File2.efi ",
- "",
- NULL
- };
-
- Version();
- for (Index = 0; Msg[Index] != NULL; Index++) {
- fprintf (stdout, "%s\n", Msg[Index]);
- }
-}
-
-static
-void
-DumpImage (
- FILE_LIST *InFile
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- InFile - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- PCI_EXPANSION_ROM_HEADER PciRomHdr;
- FILE *InFptr;
- UINT32 ImageStart;
- UINT32 ImageCount;
- EFI_PCI_EXPANSION_ROM_HEADER EfiRomHdr;
- PCI_DATA_STRUCTURE PciDs;
-
- //
- // Open the input file
- //
- if ((InFptr = fopen (InFile->FileName, "rb")) == NULL) {
- fprintf (
- stdout,
- "ERROR: Could not open input file %s\n",
- InFile->FileName
- );
- return ;
- }
- //
- // Go through the image and dump the header stuff for each
- //
- ImageCount = 0;
- for (;;) {
- //
- // Save our postition 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) {
- fprintf (stdout, "ERROR: Failed to read PCI ROM header from file\n");
- goto BailOut;
- }
-
- //
- // Dump the contents of the header
- //
- fprintf (stdout, "Image %d -- Offset 0x%X\n", ImageCount, ImageStart);
- fprintf (stdout, " ROM header contents\n");
- fprintf (stdout, " Signature 0x%04X\n", (UINT32) PciRomHdr.Signature);
- fprintf (stdout, " PCIR offset 0x%04X\n", (UINT32) PciRomHdr.PcirOffset);
- //
- // Find PCI data structure
- //
- if (fseek (InFptr, ImageStart + PciRomHdr.PcirOffset, SEEK_SET)) {
- fprintf (stdout, "ERROR: Failed to seek to PCI data structure\n");
- goto BailOut;
- }
- //
- // Read and dump the PCI data structure
- //
- if (fread (&PciDs, sizeof (PciDs), 1, InFptr) != 1) {
- fprintf (stdout, "ERROR: Failed to read PCI data structure from file\n");
- goto BailOut;
- }
-
- fprintf (stdout, " PCI Data Structure\n");
- fprintf (
- stdout,
- " Signature %c%c%c%c\n",
- (char) PciDs.Signature,
- (char) (PciDs.Signature >> 8),
- (char) (PciDs.Signature >> 16),
- (char) (PciDs.Signature >> 24)
- );
- fprintf (stdout, " Vendor ID 0x%04X\n", PciDs.VendorId);
- fprintf (stdout, " Device ID 0x%04X\n", PciDs.DeviceId);
- fprintf (
- stdout,
- " Class Code 0x%06X\n",
- (UINT32) (PciDs.ClassCode[0] | (PciDs.ClassCode[1] << 8) | (PciDs.ClassCode[2] << 16))
- );
- fprintf (stdout, " Image size 0x%X\n", PciDs.ImageLength * 512);
- fprintf (stdout, " Code revision: 0x%04X\n", PciDs.CodeRevision);
- fprintf (stdout, " Indicator 0x%02X", (UINT32) PciDs.Indicator);
- //
- // Print the indicator, used to flag the last image
- //
- if (PciDs.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.
- //
- fprintf (stdout, " Code type 0x%02X", (UINT32) PciDs.CodeType);
- if (PciDs.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)) {
- fprintf (stdout, "ERROR: Failed to re-seek to ROM header structure\n");
- goto BailOut;
- }
-
- if (fread (&EfiRomHdr, sizeof (EfiRomHdr), 1, InFptr) != 1) {
- fprintf (stdout, "ERROR: Failed to read EFI PCI ROM header from file\n");
- goto BailOut;
- }
- //
- // Now dump more info
- //
- fprintf (stdout, " EFI Signature 0x%04X\n", EfiRomHdr.EfiSignature);
- fprintf (
- stdout,
- " Compression Type 0x%04X ",
- (UINT32) 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",
- (UINT32) EfiRomHdr.EfiImageHeaderOffset,
- (UINT32) (EfiRomHdr.EfiImageHeaderOffset + 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 (PciDs.Indicator == INDICATOR_LAST) {
- goto BailOut;
- }
- //
- // Seek to the start of the next image
- //
- if (fseek (InFptr, ImageStart + (PciDs.ImageLength * 512), SEEK_SET)) {
- fprintf (stdout, "ERROR: Failed to seek to next image\n");
- 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/Tools/CCode/Source/EfiRom/build.xml b/Tools/CCode/Source/EfiRom/build.xml
deleted file mode 100644
index 3369eca3c3..0000000000
--- a/Tools/CCode/Source/EfiRom/build.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK EfiRom Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="EfiRom"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/FlashMap/FlashDefFile.c b/Tools/CCode/Source/FlashMap/FlashDefFile.c
deleted file mode 100644
index 5a9205ab36..0000000000
--- a/Tools/CCode/Source/FlashMap/FlashDefFile.c
+++ /dev/null
@@ -1,2850 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-Module Name:
-
- FlashDefFile.c
-
-Abstract:
-
- Utility for flash management in the Intel Platform Innovation Framework
- for EFI build environment.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/FirmwareVolumeHeader.h>
-#include <Common/MultiPhase.h>
-
-#include "EfiUtilityMsgs.h"
-#include "FlashDefFile.h"
-#include "SimpleFileParsing.h"
-#include "Symbols.h"
-
-//
-// #include "TrackMallocFree.h"
-//
-#define WCHAR_T char
-#define MAX_STRING_LEN 256
-#define MAX_NAME_LEN 128
-#define BUFFER_SIZE 1024
-#define MAX_ATTR_LEN 128
-#define MAX_AREATYPE_LEN 128
-#define COLUMN2_START 60
-#define COLUMN3_START 70
-//
-// Information for each subregions defined in the fdf file will be saved in these
-//
-typedef struct _FLASH_SUBREGION_DESCRIPTION {
- struct _FLASH_SUBREGION_DESCRIPTION *Next;
- int CreateHob; // to add to the auto-created HOB array
- WCHAR_T Name[MAX_NAME_LEN]; // each subregion within a region must have a unique name
- unsigned int Size; // size, in bytes, of this subregion
- unsigned int SizeLeft; // used when creating the image
- WCHAR_T Attributes[MAX_ATTR_LEN]; // subregion attributes used in the output HOB
- WCHAR_T AreaType[MAX_AREATYPE_LEN]; // subregion area type used in the output HOB
- EFI_GUID NameGuid; // used in the output HOB
- WCHAR_T NameGuidString[MAX_NAME_LEN];
- EFI_GUID AreaTypeGuid; // used in the output HOB
- WCHAR_T AreaTypeGuidString[MAX_NAME_LEN];
- EFI_GUID FileSystemGuid; // used in the output HOB
- WCHAR_T FileSystemGuidString[MAX_NAME_LEN];
-} FLASH_SUBREGION_DESCRIPTION;
-
-//
-// Information for each block in a flash device will be saved in one of these.
-// We'll also use it for region definitions.
-//
-typedef struct _FLASH_BLOCK_DESCRIPTION {
- struct _FLASH_BLOCK_DESCRIPTION *Next; // next block in the linked list
- WCHAR_T Name[MAX_NAME_LEN]; // each block must have a unique name
- unsigned int Size; // size, in bytes, of this block
- unsigned int SizeLeft; // for use when creating image
- unsigned int Flags; // user-defined flags for the block
- unsigned int Alignment; // power of 2 alignment
- WCHAR_T Attributes[MAX_ATTR_LEN]; // only used for Region definitions
- WCHAR_T AreaType[MAX_AREATYPE_LEN]; // only used for Region definitions
- EFI_GUID AreaTypeGuid;
- WCHAR_T AreaTypeGuidString[MAX_NAME_LEN];
- FLASH_SUBREGION_DESCRIPTION *Subregions;
- FLASH_SUBREGION_DESCRIPTION *LastSubregion;
-} FLASH_BLOCK_DESCRIPTION;
-
-//
-// Information for each flash device will be saved in one of these
-//
-typedef struct _FLASH_DEVICE_DESCRIPTION {
- struct _FLASH_DEVICE_DESCRIPTION *Next; // next flash device in our linked list
- int ErasePolarity; // erase polarity of the flash device
- unsigned int BaseAddress; // base address of the flash device
- unsigned int Size; // total size, in bytes, of the flash device
- WCHAR_T Name[MAX_NAME_LEN]; // name of the flash device
- FLASH_BLOCK_DESCRIPTION *PBlocks; // linked list of physical block descriptors
- FLASH_BLOCK_DESCRIPTION *LastPBlock; // last block in the linked list
- FLASH_BLOCK_DESCRIPTION *Regions; // linked list of flash region descriptors
- FLASH_BLOCK_DESCRIPTION *LastRegion; // last region in the linked list
-} FLASH_DEVICE_DESCRIPTION;
-
-//
-// For image definitions, they can specify a file name or raw data bytes. Keep a linked list.
-//
-typedef struct _IMAGE_DEFINITION_ENTRY {
- struct _IMAGE_DEFINITION_ENTRY *Next;
- WCHAR_T RegionName[MAX_NAME_LEN];
- WCHAR_T SubregionName[MAX_NAME_LEN];
- WCHAR_T Name[MAX_NAME_LEN]; // file or data name
- int IsRawData; // non-zero if raw data bytes
- unsigned int RawDataSize;
- char *RawData;
- int Optional; // optional file (don't include if it doesn't exist)
-} IMAGE_DEFINITION_ENTRY;
-
-//
-// When we parse an image definition, save all the data for each in one of these
-//
-typedef struct _IMAGE_DEFINITION {
- struct _IMAGE_DEFINITION *Next;
- WCHAR_T Name[MAX_NAME_LEN];
- IMAGE_DEFINITION_ENTRY *Entries;
- IMAGE_DEFINITION_ENTRY *LastEntry;
-} IMAGE_DEFINITION;
-
-typedef struct {
- char *BufferStart;
- char *BufferEnd;
- char *BufferPos;
-} BUFFER_DATA;
-
-static const char *CIncludeHeader = "/*++\n\n"
-" DO NOT EDIT -- file auto-generated by FlashMap utility\n\n""--*/\n""\n""#ifndef _FLASH_MAP_H_\n"
-"#define _FLASH_MAP_H_\n\n";
-//
-// "#include \"EfiFlashMap.h\"\n\n";
-//
-static const char *CIncludeFooter = "#endif // #ifndef _FLASH_MAP_H_\n\n";
-
-static const char *CFlashMapDataFileHeader = "/*++\n\n"
-" DO NOT EDIT -- file auto-generated by FlashMap utility\n\n""--*/\n""\n";
-
-static FLASH_DEVICE_DESCRIPTION *mFlashDevices = NULL;
-static IMAGE_DEFINITION *mImageDefinitions = NULL;
-
-//
-// Local function prototypes
-//
-static
-BUFFER_DATA *
-CreateBufferData (
- VOID
- );
-
-static
-BOOLEAN
-AddBufferDataByte (
- BUFFER_DATA *Buffer,
- char Data
- );
-
-static
-void
-FreeBufferData (
- BUFFER_DATA *Buffer,
- BOOLEAN FreeData
- );
-
-static
-char *
-GetBufferData (
- BUFFER_DATA *Buffer,
- int *BufferSize
- );
-
-static
-FLASH_SUBREGION_DESCRIPTION *
-ParseSubregionDefinition (
- unsigned int SizeLeft
- );
-
-void
-FDFConstructor (
- VOID
- )
-/*++
-
-Routine Description:
- Initialization routine for the services that operate on a flash
- definition file.
-
-Arguments:
- None.
-
-Returns:
- NA
-
---*/
-{
- mFlashDevices = NULL;
- mImageDefinitions = NULL;
-}
-
-void
-FDFDestructor (
- VOID
- )
-/*++
-
-Routine Description:
- Finalization/cleanup routine for the services that operate on a flash
- definition file.
-
-Arguments:
- None.
-
-Returns:
- NA
-
---*/
-{
- FLASH_BLOCK_DESCRIPTION *FBNext;
- FLASH_DEVICE_DESCRIPTION *FDNext;
- IMAGE_DEFINITION *IDNext;
- IMAGE_DEFINITION_ENTRY *IDENext;
- FLASH_SUBREGION_DESCRIPTION *SubNext;
- //
- // Go through all our flash devices and free the memory
- //
- while (mFlashDevices != NULL) {
- //
- // Free the physical block definitions
- //
- while (mFlashDevices->PBlocks != NULL) {
- FBNext = mFlashDevices->PBlocks->Next;
- _free (mFlashDevices->PBlocks);
- mFlashDevices->PBlocks = FBNext;
- }
- //
- // Free the region definitions
- //
- while (mFlashDevices->Regions != NULL) {
- FBNext = mFlashDevices->Regions->Next;
- //
- // First free the subregion definitions
- //
- while (mFlashDevices->Regions->Subregions != NULL) {
- SubNext = mFlashDevices->Regions->Subregions->Next;
- _free (mFlashDevices->Regions->Subregions);
- mFlashDevices->Regions->Subregions = SubNext;
- }
-
- _free (mFlashDevices->Regions);
- mFlashDevices->Regions = FBNext;
- }
-
- FDNext = mFlashDevices->Next;
- _free (mFlashDevices);
- mFlashDevices = FDNext;
- }
- //
- // Free up the image definitions, and the data
- //
- while (mImageDefinitions != NULL) {
- //
- // Free the entries
- //
- while (mImageDefinitions->Entries != NULL) {
- IDENext = mImageDefinitions->Entries->Next;
- if (mImageDefinitions->Entries->RawData != NULL) {
- _free (mImageDefinitions->Entries->RawData);
- }
-
- _free (mImageDefinitions->Entries);
- mImageDefinitions->Entries = IDENext;
- }
-
- IDNext = mImageDefinitions->Next;
- _free (mImageDefinitions);
- mImageDefinitions = IDNext;
- }
-}
-
-STATUS
-FDFParseFile (
- char *FileName
- )
-/*++
-
-Routine Description:
- Parse the specified flash definition file, saving the definitions in
- file-static variables for use by other functions.
-
-Arguments:
- FileName - name of the input flash definition text file.
-
-Returns:
- STATUS_SUCCESS - file parsed with no errors or warnings
- STATUS_WARNING - warnings, but no errors, were encountered while parsing
- STATUS_ERROR - errors were encountered while parsing
-
---*/
-{
- FILE *Fptr;
- STATUS Status;
- unsigned int Num;
- FLASH_DEVICE_DESCRIPTION *FDDesc;
- FLASH_BLOCK_DESCRIPTION *FBlockDesc;
- FLASH_BLOCK_DESCRIPTION *TempBlockDesc;
- FLASH_SUBREGION_DESCRIPTION *Subregion;
- FLASH_SUBREGION_DESCRIPTION *TempSubregion;
- unsigned int BlockSizeLeft;
- unsigned int RegionSizeLeft;
- unsigned int SubregionSizeLeft;
- int ErrorCount;
- int WarningCount;
- IMAGE_DEFINITION *ImageDef;
- IMAGE_DEFINITION_ENTRY *ImageDefEntry;
- IMAGE_DEFINITION_ENTRY *TempImageDefEntry;
- BUFFER_DATA *BufferData;
- char Str[100];
- BOOLEAN PreviousComma;
-
- if ((Fptr = fopen (FileName, "r")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open input flash definition file for reading");
- return STATUS_ERROR;
- }
-
- fclose (Fptr);
- Status = STATUS_SUCCESS;
- ErrorCount = 0;
- WarningCount = 0;
- //
- // Initialize the simple-file-parsing routines
- //
- SFPInit ();
- //
- // Open the file
- //
- if ((Status = SFPOpenFile (FileName)) != STATUS_SUCCESS) {
- return Status;
- }
- //
- // Parse the file. Should start with a series of these:
- // FlashDevice {
- // Name = "FLASH_1234", Size = 0x2004, BaseAddress = 0xFFF0000, ErasePolarity = 1,
- // Block { Name = "BLOCK1", Size = 0x1000, Flags = 0x0001 }
- // Block { Name = "BLOCK2", Size = 0x1004, Flags = 0x0002 }
- // Region { Name = "REGION_NAME", Size = 0x2004, Align= 4 }
- // }
- //
- while (SFPIsKeyword ("FlashDevice")) {
- //
- // Allocate memory for new flash device description block
- //
- FDDesc = (FLASH_DEVICE_DESCRIPTION *) _malloc (sizeof (FLASH_DEVICE_DESCRIPTION));
- if (FDDesc == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- ErrorCount++;
- goto Done;
- }
-
- memset (FDDesc, 0, sizeof (FLASH_DEVICE_DESCRIPTION));
- //
- // Open brace -- warning if not there
- //
- if (!SFPIsToken ("{")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected {", NULL);
- WarningCount++;
- }
- //
- // Parse: Name = "DeviceName",
- //
- if (!SFPIsKeyword ("Name")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Name'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (FDDesc->Name, sizeof (FDDesc->Name))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted name of flash device", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following flash device name", NULL);
- WarningCount++;
- }
- //
- // Parse: Size = 0x20000,
- //
- if (!SFPIsKeyword ("Size")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Size'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetNumber (&FDDesc->Size)) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected numeric Size value", NULL);
- ErrorCount++;
- goto Done;
- }
- //
- // Check for 0 size
- //
- if (FDDesc->Size == 0) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, FDDesc->Name, "Size field cannot be 0", NULL);
- ErrorCount++;
- goto Done;
- }
-
- SFPIsToken (",");
- //
- // Parse: BaseAddress = 0xFFF0000,
- //
- if (!SFPIsKeyword ("BaseAddress")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'BaseAddress'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetNumber (&FDDesc->BaseAddress)) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected numeric value for BaseAddress", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following BaseAddress value", NULL);
- WarningCount++;
- }
- //
- // Parse: ErasePolarity = 1,
- //
- if (!SFPIsKeyword ("ErasePolarity")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'ErasePolarity'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetNumber (&Num) || ((Num != 0) && (Num != 1))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected numeric erase polarity value 1 or 0", NULL);
- ErrorCount++;
- goto Done;
- }
-
- FDDesc->ErasePolarity = Num;
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following erase polarity value", NULL);
- WarningCount++;
- }
- //
- // Parse array of:
- // Block { Name = "BLOCK1", Size = 0x1000, Flags = 0x0001 }
- //
- // Keep track of size to make sure the sum of the physical blocks and region sizes do not
- // exceed the size of the flash device.
- //
- BlockSizeLeft = FDDesc->Size;
- RegionSizeLeft = FDDesc->Size;
- while (SFPIsKeyword ("Block")) {
- //
- // Allocate memory for a new physical block descriptor
- //
- FBlockDesc = (FLASH_BLOCK_DESCRIPTION *) _malloc (sizeof (FLASH_BLOCK_DESCRIPTION));
- if (FBlockDesc == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- ErrorCount++;
- goto Done;
- }
-
- memset (FBlockDesc, 0, sizeof (FLASH_BLOCK_DESCRIPTION));
- //
- // Open brace -- warning if not there
- //
- if (!SFPIsToken ("{")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected {", NULL);
- WarningCount++;
- }
- //
- // Parse: Name = "BlockName",
- //
- if (!SFPIsKeyword ("Name")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Name'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (FBlockDesc->Name, sizeof (FBlockDesc->Name))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted name of physical block", NULL);
- ErrorCount++;
- goto Done;
- }
- //
- // Make sure there are no other physical block names with this same name
- //
- for (TempBlockDesc = FDDesc->PBlocks; TempBlockDesc != NULL; TempBlockDesc = TempBlockDesc->Next) {
- if (strcmp (TempBlockDesc->Name, FBlockDesc->Name) == 0) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- TempBlockDesc->Name,
- "physical block with this name already defined"
- );
- ErrorCount++;
- }
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following physical block name", NULL);
- WarningCount++;
- }
- //
- // Parse: Size = 0x2000,
- //
- if (!SFPIsKeyword ("Size")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Size'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetNumber (&FBlockDesc->Size)) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected numeric Size value", NULL);
- ErrorCount++;
- goto Done;
- }
- //
- // Make sure the sum of physical blocks so far does not exceed flash device size
- //
- if (BlockSizeLeft < FBlockDesc->Size) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- "sum of physical block sizes exceeds flash device size",
- NULL
- );
- ErrorCount++;
- }
-
- BlockSizeLeft -= FBlockDesc->Size;
- SFPIsToken (",");
- //
- // Optional parse: Flags = 0xFFF0000,
- //
- if (SFPIsKeyword ("Flags")) {
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetNumber (&FBlockDesc->Flags)) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected numeric value for Flags", NULL);
- ErrorCount++;
- goto Done;
- }
- }
-
- if (!SFPIsToken ("}")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected PhysicalBlock closing brace '}'", NULL);
- WarningCount++;
- }
- //
- // Add the physical block descriptor to the end of the linked list
- //
- if (FDDesc->LastPBlock != NULL) {
- FDDesc->LastPBlock->Next = FBlockDesc;
- } else {
- FDDesc->PBlocks = FBlockDesc;
- }
-
- FDDesc->LastPBlock = FBlockDesc;
- }
- //
- // Make sure sum of sizes of physical blocks added up to size of flash device
- //
- if (BlockSizeLeft != 0) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- NULL,
- "sum of sizes of physical blocks (0x%08X) != flash device size (0x%08X) : delta = 0x%08X",
- FDDesc->Size - BlockSizeLeft,
- FDDesc->Size,
- BlockSizeLeft
- );
- ErrorCount++;
- }
- //
- // Parse array of:
- // Region { Name = "REGION_1", Size = 0x2000, Flags = 0x1234, Alignment = 4, Attributes = "str", AreaType = "str" }
- //
- while (SFPIsKeyword ("Region")) {
- //
- // Allocate memory for a new physical block descriptor
- //
- FBlockDesc = (FLASH_BLOCK_DESCRIPTION *) _malloc (sizeof (FLASH_BLOCK_DESCRIPTION));
- if (FBlockDesc == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- ErrorCount++;
- goto Done;
- }
-
- memset (FBlockDesc, 0, sizeof (FLASH_BLOCK_DESCRIPTION));
- //
- // Open brace -- warning if not there
- //
- if (!SFPIsToken ("{")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected {", NULL);
- WarningCount++;
- }
- //
- // Parse: Name = "BlockName",
- //
- if (!SFPIsKeyword ("Name")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Name'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (FBlockDesc->Name, sizeof (FBlockDesc->Name))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted Region name", NULL);
- ErrorCount++;
- goto Done;
- }
- //
- // Make sure there are no other region names with this same name
- //
- for (TempBlockDesc = FDDesc->Regions; TempBlockDesc != NULL; TempBlockDesc = TempBlockDesc->Next) {
- if (strcmp (TempBlockDesc->Name, FBlockDesc->Name) == 0) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- TempBlockDesc->Name,
- "Region with this name already defined"
- );
- ErrorCount++;
- }
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following Region name", NULL);
- WarningCount++;
- }
- //
- // Parse: Size = 0x2000,
- //
- if (!SFPIsKeyword ("Size")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Size'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetNumber (&FBlockDesc->Size)) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected numeric Size value", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ','", NULL);
- }
- //
- // Make sure the sum of regions so far does not exceed flash device size
- //
- if (RegionSizeLeft < FBlockDesc->Size) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "sum of Region sizes exceeds flash device size", NULL);
- ErrorCount++;
- }
-
- RegionSizeLeft -= FBlockDesc->Size;
- //
- // Optional parse: Flags = 0xFFF0000,
- //
- if (SFPIsKeyword ("Flags")) {
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetNumber (&FBlockDesc->Flags)) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected numeric value for Flags", NULL);
- ErrorCount++;
- goto Done;
- }
- //
- // comma
- //
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ','", NULL);
- }
- }
- //
- // Optional parse: Alignment = 4
- //
- if (SFPIsKeyword ("Alignment")) {
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetNumber (&FBlockDesc->Alignment)) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected numeric Alignment value", NULL);
- ErrorCount++;
- goto Done;
- }
- //
- // comma
- //
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ','", NULL);
- }
- }
- //
- // Parse: Attributes = "String",
- //
- if (!SFPIsKeyword ("Attributes")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Attributes'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (FBlockDesc->Attributes, sizeof (FBlockDesc->Attributes))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted Attributes string", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ','", NULL);
- }
- //
- // Parse: AreaType = "String",
- //
- if (!SFPIsKeyword ("AreaType")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'AreaType'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (FBlockDesc->AreaType, sizeof (FBlockDesc->AreaType))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted AreaType string", NULL);
- ErrorCount++;
- goto Done;
- }
-
- PreviousComma = SFPIsToken (",");
- //
- // Parse optional attribute "AreaTypeGuid"
- //
- if (SFPIsKeyword ("AreaTypeGuid")) {
- //
- // Check for preceeding comma now
- //
- if (!PreviousComma) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ',' before 'AreaTypeGuid'", NULL);
- WarningCount++;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (SFPGetQuotedString (FBlockDesc->AreaTypeGuidString, sizeof (FBlockDesc->AreaTypeGuidString))) {
- //
- // Nothing else to do
- //
- } else if (!SFPGetGuid (PARSE_GUID_STYLE_5_FIELDS, &FBlockDesc->AreaTypeGuid)) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- "expected AreaTypeGuid quoted string or GUID of form 12345678-1234-1234-1234-123456789ABC",
- NULL
- );
- ErrorCount++;
- goto Done;
- }
- PreviousComma = SFPIsToken (",");
- }
-
- //
- // Parse optional Subregion definitions
- //
- SubregionSizeLeft = FBlockDesc->Size;
- while (SFPIsToken ("Subregion")) {
- if (!PreviousComma) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ',' before 'Subregion'", NULL);
- WarningCount++;
- PreviousComma = TRUE;
- }
-
- Subregion = ParseSubregionDefinition (SubregionSizeLeft);
- if (Subregion == NULL) {
- ErrorCount++;
- goto Done;
- }
-
- SubregionSizeLeft -= Subregion->Size;
- //
- // Add it to the end of our list
- //
- if (FBlockDesc->Subregions == NULL) {
- FBlockDesc->Subregions = Subregion;
- } else {
- FBlockDesc->LastSubregion->Next = Subregion;
- }
-
- FBlockDesc->LastSubregion = Subregion;
- //
- // Make sure all subregion names are unique. We do this each time
- // through so that we catch the error immediately after it happens, in
- // which case the reported line number is at least close to where the
- // problem lies. We don't exit on the error because we can continue parsing
- // the script to perhaps catch other errors or warnings.
- //
- for (Subregion = FBlockDesc->Subregions; Subregion != NULL; Subregion = Subregion->Next) {
- for (TempSubregion = Subregion->Next; TempSubregion != NULL; TempSubregion = TempSubregion->Next) {
- if (strcmp (Subregion->Name, TempSubregion->Name) == 0) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, Subregion->Name, "duplicate Subregion name");
- ErrorCount++;
- }
- }
- }
- }
-
- if (!SFPIsToken ("}")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected Region closing brace '}'", NULL);
- WarningCount++;
- }
- //
- // Add the region descriptor to the end of the linked list
- //
- if (FDDesc->LastRegion != NULL) {
- FDDesc->LastRegion->Next = FBlockDesc;
- } else {
- FDDesc->Regions = FBlockDesc;
- }
-
- FDDesc->LastRegion = FBlockDesc;
- }
- //
- // Make sure sum of sizes of regions adds up to size of flash device
- //
- if (RegionSizeLeft != 0) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- NULL,
- "sum of sizes of Regions (0x%08X) != flash device size (0x%08X) : delta = 0x%08X",
- FDDesc->Size - RegionSizeLeft,
- FDDesc->Size,
- RegionSizeLeft
- );
- ErrorCount++;
- }
- //
- // Look for closing brace
- //
- if (!SFPIsToken ("}")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected FlashDevice closing brace '}'", NULL);
- WarningCount++;
- }
- //
- // Add this flash description to the list
- //
- FDDesc->Next = mFlashDevices;
- mFlashDevices = FDDesc;
- }
-
- while (SFPIsKeyword ("FlashDeviceImage")) {
- //
- // Allocate memory for a new FD image definition
- //
- ImageDef = (IMAGE_DEFINITION *) _malloc (sizeof (IMAGE_DEFINITION));
- if (ImageDef == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- ErrorCount++;
- goto Done;
- }
-
- memset (ImageDef, 0, sizeof (IMAGE_DEFINITION));
- //
- // Open brace -- warning if not there
- //
- if (!SFPIsToken ("{")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected {", NULL);
- WarningCount++;
- }
- //
- // Parse: Name = "ImageName",
- //
- if (!SFPIsKeyword ("Name")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Name'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (ImageDef->Name, sizeof (ImageDef->Name))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted name of image", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following image name", NULL);
- WarningCount++;
- }
-
- while (1) {
- //
- // Parse: File { Name = "FV\FvOem.fv", Region = "REGION_OEM", Optional = TRUE }
- //
- if (SFPIsKeyword ("File")) {
- ImageDefEntry = (IMAGE_DEFINITION_ENTRY *) _malloc (sizeof (IMAGE_DEFINITION_ENTRY));
- if (ImageDefEntry == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- ErrorCount++;
- goto Done;
- }
-
- memset (ImageDefEntry, 0, sizeof (IMAGE_DEFINITION_ENTRY));
- //
- // Open brace -- warning if not there
- //
- if (!SFPIsToken ("{")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected {", NULL);
- WarningCount++;
- }
- //
- // Parse: Name = "FileName.txt"
- //
- if (!SFPIsKeyword ("Name")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Name'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (ImageDefEntry->Name, sizeof (ImageDefEntry->Name))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted name of file", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following file name", NULL);
- WarningCount++;
- }
- //
- // Parse: Region = "REGION_NAME"
- //
- if (!SFPIsKeyword ("Region")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Region'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (ImageDefEntry->RegionName, sizeof (ImageDefEntry->RegionName))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted Region name", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following Region name", NULL);
- WarningCount++;
- }
- //
- // Parse optional: Subregion = "SUBREGION_NAME"
- //
- if (SFPIsKeyword ("Subregion")) {
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (ImageDefEntry->SubregionName, sizeof (ImageDefEntry->SubregionName))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted Subegion name", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following Subregion name", NULL);
- WarningCount++;
- }
- //
- // For a given region, you can only place data using the region name, or the subregion names.
- // In other words, you can't say File1->Region1 and File2->Region1.Subregion1. Enforce that
- // here by checking that any previous entries with the same Region name had a Subregion specified
- // as well.
- //
- for (TempImageDefEntry = ImageDef->Entries;
- TempImageDefEntry != NULL;
- TempImageDefEntry = TempImageDefEntry->Next
- ) {
- if (strcmp (TempImageDefEntry->Name, ImageDefEntry->Name) == 0) {
- if (TempImageDefEntry->SubregionName[0] == 0) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- TempImageDefEntry->RegionName,
- "data already placed on a region-basis in the region, can't place data using subregions"
- );
- ErrorCount++;
- }
- }
- }
- }
- //
- // Optional parse: Optional = TRUE | FALSE
- //
- if (SFPIsKeyword ("Optional")) {
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPIsKeyword ("TRUE")) {
- ImageDefEntry->Optional = 1;
- } else if (SFPIsKeyword ("FALSE")) {
- //
- // Already set to 0
- //
- } else {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'TRUE' or 'FALSE'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- SFPIsToken (",");
- }
- //
- // Closing brace
- //
- if (!SFPIsToken ("}")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '}' closing brace to File entry", NULL);
- ErrorCount++;
- goto Done;
- }
- //
- // Add the entry to the end of the list
- //
- if (ImageDef->LastEntry != NULL) {
- ImageDef->LastEntry->Next = ImageDefEntry;
- } else {
- ImageDef->Entries = ImageDefEntry;
- }
-
- ImageDef->LastEntry = ImageDefEntry;
- } else if (SFPIsKeyword ("RawData")) {
- //
- // Parse: RawData { Name = "PadBytes", Region = "REGION_1", Data = { 0x78, 0x56, 0x34, 0x12 }}
- //
- ImageDefEntry = (IMAGE_DEFINITION_ENTRY *) _malloc (sizeof (IMAGE_DEFINITION_ENTRY));
- if (ImageDefEntry == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- ErrorCount++;
- goto Done;
- }
-
- memset (ImageDefEntry, 0, sizeof (IMAGE_DEFINITION_ENTRY));
- ImageDefEntry->IsRawData = 1;
- //
- // Open brace -- warning if not there
- //
- if (!SFPIsToken ("{")) {
- Warning (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- "expected '{' opening brace for RawData definition",
- NULL
- );
- WarningCount++;
- }
- //
- // Parse: Name = "PadBytes"
- //
- if (!SFPIsKeyword ("Name")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Name'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (ImageDefEntry->Name, sizeof (ImageDefEntry->Name))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted name of raw data", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following raw data name", NULL);
- WarningCount++;
- }
- //
- // Parse: Region = "REGION_NAME"
- //
- if (!SFPIsKeyword ("Region")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Region'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (ImageDefEntry->RegionName, sizeof (ImageDefEntry->RegionName))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted Region name", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following Region name", NULL);
- WarningCount++;
- }
- //
- // Parse optional: Subregion = "SUBREGION_NAME"
- //
- if (SFPIsKeyword ("Subregion")) {
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (ImageDefEntry->SubregionName, sizeof (ImageDefEntry->SubregionName))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted Subegion name", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following Subregion name", NULL);
- WarningCount++;
- }
- //
- // For a given region, you can only place data using the region name, or the subregion names.
- // In other words, you can't say File1->Region1 and File2->Region1.Subregion1. Enforce that
- // here by checking that any previous entries with the same Region name had a Subregion specified
- // as well.
- //
- for (TempImageDefEntry = ImageDef->Entries;
- TempImageDefEntry != NULL;
- TempImageDefEntry = TempImageDefEntry->Next
- ) {
- if (strcmp (TempImageDefEntry->Name, ImageDefEntry->Name) == 0) {
- if (TempImageDefEntry->SubregionName[0] == 0) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- TempImageDefEntry->RegionName,
- "data already placed on a region-basis in the region, can't place data using subregions"
- );
- ErrorCount++;
- }
- }
- }
- }
- //
- // Parse: Data = { 0x78, 0x56, 0x34, 0x12 }
- //
- if (!SFPIsKeyword ("Data")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Data'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPIsToken ("{")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '{' preceeding data list", NULL);
- WarningCount++;
- }
-
- if ((BufferData = CreateBufferData ()) == NULL) {
- ErrorCount++;
- goto Done;
- }
- //
- // Read bytes from input file until closing brace
- //
- while (!SFPIsToken ("}")) {
- if (!SFPGetNumber (&Num)) {
- SFPGetNextToken (Str, sizeof (Str));
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, Str, "expected data value", Str);
- ErrorCount++;
- FreeBufferData (BufferData, TRUE);
- goto Done;
- } else {
- //
- // Only allow bytes
- //
- if (Num > 0xFF) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "only values 0-255 (0x00-0xFF) allowed", NULL);
- ErrorCount++;
- FreeBufferData (BufferData, TRUE);
- goto Done;
- }
-
- AddBufferDataByte (BufferData, (char) Num);
- SFPIsToken (",");
- }
- }
- //
- // Now get the data and save it in our image entry
- //
- ImageDefEntry->RawData = GetBufferData (BufferData, &ImageDefEntry->RawDataSize);
- FreeBufferData (BufferData, 0);
- //
- // Closing brace for RawData {}
- //
- if (!SFPIsToken ("}")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '}' closing brace for RawData", NULL);
- ErrorCount++;
- goto Done;
- }
- //
- // Add the entry to the end of the list
- //
- if (ImageDef->LastEntry != NULL) {
- ImageDef->LastEntry->Next = ImageDefEntry;
- } else {
- ImageDef->Entries = ImageDefEntry;
- }
-
- ImageDef->LastEntry = ImageDefEntry;
- } else if (SFPIsToken ("}")) {
- //
- // Closing brace for FDImage {}
- //
- break;
- } else {
- SFPGetNextToken (Str, sizeof (Str));
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, Str, "unrecognized token", Str);
- ErrorCount++;
- goto Done;
- }
- }
- //
- // Add this image definition to our global list
- //
- ImageDef->Next = mImageDefinitions;
- mImageDefinitions = ImageDef;
- }
- //
- // Check for end-of-file
- //
- if (!SFPIsEOF ()) {
- SFPGetNextToken (Str, sizeof (Str));
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, Str, "expected end-of-file", Str);
- ErrorCount++;
- }
-
-Done:
- SFPCloseFile ();
- if (ErrorCount != 0) {
- return STATUS_ERROR;
- } else if (WarningCount != 0) {
- return STATUS_WARNING;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-FLASH_SUBREGION_DESCRIPTION *
-ParseSubregionDefinition (
- unsigned int SizeLeft
- )
-/*++
-
-Routine Description:
-
- Parse Subregion definitions from the input flash definition file. Format:
-
- Subregion {
- CreateHob = TRUE,
- Name = "FOO",
- Size = 0xA000,
- Attributes = "EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV",
- AreaType = "EFI_FLASH_AREA_EFI_VARIABLES",
- NameGuid = 12345678-1234-5678-AAAA-BBBBCCCCDDDD (or "EFI_SOME_GUID"),
- AreaTypeGuid = 11111111-2222-3333-4444-1, (or "EFI_SOME_GUID") (optional)
- FileSystemGuid = 11111111-2222-3333-4444-1, (or "EFI_SOME_GUID") (optional)
- }
-
- NOTE: The caller has already parsed the "Subregion" token, so start with the opening brace.
-
-Arguments:
-
- SizeLeft - in the flash definition file, a Region can be broken up into
- one or more subregions. As we parse the subregion definitions,
- the caller keeps track of how much space is left in the region
- that we're parsing subregions for. SizeLeft is that size, and
- so the size of the subregion we're now parsing better not
- exceed the size left.
- Returns:
-
- NULL - unrecoverable errors detected while parsing the subregion definition
-
- pointer to a subregion definition created from the parsed subregion
-
---*/
-{
- FLASH_SUBREGION_DESCRIPTION *Subregion;
- int ErrorCount;
- int WarningCount;
- unsigned int Number;
- BOOLEAN PreviousComma;
- //
- // Allocate memory for the new subregion descriptor
- //
- ErrorCount = 0;
- WarningCount = 0;
- Subregion = (FLASH_SUBREGION_DESCRIPTION *) _malloc (sizeof (FLASH_SUBREGION_DESCRIPTION));
- if (Subregion == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- ErrorCount++;
- goto Done;
- }
-
- memset (Subregion, 0, sizeof (FLASH_SUBREGION_DESCRIPTION));
- //
- // Open brace -- warning if not there
- //
- if (!SFPIsToken ("{")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected {", NULL);
- WarningCount++;
- }
- //
- // Parse: CreateHob = TRUE | FALSE,
- //
- if (!SFPIsKeyword ("CreateHob")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'CreateHob'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (SFPIsToken ("TRUE")) {
- Subregion->CreateHob = 1;
- } else if (SFPIsToken ("FALSE")) {
- //
- // Subregion->CreateHob = 0; -- not required since we did a memset earlier
- //
- } else {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'TRUE' or 'FALSE'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ',' following CreateHob value", NULL);
- WarningCount++;
- }
- //
- // Parse: Name = "Name",
- //
- if (!SFPIsKeyword ("Name")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Name'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetQuotedString (Subregion->Name, sizeof (Subregion->Name))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected Subregion name", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected comma following Region name", NULL);
- WarningCount++;
- }
- //
- // Parse: Size = 0x2000,
- //
- if (!SFPIsKeyword ("Size")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Size'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (!SFPGetNumber (&Subregion->Size)) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected numeric Size value", NULL);
- ErrorCount++;
- goto Done;
- }
-
- //
- // Check that the size does not exceed the size left passed in
- //
- if (Subregion->Size > SizeLeft) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "sum of Subregion sizes exceeds Region size", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ',' following Size value", NULL);
- }
- //
- // Parse: Attributes = Number | "String",
- //
- if (!SFPIsKeyword ("Attributes")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'Attributes'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (SFPGetNumber (&Number)) {
- sprintf (Subregion->Attributes, "0x%X", Number);
- } else if (!SFPGetQuotedString (Subregion->Attributes, sizeof (Subregion->Attributes))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted Attributes string", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ','", NULL);
- }
- //
- // Parse: AreaType = Number | "String",
- // AreaType is a UINT8, so error if it exceeds the size
- //
- if (!SFPIsKeyword ("AreaType")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'AreaType'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (SFPGetNumber (&Number)) {
- if (Number > 0xFF) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "AreaType value exceeds 255", NULL);
- ErrorCount++;
- }
-
- sprintf (Subregion->AreaType, "0x%X", Number & 0x00FF);
- } else if (!SFPGetQuotedString (Subregion->AreaType, sizeof (Subregion->AreaType))) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected quoted AreaType string", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken (",")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ',' following AreaType value", NULL);
- }
- //
- // Parse the three GUIDs (last two are optional)
- //
- // NameGuid = 12345678-1234-5678-AAAA-BBBBCCCCDDDD, (or "EFI_SOME_GUID")
- // AreaTypeGuid = 11111111-2222-3333-4444-1, (or "EFI_SOME_GUID")
- // FileSysteGuid = 11111111-2222-3333-4444-1, (or "EFI_SOME_GUID")
- //
- if (!SFPIsKeyword ("NameGuid")) {
- Error (SFPGetFileName (), SFPGetLineNumber (), 0, "expected 'NameGuid'", NULL);
- ErrorCount++;
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
- //
- // Allow a GUID or a quoted string identifier, which we'll just copy as a string
- //
- if (SFPGetQuotedString (Subregion->NameGuidString, sizeof (Subregion->NameGuidString))) {
- //
- // Nothing else to do
- //
- } else if (!SFPGetGuid (PARSE_GUID_STYLE_5_FIELDS, &Subregion->NameGuid)) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- "expected NameGuid quoted string or GUID of form 12345678-1234-1234-1234-123456789ABC",
- NULL
- );
- ErrorCount++;
- goto Done;
- }
- //
- // Comma following NameGuid is optional if they don't specify AreaTypeGuid or FileSystemGuid
- //
- PreviousComma = SFPIsToken (",");
- if (SFPIsKeyword ("AreaTypeGuid")) {
- //
- // Check for preceeding comma now
- //
- if (!PreviousComma) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ',' before 'AreaTypeGuid'", NULL);
- WarningCount++;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
-
- if (SFPGetQuotedString (Subregion->AreaTypeGuidString, sizeof (Subregion->AreaTypeGuidString))) {
- //
- // Nothing else to do
- //
- } else if (!SFPGetGuid (PARSE_GUID_STYLE_5_FIELDS, &Subregion->AreaTypeGuid)) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- "expected AreaTypeGuid quoted string or GUID of form 12345678-1234-1234-1234-123456789ABC",
- NULL
- );
- ErrorCount++;
- goto Done;
- }
-
- PreviousComma = SFPIsToken (",");
- }
-
- if (SFPIsKeyword ("FileSystemGuid")) {
- //
- // Check for preceeding comma now
- //
- if (!PreviousComma) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected ',' before 'FileSystemGuid'", NULL);
- WarningCount++;
- }
-
- if (!SFPIsToken ("=")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected '='", NULL);
- WarningCount++;
- }
- //
- // Allow a GUID or a quoted string identifier, which we'll just copy as a string
- //
- if (SFPGetQuotedString (Subregion->FileSystemGuidString, sizeof (Subregion->FileSystemGuidString))) {
- //
- // Nothing else to do
- //
- } else if (!SFPGetGuid (PARSE_GUID_STYLE_5_FIELDS, &Subregion->FileSystemGuid)) {
- Error (
- SFPGetFileName (),
- SFPGetLineNumber (),
- 0,
- "expected FileSystemGuid quoted string or GUID of form 12345678-1234-1234-1234-123456789ABC",
- NULL
- );
- ErrorCount++;
- goto Done;
- }
-
- SFPIsToken (",");
- }
- //
- // Look for subregion closing brace
- //
- if (!SFPIsToken ("}")) {
- Warning (SFPGetFileName (), SFPGetLineNumber (), 0, "expected Subregion closing brace '}'", NULL);
- WarningCount++;
- }
-
-Done:
- //
- // If any errors were encountered, then delete the subregion definition
- //
- if (ErrorCount != 0) {
- _free (Subregion);
- Subregion = NULL;
- }
-
- return Subregion;
-}
-
-STATUS
-FDFCreateCIncludeFile (
- char *FlashDeviceName,
- char *FileName
- )
-/*++
-
-Routine Description:
- Create a header file with #define definitions per an already-parsed
- flash definition file.
-
-Arguments:
- FlashDeviceName - name of flash device (from the flash definition file)
- to use
- FileName - name of output file to create
-
-Returns:
- STATUS_SUCCESS - no errors or warnings
- STATUS_WARNING - warnings, but no errors, were encountered
- STATUS_ERROR - errors were encountered
-
---*/
-{
- FILE *OutFptr;
- FLASH_BLOCK_DESCRIPTION *FBlock;
- FLASH_DEVICE_DESCRIPTION *FDev;
- FLASH_SUBREGION_DESCRIPTION *Subregion;
- unsigned int Offset;
- unsigned int SubregionOffset;
- int CreateHobs;
- //
- // Find the definition we're supposed to use
- //
- for (FDev = mFlashDevices; FDev != NULL; FDev = FDev->Next) {
- if (strcmp (FDev->Name, FlashDeviceName) == 0) {
- break;
- }
- }
-
- if (FDev == NULL) {
- Error (NULL, 0, 0, NULL, FlashDeviceName, "flash device not found in flash definitions");
- return STATUS_ERROR;
- }
-
- if ((OutFptr = fopen (FileName, "w")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open output file for writing");
- return STATUS_ERROR;
- }
- //
- // Write a header
- //
- fprintf (OutFptr, CIncludeHeader);
- //
- // Write flash block base and size defines
- //
- fprintf (OutFptr, "#define FLASH_BASE 0x%08X\n", FDev->BaseAddress);
- fprintf (OutFptr, "#define FLASH_SIZE 0x%08X\n\n", FDev->Size);
- //
- // Write flash regions base, size and offset defines
- //
- Offset = 0;
- CreateHobs = 0;
- for (FBlock = FDev->Regions; FBlock != NULL; FBlock = FBlock->Next) {
- fprintf (
- OutFptr,
- "#define FLASH_REGION_%s_BASE %*c0x%08X\n",
- FBlock->Name,
- COLUMN2_START - 40 - strlen (FBlock->Name),
- ' ',
- Offset + FDev->BaseAddress
- );
- fprintf (
- OutFptr,
- "#define FLASH_REGION_%s_SIZE %*c0x%08X\n",
- FBlock->Name,
- COLUMN2_START - 40 - strlen (FBlock->Name),
- ' ',
- FBlock->Size
- );
- fprintf (
- OutFptr,
- "#define FLASH_REGION_%s_OFFSET %*c0x%08X\n",
- FBlock->Name,
- COLUMN2_START - 40 - strlen (FBlock->Name),
- ' ',
- Offset
- );
- //
- // Create defines for any subregions
- //
- SubregionOffset = 0;
- for (Subregion = FBlock->Subregions; Subregion != NULL; Subregion = Subregion->Next) {
- fprintf (
- OutFptr,
- "#define FLASH_REGION_%s_SUBREGION_%s_BASE %*c0x%08X\n",
- FBlock->Name,
- Subregion->Name,
- COLUMN3_START - 43 - strlen (FBlock->Name) - strlen (Subregion->Name),
- ' ',
- FDev->BaseAddress + Offset + SubregionOffset
- );
- fprintf (
- OutFptr,
- "#define FLASH_REGION_%s_SUBREGION_%s_SIZE %*c0x%08X\n",
- FBlock->Name,
- Subregion->Name,
- COLUMN3_START - 43 - strlen (FBlock->Name) - strlen (Subregion->Name),
- ' ',
- Subregion->Size
- );
- fprintf (
- OutFptr,
- "#define FLASH_REGION_%s_SUBREGION_%s_OFFSET %*c0x%08X\n",
- FBlock->Name,
- Subregion->Name,
- COLUMN3_START - 43 - strlen (FBlock->Name) - strlen (Subregion->Name),
- ' ',
- Offset + SubregionOffset
- );
- SubregionOffset += Subregion->Size;
- if (Subregion->CreateHob != 0) {
- CreateHobs = 1;
- }
- }
-
- Offset += FBlock->Size;
- }
- //
- // Now create a #define for the flash map data definition
- //
- fprintf (OutFptr, "\n\n#define EFI_FLASH_AREA_DATA_DEFINITION \\\n");
- //
- // Emit entry for each region
- //
- Offset = 0;
- for (FBlock = FDev->Regions; FBlock != NULL; FBlock = FBlock->Next) {
- fprintf (OutFptr, " /* %s region */\\\n", FBlock->Name);
- fprintf (OutFptr, " {\\\n");
- fprintf (OutFptr, " FLASH_REGION_%s_BASE,\\\n", FBlock->Name);
- fprintf (OutFptr, " FLASH_REGION_%s_SIZE,\\\n", FBlock->Name);
- fprintf (OutFptr, " %s,\\\n", FBlock->Attributes);
- fprintf (OutFptr, " %s,\\\n", FBlock->AreaType);
- fprintf (OutFptr, " 0, 0, 0,\\\n");
- //
- // The AreaTypeGuid may have been specified in the input flash definition file as a GUID, or
- // as a quoted string. Do the right one.
- //
- if (FBlock->AreaTypeGuidString[0] != 0) {
- fprintf (OutFptr, " %s, \\\n", FBlock->AreaTypeGuidString);
- } else {
- fprintf (
- OutFptr,
- " { 0x%08X, 0x%04X, 0x%04X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X },\\\n",
- FBlock->AreaTypeGuid.Data1,
- (unsigned int) FBlock->AreaTypeGuid.Data2,
- (unsigned int) FBlock->AreaTypeGuid.Data3,
- (unsigned int) FBlock->AreaTypeGuid.Data4[0],
- (unsigned int) FBlock->AreaTypeGuid.Data4[1],
- (unsigned int) FBlock->AreaTypeGuid.Data4[2],
- (unsigned int) FBlock->AreaTypeGuid.Data4[3],
- (unsigned int) FBlock->AreaTypeGuid.Data4[4],
- (unsigned int) FBlock->AreaTypeGuid.Data4[5],
- (unsigned int) FBlock->AreaTypeGuid.Data4[6],
- (unsigned int) FBlock->AreaTypeGuid.Data4[7]
- );
- }
- fprintf (OutFptr, " },\\\n");
- }
-
- fprintf (OutFptr, "\n\n");
- //
- // Now walk the list again to create the EFI_HOB_FLASH_MAP_ENTRY_TYPE definition
- //
- if (CreateHobs != 0) {
- fprintf (OutFptr, "//\n// EFI_HOB_FLASH_MAP_ENTRY_TYPE definition\n//\n");
- fprintf (OutFptr, "#define EFI_HOB_FLASH_MAP_ENTRY_TYPE_DATA_DEFINITION");
- for (FBlock = FDev->Regions; FBlock != NULL; FBlock = FBlock->Next) {
- //
- // See if the block has subregions, and that the CreateHobs flag is set
- // for any of them.
- //
- CreateHobs = 0;
- for (Subregion = FBlock->Subregions; Subregion != NULL; Subregion = Subregion->Next) {
- if (Subregion->CreateHob != 0) {
- CreateHobs = 1;
- break;
- }
- }
- //
- // If any of the subregions had the CreateHobs flag set, then create the entries in the
- // output file
- //
- if (CreateHobs != 0) {
- for (Subregion = FBlock->Subregions; Subregion != NULL; Subregion = Subregion->Next) {
- if (Subregion->CreateHob != 0) {
- fprintf (OutFptr, " \\\n");
- fprintf (OutFptr, " /* %s.%s Subregion */\\\n", FBlock->Name, Subregion->Name);
- fprintf (OutFptr, " {\\\n");
- fprintf (OutFptr, " {EFI_HOB_TYPE_GUID_EXTENSION,\\\n");
- fprintf (OutFptr, " sizeof (EFI_HOB_FLASH_MAP_ENTRY_TYPE ),\\\n");
- fprintf (OutFptr, " 0},\\\n");
- //
- // The NameGuid may have been specified in the input flash definition file as a GUID, or
- // as a quoted string. Do the right one.
- //
- if (Subregion->NameGuidString[0] != 0) {
- fprintf (OutFptr, " %s, \\\n", Subregion->NameGuidString);
- } else {
- fprintf (
- OutFptr,
- " { 0x%08X, 0x%04X, 0x%04X, {0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X}},\\\n",
- Subregion->NameGuid.Data1,
- (unsigned int) Subregion->NameGuid.Data2,
- (unsigned int) Subregion->NameGuid.Data3,
- (unsigned int) Subregion->NameGuid.Data4[0],
- (unsigned int) Subregion->NameGuid.Data4[1],
- (unsigned int) Subregion->NameGuid.Data4[2],
- (unsigned int) Subregion->NameGuid.Data4[3],
- (unsigned int) Subregion->NameGuid.Data4[4],
- (unsigned int) Subregion->NameGuid.Data4[5],
- (unsigned int) Subregion->NameGuid.Data4[6],
- (unsigned int) Subregion->NameGuid.Data4[7]
- );
- }
-
- fprintf (OutFptr, " {0, 0, 0},\\\n");
- fprintf (OutFptr, " %s,\\\n", Subregion->AreaType);
- //
- // The AreaTypeGuid may have been specified in the input flash definition file as a GUID, or
- // as a quoted string. Do the right one.
- //
- if (Subregion->AreaTypeGuidString[0] != 0) {
- fprintf (OutFptr, " %s, \\\n", Subregion->AreaTypeGuidString);
- } else {
- fprintf (
- OutFptr,
- " { 0x%08X, 0x%04X, 0x%04X, {0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X}},\\\n",
- Subregion->AreaTypeGuid.Data1,
- (unsigned int) Subregion->AreaTypeGuid.Data2,
- (unsigned int) Subregion->AreaTypeGuid.Data3,
- (unsigned int) Subregion->AreaTypeGuid.Data4[0],
- (unsigned int) Subregion->AreaTypeGuid.Data4[1],
- (unsigned int) Subregion->AreaTypeGuid.Data4[2],
- (unsigned int) Subregion->AreaTypeGuid.Data4[3],
- (unsigned int) Subregion->AreaTypeGuid.Data4[4],
- (unsigned int) Subregion->AreaTypeGuid.Data4[5],
- (unsigned int) Subregion->AreaTypeGuid.Data4[6],
- (unsigned int) Subregion->AreaTypeGuid.Data4[7]
- );
- }
-
- fprintf (OutFptr, " 1,\\\n");
- fprintf (OutFptr, " {{\\\n");
- fprintf (OutFptr, " %s,\\\n", Subregion->Attributes);
- fprintf (OutFptr, " 0,\\\n");
- fprintf (OutFptr, " FLASH_REGION_%s_SUBREGION_%s_BASE,\\\n", FBlock->Name, Subregion->Name);
- fprintf (OutFptr, " FLASH_REGION_%s_SUBREGION_%s_SIZE,\\\n", FBlock->Name, Subregion->Name);
- //
- // The FileSystemGuid may have been specified in the input flash definition file as a GUID, or
- // as a quoted string. Do the right one.
- //
- if (Subregion->FileSystemGuidString[0] != 0) {
- fprintf (OutFptr, " %s, \\\n", Subregion->FileSystemGuidString);
- } else {
- fprintf (
- OutFptr,
- " { 0x%08X, 0x%04X, 0x%04X, {0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X}},\\\n",
- Subregion->FileSystemGuid.Data1,
- (unsigned int) Subregion->FileSystemGuid.Data2,
- (unsigned int) Subregion->FileSystemGuid.Data3,
- (unsigned int) Subregion->FileSystemGuid.Data4[0],
- (unsigned int) Subregion->FileSystemGuid.Data4[1],
- (unsigned int) Subregion->FileSystemGuid.Data4[2],
- (unsigned int) Subregion->FileSystemGuid.Data4[3],
- (unsigned int) Subregion->FileSystemGuid.Data4[4],
- (unsigned int) Subregion->FileSystemGuid.Data4[5],
- (unsigned int) Subregion->FileSystemGuid.Data4[6],
- (unsigned int) Subregion->FileSystemGuid.Data4[7]
- );
- }
-
- fprintf (OutFptr, " }},\\\n");
- fprintf (OutFptr, " },");
- }
- }
- }
- }
-
- fprintf (OutFptr, "\n\n");
- }
-
- //
- // Write the file's closing #endif
- //
- fprintf (OutFptr, CIncludeFooter);
- fclose (OutFptr);
- return STATUS_SUCCESS;
-}
-
-STATUS
-FDFCreateAsmIncludeFile (
- char *FlashDeviceName,
- char *FileName
- )
-/*++
-
-Routine Description:
- Create an assembly header file with equate definitions per an already-parsed
- flash definition file.
-
-Arguments:
- FlashDeviceName - name of flash device (from the flash definition file)
- to use
- FileName - name of output file to create
-
-Returns:
- STATUS_SUCCESS - no errors or warnings
- STATUS_WARNING - warnings, but no errors, were encountered
- STATUS_ERROR - errors were encountered
-
---*/
-{
- FILE *OutFptr;
- FLASH_BLOCK_DESCRIPTION *FBlock;
- FLASH_DEVICE_DESCRIPTION *FDev;
- unsigned int Offset;
- FLASH_SUBREGION_DESCRIPTION *Subregion;
- unsigned int SubregionOffset;
- //
- // Find the definition we're supposed to use
- //
- for (FDev = mFlashDevices; FDev != NULL; FDev = FDev->Next) {
- if (strcmp (FDev->Name, FlashDeviceName) == 0) {
- break;
- }
- }
-
- if (FDev == NULL) {
- Error (NULL, 0, 0, NULL, FlashDeviceName, "flash device not found in flash definitions");
- return STATUS_ERROR;
- }
-
- if ((OutFptr = fopen (FileName, "w")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open output file for writing");
- return STATUS_ERROR;
- }
- //
- // Write a header
- //
- fprintf (OutFptr, "\n\n");
- //
- // Write flash block size and offset defines
- //
- fprintf (
- OutFptr,
- "FLASH_BASE %*cequ 0%08Xh\n",
- COLUMN2_START - 40,
- ' ',
- FDev->BaseAddress
- );
- fprintf (OutFptr, "FLASH_SIZE %*cequ 0%08Xh\n", COLUMN2_START - 40, ' ', FDev->Size);
- //
- // Write flash region size and offset defines
- //
- fprintf (OutFptr, "\n");
- Offset = 0;
- for (FBlock = FDev->Regions; FBlock != NULL; FBlock = FBlock->Next) {
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_BASE %*cequ 0%08Xh\n",
- FBlock->Name,
- COLUMN2_START - 20 - strlen (FBlock->Name),
- ' ',
- FDev->BaseAddress + Offset
- );
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_SIZE %*cequ 0%08Xh\n",
- FBlock->Name,
- COLUMN2_START - 20 - strlen (FBlock->Name),
- ' ',
- FBlock->Size
- );
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_OFFSET %*cequ 0%08Xh\n",
- FBlock->Name,
- COLUMN2_START - 20 - strlen (FBlock->Name),
- ' ',
- Offset
- );
- //
- // Create defines for any subregions
- //
- SubregionOffset = 0;
- for (Subregion = FBlock->Subregions; Subregion != NULL; Subregion = Subregion->Next) {
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_SUBREGION_%s_BASE %*cequ 0%08Xh\n",
- FBlock->Name,
- Subregion->Name,
- COLUMN3_START - 39 - strlen (FBlock->Name) - strlen (Subregion->Name),
- ' ',
- FDev->BaseAddress + Offset + SubregionOffset
- );
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_SUBREGION_%s_SIZE %*cequ 0%08Xh\n",
- FBlock->Name,
- Subregion->Name,
- COLUMN3_START - 39 - strlen (FBlock->Name) - strlen (Subregion->Name),
- ' ',
- Subregion->Size
- );
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_SUBREGION_%s_OFFSET %*cequ 0%08Xh\n",
- FBlock->Name,
- Subregion->Name,
- COLUMN3_START - 39 - strlen (FBlock->Name) - strlen (Subregion->Name),
- ' ',
- Offset + SubregionOffset
- );
- SubregionOffset += Subregion->Size;
- }
-
- Offset += FBlock->Size;
- }
-
- //
- // Write closing \n
- //
- fprintf (OutFptr, "\n\n");
- fclose (OutFptr);
- return STATUS_SUCCESS;
-}
-
-STATUS
-FDFCreateSymbols (
- char *FlashDeviceName
- )
-/*++
-
-Routine Description:
- Using the given flash device name, add symbols to the global symbol table. This
- allows other functions to use the symbol definitions for other purposes.
-
-Arguments:
- FlashDeviceName - name of flash device (from the flash definition file)
- to use
-
-Returns:
- STATUS_SUCCESS - no errors or warnings
- STATUS_WARNING - warnings, but no errors, were encountered
- STATUS_ERROR - errors were encountered
-
---*/
-{
- FLASH_BLOCK_DESCRIPTION *FBlock;
- FLASH_DEVICE_DESCRIPTION *FDev;
- unsigned int Offset;
- char SymName[120];
- char SymValue[120];
- FLASH_SUBREGION_DESCRIPTION *Subregion;
- unsigned int SubregionOffset;
- //
- // Find the definition we're supposed to use
- //
- for (FDev = mFlashDevices; FDev != NULL; FDev = FDev->Next) {
- if (strcmp (FDev->Name, FlashDeviceName) == 0) {
- break;
- }
- }
-
- if (FDev == NULL) {
- Error (NULL, 0, 0, NULL, FlashDeviceName, "flash device not found in flash definitions");
- return STATUS_ERROR;
- }
-
- sprintf (SymValue, "0x%08X", FDev->BaseAddress);
- SymbolAdd ("FLASH_BASE", SymValue, 0);
- sprintf (SymValue, "0x%08X", FDev->Size);
- SymbolAdd ("FLASH_SIZE", SymValue, 0);
- //
- // Add flash block size and offset defines
- //
- // Offset = 0;
- // for (FBlock = FDev->PBlocks; FBlock != NULL; FBlock = FBlock->Next) {
- // sprintf (SymName, "FLASH_BLOCK_%s_BASE", FBlock->Name);
- // sprintf (SymValue, "0x%08X", FDev->BaseAddress + Offset);
- // SymbolAdd (SymName, SymValue, 0);
- // sprintf (SymName, "FLASH_BLOCK_%s_SIZE", FBlock->Name);
- // sprintf (SymValue, "0x%08X", FBlock->Size);
- // SymbolAdd (SymName, SymValue, 0);
- // sprintf (SymName, "FLASH_BLOCK_%s_OFFSET", FBlock->Name);
- // sprintf (SymValue, "0x%08X", Offset);
- // SymbolAdd (SymName, SymValue, 0);
- // Offset += FBlock->Size;
- // }
- //
- // Add flash region block base, size, and offset defines
- //
- Offset = 0;
- for (FBlock = FDev->Regions; FBlock != NULL; FBlock = FBlock->Next) {
- sprintf (SymName, "FLASH_REGION_%s_BASE", FBlock->Name);
- sprintf (SymValue, "0x%08X", FDev->BaseAddress + Offset);
- SymbolAdd (SymName, SymValue, 0);
- sprintf (SymName, "FLASH_REGION_%s_SIZE", FBlock->Name);
- sprintf (SymValue, "0x%08X", FBlock->Size);
- SymbolAdd (SymName, SymValue, 0);
- sprintf (SymName, "FLASH_REGION_%s_OFFSET", FBlock->Name);
- sprintf (SymValue, "0x%08X", Offset);
- SymbolAdd (SymName, SymValue, 0);
- //
- // Add subregion symbols
- //
- if (FBlock->Subregions != NULL) {
- SubregionOffset = 0;
- for (Subregion = FBlock->Subregions; Subregion != NULL; Subregion = Subregion->Next) {
- sprintf (SymName, "FLASH_REGION_%s_SUBREGION_%s_BASE", FBlock->Name, Subregion->Name);
- sprintf (SymValue, "0x%08X", FDev->BaseAddress + Offset + SubregionOffset);
- SymbolAdd (SymName, SymValue, 0);
- sprintf (SymName, "FLASH_REGION_%s_SUBREGION_%s_SIZE", FBlock->Name, Subregion->Name);
- sprintf (SymValue, "0x%08X", Subregion->Size);
- SymbolAdd (SymName, SymValue, 0);
- sprintf (SymName, "FLASH_REGION_%s_SUBREGION_%s_OFFSET", FBlock->Name, Subregion->Name);
- sprintf (SymValue, "0x%08X", Offset + SubregionOffset);
- SymbolAdd (SymName, SymValue, 0);
- SubregionOffset += Subregion->Size;
- }
- }
-
- Offset += FBlock->Size;
- }
-
- return STATUS_SUCCESS;
-}
-
-STATUS
-FDFCreateImage (
- char *FlashDeviceName,
- char *ImageName,
- char *FileName
- )
-/*++
-
-Routine Description:
- Create a flash image using the given device and image names.
-
-Arguments:
- FlashDeviceName - name of flash device (from the flash definition file)
- to use
- ImageName - name of image (from the flash definition file) to create
- FileName - name of output file to create
-
-Returns:
- STATUS_SUCCESS - no errors or warnings
- STATUS_WARNING - warnings, but no errors, were encountered
- STATUS_ERROR - errors were encountered
-
---*/
-{
- STATUS Status;
- FILE *OutFptr;
- FLASH_BLOCK_DESCRIPTION *RegionDef;
- FLASH_DEVICE_DESCRIPTION *FDev;
- IMAGE_DEFINITION *ImageDef;
- unsigned int Offset;
- char *Buffer;
- FILE *InFptr;
- long FileSize;
- IMAGE_DEFINITION_ENTRY *IDefEntry;
- FLASH_SUBREGION_DESCRIPTION *SubregionDef;
- //
- // Find the flash definition we're supposed to use
- //
- InFptr = NULL;
- Status = STATUS_ERROR;
- for (FDev = mFlashDevices; FDev != NULL; FDev = FDev->Next) {
- if (strcmp (FDev->Name, FlashDeviceName) == 0) {
- break;
- }
- }
-
- if (FDev == NULL) {
- Error (NULL, 0, 0, FlashDeviceName, "flash device not found in flash definitions");
- return STATUS_ERROR;
- }
- //
- // Find the image name we're supposed to create
- //
- for (ImageDef = mImageDefinitions; ImageDef != NULL; ImageDef = ImageDef->Next) {
- if (strcmp (ImageDef->Name, ImageName) == 0) {
- break;
- }
- }
-
- if (ImageDef == NULL) {
- Error (NULL, 0, 0, ImageName, "image definition not found in image definitions");
- return STATUS_ERROR;
- }
- //
- // Open the output file
- //
- if ((OutFptr = fopen (FileName, "wb")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open output file for writing");
- return STATUS_ERROR;
- }
- //
- // Allocate a buffer to copy the input data to
- //
- Buffer = (char *) _malloc (FDev->Size);
- if (Buffer == NULL) {
- Error (NULL, 0, 0, (INT8 *) "failed to allocate memory", NULL);
- goto Done;
- }
- //
- // Set contents of buffer to the erased value
- //
- if (FDev->ErasePolarity) {
- memset (Buffer, 0xFF, FDev->Size);
- } else {
- memset (Buffer, 0, FDev->Size);
- }
- //
- // Set all region and subregion size-left fields to the size of the region/subregion
- //
- for (RegionDef = FDev->Regions; RegionDef != NULL; RegionDef = RegionDef->Next) {
- RegionDef->SizeLeft = RegionDef->Size;
- for (SubregionDef = RegionDef->Subregions; SubregionDef != NULL; SubregionDef = SubregionDef->Next) {
- SubregionDef->SizeLeft = SubregionDef->Size;
- }
- }
- //
- // Now go through the image list, read files into the buffer.
- //
- for (IDefEntry = ImageDef->Entries; IDefEntry != NULL; IDefEntry = IDefEntry->Next) {
- //
- // If it's a file name, open the file, get the size, find the corresponding
- // flash region it's in, and copy the data.
- //
- if (IDefEntry->IsRawData == 0) {
- if ((InFptr = fopen (IDefEntry->Name, "rb")) == NULL) {
- Error (NULL, 0, 0, IDefEntry->Name, "failed to open input file for reading");
- goto Done;
- }
-
- fseek (InFptr, 0, SEEK_END);
- FileSize = ftell (InFptr);
- fseek (InFptr, 0, SEEK_SET);
- } else {
- FileSize = IDefEntry->RawDataSize;
- }
- //
- // Find the region/subregion it's in, see if we have space left
- //
- Offset = 0;
- for (RegionDef = FDev->Regions; RegionDef != NULL; RegionDef = RegionDef->Next) {
- if (strcmp (RegionDef->Name, IDefEntry->RegionName) == 0) {
- break;
- }
-
- Offset += RegionDef->Size;
- }
-
- if (RegionDef == NULL) {
- Error (NULL, 0, 0, IDefEntry->RegionName, "Region name not found in FlashDevice %s definition", FDev->Name);
- goto Done;
- }
-
- //
- // Check for subregion
- //
- if (IDefEntry->SubregionName[0] != 0) {
- for (SubregionDef = RegionDef->Subregions; SubregionDef != NULL; SubregionDef = SubregionDef->Next) {
- if (strcmp (SubregionDef->Name, IDefEntry->SubregionName) == 0) {
- break;
- }
-
- Offset += SubregionDef->Size;
- }
-
- if (SubregionDef == NULL) {
- Error (
- NULL,
- 0,
- 0,
- IDefEntry->SubregionName,
- "Subregion name not found in FlashDevice %s.%s Region definition",
- FDev->Name,
- RegionDef->Name
- );
- goto Done;
- }
- //
- // Enough space in the subregion?
- //
- if (SubregionDef->SizeLeft < (unsigned int) FileSize) {
- Error (
- NULL,
- 0,
- 0,
- IDefEntry->Name,
- "insufficient space in Subregion (at least 0x%X additional bytes required)",
- FileSize - SubregionDef->SizeLeft
- );
- goto Done;
- }
-
- //
- // Read the file into the buffer if it's a file. Otherwise copy the raw data
- //
- if (IDefEntry->IsRawData == 0) {
- if (fread (Buffer + Offset + (SubregionDef->Size - SubregionDef->SizeLeft), FileSize, 1, InFptr) != 1) {
- Error (NULL, 0, 0, IDefEntry->Name, "failed to read file contents");
- goto Done;
- }
-
- fclose (InFptr);
- InFptr = NULL;
- } else {
- memcpy (
- Buffer + Offset + (SubregionDef->Size - SubregionDef->SizeLeft),
- IDefEntry->RawData,
- IDefEntry->RawDataSize
- );
- }
-
- SubregionDef->SizeLeft -= FileSize;
- //
- // Align based on the Region alignment requirements.
- //
- if (RegionDef->Alignment != 0) {
- while (((unsigned int) (SubregionDef->Size - SubregionDef->SizeLeft) &~RegionDef->Alignment) != 0) {
- if (SubregionDef->SizeLeft == 0) {
- break;
- }
-
- SubregionDef->SizeLeft--;
- }
- }
- } else {
- //
- // Placing data in a region. Check for enough space in the region left.
- //
- if (RegionDef->SizeLeft < (unsigned int) FileSize) {
- Error (
- NULL,
- 0,
- 0,
- IDefEntry->Name,
- "insufficient space in Region (at least 0x%X additional bytes required)",
- FileSize - RegionDef->SizeLeft
- );
- goto Done;
- }
-
- //
- // Read the file into the buffer if it's a file. Otherwise copy the raw data
- //
- if (IDefEntry->IsRawData == 0) {
- if (fread (Buffer + Offset + (RegionDef->Size - RegionDef->SizeLeft), FileSize, 1, InFptr) != 1) {
- Error (NULL, 0, 0, IDefEntry->Name, "failed to read file contents");
- goto Done;
- }
-
- fclose (InFptr);
- InFptr = NULL;
- } else {
- memcpy (Buffer + Offset + (RegionDef->Size - RegionDef->SizeLeft), IDefEntry->RawData, IDefEntry->RawDataSize);
- }
-
- RegionDef->SizeLeft -= FileSize;
- //
- // Align
- //
- if (RegionDef->Alignment != 0) {
- while (((unsigned int) (RegionDef->Size - RegionDef->SizeLeft) &~RegionDef->Alignment) != 0) {
- if (RegionDef->SizeLeft == 0) {
- break;
- }
-
- RegionDef->SizeLeft--;
- }
- }
- }
- }
-
- if (fwrite (Buffer, FDev->Size, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, "failed to write buffer contents to output file", NULL);
- goto Done;
- }
-
- Status = STATUS_SUCCESS;
-Done:
- if (InFptr != NULL) {
- fclose (InFptr);
- }
-
- if (Buffer != NULL) {
- _free (Buffer);
- }
-
- if (OutFptr != NULL) {
- fclose (OutFptr);
- if (Status == STATUS_ERROR) {
- remove (FileName);
- }
- }
-
- return Status;
-}
-
-STATUS
-FDFCreateDscFile (
- char *FlashDeviceName,
- char *FileName
- )
-/*++
-
-Routine Description:
- Create a DSC-style output file with equates for flash management.
-
-Arguments:
- FlashDeviceName - name of flash device (from the flash definition file)
- to use
- FileName - name of output file to create
-
-Returns:
- STATUS_SUCCESS - no errors or warnings
- STATUS_WARNING - warnings, but no errors, were encountered
- STATUS_ERROR - errors were encountered
-
---*/
-{
- FILE *OutFptr;
- FLASH_BLOCK_DESCRIPTION *FBlock;
- FLASH_DEVICE_DESCRIPTION *FDev;
- unsigned int Offset;
- FLASH_SUBREGION_DESCRIPTION *Subregion;
- unsigned int SubregionOffset;
- //
- // Find the definition we're supposed to use
- //
- for (FDev = mFlashDevices; FDev != NULL; FDev = FDev->Next) {
- if (strcmp (FDev->Name, FlashDeviceName) == 0) {
- break;
- }
- }
-
- if (FDev == NULL) {
- Error (NULL, 0, 0, FlashDeviceName, "flash device not found in flash definitions");
- return STATUS_ERROR;
- }
-
- if ((OutFptr = fopen (FileName, "w")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open output file for writing");
- return STATUS_ERROR;
- }
- //
- // Write the flash base address and size
- //
- fprintf (OutFptr, "\n");
- fprintf (OutFptr, "FLASH_BASE = 0x%08X\n", FDev->BaseAddress);
- fprintf (OutFptr, "FLASH_SIZE = 0x%08X\n\n", FDev->Size);
- //
- // Write flash block size and offset defines
- //
- Offset = 0;
- for (FBlock = FDev->Regions; FBlock != NULL; FBlock = FBlock->Next) {
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_BASE %*c= 0x%08X\n",
- FBlock->Name,
- COLUMN2_START - 40 - strlen (FBlock->Name),
- ' ',
- Offset + FDev->BaseAddress
- );
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_SIZE %*c= 0x%08X\n",
- FBlock->Name,
- COLUMN2_START - 40 - strlen (FBlock->Name),
- ' ',
- FBlock->Size
- );
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_SIZE_BLOCKS %*c= 0x%x\n",
- FBlock->Name,
- COLUMN2_START - 40 - strlen (FBlock->Name),
- ' ',
- (FBlock->Size)/(FDev->PBlocks->Size)
- );
- //
- // Create defines for any subregions
- //
- SubregionOffset = 0;
- for (Subregion = FBlock->Subregions; Subregion != NULL; Subregion = Subregion->Next) {
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_SUBREGION_%s_BASE %*c= 0x%08X\n",
- FBlock->Name,
- Subregion->Name,
- COLUMN3_START - 48 - strlen (FBlock->Name) - strlen (Subregion->Name),
- ' ',
- FDev->BaseAddress + Offset + SubregionOffset
- );
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_SUBREGION_%s_SIZE %*c= 0x%08X\n",
- FBlock->Name,
- Subregion->Name,
- COLUMN3_START - 48 - strlen (FBlock->Name) - strlen (Subregion->Name),
- ' ',
- Subregion->Size
- );
- fprintf (
- OutFptr,
- "FLASH_REGION_%s_SUBREGION_%s_OFFSET %*c= 0x%08X\n",
- FBlock->Name,
- Subregion->Name,
- COLUMN3_START - 48 - strlen (FBlock->Name) - strlen (Subregion->Name),
- ' ',
- Offset + SubregionOffset
- );
-
- SubregionOffset += Subregion->Size;
- }
-
- Offset += FBlock->Size;
- }
- //
- // Close file
- //
- fprintf (OutFptr, "\n");
- fclose (OutFptr);
- return STATUS_SUCCESS;
-}
-
-
-/*++
-
-Routine Description:
- The following buffer management routines are used to encapsulate functionality
- for managing a growable data buffer.
-
-Arguments:
- BUFFER_DATA - structure that is used to maintain a data buffer
-
-Returns:
- NA
-
---*/
-static
-BUFFER_DATA *
-CreateBufferData (
- VOID
- )
-/*++
-
-Routine Description:
-
- Create a growable data buffer with default buffer length.
-
-Arguments:
-
- None
-
-Returns:
-
- NULL - error occured during data buffer creation
- Not NULL - the pointer to the newly created data buffer
-
---*/
-{
- BUFFER_DATA *BD;
- BD = (BUFFER_DATA *) _malloc (sizeof (BUFFER_DATA));
- if (BD == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return NULL;
- }
-
- memset (BD, 0, sizeof (BUFFER_DATA));
- BD->BufferStart = (char *) _malloc (BUFFER_SIZE);
- if (BD->BufferStart == NULL) {
- _free (BD);
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return NULL;
- }
-
- BD->BufferEnd = BD->BufferStart + BUFFER_SIZE;
- BD->BufferPos = BD->BufferStart;
- return BD;
-}
-
-static
-BOOLEAN
-AddBufferDataByte (
- BUFFER_DATA *Buffer,
- char Data
- )
-/*++
-
-Routine Description:
-
- Add a single byte to a growable data buffer, growing the buffer if required.
-
-Arguments:
-
- Buffer - pointer to the growable data buffer to add a single byte to
- Data - value of the single byte data to be added
-
-Returns:
-
- TRUE - the single byte data was successfully added
- FALSE - error occurred, the single byte data was not added
-
---*/
-{
- int Size;
- char *NewBuffer;
- //
- // See if we have to grow the buffer
- //
- if (Buffer->BufferPos >= Buffer->BufferEnd) {
- Size = (int) Buffer->BufferEnd - (int) Buffer->BufferStart;
- NewBuffer = (char *) _malloc (Size + BUFFER_SIZE);
- if (NewBuffer == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return FALSE;
- }
-
- memcpy (NewBuffer, Buffer->BufferStart, Size);
- _free (Buffer->BufferStart);
- Buffer->BufferStart = NewBuffer;
- Buffer->BufferPos = Buffer->BufferStart + Size;
- Buffer->BufferEnd = Buffer->BufferStart + Size + BUFFER_SIZE;
- }
-
- *Buffer->BufferPos = Data;
- Buffer->BufferPos++;
- return TRUE;
-}
-
-static
-void
-FreeBufferData (
- BUFFER_DATA *Buffer,
- BOOLEAN FreeData
- )
-/*++
-
-Routine Description:
-
- Free memory used to manage a growable data buffer.
-
-Arguments:
-
- Buffer - pointer to the growable data buffer to be destructed
- FreeData - TRUE, free memory containing the buffered data
- FALSE, do not free the buffered data memory
-
-Returns:
-
- None
-
---*/
-{
- if (Buffer != NULL) {
- if (FreeData && (Buffer->BufferStart != NULL)) {
- _free (Buffer->BufferStart);
- }
-
- _free (Buffer);
- }
-}
-
-static
-char *
-GetBufferData (
- BUFFER_DATA *Buffer,
- int *BufferSize
- )
-/*++
-
-Routine Description:
-
- Return a pointer and size of the data in a growable data buffer.
-
-Arguments:
-
- Buffer - pointer to the growable data buffer
- BufferSize - size of the data in the growable data buffer
-
-Returns:
-
- pointer of the data in the growable data buffer
-
---*/
-{
- *BufferSize = (int) Buffer->BufferPos - (int) Buffer->BufferStart;
- return Buffer->BufferStart;
-}
-
-STATUS
-FDDiscover (
- char *FDFileName,
- unsigned int BaseAddr
- )
-/*++
-
-Routine Description:
- Walk a binary image and see if you find anything that looks like a
- firmware volume.
-
-Arguments:
- FDFileName - name of input FD image to parse
- BaseAddr - base address of input FD image
-
-Returns:
- STATUS_SUCCESS - no errors or warnings
- STATUS_WARNING - warnings, but no errors, were encountered
- STATUS_ERROR - errors were encountered
-
-NOTE:
- This routine is used for debug purposes only.
-
---*/
-{
- FILE *InFptr;
- long FileSize;
- long Offset;
- EFI_FIRMWARE_VOLUME_HEADER FVHeader;
- EFI_GUID
- FileSystemGuid = { 0x7A9354D9, 0x0468, 0x444a, 0x81, 0xCE, 0x0B, 0xF6, 0x17, 0xD8, 0x90, 0xDF };
-
- if ((InFptr = fopen (FDFileName, "rb")) == NULL) {
- Error (NULL, 0, 0, FDFileName, "failed to open file for reading");
- return STATUS_ERROR;
- }
-
- fseek (InFptr, 0, SEEK_END);
- FileSize = ftell (InFptr);
- fseek (InFptr, 0, SEEK_SET);
- Offset = 0;
- while (Offset < FileSize) {
- fseek (InFptr, Offset, SEEK_SET);
- //
- // Read the contents of the file, see if it's an FV header
- //
- if (fread (&FVHeader, sizeof (EFI_FIRMWARE_VOLUME_HEADER), 1, InFptr) == 1) {
- //
- // Check version and GUID
- //
- if ((FVHeader.Revision == EFI_FVH_REVISION) && (FVHeader.Signature == EFI_FVH_SIGNATURE)) {
- fprintf (stdout, "FV header at 0x%08X FVSize=0x%08X ", Offset + BaseAddr, (UINT32) FVHeader.FvLength);
- if (memcmp (&FVHeader.FileSystemGuid, &FileSystemGuid, sizeof (EFI_GUID)) == 0) {
- fprintf (stdout, "standard FFS file system\n");
- } else {
- fprintf (stdout, "non-standard FFS file system\n");
- }
- }
- }
-
- Offset += 16 * 1024;
- }
-
- fclose (InFptr);
- return STATUS_SUCCESS;
-}
diff --git a/Tools/CCode/Source/FlashMap/FlashDefFile.h b/Tools/CCode/Source/FlashMap/FlashDefFile.h
deleted file mode 100644
index 0e2ea2c920..0000000000
--- a/Tools/CCode/Source/FlashMap/FlashDefFile.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-
-Module Name:
-
- FlashDefFile.h
-
-Abstract:
-
- Header file for flash management utility in the Intel Platform
- Innovation Framework for EFI build environment.
-
---*/
-
-#ifndef _FLASH_DEF_FILE_H_
-#define _FLASH_DEF_FILE_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-void
-FDFConstructor (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-void
-FDFDestructor (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-FDFParseFile (
- char *FileName
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FileName - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-FDFCreateCIncludeFile (
- char *FlashDeviceName,
- char *FileName
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FlashDeviceName - GC_TODO: add argument description
- FileName - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-FDFCreateCFlashMapDataFile (
- char *FlashDeviceName,
- char *FileName
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FlashDeviceName - GC_TODO: add argument description
- FileName - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-FDFCreateAsmIncludeFile (
- char *FlashDeviceName,
- char *FileName
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FlashDeviceName - GC_TODO: add argument description
- FileName - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-FDFParseFile (
- char *FileName
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FileName - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-FDFCreateImage (
- char *FlashDeviceName,
- char *ImageName,
- char *FileName
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FlashDeviceName - GC_TODO: add argument description
- ImageName - GC_TODO: add argument description
- FileName - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-FDFCreateDscFile (
- char *FlashDeviceName,
- char *FileName
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FlashDeviceName - GC_TODO: add argument description
- FileName - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-FDFCreateSymbols (
- char *FlashDeviceName
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FlashDeviceName - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-FDDiscover (
- char *FDFileName,
- unsigned int BaseAddr
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FDFileName - GC_TODO: add argument description
- BaseAddr - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // #ifndef _FLASH_DEF_FILE_H_
diff --git a/Tools/CCode/Source/FlashMap/FlashMap.c b/Tools/CCode/Source/FlashMap/FlashMap.c
deleted file mode 100644
index 41f6de4025..0000000000
--- a/Tools/CCode/Source/FlashMap/FlashMap.c
+++ /dev/null
@@ -1,820 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-Module Name:
-
- FlashMap.c
-
-Abstract:
-
- Utility for flash management in the Intel Platform Innovation Framework
- for EFI build environment.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include <Common/UefiBaseTypes.h>
-
-#include "EfiUtilityMsgs.h"
-#include "Microcode.h"
-#include "FlashDefFile.h"
-#include "Symbols.h"
-
-//
-// Version of this utility
-//
-#define UTILITY_NAME "FlashMap"
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 0
-
-
-typedef struct _STRING_LIST {
- struct _STRING_LIST *Next;
- char *Str;
-} STRING_LIST;
-
-//
-// Keep our globals in one of these structures
-//
-static struct {
- char *CIncludeFileName;
- char *FlashDevice;
- char *FlashDeviceImage;
- char *MCIFileName;
- char *MCOFileName;
- char *ImageOutFileName;
- char *DscFileName;
- char *AsmIncludeFileName;
- char *FlashDefinitionFileName;
- char *StringReplaceInFileName;
- char *StringReplaceOutFileName;
- char *DiscoverFDImageName;
- char MicrocodePadByteValue;
- unsigned int MicrocodeAlignment;
- STRING_LIST *MCIFileNames;
- STRING_LIST *LastMCIFileNames;
- unsigned int BaseAddress;
-} mGlobals;
-
-#define DEFAULT_MC_PAD_BYTE_VALUE 0xFF
-#define DEFAULT_MC_ALIGNMENT 16
-
-static
-STATUS
-ProcessCommandLine (
- int argc,
- char *argv[]
- );
-
-static
-STATUS
-MergeMicrocodeFiles (
- char *OutFileName,
- STRING_LIST *FileNames,
- unsigned int Alignment,
- char PadByteValue
- );
-
-static
-void
-Version (
- VOID
- );
-
-static
-void
-Usage (
- VOID
- );
-
-char*
-NormalizePath (
- char* OldPathName
- );
-
-int
-main (
- int argc,
- char *argv[]
- )
-/*++
-
-Routine Description:
- Parse the command line arguments and then call worker functions to do the work
-
-Arguments:
- argc - number of elements in argv
- argv - array of command-line arguments
-
-Returns:
- STATUS_SUCCESS - no problems encountered while processing
- STATUS_WARNING - warnings, but no errors, were encountered while processing
- STATUS_ERROR - errors were encountered while processing
-
---*/
-{
- STATUS Status;
-
- SetUtilityName (UTILITY_NAME);
- Status = ProcessCommandLine (argc, argv);
- if (Status != STATUS_SUCCESS) {
- return Status;
- }
- //
- // Check for discovery of an FD (command line option)
- //
- if (mGlobals.DiscoverFDImageName != NULL) {
- Status = FDDiscover (mGlobals.DiscoverFDImageName, mGlobals.BaseAddress);
- goto Done;
- }
- //
- // If they're doing microcode file parsing, then do that
- //
- if (mGlobals.MCIFileName != NULL) {
- MicrocodeConstructor ();
- MicrocodeParseFile (mGlobals.MCIFileName, mGlobals.MCOFileName);
- MicrocodeDestructor ();
- }
- //
- // If they're doing microcode file merging, then do that now
- //
- if (mGlobals.MCIFileNames != NULL) {
- MergeMicrocodeFiles (
- mGlobals.MCOFileName,
- mGlobals.MCIFileNames,
- mGlobals.MicrocodeAlignment,
- mGlobals.MicrocodePadByteValue
- );
- }
- //
- // If using a flash definition file, then process that and return
- //
- if (mGlobals.FlashDefinitionFileName != NULL) {
- FDFConstructor ();
- SymbolsConstructor ();
- Status = FDFParseFile (mGlobals.FlashDefinitionFileName);
- if (GetUtilityStatus () != STATUS_ERROR) {
- //
- // If they want us to do a string-replace on a file, then add the symbol definitions to
- // the symbol table, and then do the string replace.
- //
- if (mGlobals.StringReplaceInFileName != NULL) {
- Status = FDFCreateSymbols (mGlobals.FlashDevice);
- Status = SymbolsFileStringsReplace (mGlobals.StringReplaceInFileName, mGlobals.StringReplaceOutFileName);
- }
- //
- // If they want us to create a .h defines file or .c flashmap data file, then do so now
- //
- if (mGlobals.CIncludeFileName != NULL) {
- Status = FDFCreateCIncludeFile (mGlobals.FlashDevice, mGlobals.CIncludeFileName);
- }
- if (mGlobals.AsmIncludeFileName != NULL) {
- Status = FDFCreateAsmIncludeFile (mGlobals.FlashDevice, mGlobals.AsmIncludeFileName);
- }
- //
- // If they want us to create an image, do that now
- //
- if (mGlobals.ImageOutFileName != NULL) {
- Status = FDFCreateImage (mGlobals.FlashDevice, mGlobals.FlashDeviceImage, mGlobals.ImageOutFileName);
- }
- //
- // If they want to create an output DSC file, do that now
- //
- if (mGlobals.DscFileName != NULL) {
- Status = FDFCreateDscFile (mGlobals.FlashDevice, mGlobals.DscFileName);
- }
- }
- SymbolsDestructor ();
- FDFDestructor ();
- }
-Done:
- //
- // Free up memory
- //
- while (mGlobals.MCIFileNames != NULL) {
- mGlobals.LastMCIFileNames = mGlobals.MCIFileNames->Next;
- _free (mGlobals.MCIFileNames);
- mGlobals.MCIFileNames = mGlobals.LastMCIFileNames;
- }
- return GetUtilityStatus ();
-}
-
-static
-STATUS
-MergeMicrocodeFiles (
- char *OutFileName,
- STRING_LIST *FileNames,
- unsigned int Alignment,
- char PadByteValue
- )
-/*++
-
-Routine Description:
-
- Merge binary microcode files into a single file, taking into consideration
- the alignment and pad value.
-
-Arguments:
-
- OutFileName - name of the output file to create
- FileNames - linked list of input microcode files to merge
- Alignment - alignment for each microcode file in the output image
- PadByteValue - value to use when padding to meet alignment requirements
-
-Returns:
-
- STATUS_SUCCESS - merge completed successfully or with acceptable warnings
- STATUS_ERROR - merge failed, output file not created
-
---*/
-{
- long FileSize;
- long TotalFileSize;
- FILE *InFptr;
- FILE *OutFptr;
- char *Buffer;
- STATUS Status;
-
- //
- // Open the output file
- //
- if ((OutFptr = fopen (OutFileName, "wb")) == NULL) {
- Error (NULL, 0, 0, OutFileName, "failed to open output file for writing");
- return STATUS_ERROR;
- }
- //
- // Walk the list of files
- //
- Status = STATUS_ERROR;
- Buffer = NULL;
- InFptr = NULL;
- TotalFileSize = 0;
- while (FileNames != NULL) {
- //
- // Open the file, determine the size, then read it in and write
- // it back out.
- //
- if ((InFptr = fopen (NormalizePath(FileNames->Str), "rb")) == NULL) {
- Error (NULL, 0, 0, NormalizePath(FileNames->Str), "failed to open input file for reading");
- goto Done;
- }
- fseek (InFptr, 0, SEEK_END);
- FileSize = ftell (InFptr);
- fseek (InFptr, 0, SEEK_SET);
- if (FileSize != 0) {
- Buffer = (char *) _malloc (FileSize);
- if (Buffer == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- goto Done;
- }
- if (fread (Buffer, FileSize, 1, InFptr) != 1) {
- Error (NULL, 0, 0, FileNames->Str, "failed to read file contents");
- goto Done;
- }
- //
- // Align
- //
- if (Alignment != 0) {
- while ((TotalFileSize % Alignment) != 0) {
- if (fwrite (&PadByteValue, 1, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, OutFileName, "failed to write pad bytes to output file");
- goto Done;
- }
- TotalFileSize++;
- }
- }
- TotalFileSize += FileSize;
- if (fwrite (Buffer, FileSize, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, OutFileName, "failed to write to output file");
- goto Done;
- }
- _free (Buffer);
- Buffer = NULL;
- } else {
- Warning (NULL, 0, 0, FileNames->Str, "0-size file encountered");
- }
- fclose (InFptr);
- InFptr = NULL;
- FileNames = FileNames->Next;
- }
- Status = STATUS_SUCCESS;
-Done:
- fclose (OutFptr);
- if (InFptr != NULL) {
- fclose (InFptr);
- }
- if (Buffer != NULL) {
- _free (Buffer);
- }
- if (Status == STATUS_ERROR) {
- remove (OutFileName);
- }
- return Status;
-}
-
-static
-STATUS
-ProcessCommandLine (
- int argc,
- char *argv[]
- )
-/*++
-
-Routine Description:
- Process the command line arguments
-
-Arguments:
- argc - Standard C entry point arguments
- argv[] - Standard C entry point arguments
-
-Returns:
- STATUS_SUCCESS - no problems encountered while processing
- STATUS_WARNING - warnings, but no errors, were encountered while processing
- STATUS_ERROR - errors were encountered while processing
-
---*/
-{
- int ThingsToDo;
- unsigned int Temp;
- STRING_LIST *Str;
- //
- // Skip program name arg, process others
- //
- argc--;
- argv++;
- if (argc == 0) {
- Usage ();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[0], "-h") == 0) || (strcmp(argv[0], "--help") == 0) ||
- (strcmp(argv[0], "-?") == 0) || (strcmp(argv[0], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[0], "-V") == 0) || (strcmp(argv[0], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- //
- // Clear out our globals, then start walking the arguments
- //
- memset ((void *) &mGlobals, 0, sizeof (mGlobals));
- mGlobals.MicrocodePadByteValue = DEFAULT_MC_PAD_BYTE_VALUE;
- mGlobals.MicrocodeAlignment = DEFAULT_MC_ALIGNMENT;
- ThingsToDo = 0;
- while (argc > 0) {
- if (strcmp (argv[0], "-?") == 0) {
- Usage ();
- return STATUS_ERROR;
- } else if (strcmp (argv[0], "-hfile") == 0) {
- //
- // -hfile FileName
- //
- // Used to specify an output C #include file to create that contains
- // #define statements for all the flashmap region offsets and sizes.
- // Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires an output file name");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.CIncludeFileName = argv[0];
- ThingsToDo++;
- } else if (strcmp (argv[0], "-flashdevice") == 0) {
- //
- // -flashdevice FLASH_DEVICE_NAME
- //
- // Used to select which flash device definition to operate on.
- // Check for additional argument
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires a flash device name to use");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.FlashDevice = argv[0];
- } else if (strcmp (argv[0], "-mco") == 0) {
- //
- // -mco OutFileName
- //
- // Used to specify a microcode output binary file to create.
- // Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, (INT8 *) argv[0], (INT8 *) "option requires an output microcode file name to create");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.MCOFileName = argv[0];
- ThingsToDo++;
- } else if (strcmp (argv[0], "-asmincfile") == 0) {
- //
- // -asmincfile FileName
- //
- // Used to specify the name of the output assembly include file that contains
- // equates for the flash region addresses and sizes.
- // Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires an output ASM include file name to create");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.AsmIncludeFileName = argv[0];
- ThingsToDo++;
- } else if (strcmp (argv[0], "-mci") == 0) {
- //
- // -mci FileName
- //
- // Used to specify an input microcode text file to parse.
- // Check for additional argument
- //
- if (argc < 2) {
- Error (NULL, 0, 0, (INT8 *) argv[0], (INT8 *) "option requires an input microcode text file name to parse");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.MCIFileName = argv[0];
- } else if (strcmp (argv[0], "-flashdeviceimage") == 0) {
- //
- // -flashdeviceimage FlashDeviceImage
- //
- // Used to specify which flash device image definition from the input flash definition file
- // to create.
- // Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires the name of a flash definition image to use");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.FlashDeviceImage = argv[0];
- } else if (strcmp (argv[0], "-imageout") == 0) {
- //
- // -imageout FileName
- //
- // Used to specify the name of the output FD image file to create.
- // Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires an output image filename to create");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.ImageOutFileName = argv[0];
- ThingsToDo++;
- } else if (strcmp (argv[0], "-dsc") == 0) {
- //
- // -dsc FileName
- //
- // Used to specify the name of the output DSC file to create.
- // Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires an output DSC filename to create");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.DscFileName = argv[0];
- ThingsToDo++;
- } else if (strcmp (argv[0], "-fdf") == 0) {
- //
- // -fdf FileName
- //
- // Used to specify the name of the input flash definition file.
- // Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires an input flash definition file name");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.FlashDefinitionFileName = argv[0];
- } else if (strcmp (argv[0], "-discover") == 0) {
- //
- // -discover FDFileName
- //
- // Debug functionality used to scan an existing FD image, trying to find
- // firmware volumes at 64K boundaries.
- // Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires an input FD image file name");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.DiscoverFDImageName = argv[0];
- ThingsToDo++;
- } else if (strcmp (argv[0], "-baseaddr") == 0) {
- //
- // -baseaddr Addr
- //
- // Used to specify a base address when doing a discover of an FD image.
- // Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires a base address");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- if (tolower (argv[0][1]) == 'x') {
- sscanf (argv[0] + 2, "%x", &mGlobals.BaseAddress);
- } else {
- sscanf (argv[0], "%d", &mGlobals.BaseAddress);
- }
- } else if (strcmp (argv[0], "-padvalue") == 0) {
- //
- // -padvalue Value
- //
- // Used to specify the value to pad with when aligning data while
- // creating an FD image. Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires a byte value");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- if (tolower (argv[0][1]) == 'x') {
- sscanf (argv[0] + 2, "%x", &Temp);
- mGlobals.MicrocodePadByteValue = (char) Temp;
- } else {
- sscanf (argv[0], "%d", &Temp);
- mGlobals.MicrocodePadByteValue = (char) Temp;
- }
- } else if (strcmp (argv[0], "-align") == 0) {
- //
- // -align Alignment
- //
- // Used to specify how each data file is aligned in the region
- // when creating an FD image. Check for additional argument.
- //
- if (argc < 2) {
- Error (NULL, 0, 0, argv[0], "option requires an alignment");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- if (tolower (argv[0][1]) == 'x') {
- sscanf (argv[0] + 2, "%x", &mGlobals.MicrocodeAlignment);
- } else {
- sscanf (argv[0], "%d", &mGlobals.MicrocodeAlignment);
- }
- } else if (strcmp (argv[0], "-mcmerge") == 0) {
- //
- // -mcmerge FileName(s)
- //
- // Used to concatenate multiple microde binary files. Can specify
- // multiple file names with the one -mcmerge flag. Check for additional argument.
- //
- if ((argc < 2) || (argv[1][0] == '-')) {
- Error (NULL, 0, 0, argv[0], "option requires one or more input file names");
- return STATUS_ERROR;
- }
- //
- // Take input files until another option or end of list
- //
- ThingsToDo++;
- while ((argc > 1) && (argv[1][0] != '-')) {
- Str = (STRING_LIST *) _malloc (sizeof (STRING_LIST));
- if (Str == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
- memset (Str, 0, sizeof (STRING_LIST));
- Str->Str = argv[1];
- if (mGlobals.MCIFileNames == NULL) {
- mGlobals.MCIFileNames = Str;
- } else {
- mGlobals.LastMCIFileNames->Next = Str;
- }
- mGlobals.LastMCIFileNames = Str;
- argc--;
- argv++;
- }
- } else if (strcmp (argv[0], "-strsub") == 0) {
- //
- // -strsub SrcFile DestFile
- //
- // Used to perform string substitutions on a file, writing the result to a new
- // file. Check for two additional arguments.
- //
- if (argc < 3) {
- Error (NULL, 0, 0, argv[0], "option requires input and output file names for string substitution");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- mGlobals.StringReplaceInFileName = argv[0];
- argc--;
- argv++;
- mGlobals.StringReplaceOutFileName = argv[0];
- ThingsToDo++;
- } else {
- Error (NULL, 0, 0, argv[0], "invalid option");
- return STATUS_ERROR;
- }
- argc--;
- argv++;
- }
- //
- // If no outputs requested, then report an error
- //
- if (ThingsToDo == 0) {
- Error (NULL, 0, 0, "nothing to do", NULL);
- return STATUS_ERROR;
- }
- //
- // If they want an asm file, #include file, or C file to be created, then they have to specify a
- // flash device name and flash definition file name.
- //
- if ((mGlobals.CIncludeFileName != NULL) &&
- ((mGlobals.FlashDevice == NULL) || (mGlobals.FlashDefinitionFileName == NULL))) {
- Error (NULL, 0, 0, "must specify -flashdevice and -fdf with -hfile", NULL);
- return STATUS_ERROR;
- }
- if ((mGlobals.AsmIncludeFileName != NULL) &&
- ((mGlobals.FlashDevice == NULL) || (mGlobals.FlashDefinitionFileName == NULL))) {
- Error (NULL, 0, 0, "must specify -flashdevice and -fdf with -asmincfile", NULL);
- return STATUS_ERROR;
- }
- //
- // If they want a dsc file to be created, then they have to specify a
- // flash device name and a flash definition file name
- //
- if (mGlobals.DscFileName != NULL) {
- if (mGlobals.FlashDevice == NULL) {
- Error (NULL, 0, 0, "must specify -flashdevice with -dsc", NULL);
- return STATUS_ERROR;
- }
- if (mGlobals.FlashDefinitionFileName == NULL) {
- Error (NULL, 0, 0, "must specify -fdf with -dsc", NULL);
- return STATUS_ERROR;
- }
- }
- //
- // If they specified an output microcode file name, then they have to specify an input
- // file name, and vice versa.
- //
- if ((mGlobals.MCIFileName != NULL) && (mGlobals.MCOFileName == NULL)) {
- Error (NULL, 0, 0, "must specify output microcode file name", NULL);
- return STATUS_ERROR;
- }
- if ((mGlobals.MCOFileName != NULL) && (mGlobals.MCIFileName == NULL) && (mGlobals.MCIFileNames == NULL)) {
- Error (NULL, 0, 0, "must specify input microcode file name", NULL);
- return STATUS_ERROR;
- }
- //
- // If doing merge, then have to specify output file name
- //
- if ((mGlobals.MCIFileNames != NULL) && (mGlobals.MCOFileName == NULL)) {
- Error (NULL, 0, 0, "must specify output microcode file name", NULL);
- return STATUS_ERROR;
- }
- //
- // If they want an output image to be created, then they have to specify
- // the flash device and the flash device image to use.
- //
- if (mGlobals.ImageOutFileName != NULL) {
- if (mGlobals.FlashDevice == NULL) {
- Error (NULL, 0, 0, "must specify -flashdevice with -imageout", NULL);
- return STATUS_ERROR;
- }
- if (mGlobals.FlashDeviceImage == NULL) {
- Error (NULL, 0, 0, "must specify -flashdeviceimage with -imageout", NULL);
- return STATUS_ERROR;
- }
- if (mGlobals.FlashDefinitionFileName == NULL) {
- Error (NULL, 0, 0, "must specify -c or -fdf with -imageout", NULL);
- return STATUS_ERROR;
- }
- }
- return STATUS_SUCCESS;
-}
-
-static
-void
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- Print version information for this utility.
-
-Arguments:
-
- None.
-
-Returns:
-
- Nothing.
---*/
-{
- printf ("%s v%d.%d -EDK Utility for flash management for EFI build environment.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2006 Intel Corporation. All rights reserved.\n");
-}
-
-static
-void
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
- Print utility command line help
-
-Arguments:
- None
-
-Returns:
- NA
-
---*/
-{
- int i;
- char *Msg[] = {
- "\nUsage: FlashTool -fdf FlashDefFile -flashdevice FlashDevice",
- " -flashdeviceimage FlashDeviceImage -mci MCIFile -mco MCOFile",
- " -discover FDImage -dsc DscFile -asmincfile AsmIncFile",
- " -imageOut ImageOutFile -hfile HFile -strsub InStrFile OutStrFile",
- " -baseaddr BaseAddr -align Alignment -padvalue PadValue",
- " -mcmerge MCIFile(s)",
- " -h,--help,-?,/? - to display help messages",
- " -V,--version - to display version information",
- " where",
- " FlashDefFile - input Flash Definition File",
- " FlashDevice - flash device to use (from flash definition file)",
- " FlashDeviceImage - flash device image to use (from flash definition file)",
- " MCIFile - input microcode file to parse",
- " MCOFile - output binary microcode image to create from MCIFile",
- " HFile - output #include file to create",
- " FDImage - name of input FDImage file to scan",
- " ImageOutFile - output image file to create",
- " DscFile - output DSC file to create",
- " AsmIncFile - output ASM include file to create",
- " InStrFile - input file to replace symbol names, writing result to OutStrFile",
- " BaseAddr - base address of FDImage (used with -discover)",
- " Alignment - alignment to use when merging microcode binaries",
- " PadValue - byte value to use as pad value when aligning microcode binaries",
- " MCIFile(s) - one or more microcode binary files to merge/concatenate",
- NULL
- };
-
- Version();
- for (i = 0; Msg[i] != NULL; i++) {
- fprintf (stdout, "%s\n", Msg[i]);
- }
-}
-
-char*
-NormalizePath (
- char* OldPathName
- )
-{
- char* Visitor;
-
- if (OldPathName == NULL) {
- return NULL;
- }
-
- Visitor = OldPathName;
- while (*Visitor != '\0') {
- if (*Visitor == '\\') {
- *Visitor = '/';
- }
- Visitor++;
- }
-
- return OldPathName;
-}
-
diff --git a/Tools/CCode/Source/FlashMap/Microcode.c b/Tools/CCode/Source/FlashMap/Microcode.c
deleted file mode 100644
index 84534e316f..0000000000
--- a/Tools/CCode/Source/FlashMap/Microcode.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-Module Name:
-
- Microcode.c
-
-Abstract:
-
- Utility for working with microcode patch files in the Intel
- Platform Innovation Framework for EFI build environment.
-
---*/
-
-#include <stdio.h>
-#include <string.h> // for memset()
-#include <ctype.h>
-#include <stdlib.h> // for malloc()
-
-#include "EfiUtilityMsgs.h"
-#include "Microcode.h"
-
-#define MAX_LINE_LEN 256
-
-#define STATUS_IGNORE 0xA
-
-//
-// Structure definition for a microcode header
-//
-typedef struct {
- unsigned int HeaderVersion;
- unsigned int PatchId;
- unsigned int Date;
- unsigned int CpuId;
- unsigned int Checksum;
- unsigned int LoaderVersion;
- unsigned int PlatformId;
- unsigned int DataSize; // if 0, then TotalSize = 2048, and TotalSize field is invalid
- unsigned int TotalSize; // number of bytes
- unsigned int Reserved[3];
-} MICROCODE_IMAGE_HEADER;
-
-static
-STATUS
-MicrocodeReadData (
- FILE *InFptr,
- unsigned int *Data
- );
-
-void
-MicrocodeConstructor (
- void
- )
-/*++
-
-Routine Description:
-
- Constructor of module Microcode
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
-}
-
-void
-MicrocodeDestructor (
- void
- )
-/*++
-
-Routine Description:
-
- Destructor of module Microcode
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
-}
-
-static
-STATUS
-MicrocodeReadData (
- FILE *InFptr,
- unsigned int *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
-
---*/
-{
- char Line[MAX_LINE_LEN];
- char *cptr;
- unsigned int ctr;
-
- Line[MAX_LINE_LEN - 1] = 0;
- *Data = 0;
- 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 leading white-space characters (except carriage returns) from Line
- //
- if (isspace(Line[0]) && Line[0] != '\n') {
- while (isspace(Line[0])) {
- for (ctr = 0; ctr < strlen(Line); ctr++)
- if (Line[ctr] != '\n')
- Line[ctr] = Line[ctr + 1];
- }
- }
-
- //
- // Look for
- // dd 000000001h ; comment
- // dd XXXXXXXX
- // DD XXXXXXXXX
- // DD XXXXXXXXX
- //
- for (cptr = Line; *cptr && isspace(*cptr); cptr++) {
- }
- if ((tolower(cptr[0]) == 'd') && (tolower(cptr[1]) == 'd') && isspace (cptr[2])) {
- //
- // Skip blanks and look for a hex digit
- //
- cptr += 3;
- for (; *cptr && isspace(*cptr); cptr++) {
- }
- if (isxdigit (*cptr)) {
- if (sscanf (cptr, "%X", Data) != 1) {
- return STATUS_ERROR;
- }
- }
- return STATUS_SUCCESS;
- }
- if (strlen(Line) == 1) {
- return STATUS_IGNORE;
- }
- if (tolower(cptr[0]) == ';') {
- return STATUS_IGNORE;
- }
- return STATUS_ERROR;
-}
-
-STATUS
-MicrocodeParseFile (
- char *InFileName,
- char *OutFileName
- )
-/*++
-
-Routine Description:
- Parse a microcode text file, and write the binary results to an output file.
-
-Arguments:
- InFileName - input text file to parse
- OutFileName - output file to write raw binary data from parsed input file
-
-Returns:
- STATUS_SUCCESS - no errors or warnings
- STATUS_ERROR - errors were encountered
-
---*/
-{
- FILE *InFptr;
- FILE *OutFptr;
- STATUS Status;
- MICROCODE_IMAGE_HEADER *Header;
- unsigned int Size;
- unsigned int Size2;
- unsigned int Data;
- unsigned int Checksum;
- char *Buffer;
- char *Ptr;
- char *OrigPtr;
- unsigned int TotalSize;
-
- Status = STATUS_ERROR;
- InFptr = NULL;
- OutFptr = NULL;
- Buffer = NULL;
- //
- // Open the input text file
- //
- if ((InFptr = fopen (InFileName, "r")) == NULL) {
- Error (NULL, 0, 0, InFileName, "failed to open input microcode file for reading");
- return STATUS_ERROR;
- }
- //
- // Make two passes on the input file. The first pass is to determine how
- // much data is in the file so we can allocate a working buffer. Then
- // we'll allocate a buffer and re-read the file into the buffer for processing.
- //
- Size = 0;
- do {
- Status = MicrocodeReadData (InFptr, &Data);
- if (Status == STATUS_SUCCESS) {
- Size += sizeof (Data);
- }
- if (Status == STATUS_IGNORE) {
- Status = STATUS_SUCCESS;
- }
- } while (Status == STATUS_SUCCESS);
- //
- // Error if no data.
- //
- if (Size == 0) {
- Error (NULL, 0, 0, InFileName, "no parse-able data found in file");
- goto Done;
- }
- if (Size < sizeof (MICROCODE_IMAGE_HEADER)) {
- Error (NULL, 0, 0, InFileName, "amount of parse-able data is insufficient to contain a microcode header");
- goto Done;
- }
- //
- // Allocate a buffer for the data
- //
- Buffer = (char *) _malloc (Size);
- if (Buffer == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- goto Done;
- }
- //
- // Re-read the file, storing the data into our buffer
- //
- fseek (InFptr, 0, SEEK_SET);
- Ptr = Buffer;
- OrigPtr = Ptr;
- do {
- OrigPtr = Ptr;
- Status = MicrocodeReadData (InFptr, &Data);
- if (Status == STATUS_SUCCESS) {
- *(unsigned int *) Ptr = Data;
- Ptr += sizeof (Data);
- }
- if (Status == STATUS_IGNORE) {
- Ptr = OrigPtr;
- Status = STATUS_SUCCESS;
- }
- } while (Status == STATUS_SUCCESS);
- //
- // 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.
- //
- Header = (MICROCODE_IMAGE_HEADER *) Buffer;
- if (Header->DataSize == 0) {
- TotalSize = 2048;
- } else {
- TotalSize = Header->TotalSize;
- }
- if (TotalSize != Size) {
- Error (NULL, 0, 0, InFileName, "file contents do not contain expected TotalSize 0x%04X", TotalSize);
- goto Done;
- }
- //
- // Checksum the contents
- //
- Ptr = Buffer;
- Checksum = 0;
- Size2 = 0;
- while (Size2 < Size) {
- Checksum += *(unsigned int *) Ptr;
- Ptr += 4;
- Size2 += 4;
- }
- if (Checksum != 0) {
- Error (NULL, 0, 0, InFileName, "checksum failed on file contents");
- goto Done;
- }
- //
- // Open the output file and write the buffer contents
- //
- if ((OutFptr = fopen (OutFileName, "wb")) == NULL) {
- Error (NULL, 0, 0, OutFileName, "failed to open output microcode file for writing");
- goto Done;
- }
- if (fwrite (Buffer, Size, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, OutFileName, "failed to write microcode data to output file");
- goto Done;
- }
- Status = STATUS_SUCCESS;
-Done:
- if (Buffer != NULL) {
- free (Buffer);
- }
- if (InFptr != NULL) {
- fclose (InFptr);
- }
- if (OutFptr != NULL) {
- fclose (OutFptr);
- if (Status == STATUS_ERROR) {
- remove (OutFileName);
- }
- }
- return Status;
-}
diff --git a/Tools/CCode/Source/FlashMap/Microcode.h b/Tools/CCode/Source/FlashMap/Microcode.h
deleted file mode 100644
index f85313e978..0000000000
--- a/Tools/CCode/Source/FlashMap/Microcode.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-Module Name:
-
- Microcode.h
-
-Abstract:
-
- Header file for flash management utility in the Intel Platform
- Innovation Framework for EFI build environment.
-
---*/
-
-#ifndef _MICROCODE_H_
-#define _MICROCODE_H_
-
-void
-MicrocodeConstructor (
- void
- );
-/*++
-
-Routine Description:
-
- Constructor of module Microcode
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-
-void
-MicrocodeDestructor (
- void
- );
-/*++
-
-Routine Description:
-
- Destructor of module Microcode
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-
-STATUS
-MicrocodeParseFile (
- char *InFileName,
- char *OutFileName
- );
-/*++
-
-Routine Description:
- Parse a microcode text file, and write the binary results to an output file.
-
-Arguments:
- InFileName - input text file to parse
- OutFileName - output file to write raw binary data from parsed input file
-
-Returns:
- STATUS_SUCCESS - no errors or warnings
- STATUS_ERROR - errors were encountered
-
---*/
-
-
-#endif // #ifndef _MICROCODE_H_
diff --git a/Tools/CCode/Source/FlashMap/Symbols.c b/Tools/CCode/Source/FlashMap/Symbols.c
deleted file mode 100644
index 8e408144db..0000000000
--- a/Tools/CCode/Source/FlashMap/Symbols.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-Module Name:
-
- Symbol.c
-
-Abstract:
-
- Class-like implementation for a symbol table.
-
---*/
-
-// GC_TODO: fix comment to set correct module name: Symbols.c
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-//
-// for isspace()
-//
-#include <ctype.h>
-
-#include <Common/UefiBaseTypes.h>
-
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.h"
-#include "Symbols.h"
-
-#define MAX_LINE_LEN 512
-
-//
-// Linked list to keep track of all symbols
-//
-typedef struct _SYMBOL {
- struct _SYMBOL *Next;
- int Type;
- char *Name;
- char *Value;
-} SYMBOL;
-
-static
-SYMBOL *
-FreeSymbols (
- SYMBOL *Syms
- );
-
-static
-int
-ExpandMacros (
- char *SourceLine,
- char *DestLine,
- int LineLen
- );
-
-static SYMBOL *mSymbolTable = NULL;
-
-void
-SymbolsConstructor (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- SymbolsDestructor ();
-}
-
-void
-SymbolsDestructor (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- mSymbolTable = FreeSymbols (mSymbolTable);
-}
-
-char *
-GetSymbolValue (
- char *SymbolName
- )
-/*++
-
-Routine Description:
-
- Look up a symbol in our symbol table.
-
-Arguments:
-
- SymbolName
-
-Returns:
-
- Pointer to the value of the symbol if found
- NULL if the symbol is not found
-
---*/
-// GC_TODO: SymbolName - add argument and description to function comment
-{
- SYMBOL *Symbol;
- //
- // Walk the symbol table
- //
- Symbol = mSymbolTable;
- while (Symbol) {
- if (stricmp (SymbolName, Symbol->Name) == 0) {
- return Symbol->Value;
- }
-
- Symbol = Symbol->Next;
- }
-
- return NULL;
-}
-
-int
-SymbolAdd (
- char *Name,
- char *Value,
- int Mode
- )
-/*++
-
-Routine Description:
-
- Add a symbol name/value to the symbol table
-
-Arguments:
-
- Name - name of symbol to add
- Value - value of symbol to add
- Mode - currrently unused
-
-Returns:
-
- Length of symbol added.
-
-Notes:
- If Value == NULL, then this routine will assume that the Name field
- looks something like "MySymName = MySymValue", and will try to parse
- it that way and add the symbol name/pair from the string.
-
---*/
-{
- SYMBOL *Symbol;
-
- SYMBOL *NewSymbol;
- int Len;
- char *Start;
- char *Cptr;
- char CSave;
- char *SaveCptr;
-
- Len = 0;
- SaveCptr = NULL;
- CSave = 0;
- //
- // If value pointer is null, then they passed us a line something like:
- // varname = value, or simply var =
- //
- if (Value == NULL) {
- Start = Name;
- while (*Name && isspace (*Name)) {
- Name++;
- }
-
- if (Name == NULL) {
- return -1;
- }
- //
- // Find the end of the name. Either space or a '='.
- //
- for (Value = Name; *Value && !isspace (*Value) && (*Value != '='); Value++)
- ;
- if (Value == NULL) {
- return -1;
- }
- //
- // Look for the '='
- //
- Cptr = Value;
- while (*Value && (*Value != '=')) {
- Value++;
- }
-
- if (Value == NULL) {
- return -1;
- }
- //
- // Now truncate the name
- //
- *Cptr = 0;
- //
- // Skip over the = and then any spaces
- //
- Value++;
- while (*Value && isspace (*Value)) {
- Value++;
-
- }
- //
- // Find end of string, checking for quoted string
- //
- if (*Value == '\"') {
- Value++;
- for (Cptr = Value; *Cptr && *Cptr != '\"'; Cptr++)
- ;
- } else {
- for (Cptr = Value; *Cptr && !isspace (*Cptr); Cptr++)
- ;
- }
- //
- // Null terminate the value string
- //
- CSave = *Cptr;
- SaveCptr = Cptr;
- *Cptr = 0;
- Len = (int) (Cptr - Start);
- }
- //
- // We now have a symbol name and a value. Look for an existing variable
- // and overwrite it.
- //
- Symbol = mSymbolTable;
- while (Symbol) {
- //
- // Check for symbol name match
- //
- if (stricmp (Name, Symbol->Name) == 0) {
- _free (Symbol->Value);
- Symbol->Value = (char *) _malloc (strlen (Value) + 1);
- if (Symbol->Value == NULL) {
- Error (NULL, 0, 0, NULL, "failed to allocate memory");
- return -1;
- }
-
- strcpy (Symbol->Value, Value);
- //
- // If value == "NULL", then make it a 0-length string
- //
- if (stricmp (Symbol->Value, "NULL") == 0) {
- Symbol->Value[0] = 0;
- }
-
- return Len;
- }
-
- Symbol = Symbol->Next;
- }
- //
- // Does not exist, create a new one
- //
- NewSymbol = (SYMBOL *) _malloc (sizeof (SYMBOL));
- if (NewSymbol == NULL) {
- Error (NULL, 0, 0, NULL, "memory allocation failure");
- return -1;
- }
-
- memset ((char *) NewSymbol, 0, sizeof (SYMBOL));
- NewSymbol->Name = (char *) _malloc (strlen (Name) + 1);
- if (NewSymbol->Name == NULL) {
- Error (NULL, 0, 0, NULL, "memory allocation failure");
- _free (NewSymbol);
- return -1;
- }
-
- NewSymbol->Value = (char *) _malloc (strlen (Value) + 1);
- if (NewSymbol->Value == NULL) {
- Error (NULL, 0, 0, NULL, "memory allocation failure");
- _free (NewSymbol->Name);
- _free (NewSymbol);
- return -1;
- }
-
- strcpy (NewSymbol->Name, Name);
- strcpy (NewSymbol->Value, Value);
- //
- // Remove trailing spaces
- //
- Cptr = NewSymbol->Value + strlen (NewSymbol->Value) - 1;
- while (Cptr > NewSymbol->Value) {
- if (isspace (*Cptr)) {
- *Cptr = 0;
- Cptr--;
- } else {
- break;
- }
- }
- //
- // Add it to the head of the list.
- //
- NewSymbol->Next = mSymbolTable;
- mSymbolTable = NewSymbol;
- //
- // If value == "NULL", then make it a 0-length string
- //
- if (stricmp (NewSymbol->Value, "NULL") == 0) {
- NewSymbol->Value[0] = 0;
- }
- //
- // Restore the terminator we inserted if they passed in var=value
- //
- if (SaveCptr != NULL) {
- *SaveCptr = CSave;
- }
- _free (NewSymbol->Value);
- _free (NewSymbol->Name);
- _free (NewSymbol);
- return Len;
-}
-
-static
-STATUS
-RemoveSymbol (
- char *Name,
- char SymbolType
- )
-/*++
-
-Routine Description:
-
- Remove a symbol name/value from the symbol table
-
-Arguments:
-
- Name - name of symbol to remove
- SymbolType - type of symbol to remove
-
-Returns:
-
- STATUS_SUCCESS - matching symbol found and removed
- STATUS_ERROR - matching symbol not found in symbol table
-
---*/
-{
- SYMBOL *Symbol;
-
- SYMBOL *PrevSymbol;
-
- PrevSymbol = NULL;
- Symbol = mSymbolTable;
- //
- // Walk the linked list of symbols in the symbol table looking
- // for a match of both symbol name and type.
- //
- while (Symbol) {
- if ((stricmp (Name, Symbol->Name) == 0) && (Symbol->Type & SymbolType)) {
- //
- // If the symbol has a value associated with it, free the memory
- // allocated for the value.
- // Then free the memory allocated for the symbols string name.
- //
- if (Symbol->Value) {
- _free (Symbol->Value);
- }
-
- _free (Symbol->Name);
- //
- // Link the previous symbol to the next symbol to effectively
- // remove this symbol from the linked list.
- //
- if (PrevSymbol) {
- PrevSymbol->Next = Symbol->Next;
- } else {
- mSymbolTable = Symbol->Next;
- }
-
- _free (Symbol);
- return STATUS_SUCCESS;
- }
-
- PrevSymbol = Symbol;
- Symbol = Symbol->Next;
- }
-
- return STATUS_WARNING;
-}
-
-static
-SYMBOL *
-FreeSymbols (
- SYMBOL *Syms
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- Syms - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- SYMBOL *Next;
- while (Syms) {
- if (Syms->Name != NULL) {
- _free (Syms->Name);
- }
-
- if (Syms->Value != NULL) {
- _free (Syms->Value);
- }
-
- Next = Syms->Next;
- _free (Syms);
- Syms = Next;
- }
-
- return Syms;
-}
-
-static
-int
-ExpandMacros (
- char *SourceLine,
- char *DestLine,
- int LineLen
- )
-/*++
-
-Routine Description:
-
- Given a line of text, replace all variables of format $(NAME) with values
- from our symbol table.
-
-Arguments:
-
- SourceLine - input line of text to do symbol replacements on
- DestLine - on output, SourceLine with symbols replaced
- LineLen - length of DestLine, so we don't exceed its allocated length
-
-Returns:
-
- STATUS_SUCCESS - no problems encountered
- STATUS_WARNING - missing closing parenthesis on a symbol reference in SourceLine
- STATUS_ERROR - memory allocation failure
-
---*/
-{
- static int NestDepth = 0;
- char *FromPtr;
- char *ToPtr;
- char *SaveStart;
- char *Cptr;
- char *value;
- int Expanded;
- int ExpandedCount;
- INT8 *LocalDestLine;
- STATUS Status;
- int LocalLineLen;
-
- NestDepth++;
- Status = STATUS_SUCCESS;
- LocalDestLine = (char *) _malloc (LineLen);
- if (LocalDestLine == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failed", NULL);
- return STATUS_ERROR;
- }
-
- FromPtr = SourceLine;
- ToPtr = LocalDestLine;
- //
- // Walk the entire line, replacing $(MACRO_NAME).
- //
- LocalLineLen = LineLen;
- ExpandedCount = 0;
- while (*FromPtr && (LocalLineLen > 0)) {
- if ((*FromPtr == '$') && (*(FromPtr + 1) == '(')) {
- //
- // Save the start in case it's undefined, in which case we copy it as-is.
- //
- SaveStart = FromPtr;
- Expanded = 0;
- //
- // Macro expansion time. Find the end (no spaces allowed)
- //
- FromPtr += 2;
- for (Cptr = FromPtr; *Cptr && (*Cptr != ')'); Cptr++)
- ;
- if (*Cptr) {
- //
- // Truncate the string at the closing parenthesis for ease-of-use.
- // Then copy the string directly to the destination line in case we don't find
- // a definition for it.
- //
- *Cptr = 0;
- strcpy (ToPtr, SaveStart);
- if ((value = GetSymbolValue (FromPtr)) != NULL) {
- strcpy (ToPtr, value);
- LocalLineLen -= strlen (value);
- ToPtr += strlen (value);
- Expanded = 1;
- ExpandedCount++;
- }
-
- if (!Expanded) {
- //
- // Restore closing parenthesis, and advance to next character
- //
- *Cptr = ')';
- FromPtr = SaveStart + 1;
- ToPtr++;
- } else {
- FromPtr = Cptr + 1;
- }
- } else {
- Error (NULL, 0, 0, SourceLine, "missing closing parenthesis on macro");
- strcpy (ToPtr, FromPtr);
- Status = STATUS_WARNING;
- goto Done;
- }
- } else {
- *ToPtr = *FromPtr;
- FromPtr++;
- ToPtr++;
- LocalLineLen--;
- }
- }
-
- if (*FromPtr == 0) {
- *ToPtr = 0;
- }
-
- //
- // If we expanded at least one string successfully, then make a recursive call to try again.
- //
- if ((ExpandedCount != 0) && (Status == STATUS_SUCCESS) && (NestDepth < 10)) {
- Status = ExpandMacros (LocalDestLine, DestLine, LineLen);
- _free (LocalDestLine);
- NestDepth = 0;
- return Status;
- }
-
-Done:
- if (Status != STATUS_ERROR) {
- strcpy (DestLine, LocalDestLine);
- }
-
- NestDepth = 0;
- _free (LocalDestLine);
- return Status;
-}
-
-STATUS
-SymbolsFileStringsReplace (
- char *InFileName,
- char *OutFileName
- )
-/*++
-
-Routine Description:
-
- Given input and output file names, read in the input file, replace variable
- references of format $(NAME) with appropriate values from our symbol table,
- and write the result out to the output file.
-
-Arguments:
-
- InFileName - name of input text file to replace variable references
- OutFileName - name of output text file to write results to
-
-Returns:
-
- STATUS_SUCCESS - no problems encountered
- STATUS_ERROR - failed to open input or output file
-
---*/
-{
- STATUS Status;
- FILE *InFptr;
- FILE *OutFptr;
- char Line[MAX_LINE_LEN];
- char OutLine[MAX_LINE_LEN];
-
- Status = STATUS_ERROR;
- //
- // Open input and output files
- //
- InFptr = NULL;
- OutFptr = NULL;
- if ((InFptr = fopen (InFileName, "r")) == NULL) {
- Error (NULL, 0, 0, InFileName, "failed to open input file for reading");
- goto Done;
- }
-
- if ((OutFptr = fopen (OutFileName, "w")) == NULL) {
- Error (NULL, 0, 0, OutFileName, "failed to open output file for writing");
- goto Done;
- }
- //
- // Read lines from input file until done
- //
- while (fgets (Line, sizeof (Line), InFptr) != NULL) {
- ExpandMacros (Line, OutLine, sizeof (OutLine));
- fprintf (OutFptr, OutLine);
- }
-
- Status = STATUS_SUCCESS;
-Done:
- if (InFptr != NULL) {
- fclose (InFptr);
- }
-
- if (OutFptr != NULL) {
- fclose (OutFptr);
- }
-
- return Status;
-}
diff --git a/Tools/CCode/Source/FlashMap/Symbols.h b/Tools/CCode/Source/FlashMap/Symbols.h
deleted file mode 100644
index a3cadff268..0000000000
--- a/Tools/CCode/Source/FlashMap/Symbols.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-Module Name:
-
- Symbols.h
-
-Abstract:
-
- Defines and prototypes for a class-like symbol table service.
-
---*/
-
-#ifndef _SYMBOLS_H_
-#define _SYMBOLS_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-int
-SymbolAdd (
- char *Name,
- char *Value,
- int Mode
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- Name - GC_TODO: add argument description
- Value - GC_TODO: add argument description
- Mode - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-STATUS
-SymbolsFileStringsReplace (
- char *InFileName,
- char *OutFileName
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- InFileName - GC_TODO: add argument description
- OutFileName - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-void
-SymbolsConstructor (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-void
-SymbolsDestructor (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // #ifndef _SYMBOLS_H_
diff --git a/Tools/CCode/Source/FlashMap/build.xml b/Tools/CCode/Source/FlashMap/build.xml
deleted file mode 100644
index 0fc7168dc7..0000000000
--- a/Tools/CCode/Source/FlashMap/build.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK FlashMap Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="FlashMap"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <defineset>
- <define name="_malloc" value="malloc"/>
- <define name="_free" value="free"/>
- </defineset>
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/FwImage/build.xml b/Tools/CCode/Source/FwImage/build.xml
deleted file mode 100644
index 1d261928fb..0000000000
--- a/Tools/CCode/Source/FwImage/build.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK FwImage Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="FwImage"/>
- <property name="FileSet" value="fwimage.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <!-- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/> -->
- <!-- We can only convert IA32, not X64, ELF objects -->
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/FwImage/fwimage.c b/Tools/CCode/Source/FwImage/fwimage.c
deleted file mode 100644
index f51f824e22..0000000000
--- a/Tools/CCode/Source/FwImage/fwimage.c
+++ /dev/null
@@ -1,1132 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2007, 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.
-
-Module Name:
-
- fwimage.c
-
-Abstract:
-
- Converts a pe32+ image to an FW image type
-
---*/
-
-#include "WinNtInclude.h"
-
-//
-// List of OS and CPU which support ELF to PE conversion
-//
-#if defined(linux)
-#if defined (__i386__) || defined(__x86_64__)
-#define HAVE_ELF
-#endif
-#endif
-
-#ifndef __GNUC__
-#include <windows.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#ifdef HAVE_ELF
-#include <elf.h>
-#endif
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h>
-
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.c"
-
-//
-// Version of this utility
-//
-#define UTILITY_NAME "FwImage"
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 0
-
-#ifdef __GNUC__
-typedef unsigned long ULONG;
-typedef unsigned char UCHAR;
-typedef unsigned char *PUCHAR;
-typedef unsigned short USHORT;
-#endif
-
-PUCHAR InImageName;
-
-static
-void
-Version (
- VOID
- )
-{
- printf ("%s v%d.%d -EDK Utility for Converting a pe32+ image to an FW image type.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2006 Intel Corporation. All rights reserved.\n");
-}
-
-
-VOID
-Usage (
- VOID
- )
-{
- Version();
- printf ("\nUsage: " UTILITY_NAME " {-t time-date} {-h|--help|-?|/?|-V|--version} \n\
- [BASE|SEC|PEI_CORE|PEIM|DXE_CORE|DXE_DRIVER|DXE_RUNTIME_DRIVER|\n\
- DXE_SAL_DRIVER|DXE_SMM_DRIVER|TOOL|UEFI_DRIVER|UEFI_APPLICATION|\n\
- USER_DEFINED] peimage [outimage]\n");
-}
-
-static
-STATUS
-FCopyFile (
- FILE *in,
- FILE *out
- )
-{
- ULONG filesize;
- ULONG offset;
- ULONG length;
- UCHAR Buffer[8 * 1024];
-
- fseek (in, 0, SEEK_END);
- filesize = ftell (in);
-
- fseek (in, 0, SEEK_SET);
- fseek (out, 0, SEEK_SET);
-
- offset = 0;
- while (offset < filesize) {
- length = sizeof (Buffer);
- if (filesize - offset < length) {
- length = filesize - offset;
- }
-
- fread (Buffer, length, 1, in);
- fwrite (Buffer, length, 1, out);
- offset += length;
- }
-
- if ((ULONG) ftell (out) != filesize) {
- Error (NULL, 0, 0, "write error", NULL);
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-FReadFile (
- FILE *in,
- VOID **Buffer,
- UINTN *Length
- )
-{
- fseek (in, 0, SEEK_END);
- *Length = ftell (in);
- *Buffer = malloc (*Length);
- fseek (in, 0, SEEK_SET);
- fread (*Buffer, *Length, 1, in);
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-FWriteFile (
- FILE *out,
- VOID *Buffer,
- UINTN Length
- )
-{
- fseek (out, 0, SEEK_SET);
- fwrite (Buffer, Length, 1, out);
- if ((ULONG) ftell (out) != Length) {
- Error (NULL, 0, 0, "write error", NULL);
- return STATUS_ERROR;
- }
- free (Buffer);
- return STATUS_SUCCESS;
-}
-
-#ifdef HAVE_ELF
-INTN
-IsElfHeader(
- UINT8 *FileBuffer
-)
-{
- return (FileBuffer[EI_MAG0] == ELFMAG0
- && FileBuffer[EI_MAG1] == ELFMAG1
- && FileBuffer[EI_MAG2] == ELFMAG2
- && FileBuffer[EI_MAG3] == ELFMAG3);
-}
-
-typedef Elf32_Shdr Elf_Shdr;
-typedef Elf32_Ehdr Elf_Ehdr;
-typedef Elf32_Rel Elf_Rel;
-typedef Elf32_Sym Elf_Sym;
-#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.
-//
-Elf_Ehdr *Ehdr;
-Elf_Shdr *ShdrBase;
-
-//
-// PE section alignment.
-//
-const UINT32 CoffAlignment = 0x20;
-const UINT32 CoffNbrSections = 4;
-
-//
-// Current offset in coff file.
-//
-UINT32 CoffOffset;
-
-//
-// Result Coff file in memory.
-//
-UINT8 *CoffFile;
-
-//
-// Offset in Coff file of headers and sections.
-//
-UINT32 NtHdrOffset;
-UINT32 TableOffset;
-UINT32 TextOffset;
-UINT32 DataOffset;
-UINT32 RelocOffset;
-
-//
-// ELF sections to offset in Coff file.
-//
-UINT32 *CoffSectionsOffset;
-
-EFI_IMAGE_BASE_RELOCATION *CoffBaseRel;
-UINT16 *CoffEntryRel;
-
-UINT32
-CoffAlign(
- UINT32 Offset
- )
-{
- return (Offset + CoffAlignment - 1) & ~(CoffAlignment - 1);
-}
-
-Elf_Shdr *
-GetShdrByIndex(
- UINT32 Num
- )
-{
- if (Num >= Ehdr->e_shnum)
- return NULL;
- return (Elf_Shdr*)((UINT8*)ShdrBase + Num * Ehdr->e_shentsize);
-}
-
-INTN
-CheckElfHeader(
- VOID
- )
-{
- //
- // Note: Magic has already been tested.
- //
- if (Ehdr->e_ident[EI_CLASS] != ELFCLASS)
- return 0;
- if (Ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
- return 0;
- if (Ehdr->e_type != ET_EXEC)
- return 0;
- if (Ehdr->e_machine != EM_386)
- return 0;
- if (Ehdr->e_version != EV_CURRENT)
- return 0;
-
- //
- // Find the section header table
- //
- ShdrBase = (Elf_Shdr *)((UINT8 *)Ehdr + Ehdr->e_shoff);
-
- CoffSectionsOffset = (UINT32 *)malloc(Ehdr->e_shnum * sizeof (UINT32));
-
- memset(CoffSectionsOffset, 0, Ehdr->e_shnum * sizeof(UINT32));
- return 1;
-}
-
-int
-IsTextShdr(
- Elf_Shdr *Shdr
- )
-{
- return (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC;
-}
-
-int
-IsDataShdr(
- Elf_Shdr *Shdr
- )
-{
- return (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);
-}
-
-void
-CreateSectionHeader(
- const char *Name,
- UINT32 Offset,
- UINT32 Size,
- UINT32 Flags
- )
-{
- EFI_IMAGE_SECTION_HEADER *Hdr;
- Hdr = (EFI_IMAGE_SECTION_HEADER*)(CoffFile + TableOffset);
-
- strcpy(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;
-
- TableOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
-}
-
-void
-ScanSections(
- VOID
- )
-{
- UINT32 i;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_NT_HEADERS *NtHdr;
- UINT32 CoffEntry = 0;
-
- CoffOffset = 0;
-
- //
- // Coff file start with a DOS header.
- //
- CoffOffset = sizeof(EFI_IMAGE_DOS_HEADER) + 0x40;
- NtHdrOffset = CoffOffset;
- CoffOffset += sizeof(EFI_IMAGE_NT_HEADERS);
- TableOffset = CoffOffset;
- CoffOffset += CoffNbrSections * sizeof(EFI_IMAGE_SECTION_HEADER);
-
- //
- // First text sections.
- //
- CoffOffset = CoffAlign(CoffOffset);
- TextOffset = CoffOffset;
- for (i = 0; i < Ehdr->e_shnum; i++) {
- Elf_Shdr *shdr = GetShdrByIndex(i);
- if (IsTextShdr(shdr)) {
- //
- // Align the coff offset to meet with the alignment requirement of section
- // itself.
- //
- if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {
- CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
- }
-
- /* Relocate entry. */
- if ((Ehdr->e_entry >= shdr->sh_addr) &&
- (Ehdr->e_entry < shdr->sh_addr + shdr->sh_size)) {
- CoffEntry = CoffOffset + Ehdr->e_entry - shdr->sh_addr;
- }
- CoffSectionsOffset[i] = CoffOffset;
- CoffOffset += shdr->sh_size;
- }
- }
- CoffOffset = CoffAlign(CoffOffset);
-
- //
- // Then data sections.
- //
- DataOffset = CoffOffset;
- for (i = 0; i < Ehdr->e_shnum; i++) {
- Elf_Shdr *shdr = GetShdrByIndex(i);
- if (IsDataShdr(shdr)) {
- //
- // Align the coff offset to meet with the alignment requirement of section
- // itself.
- //
- if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {
- CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);
- }
-
- CoffSectionsOffset[i] = CoffOffset;
- CoffOffset += shdr->sh_size;
- }
- }
- CoffOffset = CoffAlign(CoffOffset);
-
- RelocOffset = CoffOffset;
-
- //
- // Allocate base Coff file. Will be expanded later for relocations.
- //
- CoffFile = (UINT8 *)malloc(CoffOffset);
- memset(CoffFile, 0, CoffOffset);
-
- //
- // Fill headers.
- //
- DosHdr = (EFI_IMAGE_DOS_HEADER *)CoffFile;
- DosHdr->e_magic = EFI_IMAGE_DOS_SIGNATURE;
- DosHdr->e_lfanew = NtHdrOffset;
-
- NtHdr = (EFI_IMAGE_NT_HEADERS*)(CoffFile + NtHdrOffset);
-
- NtHdr->Signature = EFI_IMAGE_NT_SIGNATURE;
-
- NtHdr->FileHeader.Machine = EFI_IMAGE_MACHINE_IA32;
- NtHdr->FileHeader.NumberOfSections = CoffNbrSections;
- NtHdr->FileHeader.TimeDateStamp = time(NULL);
- NtHdr->FileHeader.PointerToSymbolTable = 0;
- NtHdr->FileHeader.NumberOfSymbols = 0;
- NtHdr->FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->OptionalHeader);
- NtHdr->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->OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
- NtHdr->OptionalHeader.SizeOfCode = DataOffset - TextOffset;
- NtHdr->OptionalHeader.SizeOfInitializedData = RelocOffset - DataOffset;
- NtHdr->OptionalHeader.SizeOfUninitializedData = 0;
- NtHdr->OptionalHeader.AddressOfEntryPoint = CoffEntry;
- NtHdr->OptionalHeader.BaseOfCode = TextOffset;
-
- NtHdr->OptionalHeader.BaseOfData = DataOffset;
- NtHdr->OptionalHeader.ImageBase = 0;
- NtHdr->OptionalHeader.SectionAlignment = CoffAlignment;
- NtHdr->OptionalHeader.FileAlignment = CoffAlignment;
- NtHdr->OptionalHeader.SizeOfImage = 0;
-
- NtHdr->OptionalHeader.SizeOfHeaders = TextOffset;
- NtHdr->OptionalHeader.NumberOfRvaAndSizes = EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
-
- //
- // Section headers.
- //
- CreateSectionHeader (".text", TextOffset, DataOffset - TextOffset,
- EFI_IMAGE_SCN_CNT_CODE
- | EFI_IMAGE_SCN_MEM_EXECUTE
- | EFI_IMAGE_SCN_MEM_READ);
- CreateSectionHeader (".data", DataOffset, RelocOffset - DataOffset,
- EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
- | EFI_IMAGE_SCN_MEM_WRITE
- | EFI_IMAGE_SCN_MEM_READ);
-}
-
-void
-WriteSections(
- int (*Filter)(Elf_Shdr *)
- )
-{
- UINT32 Idx;
-
- //
- // First: copy sections.
- //
- for (Idx = 0; Idx < Ehdr->e_shnum; Idx++) {
- Elf_Shdr *Shdr = GetShdrByIndex(Idx);
- if ((*Filter)(Shdr)) {
- switch (Shdr->sh_type) {
- case SHT_PROGBITS:
- /* Copy. */
- memcpy(CoffFile + CoffSectionsOffset[Idx],
- (UINT8*)Ehdr + Shdr->sh_offset,
- Shdr->sh_size);
- break;
- case SHT_NOBITS:
- memset(CoffFile + CoffSectionsOffset[Idx], 0, Shdr->sh_size);
- break;
- default:
- Error (NULL, 0, 0, InImageName, "unhandle section type %x",
- (UINTN)Shdr->sh_type);
- }
- }
- }
-
- //
- // Second: apply relocations.
- //
- for (Idx = 0; Idx < Ehdr->e_shnum; Idx++) {
- Elf_Shdr *RelShdr = GetShdrByIndex(Idx);
- if (RelShdr->sh_type != SHT_REL)
- continue;
- Elf_Shdr *SecShdr = GetShdrByIndex(RelShdr->sh_info);
- UINT32 SecOffset = CoffSectionsOffset[RelShdr->sh_info];
- if (RelShdr->sh_type == SHT_REL && (*Filter)(SecShdr)) {
- UINT32 RelIdx;
- Elf_Shdr *SymtabShdr = GetShdrByIndex(RelShdr->sh_link);
- UINT8 *Symtab = (UINT8*)Ehdr + SymtabShdr->sh_offset;
-
- for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
- Elf_Rel *Rel = (Elf_Rel *)((UINT8*)Ehdr + RelShdr->sh_offset + RelIdx);
- Elf_Sym *Sym = (Elf_Sym *)
- (Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize);
- Elf_Shdr *SymShdr;
- UINT8 *Targ;
-
- if (Sym->st_shndx == SHN_UNDEF
- || Sym->st_shndx == SHN_ABS
- || Sym->st_shndx > Ehdr->e_shnum) {
- Error (NULL, 0, 0, InImageName, "bad symbol definition");
- }
- SymShdr = GetShdrByIndex(Sym->st_shndx);
-
- //
- // Note: r_offset in a memory address.
- // Convert it to a pointer in the coff file.
- //
- Targ = CoffFile + SecOffset + (Rel->r_offset - SecShdr->sh_addr);
-
- switch (ELF_R_TYPE(Rel->r_info)) {
- case R_386_NONE:
- break;
- case R_386_32:
- //
- // Absolute relocation.
- //
- *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr
- + CoffSectionsOffset[Sym->st_shndx];
- break;
- case R_386_PC32:
- //
- // Relative relocation: Symbol - Ip + Addend
- //
- *(UINT32 *)Targ = *(UINT32 *)Targ
- + (CoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr)
- - (SecOffset - SecShdr->sh_addr);
- break;
- default:
- Error (NULL, 0, 0, InImageName, "unhandled relocation type %x",
- ELF_R_TYPE(Rel->r_info));
- }
- }
- }
- }
-}
-
-void
-CoffAddFixupEntry(
- UINT16 Val
- )
-{
- *CoffEntryRel = Val;
- CoffEntryRel++;
- CoffBaseRel->SizeOfBlock += 2;
- CoffOffset += 2;
-}
-
-void
-CoffAddFixup(
- UINT32 Offset,
- UINT8 Type
- )
-{
- if (CoffBaseRel == NULL
- || CoffBaseRel->VirtualAddress != (Offset & ~0xfff)) {
- if (CoffBaseRel != NULL) {
- //
- // Add a null entry (is it required ?)
- //
- CoffAddFixupEntry (0);
- //
- // Pad for alignment.
- //
- if (CoffOffset % 4 != 0)
- CoffAddFixupEntry (0);
- }
-
- CoffFile = realloc
- (CoffFile,
- CoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000);
- memset(CoffFile + CoffOffset, 0,
- sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000);
-
- CoffBaseRel = (EFI_IMAGE_BASE_RELOCATION*)(CoffFile + CoffOffset);
- CoffBaseRel->VirtualAddress = Offset & ~0xfff;
- CoffBaseRel->SizeOfBlock = sizeof(EFI_IMAGE_BASE_RELOCATION);
-
- CoffEntryRel = (UINT16 *)(CoffBaseRel + 1);
- CoffOffset += sizeof(EFI_IMAGE_BASE_RELOCATION);
- }
-
- //
- // Fill the entry.
- //
- CoffAddFixupEntry((Type << 12) | (Offset & 0xfff));
-}
-
-void
-WriteRelocations(
- VOID
- )
-{
- UINT32 Idx;
- EFI_IMAGE_NT_HEADERS *NtHdr;
- EFI_IMAGE_DATA_DIRECTORY *Dir;
-
- for (Idx = 0; Idx < Ehdr->e_shnum; Idx++) {
- Elf_Shdr *RelShdr = GetShdrByIndex(Idx);
- if (RelShdr->sh_type == SHT_REL) {
- Elf_Shdr *SecShdr = GetShdrByIndex(RelShdr->sh_info);
- if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) {
- UINT32 RelIdx;
- for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
- Elf_Rel *Rel = (Elf_Rel *)
- ((UINT8*)Ehdr + RelShdr->sh_offset + RelIdx);
- switch (ELF_R_TYPE(Rel->r_info)) {
- case R_386_NONE:
- case R_386_PC32:
- break;
- case R_386_32:
- CoffAddFixup(CoffSectionsOffset[RelShdr->sh_info]
- + (Rel->r_offset - SecShdr->sh_addr),
- EFI_IMAGE_REL_BASED_HIGHLOW);
- break;
- default:
- Error (NULL, 0, 0, InImageName, "unhandled relocation type %x",
- ELF_R_TYPE(Rel->r_info));
- }
- }
- }
- }
- }
-
- //
- // Pad by adding empty entries.
- //
- while (CoffOffset & (CoffAlignment - 1)) {
- CoffAddFixupEntry(0);
- }
-
- CreateSectionHeader (".reloc", RelocOffset, CoffOffset - RelocOffset,
- EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
- | EFI_IMAGE_SCN_MEM_DISCARDABLE
- | EFI_IMAGE_SCN_MEM_READ);
-
- NtHdr = (EFI_IMAGE_NT_HEADERS *)(CoffFile + NtHdrOffset);
- Dir = &NtHdr->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
- Dir->VirtualAddress = RelocOffset;
- Dir->Size = CoffOffset - RelocOffset;
-}
-
-void
-WriteDebug(
- VOID
- )
-{
- UINT32 Len = strlen(InImageName) + 1;
- UINT32 DebugOffset = CoffOffset;
- EFI_IMAGE_NT_HEADERS *NtHdr;
- EFI_IMAGE_DATA_DIRECTORY *DataDir;
- EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir;
- EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10;
-
- CoffOffset += sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)
- + sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY)
- + Len;
- CoffOffset = CoffAlign(CoffOffset);
-
- CoffFile = realloc
- (CoffFile, CoffOffset);
- memset(CoffFile + DebugOffset, 0, CoffOffset - DebugOffset);
-
- Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(CoffFile + DebugOffset);
- Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW;
- Dir->SizeOfData = sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) + Len;
- Dir->RVA = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
- Dir->FileOffset = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
-
- Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1);
- Nb10->Signature = CODEVIEW_SIGNATURE_NB10;
- strcpy ((PUCHAR)(Nb10 + 1), InImageName);
-
- CreateSectionHeader (".debug", DebugOffset, CoffOffset - DebugOffset,
- EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
- | EFI_IMAGE_SCN_MEM_DISCARDABLE
- | EFI_IMAGE_SCN_MEM_READ);
-
- NtHdr = (EFI_IMAGE_NT_HEADERS *)(CoffFile + NtHdrOffset);
- DataDir = &NtHdr->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG];
- DataDir->VirtualAddress = DebugOffset;
- DataDir->Size = CoffOffset - DebugOffset;
-}
-
-void
-ConvertElf (
- UINT8 **FileBuffer,
- UINTN *FileLength
- )
-{
- EFI_IMAGE_NT_HEADERS *NtHdr;
-
- //
- // Check header, read section table.
- //
- Ehdr = (Elf32_Ehdr*)*FileBuffer;
- if (!CheckElfHeader())
- return;
-
- //
- // Compute sections new address.
- //
- ScanSections();
-
- //
- // Write and relocate sections.
- //
- WriteSections(IsTextShdr);
- WriteSections(IsDataShdr);
-
- //
- // Translate and write relocations.
- //
- WriteRelocations();
-
- //
- // Write debug info.
- //
- WriteDebug();
-
- NtHdr = (EFI_IMAGE_NT_HEADERS *)(CoffFile + NtHdrOffset);
- NtHdr->OptionalHeader.SizeOfImage = CoffOffset;
-
- //
- // Replace.
- //
- free(*FileBuffer);
- *FileBuffer = CoffFile;
- *FileLength = CoffOffset;
-}
-#endif // HAVE_ELF
-
-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.
-
---*/
-{
- ULONG Type;
- PUCHAR Ext;
- PUCHAR p;
- PUCHAR pe;
- PUCHAR OutImageName;
- UCHAR outname[500];
- FILE *fpIn;
- FILE *fpOut;
- VOID *ZeroBuffer;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_NT_HEADERS *PeHdr;
- EFI_IMAGE_OPTIONAL_HEADER32 *Optional32;
- EFI_IMAGE_OPTIONAL_HEADER64 *Optional64;
- time_t TimeStamp;
- struct tm TimeStruct;
- EFI_IMAGE_DOS_HEADER BackupDosHdr;
- ULONG Index;
- ULONG Index1;
- ULONG Index2;
- ULONG Index3;
- BOOLEAN TimeStampPresent;
- UINTN AllignedRelocSize;
- UINTN Delta;
- EFI_IMAGE_SECTION_HEADER *SectionHeader;
- UINT8 *FileBuffer;
- UINTN FileLength;
- RUNTIME_FUNCTION *RuntimeFunction;
- UNWIND_INFO *UnwindInfo;
-
- SetUtilityName (UTILITY_NAME);
- //
- // Assign to fix compile warning
- //
- OutImageName = NULL;
- Type = 0;
- Ext = 0;
- TimeStamp = 0;
- TimeStampPresent = FALSE;
-
- if (argc == 1) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- //
- // Look for -t time-date option first. If the time is "0", then
- // skip it.
- //
- if ((argc > 2) && !strcmp (argv[1], "-t")) {
- TimeStampPresent = TRUE;
- if (strcmp (argv[2], "0") != 0) {
- //
- // Convert the string to a value
- //
- memset ((char *) &TimeStruct, 0, sizeof (TimeStruct));
- if (sscanf(
- argv[2], "%d/%d/%d,%d:%d:%d",
- &TimeStruct.tm_mon, /* months since January - [0,11] */
- &TimeStruct.tm_mday, /* day of the month - [1,31] */
- &TimeStruct.tm_year, /* years since 1900 */
- &TimeStruct.tm_hour, /* hours since midnight - [0,23] */
- &TimeStruct.tm_min, /* minutes after the hour - [0,59] */
- &TimeStruct.tm_sec /* seconds after the minute - [0,59] */
- ) != 6) {
- Error (NULL, 0, 0, argv[2], "failed to convert to mm/dd/yyyy,hh:mm:ss format");
- return STATUS_ERROR;
- }
- //
- // Now fixup some of the fields
- //
- TimeStruct.tm_mon--;
- TimeStruct.tm_year -= 1900;
- //
- // Sanity-check values?
- // Convert
- //
- TimeStamp = mktime (&TimeStruct);
- if (TimeStamp == (time_t) - 1) {
- Error (NULL, 0, 0, argv[2], "failed to convert time");
- return STATUS_ERROR;
- }
- }
- //
- // Skip over the args
- //
- argc -= 2;
- argv += 2;
- }
- //
- // Check for enough args
- //
- if (argc < 3) {
- Usage ();
- return STATUS_ERROR;
- }
-
- InImageName = argv[2];
-
- if (argc == 4) {
- OutImageName = argv[3];
- }
- //
- // Get new image type
- //
- p = argv[1];
- if (*p == '/' || *p == '\\') {
- p += 1;
- }
-
- if (stricmp (p, "app") == 0 || stricmp (p, "UEFI_APPLICATION") == 0) {
- Type = EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION;
- Ext = ".efi";
-
- } else if (stricmp (p, "bsdrv") == 0 || stricmp (p, "DXE_DRIVER") == 0) {
- Type = EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER;
- Ext = ".efi";
-
- } else if (stricmp (p, "rtdrv") == 0 || stricmp (p, "DXE_RUNTIME_DRIVER") == 0) {
- Type = EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER;
- Ext = ".efi";
-
- } else if (stricmp (p, "rtdrv") == 0 || stricmp (p, "DXE_SAL_DRIVER") == 0) {
- Type = EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER;
- Ext = ".efi";
- } else if (stricmp (p, "SEC") == 0) {
- Type = EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER;
- Ext = ".sec";
- } else if (stricmp (p, "peim") == 0 ||
- stricmp (p, "BASE") == 0 ||
- stricmp (p, "PEI_CORE") == 0 ||
- stricmp (p, "PEIM") == 0 ||
- stricmp (p, "DXE_SMM_DRIVER") == 0 ||
- stricmp (p, "TOOL") == 0 ||
- stricmp (p, "UEFI_APPLICATION") == 0 ||
- stricmp (p, "USER_DEFINED") == 0 ||
- stricmp (p, "UEFI_DRIVER") == 0 ||
- stricmp (p, "DXE_CORE") == 0
- ) {
- Type = EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER;
- Ext = ".pei";
- } else {
- printf ("%s", p);
- Usage ();
- return STATUS_ERROR;
- }
- //
- // open source file
- //
- fpIn = fopen (InImageName, "rb");
- if (!fpIn) {
- Error (NULL, 0, 0, InImageName, "failed to open input file for reading");
- return STATUS_ERROR;
- }
-
- FReadFile (fpIn, (VOID **)&FileBuffer, &FileLength);
-
-#ifdef HAVE_ELF
- if (IsElfHeader(FileBuffer)) {
- ConvertElf(&FileBuffer, &FileLength);
- }
-#endif
- //
- // Read the dos & pe hdrs of the image
- //
- DosHdr = (EFI_IMAGE_DOS_HEADER *)FileBuffer;
- if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
- Error (NULL, 0, 0, InImageName, "DOS header signature not found in source image");
- fclose (fpIn);
- return STATUS_ERROR;
- }
-
- PeHdr = (EFI_IMAGE_NT_HEADERS *)(FileBuffer + DosHdr->e_lfanew);
- if (PeHdr->Signature != EFI_IMAGE_NT_SIGNATURE) {
- Error (NULL, 0, 0, InImageName, "PE header signature not found in source image");
- fclose (fpIn);
- return STATUS_ERROR;
- }
-
- //
- // open output file
- //
- strcpy (outname, InImageName);
- pe = NULL;
- for (p = outname; *p; p++) {
- if (*p == '.') {
- pe = p;
- }
- }
-
- if (!pe) {
- pe = p;
- }
-
- strcpy (pe, Ext);
-
- if (!OutImageName) {
- OutImageName = outname;
- }
-
- fpOut = fopen (OutImageName, "w+b");
- if (!fpOut) {
- Error (NULL, 0, 0, OutImageName, "could not open output file for writing");
- fclose (fpIn);
- return STATUS_ERROR;
- }
-
- //
- // Zero all unused fields of the DOS header
- //
- 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 < (ULONG) DosHdr->e_lfanew; Index++) {
- FileBuffer[Index] = DosHdr->e_cp;
- }
-
- //
- // Patch the PE header
- //
- PeHdr->OptionalHeader.Subsystem = (USHORT) Type;
- if (TimeStampPresent) {
- PeHdr->FileHeader.TimeDateStamp = (UINT32) TimeStamp;
- }
-
- if (PeHdr->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
- Optional32 = (EFI_IMAGE_OPTIONAL_HEADER32 *)&PeHdr->OptionalHeader;
- Optional32->MajorLinkerVersion = 0;
- Optional32->MinorLinkerVersion = 0;
- 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;
-
- //
- // Strip zero padding at the end of the .reloc section
- //
- if (Optional32->NumberOfRvaAndSizes >= 6) {
- if (Optional32->DataDirectory[5].Size != 0) {
- SectionHeader = (EFI_IMAGE_SECTION_HEADER *)(FileBuffer + DosHdr->e_lfanew + sizeof(UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + PeHdr->FileHeader.SizeOfOptionalHeader);
- for (Index = 0; Index < PeHdr->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[5].VirtualAddress) {
- SectionHeader->Misc.VirtualSize = Optional32->DataDirectory[5].Size;
- AllignedRelocSize = (Optional32->DataDirectory[5].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;
- }
- }
- }
- }
- }
- }
- }
- if (PeHdr->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
- Optional64 = (EFI_IMAGE_OPTIONAL_HEADER64 *)&PeHdr->OptionalHeader;
- Optional64->MajorLinkerVersion = 0;
- Optional64->MinorLinkerVersion = 0;
- 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;
-
- //
- // Zero the .pdata section if the machine type is X64 and the Debug Directory is empty
- //
- if (PeHdr->FileHeader.Machine == 0x8664) { // X64
- if (Optional64->NumberOfRvaAndSizes >= 4) {
- if (Optional64->NumberOfRvaAndSizes < 7 || (Optional64->NumberOfRvaAndSizes >= 7 && Optional64->DataDirectory[6].Size == 0)) {
- SectionHeader = (EFI_IMAGE_SECTION_HEADER *)(FileBuffer + DosHdr->e_lfanew + sizeof(UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + PeHdr->FileHeader.SizeOfOptionalHeader);
- for (Index = 0; Index < PeHdr->FileHeader.NumberOfSections; Index++, SectionHeader++) {
- if (SectionHeader->VirtualAddress == Optional64->DataDirectory[3].VirtualAddress) {
- RuntimeFunction = (RUNTIME_FUNCTION *)(FileBuffer + SectionHeader->PointerToRawData);
- for (Index1 = 0; Index1 < Optional64->DataDirectory[3].Size / sizeof (RUNTIME_FUNCTION); Index1++, RuntimeFunction++) {
- SectionHeader = (EFI_IMAGE_SECTION_HEADER *)(FileBuffer + DosHdr->e_lfanew + sizeof(UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + PeHdr->FileHeader.SizeOfOptionalHeader);
- for (Index2 = 0; Index2 < PeHdr->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));
- }
- }
- }
- memset (RuntimeFunction, 0, sizeof (RUNTIME_FUNCTION));
- }
-
- break;
- }
- }
- Optional64->DataDirectory[3].Size = 0;
- Optional64->DataDirectory[3].VirtualAddress = 0;
- }
- }
- }
-
- //
- // Strip zero padding at the end of the .reloc section
- //
- if (Optional64->NumberOfRvaAndSizes >= 6) {
- if (Optional64->DataDirectory[5].Size != 0) {
- SectionHeader = (EFI_IMAGE_SECTION_HEADER *)(FileBuffer + DosHdr->e_lfanew + sizeof(UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + PeHdr->FileHeader.SizeOfOptionalHeader);
- for (Index = 0; Index < PeHdr->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[5].VirtualAddress) {
- SectionHeader->Misc.VirtualSize = Optional64->DataDirectory[5].Size;
- AllignedRelocSize = (Optional64->DataDirectory[5].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;
- }
- }
- }
- }
- }
- }
- }
-
- FWriteFile (fpOut, FileBuffer, FileLength);
-
- //
- // Done
- //
- fclose (fpIn);
- fclose (fpOut);
- //
- // printf ("Created %s\n", OutImageName);
- //
- return STATUS_SUCCESS;
-}
diff --git a/Tools/CCode/Source/GenAcpiTable/GenAcpiTable.c b/Tools/CCode/Source/GenAcpiTable/GenAcpiTable.c
deleted file mode 100644
index 5638c3fa25..0000000000
--- a/Tools/CCode/Source/GenAcpiTable/GenAcpiTable.c
+++ /dev/null
@@ -1,743 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2007 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.
-
-Module Name:
-
- GenAcpiTable.c
-
-Abstract:
-
- A utility that extracts the .DATA section from a PE/COFF image.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h> // for PE32 structure definitions
-
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.h"
-
-//
-// Acpi Table definition
-//
-#include "Acpi.h"
-#include "Acpi1_0.h"
-#include "Acpi2_0.h"
-#include "Acpi3_0.h"
-#include "MemoryMappedConfigurationSpaceAccessTable.h"
-
-//
-// Version of this utility
-//
-#define UTILITY_NAME "GenAcpiTable"
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 11
-
-//
-// Define the max length of a filename
-//
-#define MAX_PATH 256
-#define DEFAULT_OUTPUT_EXTENSION ".acpi"
-
-//
-// Use this to track our command-line options and globals
-//
-struct {
- INT8 OutFileName[MAX_PATH];
- INT8 InFileName[MAX_PATH];
-} mOptions;
-
-//
-// Use these to convert from machine type value to a named type
-//
-typedef struct {
- UINT16 Value;
- INT8 *Name;
-} STRING_LOOKUP;
-
-static STRING_LOOKUP mMachineTypes[] = {
- EFI_IMAGE_MACHINE_IA32,
- "IA32",
- EFI_IMAGE_MACHINE_IA64,
- "IA64",
- EFI_IMAGE_MACHINE_EBC,
- "EBC",
- 0,
- NULL
-};
-
-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
- );
-
-static
-void
-Usage (
- VOID
- );
-
-static
-STATUS
-ParseCommandLine (
- int Argc,
- char *Argv[]
- );
-
-static
-STATUS
-CheckAcpiTable (
- VOID *AcpiTable,
- UINT32 Length
- );
-
-static
-STATUS
-CheckPE32File (
- INT8 *FileName,
- FILE *Fptr,
- UINT16 *MachineType,
- UINT16 *SubSystem
- );
-
-static
-STATUS
-ProcessFile (
- INT8 *InFileName,
- INT8 *OutFileName
- );
-
-static
-void
-DumpImage (
- INT8 *FileName
- );
-
-main (
- int Argc,
- char *Argv[]
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
- Argc - standard C main() argument count
-
- Argv - standard C main() argument list
-
-Returns:
-
- 0 success
- non-zero otherwise
-
---*/
-// GC_TODO: ] - add argument and description to function comment
-{
- UINT32 Status;
-
- SetUtilityName (UTILITY_NAME);
- //
- // Parse the command line arguments
- //
- if (ParseCommandLine (Argc, Argv)) {
- return STATUS_ERROR;
- }
- //
- // Make sure we don't have the same filename for input and output files
- //
- if (stricmp (mOptions.OutFileName, mOptions.InFileName) == 0) {
- Error (NULL, 0, 0, mOptions.OutFileName, "input and output file names must be different");
- goto Finish;
- }
- //
- // Process the file
- //
- ProcessFile (mOptions.InFileName, mOptions.OutFileName);
-Finish:
- Status = GetUtilityStatus ();
- return Status;
-}
-
-static
-STATUS
-ProcessFile (
- INT8 *InFileName,
- INT8 *OutFileName
- )
-/*++
-
-Routine Description:
-
- Process a PE32 EFI file.
-
-Arguments:
-
- InFileName - Name of the PE32 EFI file to process.
- OutFileName - Name of the output file for the processed data.
-
-Returns:
-
- 0 - successful
-
---*/
-{
- STATUS Status;
- UINTN Index;
- FILE *InFptr;
- FILE *OutFptr;
- UINT16 MachineType;
- UINT16 SubSystem;
- UINT32 PESigOffset;
- EFI_IMAGE_FILE_HEADER FileHeader;
- EFI_IMAGE_OPTIONAL_HEADER32 OptionalHeader32;
- EFI_IMAGE_OPTIONAL_HEADER64 OptionalHeader64;
- EFI_IMAGE_SECTION_HEADER SectionHeader;
- UINT8 *Buffer;
- long SaveFilePosition;
-
- InFptr = NULL;
- OutFptr = NULL;
- Buffer = NULL;
- Status = STATUS_ERROR;
- //
- // Try to open the input file
- //
- if ((InFptr = fopen (InFileName, "rb")) == NULL) {
- Error (NULL, 0, 0, InFileName, "failed to open input file for reading");
- return STATUS_ERROR;
- }
- //
- // Double-check the file to make sure it's what we expect it to be
- //
- if (CheckPE32File (InFileName, InFptr, &MachineType, &SubSystem) != STATUS_SUCCESS) {
- goto Finish;
- }
- //
- // Per the PE/COFF specification, at offset 0x3C in the file is a 32-bit
- // offset (from the start of the file) to the PE signature, which always
- // follows the MSDOS stub. The PE signature is immediately followed by the
- // COFF file header.
- //
- //
- if (fseek (InFptr, 0x3C, SEEK_SET) != 0) {
- Error (NULL, 0, 0, InFileName, "failed to seek to PE signature in file", NULL);
- goto Finish;
- }
-
- if (fread (&PESigOffset, sizeof (PESigOffset), 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to read PE signature offset from file");
- goto Finish;
- }
-
- if (fseek (InFptr, PESigOffset + 4, SEEK_SET) != 0) {
- Error (NULL, 0, 0, InFileName, "failed to seek to PE signature");
- goto Finish;
- }
- //
- // We should now be at the COFF file header. Read it in and verify it's
- // of an image type we support.
- //
- if (fread (&FileHeader, sizeof (EFI_IMAGE_FILE_HEADER), 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to read file header from image");
- goto Finish;
- }
-
- if ((FileHeader.Machine != EFI_IMAGE_MACHINE_IA32) && (FileHeader.Machine != EFI_IMAGE_MACHINE_IA64) && (FileHeader.Machine != EFI_IMAGE_MACHINE_X64)) {
- Error (NULL, 0, 0, InFileName, "image is of an unsupported machine type 0x%X", (UINT32) FileHeader.Machine);
- goto Finish;
- }
- //
- // Read in the optional header. Assume PE32, and if not, then re-read as PE32+
- //
- SaveFilePosition = ftell (InFptr);
- if (fread (&OptionalHeader32, sizeof (EFI_IMAGE_OPTIONAL_HEADER32), 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to read optional header from input file");
- goto Finish;
- }
-
- if (OptionalHeader32.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
- if (fseek (InFptr, SaveFilePosition, SEEK_SET) != 0) {
- Error (NULL, 0, 0, InFileName, "failed to seek to .data section");
- goto Finish;
- }
-
- if (fread (&OptionalHeader64, sizeof (EFI_IMAGE_OPTIONAL_HEADER64), 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to read optional header from input file");
- goto Finish;
- }
- }
- //
- // Search for the ".data" section
- //
- for (Index = 0; Index < FileHeader.NumberOfSections; Index++) {
- if (fread (&SectionHeader, sizeof (EFI_IMAGE_SECTION_HEADER), 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to read optional header from input file");
- goto Finish;
- }
-
- if (strcmp (SectionHeader.Name, ".data") == 0 || strcmp (SectionHeader.Name, ".sdata") == 0) {
- if (fseek (InFptr, SectionHeader.PointerToRawData, SEEK_SET) != 0) {
- Error (NULL, 0, 0, InFileName, "failed to seek to .data section");
- goto Finish;
- }
-
- Buffer = (UINT8 *) malloc (SectionHeader.Misc.VirtualSize);
- if (Buffer == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Finish;
- }
- if (fread (Buffer, SectionHeader.Misc.VirtualSize, 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to .data section");
- goto Finish;
- }
-
- //
- // Check Acpi Table
- //
- if (CheckAcpiTable (Buffer, SectionHeader.Misc.VirtualSize) != STATUS_SUCCESS) {
- Error (NULL, 0, 0, InFileName, "failed to check ACPI table");
- goto Finish;
- }
-
- //
- // Now open our output file
- //
- if ((OutFptr = fopen (OutFileName, "wb")) == NULL) {
- Error (NULL, 0, 0, OutFileName, "failed to open output file for writing");
- goto Finish;
- }
-
- if (fwrite (Buffer, SectionHeader.Misc.VirtualSize, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, OutFileName, "failed to write .data section");
- goto Finish;
- }
-
- Status = STATUS_SUCCESS;
- goto Finish;
- }
- }
-
- Status = STATUS_ERROR;
-
-Finish:
- if (InFptr != NULL) {
- fclose (InFptr);
- }
- //
- // Close the output file. If there was an error, delete the output file so
- // that a subsequent build will rebuild it.
- //
- if (OutFptr != NULL) {
- fclose (OutFptr);
- if (GetUtilityStatus () == STATUS_ERROR) {
- remove (OutFileName);
- }
- }
-
- //
- // Free up our buffer
- //
- if (Buffer != NULL) {
- free (Buffer);
- }
-
- return Status;
-}
-
-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, 0, "CheckAcpiTable", "failed to pass AcpiTable Length check");
- 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:
- Error (NULL, 0, 0, "CheckAcpiTable", "failed to pass FACP revision check");
- return STATUS_ERROR;
- }
- if (ExpectedLength != AcpiHeader->Length) {
- Error (NULL, 0, 0, "CheckAcpiTable", "failed to pass FACP Length check");
- 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 != 0) &&
- (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, 0, "CheckAcpiTable", "failed to pass FACS version check");
- 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, 0, "CheckAcpiTable", "failed to pass FACS Length check");
- 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) {
- Error (NULL, 0, 0, "CheckAcpiTable", "failed to pass DSDT revision check");
- return STATUS_ERROR;
- }
- if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER)) {
- Error (NULL, 0, 0, "CheckAcpiTable", "failed to pass DSDT Length check");
- return STATUS_ERROR;
- }
- break;
-
- //
- // "APIC" Multiple APIC Description Table
- //
- case EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE:
- 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, 0, "CheckAcpiTable", "failed to pass APIC revision check");
- return STATUS_ERROR;
- }
- if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER) + sizeof(UINT32) + sizeof(UINT32)) {
- Error (NULL, 0, 0, "CheckAcpiTable", "failed to pass APIC Length check");
- 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) {
- Error (NULL, 0, 0, "CheckAcpiTable", "failed to pass MCFG revision check");
- return STATUS_ERROR;
- }
- if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER) + sizeof(UINT64)) {
- Error (NULL, 0, 0, "CheckAcpiTable", "failed to pass MCFG Length check");
- return STATUS_ERROR;
- }
- break;
-
- //
- // Other table pass check
- //
- default:
- break;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-CheckPE32File (
- INT8 *FileName,
- FILE *Fptr,
- UINT16 *MachineType,
- UINT16 *SubSystem
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FileName - GC_TODO: add argument description
- Fptr - GC_TODO: add argument description
- MachineType - GC_TODO: add argument description
- SubSystem - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- /*++
-
-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_FILE_HEADER FileHdr;
- EFI_IMAGE_OPTIONAL_HEADER OptionalHdr;
- UINT32 PESig;
- STATUS Status;
-
- Status = STATUS_ERROR;
- //
- // 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, 0, FileName, "failed to read the DOS stub from the input file");
- goto Finish;
- }
- //
- // Check the magic number (0x5A4D)
- //
- if (DosHeader.e_magic != EFI_IMAGE_DOS_SIGNATURE) {
- Error (NULL, 0, 0, FileName, "input file does not appear to be a PE32 image (magic number)");
- goto Finish;
- }
- //
- // Position into the file and check the PE signature
- //
- fseek (Fptr, (long) DosHeader.e_lfanew, SEEK_SET);
- if (fread (&PESig, sizeof (PESig), 1, Fptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to read PE signature bytes");
- goto Finish;
- }
- //
- // Check the PE signature in the header "PE\0\0"
- //
- if (PESig != EFI_IMAGE_NT_SIGNATURE) {
- Error (NULL, 0, 0, FileName, "file does not appear to be a PE32 image (signature)");
- goto Finish;
- }
- //
- // Read the file header
- //
- if (fread (&FileHdr, sizeof (FileHdr), 1, Fptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to read PE file header from input file");
- goto Finish;
- }
- //
- // Read the optional header so we can get the subsystem
- //
- if (fread (&OptionalHdr, sizeof (OptionalHdr), 1, Fptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to read COFF optional header from input file");
- goto Finish;
- }
-
- *SubSystem = OptionalHdr.Subsystem;
- //
- // Good to go
- //
- Status = STATUS_SUCCESS;
-Finish:
- fseek (Fptr, 0, SEEK_SET);
- return Status;
-}
-
-static
-int
-ParseCommandLine (
- int Argc,
- char *Argv[]
- )
-/*++
-
-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
-
-Returns:
-
- STATUS_SUCCESS success
- non-zero otherwise
-
---*/
-// GC_TODO: ] - add argument and description to function comment
-{
- //
- // Clear out the options
- //
- memset ((char *) &mOptions, 0, sizeof (mOptions));
- //
- // Skip over the program name
- //
- Argc--;
- Argv++;
-
- if (Argc < 1) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
- (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- if (Argc != 2) {
- Usage ();
- return STATUS_ERROR;
- }
-
- strcpy (mOptions.InFileName, Argv[0]);
- //
- // Next argument
- //
- Argv++;
- Argc--;
-
- strcpy (mOptions.OutFileName, Argv[0]);
-
- return STATUS_SUCCESS;
-}
-
-static
-void
-Version (
- VOID
- )
-{
- printf ("%s v%d.%d -EDK Utility for generating ACPI Table image from an EFI PE32 image.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2006 Intel Corporation. All rights reserved.\n");
-}
-
-
-static
-void
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Print usage information for this utility.
-
-Arguments:
-
- None.
-
-Returns:
-
- Nothing.
-
---*/
-{
- int Index;
- static const char *Msg[] = {
- "\nUsage: "UTILITY_NAME " {-h|--help|-?|/?|-V|--version} InFileName OutFileName",
- " where:",
- " InFileName - name of the input PE32 file",
- " OutFileName - to write output to OutFileName rather than InFileName"DEFAULT_OUTPUT_EXTENSION,
- NULL
- };
-
- Version();
- for (Index = 0; Msg[Index] != NULL; Index++) {
- fprintf (stdout, "%s\n", Msg[Index]);
- }
-}
diff --git a/Tools/CCode/Source/GenAcpiTable/build.xml b/Tools/CCode/Source/GenAcpiTable/build.xml
deleted file mode 100644
index e864f132cb..0000000000
--- a/Tools/CCode/Source/GenAcpiTable/build.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006 - 2007, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenAcpiTable Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenAcpiTable"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/IndustryStandard"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c b/Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c
deleted file mode 100644
index 6082b4d838..0000000000
--- a/Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/*++
-
-Copyright (c) 1999 - 2006 Intel Corporation. All rights reserved
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-
-Module Name:
-
- GenBsfFixup.c
-
-Abstract:
-
- Utility to Fixup the SEC component for IA32. This is an
- interim tool in place of the full GenBsfImage support for
- IA32.
- This tool supports the Synch3 update
-
---*/
-
-#include "BaseTypes.h"
-#include "UefiBaseTypes.h"
-#include "EfiImage.h"
-#include "FirmwareVolumeHeader.h"
-#include "FirmwareVolumeImageFormat.h"
-#include "ParseInf.h"
-#include "CommonLib.h"
-#include "FirmwareFileSystem.h"
-#include "FvLib.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-//
-// BugBug -- this port to the new FFS is really weird.
-// A lot of the file-header stuff has been ported, but
-// not the section information.
-//
-
-#define UTILITY_NAME "GenBsfFixup"
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-
-UINT32 gFixup;
-
-UINT32
-GetOccupiedSize (
- IN UINT32 ActualSize,
- IN UINT32 Alignment
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- ActualSize - GC_TODO: add argument description
- Alignment - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- UINT32 OccupiedSize;
-
- OccupiedSize = ActualSize;
- while ((OccupiedSize & (Alignment - 1)) != 0) {
- OccupiedSize++;
- }
-
- return OccupiedSize;
-}
-
-static
-void
-Version (
- VOID
- )
-{
- printf ("%s v%d.%d -EDK Utility to Fixup the SEC component for IA32.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2006 Intel Corporation. All rights reserved.\n");
-}
-
-
-VOID
-Usage (
- VOID
- )
-{
- Version();
- printf ("\nUsage: " UTILITY_NAME " FvVolumeImageFile AddressOfFvInMemory OffsetOfFixup OutputFileName \n");
-}
-
-int
-ReadHeader (
- FILE *In,
- UINT32 *FvSize
- )
-/*++
-
-Routine Description:
-
- Reads in Firmware Volume information from the volume header file.
-
-Arguments:
-
- In: Firmware Volume header file to read from
- FvSize: Size of Firmware Volume
-
-Returns:
-
- int: Number of bytes read
-
---*/
-{
- EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
- EFI_FV_BLOCK_MAP_ENTRY BlockMap;
- INT32 SigTemp[2];
- INT32 Invert;
- INT32 bytesread;
- UINT32 size;
-
- size = 0;
- Invert = 0;
- bytesread = 0;
-
- if (In == NULL) {
- printf ("Error: Input file is NULL.\n");
- return -1;
- }
-
- fread (&VolumeHeader, sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, In);
- bytesread = sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY);
- SigTemp[0] = VolumeHeader.Signature;
- SigTemp[1] = 0;
-
- if (VolumeHeader.Attributes & EFI_FVB_ERASE_POLARITY) {
- Invert = 1;
- }
-
- do {
- fread (&BlockMap, sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, In);
- bytesread += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
-
- if (BlockMap.NumBlocks != 0) {
- size += BlockMap.NumBlocks * BlockMap.BlockLength;
- }
-
- } while (BlockMap.NumBlocks != 0);
-
- *FvSize = size;
- rewind (In);
-
- if (Invert == 1) {
- bytesread *= -1;
- }
-
- return bytesread;
-}
-
-UINT32
-GetSectionLength (
- IN UINT32 *Length
- )
-/*++
-
-Routine Description:
-
- Converts a UINT8[3] array to a UINT32
-
-Arguments:
-
- Length A pointer to a 3 byte array
-
-Returns:
-
- UINT32: The length.
-
---*/
-{
- return *Length & 0x00FFFFFF;
-}
-
-int
-Readfile (
- UINT8 *FvImage,
- int bytes,
- int Invert
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FvImage - GC_TODO: add argument description
- bytes - GC_TODO: add argument description
- Invert - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- UINT32 FileLength;
- UINT32 OccupiedFileLength;
- EFI_FFS_FILE_HEADER *FileHeader;
- UINT8 FileState;
- UINT8 Checksum;
- UINT8 *Ptr;
- UINT32 SectionLength;
- EFI_COMMON_SECTION_HEADER *SectionHeader;
- EFI_IMAGE_NT_HEADERS *PeHeader;
- UINT32 PeiCoreOffset;
-
- Ptr = FvImage + bytes;
-
- FileHeader = (EFI_FFS_FILE_HEADER *) Ptr;
-
- FileState = GetFileState ((UINT8) Invert, FileHeader);
-
- switch (FileState) {
- case EFI_FILE_HEADER_CONSTRUCTION:
- case EFI_FILE_HEADER_INVALID:
- return sizeof (EFI_FFS_FILE_HEADER);
-
- case EFI_FILE_HEADER_VALID:
- Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
- Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
- Checksum = (UINT8) (Checksum - FileHeader->State);
- if (Checksum != 0) {
- return -1;
- }
- //
- // Now do the fixup stuff - begin
- //
- if (FileHeader->Type == EFI_FV_FILETYPE_PEI_CORE) {
- SectionHeader = (EFI_COMMON_SECTION_HEADER *) FileHeader + sizeof (EFI_FFS_FILE_HEADER);
- SectionLength = GetSectionLength ((UINT32 *) &SectionHeader->Size[0]);
-
- printf ("Section length is 0x%X\n", SectionLength);
-
- if (SectionHeader->Type == EFI_SECTION_PE32) {
-
- gFixup = bytes + sizeof (EFI_FFS_FILE_HEADER) + sizeof (EFI_COMMON_SECTION_HEADER);
-
- PeHeader = (EFI_IMAGE_NT_HEADERS *) Ptr + sizeof (EFI_FFS_FILE_HEADER) + sizeof (EFI_COMMON_SECTION_HEADER);
-
- if (((EFI_IMAGE_DOS_HEADER *) PeHeader)->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
- //
- // DOS image header is present, so read the PE header after the DOS image header
- //
- PeHeader = (EFI_IMAGE_NT_HEADERS *) ((UINTN) PeHeader + (UINTN) ((((EFI_IMAGE_DOS_HEADER *) PeHeader)->e_lfanew) & 0x0ffff));
-
- }
-
- PeiCoreOffset = (UINTN) ((UINTN) (PeHeader->OptionalHeader.AddressOfEntryPoint & 0x0ffffffff));
-
- gFixup += PeiCoreOffset;
- }
- }
-
- FileLength = GetLength (FileHeader->Size);
- OccupiedFileLength = GetOccupiedSize (FileLength, 8);
- return OccupiedFileLength;
-
- case EFI_FILE_DATA_VALID:
- //
- // Calculate header checksum
- //
- Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
- Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
- Checksum = (UINT8) (Checksum - FileHeader->State);
- if (Checksum != 0) {
- return -1;
- }
- //
- // Determine file length
- //
- FileLength = GetLength (FileHeader->Size);
- OccupiedFileLength = GetOccupiedSize (FileLength, 8);
-
- //
- // Determine if file checksum is valid or fixed
- //
- if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
- Checksum = CalculateSum8 (Ptr, FileLength);
- Checksum = (UINT8) (Checksum - FileHeader->State);
- if (Checksum != 0) {
- return -1;
- }
- } else {
- if (FileHeader->IntegrityCheck.Checksum.File != FFS_FIXED_CHECKSUM) {
- return -1;
- }
- }
- break;
-
- case EFI_FILE_MARKED_FOR_UPDATE:
- case EFI_FILE_DELETED:
- //
- // Calculate header checksum
- //
- Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
- Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
- Checksum = (UINT8) (Checksum - FileHeader->State);
- if (Checksum != 0) {
- return -1;
- }
- //
- // Determine file length
- //
- FileLength = GetLength (FileHeader->Size);
- OccupiedFileLength = GetOccupiedSize (FileLength, 8);
-
- //
- // Determine if file checksum is valid or fixed
- //
- if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
- Checksum = CalculateSum8 (Ptr, FileLength);
- Checksum = (UINT8) (Checksum - FileHeader->State);
- if (Checksum != 0) {
- return -1;
- }
- } else {
- if (FileHeader->IntegrityCheck.Checksum.File != FFS_FIXED_CHECKSUM) {
- return -1;
- }
- }
-
- return OccupiedFileLength;
-
- default:
- return sizeof (EFI_FFS_FILE_HEADER);
- }
-
- return OccupiedFileLength;
-}
-
-int
-main (
- int argc,
- char*argv[]
- )
-/*++
-
-Routine Description:
-
- Runs GenBsfFixup
-
-Arguments:
-
- argc: number of command line arguments
-
- arg[0] = This file name
- arg[1] = Firmware Volume Name
- arg[2] = Base Address to relocate
- arg[3] = Relative offset of the fixup to perform
- arg[4] = Output File Name
-
-Returns:
-
- int: 0 code success, -1 code failure
-
---*/
-{
- FILE *In;
- FILE *Out;
- int ByteStart;
- int Invert;
- int Index;
- int cnt;
- UINT8 *FvImage;
- int ByteRead;
- UINT32 FvSize;
- UINT64 delta;
- UINT32 Idx;
- UINT64 FvOffset;
- EFI_STATUS Status;
-
- Index = 0;
- Invert = 0;
-
- if (argc == 1) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return -1;
- }
-
- if (argc != 5) {
- Usage();
- return -1;
- }
-
- In = fopen (argv[1], "rb");
-
- if (In == NULL) {
- printf ("Unable to open FV image file \"%s\"\n", argv[1]);
- return -1;
- }
-
- ByteStart = ReadHeader (In, &FvSize);
-
- if (ByteStart < 0) {
- Invert = 1;
- ByteStart *= -1;
- }
-
- FvImage = malloc (FvSize);
- if (FvImage == NULL) {
- printf ("Cannot allocate memory\n");
- fclose (In);
- return -1;
- }
-
- ByteRead = fread (FvImage, 1, FvSize, In);
-
- if ((unsigned int) ByteRead != FvSize) {
- printf ("Read File error\n");
- fclose (In);
- return -1;
- }
-
- cnt = 0;
- while ((unsigned int) ByteStart < FvSize && cnt != -1) {
- cnt = Readfile (FvImage, ByteStart, Invert);
-
- if (cnt != -1) {
- ByteStart += cnt;
- }
-
- if (cnt != sizeof (EFI_FFS_FILE_HEADER)) {
- Index++;
- }
- }
-
- if (cnt == -1) {
- printf ("Firmware Volume image corrupted\n");
- return -1;
- }
-
- fclose (In);
-
- Out = fopen (argv[4], "wb");
-
- if (Out == NULL) {
- printf ("Unable to open FV image file \"%s\"\n", argv[4]);
- return -1;
- }
-
- In = fopen (argv[1], "rb");
-
- if (In == NULL) {
- printf ("Unable to open FV image file \"%s\"\n", argv[1]);
- return -1;
- }
-
- if (gFixup != 0) {
-
- printf ("Fixup of 0x%X\n", gFixup);
-
- Status = AsciiStringToUint64 (argv[2], TRUE, &FvOffset);
-
- gFixup += (UINT32) FvOffset;
-
- ByteStart = ReadHeader (In, &FvSize);
-
- Readfile (FvImage, ByteStart, Invert);
-
- cnt = 0;
- Status = AsciiStringToUint64 (argv[3], TRUE, &delta);
-
- fclose (In);
- In = fopen (argv[1], "rb");
-
- if (In == NULL) {
- printf ("Unable to open FV image file \"%s\"\n", argv[1]);
- return -1;
- }
-
- for (Idx = 0; Idx < delta - FvOffset; Idx++) {
- fputc (fgetc (In), Out);
- }
-
- fwrite (&gFixup, sizeof (UINT32), 1, Out);
- fseek (In, sizeof (UINT32), SEEK_CUR);
-
- for (Idx = 0; Idx < FvSize - (delta - FvOffset) - sizeof (UINT32); Idx++) {
- fputc (fgetc (In), Out);
- }
-
- fclose (In);
- fclose (Out);
- } else {
- printf ("There was no fixup to perform\n");
- }
-
- free (FvImage);
-
- return 0;
-}
diff --git a/Tools/CCode/Source/GenBsfFixup/build.xml b/Tools/CCode/Source/GenBsfFixup/build.xml
deleted file mode 100644
index 1f35cf2948..0000000000
--- a/Tools/CCode/Source/GenBsfFixup/build.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenFvImage Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenBsfFixup"/>
- <property name="FileSet" value="GenBsfFixup.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- <if>
- <istrue value="${OSX}"/>
- <then>
- <property name="syslibdirs" value=""/>
- <property name="syslibs" value=""/>
- </then>
- </if>
-
- <if>
- <istrue value="${cygwin}"/>
- <then>
- <property name="syslibdirs" value="${env.CYGWIN_HOME}/lib/e2fsprogs"/>
- <property name="syslibs" value="uuid"/>
- </then>
- </if>
-
- <if>
- <istrue value="${msft}"/>
- <then>
- <property name="syslibdirs" value=""/>
- <property name="syslibs" value="uuid"/>
- </then>
- </if>
-
- <if>
- <istrue value="${linux}"/>
- <then>
- <if>
- <istrue value="${x86_64_linux}"/>
- <then>
- <property name="syslibdirs" value="/lib64"/>
- </then>
- <else>
- <property name="syslibdirs" value="/usr/lib"/>
- </else>
- </if>
- <property name="syslibs" value="uuid"/>
- </then>
- </if>
- <echo message="syslibdirs set to: ${syslibdirs}"/>
- </target>
-
- <target name="Tool" depends="init, GenBsfFixup"/>
-
- <target name="GenBsfFixup" >
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <defineset>
- <define name="BUILDING_TOOLS"/>
- <define name="TOOL_BUILD_IA32_TARGET"/>
- </defineset>
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"/>
-
- <includepath path="${PACKAGE_DIR}/${ToolName}"/>
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Common"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
-
- <linkerarg value="/nodefaultlib:libc.lib" if="msft"/>
- <syslibset dir="${syslibdirs}" libs="${syslibs}" if="cyglinux"/>
- <syslibset libs="RpcRT4" if="msft"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ia32${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_X64${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ipf${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ia32.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}_X64.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ipf.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenBsfImage/GenBsfImage.c b/Tools/CCode/Source/GenBsfImage/GenBsfImage.c
deleted file mode 100644
index a294a2eea3..0000000000
--- a/Tools/CCode/Source/GenBsfImage/GenBsfImage.c
+++ /dev/null
@@ -1,3532 +0,0 @@
-/*++
-
-Copyright (c) 1999 - 2006, Intel Corporation. All rights reserved
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-
-Module Name:
-
- GenBsfImage.c
-
-Abstract:
-
- This file contains functions required to generate a boot strap file (BSF)
- also known as the Volume Top File (VTF)
-
---*/
-
-//
-// Module Coded to EFI 2.0 Coding Conventions
-//
-#include <FvLib.h>
-#include <Common/UefiBaseTypes.h>
-#include "GenBsfImage.h"
-#include <Guid/FirmwareFileSystem.h>
-#include "CommonLib.h"
-
-//
-// Global variables
-//
-EFI_GUID Bsf1NameGuid = EFI_IPF_VTF1_GUID
-EFI_GUID Bsf2NameGuid = EFI_IPF_VTF2_GUID
-
-CHAR8 **TokenStr;
-CHAR8 **OrgStrTokPtr;
-
-PARSED_BSF_INFO *FileListPtr;
-PARSED_BSF_INFO *FileListHeadPtr;
-
-VOID *Bsf1Buffer;
-VOID *Bsf1EndBuffer;
-VOID *Bsf2Buffer;
-VOID *Bsf2EndBuffer;
-
-UINTN ValidLineNum = 0;
-UINTN ValidFFDFileListNum = 0;
-
-//
-// Section Description and their number of occurences in *.INF file
-//
-UINTN NumFvFiles = 0;
-UINTN SectionOptionNum = 0;
-
-//
-// Global flag which will check for BSF Present, if yes then will be used
-// to decide about adding FFS header to pad data
-//
-BOOLEAN BSFPresent = FALSE;
-
-//
-// Address related information
-//
-UINT64 Fv1BaseAddress = 0;
-UINT64 Fv2BaseAddress = 0;
-UINT64 Fv1EndAddress = 0;
-UINT64 Fv2EndAddress = 0;
-UINT32 Bsf1TotalSize = SIZE_TO_OFFSET_PAL_A_END;
-UINT64 Bsf1LastStartAddress = 0;
-UINT32 Bsf2TotalSize = 0;
-UINT64 Bsf2LastStartAddress = 0;
-
-UINT32 BufferToTop = 0;
-
-//
-// IA32 Reset Vector Bin name
-//
-CHAR8 IA32BinFile[FILE_NAME_SIZE];
-
-//
-// Function Implementations
-//
-VOID
-BuildTokenList (
- IN CHAR8 *Token
- )
-/*++
-Routine Description:
-
- This function builds the token list in an array which will be parsed later
-
-Arguments:
-
- Token - The pointer of string
-
-Returns:
-
- None
-
---*/
-{
- strcpy (*TokenStr, Token);
- TokenStr++;
-}
-
-EFI_STATUS
-ConvertVersionInfo (
- IN CHAR8 *Str,
- IN OUT UINT8 *MajorVer,
- IN OUT UINT8 *MinorVer
- )
-/*++
-Routine Description:
-
- This function converts GUID string to GUID
-
-Arguments:
-
- Str - String representing in form XX.XX
- MajorVer - The major vertion
- MinorVer - The minor vertion
-
-Returns:
-
- EFI_SUCCESS - The fuction completed successfully.
-
---*/
-{
- CHAR8 StrPtr[40];
- CHAR8 *Token;
- UINTN Length;
- UINTN Major;
- UINTN Minor;
-
- Major = 0;
- Minor = 0;
- memset (StrPtr, 0, 40);
- Token = strtok (Str, ".");
-
- while (Token != NULL) {
- strcat (StrPtr, Token);
- Token = strtok (NULL, ".");
- }
-
- Length = strlen (StrPtr);
- sscanf (
- StrPtr,
- "%01x%02x",
- &Major,
- &Minor
- );
-
- *MajorVer = (UINT8) Major;
- *MinorVer = (UINT8) Minor;
- return EFI_SUCCESS;
-}
-
-VOID
-TrimLine (
- IN CHAR8 *Line
- )
-/*++
-Routine Description:
-
- This function cleans up the line by removing all whitespace and
- comments
-
-Arguments:
-
- Line - The pointer of the string
-
-Returns:
-
- None
-
---*/
-{
- CHAR8 TmpLine[FILE_NAME_SIZE];
- CHAR8 Char;
- CHAR8 *Ptr0;
- UINTN Index;
- UINTN Index2;
-
- //
- // Change '#' to '//' for Comment style
- //
- if (((Ptr0 = strchr (Line, '#')) != NULL) || ((Ptr0 = strstr (Line, "//")) != NULL)) {
- Line[Ptr0 - Line] = 0;
- }
-
- //
- // Initialize counters
- //
- Index = 0;
- Index2 = 0;
-
- while ((Char = Line[Index]) != 0) {
- if ((Char != ' ') && (Char != '\t') && (Char != '\n')) {
- TmpLine[Index2++] = Char;
- }
- Index++;
- }
-
- TmpLine[Index2] = 0;
- strcpy (Line, TmpLine);
-}
-
-VOID
-ValidLineCount (
- IN FILE *Fp
- )
-/*++
-
-Routine Description:
-
- This function calculated number of valid lines in a input file.
-
-Arguments:
-
- Fp - Pointer to a file handle which has been opened.
-
-Returns:
-
- None
-
---*/
-{
- CHAR8 Buff[FILE_NAME_SIZE];
-
- while (fgets (Buff, sizeof (Buff), Fp)) {
- TrimLine (Buff);
- if (Buff[0] == 0) {
- continue;
- }
-
- ValidLineNum++;
- }
-}
-
-VOID
-ParseInputFile (
- IN FILE *Fp
- )
-/*++
-
-Routine Description:
-
- This function parses the input file and tokenize the string
-
-Arguments:
-
- Fp - Pointer to a file handle which has been opened.
-
-Returns:
-
- None
-
---*/
-{
- CHAR8 *Token;
- CHAR8 Buff[FILE_NAME_SIZE];
- CHAR8 OrgLine[FILE_NAME_SIZE];
- CHAR8 Str[FILE_NAME_SIZE];
- CHAR8 Delimit[] = "=";
-
- while (fgets (Buff, sizeof (Buff), Fp) != NULL) {
- strcpy (OrgLine, Buff);
- TrimLine (Buff);
- if (Buff[0] == 0) {
- continue;
- }
-
- Token = strtok (Buff, Delimit);
-
- while (Token != NULL) {
- strcpy (Str, Token);
- BuildTokenList (Str);
- Token = strtok (NULL, Delimit);
- }
- }
-}
-
-EFI_STATUS
-InitializeComps (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function intializes the relevant global variable which is being
- used to store the information retrieved from INF file. This also initializes
- the BSF symbol file.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_OUT_OF_RESOURCES - Malloc failed.
-
---*/
-{
-
- FileListPtr = malloc (sizeof (PARSED_BSF_INFO));
-
- if (FileListPtr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileListHeadPtr = FileListPtr;
- memset (FileListPtr, 0, sizeof (PARSED_BSF_INFO));
- FileListPtr->NextBsfInfo = NULL;
-
- remove (BSF_SYM_FILE);
- return EFI_SUCCESS;
-}
-
-VOID
-ParseAndUpdateComponents (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function intializes the relevant global variable which is being
- used to store the information retrieved from INF file.
-
-Arguments:
-
- BsfInfo - A pointer to the BSF Info Structure
-
-
-Returns:
-
- None
-
---*/
-{
- UINT64 StringValue;
-
- while (*TokenStr != NULL && (_stricmp (*TokenStr, "COMP_NAME") != 0)) {
-
- if (_stricmp (*TokenStr, "COMP_LOC") == 0) {
- TokenStr++;
- if (_stricmp (*TokenStr, "F") == 0) {
- BsfInfo->LocationType = FIRST_VTF;
- } else if (_stricmp (*TokenStr, "S") == 0) {
- BsfInfo->LocationType = SECOND_VTF;
- } else {
- BsfInfo->LocationType = NONE;
- printf ("\nERROR: Unknown location for component %s", BsfInfo->CompName);
- }
- } else if (_stricmp (*TokenStr, "COMP_TYPE") == 0) {
- TokenStr++;
- if (AsciiStringToUint64 (*TokenStr, FALSE, &StringValue) != EFI_SUCCESS) {
- printf ("\nERROR: Could not read a numeric value from \"%s\".", TokenStr);
- return ;
- }
-
- BsfInfo->CompType = (UINT8) StringValue;
- } else if (_stricmp (*TokenStr, "COMP_VER") == 0) {
- TokenStr++;
- if (_stricmp (*TokenStr, "-") == 0) {
- BsfInfo->VersionPresent = FALSE;
- BsfInfo->MajorVer = 0;
- BsfInfo->MinorVer = 0;
- } else {
- BsfInfo->VersionPresent = TRUE;
- ConvertVersionInfo (*TokenStr, &BsfInfo->MajorVer, &BsfInfo->MinorVer);
- }
- } else if (_stricmp (*TokenStr, "COMP_BIN") == 0) {
- TokenStr++;
- strcpy (BsfInfo->CompBinName, *TokenStr);
- } else if (_stricmp (*TokenStr, "COMP_SYM") == 0) {
- TokenStr++;
- strcpy (BsfInfo->CompSymName, *TokenStr);
- } else if (_stricmp (*TokenStr, "COMP_SIZE") == 0) {
- TokenStr++;
- if (_stricmp (*TokenStr, "-") == 0) {
- BsfInfo->PreferredSize = FALSE;
- BsfInfo->CompSize = 0;
- } else {
- BsfInfo->PreferredSize = TRUE;
- if (AsciiStringToUint64 (*TokenStr, FALSE, &StringValue) != EFI_SUCCESS) {
- printf ("\nERROR: Could not read a numeric value from \"%s\".", TokenStr);
- return ;
- }
-
- BsfInfo->CompSize = (UINTN) StringValue;
- }
-
- } else if (_stricmp (*TokenStr, "COMP_CS") == 0) {
- TokenStr++;
- if (_stricmp (*TokenStr, "1") == 0) {
- BsfInfo->CheckSumRequired = 1;
- } else if (_stricmp (*TokenStr, "0") == 0) {
- BsfInfo->CheckSumRequired = 0;
- } else {
- printf ("\nERROR: Bad information in INF file about Checksum required field");
- }
- }
-
- TokenStr++;
- if (*TokenStr == NULL) {
- break;
- }
- }
-}
-
-VOID
-InitializeInFileInfo (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function intializes the relevant global variable which is being
- used to store the information retrieved from INF file.
-
-Arguments:
-
- NONE
-
-Returns:
-
- NONE
-
---*/
-{
- UINTN SectionOptionFlag;
- UINTN SectionCompFlag;
-
- SectionOptionFlag = 0;
- SectionCompFlag = 0;
- TokenStr = OrgStrTokPtr;
- while (*TokenStr != NULL) {
- if (_stricmp (*TokenStr, "[OPTIONS]") == 0) {
- SectionOptionFlag = 1;
- SectionCompFlag = 0;
- }
-
- if (_stricmp (*TokenStr, "[COMPONENTS]") == 0) {
- if (FileListPtr == NULL) {
- FileListPtr = FileListHeadPtr;
- }
-
- SectionCompFlag = 1;
- SectionOptionFlag = 0;
- TokenStr++;
- }
-
- if (SectionOptionFlag) {
- if (_stricmp (*TokenStr, "IA32_RST_BIN") == 0) {
- *TokenStr++;
- strcpy (IA32BinFile, *TokenStr);
- }
- }
-
- if (SectionCompFlag) {
- if (_stricmp (*TokenStr, "COMP_NAME") == 0) {
- TokenStr++;
- strcpy (FileListPtr->CompName, *TokenStr);
- TokenStr++;
- ParseAndUpdateComponents (FileListPtr);
- }
-
- if (*TokenStr != NULL) {
- FileListPtr->NextBsfInfo = malloc (sizeof (PARSED_BSF_INFO));
- if (FileListPtr->NextBsfInfo == NULL) {
- printf ("Error: Out of memory resources.\n");
- break;
- }
- FileListPtr = FileListPtr->NextBsfInfo;
- memset (FileListPtr, 0, sizeof (PARSED_BSF_INFO));
- FileListPtr->NextBsfInfo = NULL;
- continue;
- } else {
- break;
- }
- }
-
- TokenStr++;
- }
-}
-
-EFI_STATUS
-GetBsfRelatedInfoFromInfFile (
- IN CHAR8 *FileName
- )
-/*++
-
-Routine Description:
-
- This function reads the input file, parse it and create a list of tokens
- which is parsed and used, to intialize the data related to BSF
-
-Arguments:
-
- FileName - FileName which needed to be read to parse data
-
-Returns:
-
- EFI_ABORTED - Error in opening file
- EFI_INVALID_PARAMETER - File doesn't contain any valid informations
- EFI_OUT_OF_RESOURCES - Malloc Failed
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- FILE *Fp;
- UINTN Index;
- EFI_STATUS Status;
-
- Fp = fopen (FileName, "r");
- if (Fp == NULL) {
- printf ("\nERROR: Error in opening %s file\n", FileName);
- return EFI_ABORTED;
- }
-
- ValidLineCount (Fp);
-
- if (ValidLineNum == 0) {
- printf ("\nERROR: File doesn't contain any valid informations");
- return EFI_INVALID_PARAMETER;
- }
-
- TokenStr = (CHAR8 **) malloc (sizeof (UINTN) * (2 * ValidLineNum + 1));
-
- if (TokenStr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- memset (TokenStr, 0, (sizeof (UINTN) * (2 * ValidLineNum + 1)));
- OrgStrTokPtr = TokenStr;
-
- for (Index = 0; Index < (2 * ValidLineNum); Index++) {
- *TokenStr = (CHAR8*)malloc (sizeof (CHAR8) * FILE_NAME_SIZE);
-
- if (*TokenStr == NULL) {
- free (OrgStrTokPtr);
- return EFI_OUT_OF_RESOURCES;
- }
-
- memset (*TokenStr, 0, FILE_NAME_SIZE);
-// free (*TokenStr);
- TokenStr++;
- }
-
- TokenStr = NULL;
- TokenStr = OrgStrTokPtr;
- fseek (Fp, 0L, SEEK_SET);
-
- Status = InitializeComps ();
-
- if (Status != EFI_SUCCESS) {
- free (OrgStrTokPtr);
- return Status;
- }
-
- ParseInputFile (Fp);
- InitializeInFileInfo ();
-
- if (Fp) {
- fclose (Fp);
- }
- free (OrgStrTokPtr);
- return EFI_SUCCESS;
-}
-
-VOID
-GetRelativeAddressInBsfBuffer (
- IN UINT64 Address,
- IN OUT UINTN *RelativeAddress,
- IN LOC_TYPE LocType
- )
-/*++
-
-Routine Description:
-
- This function checks for the address alignmnet for specified data boundary. In
- case the address is not aligned, it returns FALSE and the amount of data in
- terms of byte needed to adjust to get the boundary alignmnet. If data is
- aligned, TRUE will be returned.
-
-Arguments:
-
- Address - The address of the flash map space
- RelativeAddress - The relative address of the Buffer
- LocType - The type of the BSF
-
-
-Returns:
-
-
---*/
-{
- UINT64 TempAddress;
- UINT8 *LocalBuff;
-
- if (LocType == FIRST_VTF) {
- LocalBuff = (UINT8 *) Bsf1EndBuffer;
- TempAddress = Fv1EndAddress - Address;
- *RelativeAddress = (UINTN) LocalBuff - (UINTN) TempAddress;
- } else {
- LocalBuff = (UINT8 *) Bsf2EndBuffer;
- TempAddress = Fv2EndAddress - Address;
- *RelativeAddress = (UINTN) LocalBuff - (UINTN) TempAddress;
- }
-}
-
-EFI_STATUS
-GetComponentVersionInfo (
- IN OUT PARSED_BSF_INFO *BsfInfo,
- IN UINT8 *Buffer
- )
-/*++
-Routine Description:
-
- This function will extract the version information from File
-
-Arguments:
-
- BsfInfo - A Pointer to the BSF Info Structure
- Buffer - A Pointer to type UINT8
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_INVALID_PARAMETER - The parameter is invalid
-
---*/
-{
- UINT16 VersionInfo;
- EFI_STATUS Status;
-
- switch (BsfInfo->CompType) {
-
- case COMP_TYPE_FIT_PAL_A:
- case COMP_TYPE_FIT_PAL_B:
- memcpy (&VersionInfo, (Buffer + 8), sizeof (UINT16));
- BsfInfo->MajorVer = (UINT8) ((VersionInfo & 0xFF00) >> 8);
- BsfInfo->MinorVer = (UINT8) (VersionInfo & 0x00FF);
- Status = EFI_SUCCESS;
- break;
-
- default:
- Status = EFI_INVALID_PARAMETER;
- break;
- }
-
- return Status;
-}
-
-BOOLEAN
-CheckAddressAlignment (
- IN UINT64 Address,
- IN UINT64 AlignmentData,
- IN OUT UINT64 *AlignAdjustByte
- )
-/*++
-
-Routine Description:
-
- This function checks for the address alignmnet for specified data boundary. In
- case the address is not aligned, it returns FALSE and the amount of data in
- terms of byte needed to adjust to get the boundary alignmnet. If data is
- aligned, TRUE will be returned.
-
-Arguments:
-
- Address - Pointer to buffer containing byte data of component.
- AlignmentData - DataSize for which address needed to be aligned
- AlignAdjustByte - Number of bytes needed to adjust alignment.
-
-Returns:
-
- TRUE - Address is aligned to specific data size boundary
- FALSE - Address in not aligned to specified data size boundary
- - Add/Subtract AlignAdjustByte to aling the address.
-
---*/
-{
- //
- // Check if the assigned address is on address boundary. If not, it will
- // return the remaining byte required to adjust the address for specified
- // address boundary
- //
- *AlignAdjustByte = (Address % AlignmentData);
-
- if (*AlignAdjustByte == 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-EFI_STATUS
-GetFitTableStartAddress (
- IN OUT FIT_TABLE **FitTable
- )
-/*++
-
-Routine Description:
-
- Get the FIT table start address in BSF Buffer
-
-Arguments:
-
- FitTable - Pointer to available fit table where new component can be added
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- UINT64 FitTableAdd;
- UINT64 FitTableAddOffset;
- UINTN RelativeAddress;
-
- //
- // Read the Fit Table address from Itanium-based address map.
- //
- FitTableAddOffset = Fv1EndAddress - (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT + SIZE_FIT_TABLE_ADD);
-
- //
- // Translate this Itanium-based address in terms of local buffer address which
- // contains the image for Boot Strapped File. The relative address will be
- // the address of fit table BSF buffer.
- //
- GetRelativeAddressInBsfBuffer (FitTableAddOffset, &RelativeAddress, FIRST_VTF);
- FitTableAdd = *(UINTN *) RelativeAddress;
-
- //
- // The FitTableAdd is the extracted Itanium based address pointing to FIT
- // table. The relative address will return its actual location in BSF
- // Buffer.
- //
- GetRelativeAddressInBsfBuffer (FitTableAdd, &RelativeAddress, FIRST_VTF);
-
- *FitTable = (FIT_TABLE *) RelativeAddress;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetNextAvailableFitPtr (
- IN FIT_TABLE **FitPtr
- )
-/*++
-
-Routine Description:
-
- Get the FIT table address and locate the free space in fit where we can add
- new component. In this process, this function locates the fit table using
- Fit pointer in Itanium-based address map (as per Intel?Itanium(TM) SAL spec)
- and locate the available location in FIT table to be used by new components.
- If there are any Fit table which areg not being used contains ComponentType
- field as 0x7F. If needed we can change this and spec this out.
-
-Arguments:
-
- FitPtr - Pointer to available fit table where new component can be added
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- FIT_TABLE *TmpFitPtr;
- UINT64 FitTableAdd;
- UINT64 FitTableAddOffset;
- UINTN Index;
- UINTN NumFitComponents;
- UINTN RelativeAddress;
-
- //
- // Read the Fit Table address from Itanium-based address map.
- //
- FitTableAddOffset = Fv1EndAddress - (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT + SIZE_FIT_TABLE_ADD);
-
- //
- // Translate this Itanium-based address in terms of local buffer address which
- // contains the image for Boot Strapped File. The relative address will be
- // the address of fit table BSF buffer.
- //
- GetRelativeAddressInBsfBuffer (FitTableAddOffset, &RelativeAddress, FIRST_VTF);
- FitTableAdd = *(UINTN *) RelativeAddress;
-
- //
- // The FitTableAdd is the extracted Itanium based address pointing to FIT
- // table. The relative address will return its actual location in BSF
- // Buffer.
- //
- GetRelativeAddressInBsfBuffer (FitTableAdd, &RelativeAddress, FIRST_VTF);
-
- TmpFitPtr = (FIT_TABLE *) RelativeAddress;
- NumFitComponents = TmpFitPtr->CompSize;
-
- for (Index = 0; Index < NumFitComponents; Index++) {
- if ((TmpFitPtr->CvAndType & FIT_TYPE_MASK) == COMP_TYPE_FIT_UNUSED) {
- *FitPtr = TmpFitPtr;
- break;
- }
-
- TmpFitPtr++;
- }
-
- return EFI_SUCCESS;
-}
-
-INTN
-CompareItems (
- IN const VOID *Arg1,
- IN const VOID *Arg2
- )
-/*++
-
-Routine Description:
-
- This function is used by qsort to sort the FIT table based upon Component
- Type in their incresing order.
-
-Arguments:
-
- Arg1 - Pointer to Arg1
- Arg2 - Pointer to Arg2
-
-Returns:
-
- None
-
---*/
-{
- if ((((FIT_TABLE *) Arg1)->CvAndType & FIT_TYPE_MASK) > (((FIT_TABLE *) Arg2)->CvAndType & FIT_TYPE_MASK)) {
- return 1;
- } else if ((((FIT_TABLE *) Arg1)->CvAndType & FIT_TYPE_MASK) < (((FIT_TABLE *) Arg2)->CvAndType & FIT_TYPE_MASK)) {
- return -1;
- } else {
- return 0;
- }
-}
-
-VOID
-SortFitTable (
- IN VOID
- )
-/*++
-
-Routine Description:
-
- This function is used by qsort to sort the FIT table based upon Component
- Type in their incresing order.
-
-Arguments:
-
- VOID
-
-Returns:
-
- None
-
---*/
-{
- FIT_TABLE *FitTable;
- FIT_TABLE *TmpFitPtr;
- UINTN NumFitComponents;
- UINTN Index;
-
- GetFitTableStartAddress (&FitTable);
- TmpFitPtr = FitTable;
- NumFitComponents = 0;
- for (Index = 0; Index < FitTable->CompSize; Index++) {
- if ((TmpFitPtr->CvAndType & FIT_TYPE_MASK) != COMP_TYPE_FIT_UNUSED) {
- NumFitComponents += 1;
- }
-
- TmpFitPtr++;
- }
-
- qsort ((VOID *) FitTable, NumFitComponents, sizeof (FIT_TABLE), CompareItems);
-}
-
-VOID
-UpdateFitEntryForFwVolume (
- IN UINT64 Size
- )
-/*++
-
-Routine Description:
-
- This function updates the information about Firmware Volume in FIT TABLE.
- This FIT table has to be immediately below the PAL_A Start and it contains
- component type and address information. Other informations can't be
- created this time so we would need to fix it up..
-
-
-Arguments:
-
- Size - Firmware Volume Size
-
-Returns:
-
- VOID
-
---*/
-{
- FIT_TABLE *CompFitPtr;
- UINTN RelativeAddress;
-
- //
- // FV Fit table will be located at PAL_A Startaddress - 16 byte location
- //
- Bsf1LastStartAddress -= 0x10;
- Bsf1TotalSize += 0x10;
-
- GetRelativeAddressInBsfBuffer (Bsf1LastStartAddress, &RelativeAddress, FIRST_VTF);
-
- CompFitPtr = (FIT_TABLE *) RelativeAddress;
- CompFitPtr->CompAddress = Fv1BaseAddress;
-
- //
- // Since we don't have any information about its location in Firmware Volume,
- // initialize address to 0. This will be updated once Firmware Volume is
- // being build and its current address will be fixed in FIT table. Currently
- // we haven't implemented it so far and working on architectural clarafication
- //
- //
- // Firmware Volume Size in 16 byte block
- //
- CompFitPtr->CompSize = ((UINT32) Size) / 16;
-
- //
- // Since Firmware Volume does not exist by the time we create this FIT info
- // this should be fixedup from Firmware Volume creation tool. We haven't
- // worked out a method so far.
- //
- CompFitPtr->CompVersion = MAKE_VERSION (0, 0);
-
- //
- // Since we don't have any info about this file, we are making sure that
- // checksum is not needed.
- //
- CompFitPtr->CvAndType = CV_N_TYPE (0, COMP_TYPE_FIT_FV_BOOT);
-
- //
- // Since non BSF component will reside outside the BSF, we will not have its
- // binary image while creating BSF, hence we will not perform checksum at
- // this time. Once Firmware Volume is being created which will contain this
- // BSF, it will fix the FIT table for all the non BSF component and hence
- // checksum
- //
- CompFitPtr->CheckSum = 0;
-}
-
-EFI_STATUS
-UpdateFitEntryForNonBSFComp (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function updates the information about non BSF component in FIT TABLE.
- Since non BSF componets binaries are not part of BSF binary, we would still
- be required to update its location information in Firmware Volume, inside
- FIT table.
-
-Arguments:
-
- BsfInfo - Pointer to BSF Info Structure
-
-Returns:
-
- EFI_ABORTED - The function fails to update the component in FIT
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- FIT_TABLE *CompFitPtr;
-
- //
- // Scan the FIT table for available space
- //
- GetNextAvailableFitPtr (&CompFitPtr);
- if (CompFitPtr == NULL) {
- printf ("\nERROR: Can't update this component in FIT");
- return EFI_ABORTED;
- }
-
- //
- // Since we don't have any information about its location in Firmware Volume,
- // initialize address to 0. This will be updated once Firmware Volume is
- // being build and its current address will be fixed in FIT table
- //
- CompFitPtr->CompAddress = 0;
- CompFitPtr->CompSize = BsfInfo->CompSize;
- CompFitPtr->CompVersion = MAKE_VERSION (BsfInfo->MajorVer, BsfInfo->MinorVer);
- CompFitPtr->CvAndType = CV_N_TYPE (BsfInfo->CheckSumRequired, BsfInfo->CompType);
-
- //
- // Since non BSF component will reside outside the BSF, we will not have its
- // binary image while creating BSF, hence we will not perform checksum at
- // this time. Once Firmware Volume is being created which will contain this
- // BSF, it will fix the FIT table for all the non BSF component and hence
- // checksum
- //
- CompFitPtr->CheckSum = 0;
-
- //
- // Fit Type is FV_BOOT which means Firmware Volume, we initialize this to base
- // address of Firmware Volume in which this BSF will be attached.
- //
- if ((CompFitPtr->CvAndType & 0x7F) == COMP_TYPE_FIT_FV_BOOT) {
- CompFitPtr->CompAddress = Fv1BaseAddress;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// !!!WARNING
-// This function is updating the SALE_ENTRY in Itanium address space as per SAL
-// spec. SALE_ENTRY is being read from SYM file of PEICORE. Once the PEI
-// CORE moves in Firmware Volume, we would need to modify this function to be
-// used with a API which will detect PEICORE component while building Firmware
-// Volume and update its entry in FIT table as well as in Itanium address space
-// as per Intel?Itanium(TM) SAL address space
-//
-EFI_STATUS
-UpdateEntryPoint (
- IN PARSED_BSF_INFO *BsfInfo,
- IN UINT64 *CompStartAddress
- )
-/*++
-
-Routine Description:
-
- This function updated the architectural entry point in IPF, SALE_ENTRY.
-
-Arguments:
-
- BsfInfo - Pointer to BSF Info Structure
- CompStartAddress - Pointer to Component Start Address
-
-Returns:
-
- EFI_INVALID_PARAMETER - The parameter is invalid
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- UINTN RelativeAddress;
- UINT64 SalEntryAdd;
- FILE *Fp;
- UINTN Offset;
-
- CHAR8 Buff[FILE_NAME_SIZE];
- CHAR8 Buff1[10];
- CHAR8 Buff2[10];
- CHAR8 OffsetStr[30];
- CHAR8 Buff3[10];
- CHAR8 Buff4[10];
- CHAR8 Buff5[10];
- CHAR8 Token[50];
-
- Fp = fopen (BsfInfo->CompSymName, "r+b");
-
- if (Fp == NULL) {
- printf ("\nERROR: Error in opening file");
- return EFI_INVALID_PARAMETER;
- }
-
- while (fgets (Buff, sizeof (Buff), Fp) != NULL) {
- fscanf (
- Fp,
- "%s %s %s %s %s %s %s",
- &Buff1,
- &Buff2,
- &OffsetStr,
- &Buff3,
- &Buff4,
- &Buff5,
- &Token
- );
- if (_stricmp (Token, "SALE_ENTRY") == 0) {
- break;
- }
- }
-
- Offset = strtoul (OffsetStr, NULL, 16);
-
- *CompStartAddress += Offset;
- SalEntryAdd = Fv1EndAddress - (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT);
-
- GetRelativeAddressInBsfBuffer (SalEntryAdd, &RelativeAddress, FIRST_VTF);
-
- memcpy ((VOID *) RelativeAddress, (VOID *) CompStartAddress, sizeof (UINT64));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CreateAndUpdateComponent (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function reads the binary file for each components and update them
- in BSF Buffer as well as in FIT table. If the component is located in non
- BSF area, only the FIT table address will be updated
-
-Arguments:
-
- BsfInfo - Pointer to Parsed Info
-
-Returns:
-
- EFI_SUCCESS - The function completed successful
- EFI_ABORTED - Aborted due to one of the many reasons like:
- (a) Component Size greater than the specified size.
- (b) Error opening files.
-
- EFI_INVALID_PARAMETER Value returned from call to UpdateEntryPoint()
- EFI_OUT_OF_RESOURCES Memory allocation failure.
-
---*/
-{
- EFI_STATUS Status;
- UINT64 CompStartAddress;
- UINT64 FileSize;
- UINT64 NumByteRead;
- UINT64 NumAdjustByte;
- UINT8 *Buffer;
- FILE *Fp;
- FIT_TABLE *CompFitPtr;
- BOOLEAN Aligncheck;
-
- if (BsfInfo->LocationType == NONE) {
- UpdateFitEntryForNonBSFComp (BsfInfo);
- return EFI_SUCCESS;
- }
-
- Fp = fopen (BsfInfo->CompBinName, "r+b");
-
- if (Fp == NULL) {
- printf ("\nERROR: Opening file %s", BsfInfo->CompBinName);
- return EFI_ABORTED;
- }
-
- FileSize = _filelength (fileno (Fp));
-
- if ((BsfInfo->CompType == COMP_TYPE_FIT_PAL_B) || (BsfInfo->CompType == COMP_TYPE_FIT_PAL_A_SPECIFIC)) {
-
- //
- // BUGBUG: Satish to correct
- //
- FileSize -= SIZE_OF_PAL_HEADER;
- }
-
- if (BsfInfo->PreferredSize) {
- if (FileSize > BsfInfo->CompSize) {
- printf ("\nERROR: The component size is more than specified size");
- return EFI_ABORTED;
- }
-
- FileSize = BsfInfo->CompSize;
- }
-
- Buffer = malloc ((UINTN) FileSize);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- memset (Buffer, 0, (UINTN) FileSize);
-
- if ((BsfInfo->CompType == COMP_TYPE_FIT_PAL_B) || (BsfInfo->CompType == COMP_TYPE_FIT_PAL_A_SPECIFIC)) {
-
- //
- // Read first 64 bytes of PAL header and use it to find version info
- //
- NumByteRead = fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);
-
- //
- // PAL header contains the version info. Currently, we will use the header
- // to read version info and then discard.
- //
- if (!BsfInfo->VersionPresent) {
- GetComponentVersionInfo (BsfInfo, Buffer);
- }
- }
-
- NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);
- fclose (Fp);
-
- //
- // If it is non PAL_B component, pass the entire buffer to get the version
- // info and implement any specific case inside GetComponentVersionInfo.
- //
- if (BsfInfo->CompType != COMP_TYPE_FIT_PAL_B) {
- if (!BsfInfo->VersionPresent) {
- GetComponentVersionInfo (BsfInfo, Buffer);
- }
- }
-
- if (BsfInfo->LocationType == SECOND_VTF) {
-
- CompStartAddress = (Bsf2LastStartAddress - FileSize);
- } else {
- CompStartAddress = (Bsf1LastStartAddress - FileSize);
- }
-
- if (BsfInfo->CompType == COMP_TYPE_FIT_PAL_B) {
- Aligncheck = CheckAddressAlignment (CompStartAddress, 32 * 1024, &NumAdjustByte);
- } else {
- Aligncheck = CheckAddressAlignment (CompStartAddress, 8, &NumAdjustByte);
- }
-
- if (!Aligncheck) {
- CompStartAddress -= NumAdjustByte;
- }
-
- if (BsfInfo->LocationType == SECOND_VTF) {
- Bsf2LastStartAddress = CompStartAddress;
- Bsf2TotalSize += (UINT32) (FileSize + NumAdjustByte);
- Status = UpdateBsfBuffer (CompStartAddress, Buffer, FileSize, SECOND_VTF);
- } else {
- Bsf1LastStartAddress = CompStartAddress;
- Bsf1TotalSize += (UINT32) (FileSize + NumAdjustByte);
- Status = UpdateBsfBuffer (CompStartAddress, Buffer, FileSize, FIRST_VTF);
- }
-
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- GetNextAvailableFitPtr (&CompFitPtr);
-
- CompFitPtr->CompAddress = CompStartAddress | IPF_CACHE_BIT;
- assert ((FileSize % 16) == 0);
- CompFitPtr->CompSize = (UINT32) (FileSize / 16);
- CompFitPtr->CompVersion = MAKE_VERSION (BsfInfo->MajorVer, BsfInfo->MinorVer);
- CompFitPtr->CvAndType = CV_N_TYPE (BsfInfo->CheckSumRequired, BsfInfo->CompType);
- if (BsfInfo->CheckSumRequired) {
- CompFitPtr->CheckSum = 0;
- CompFitPtr->CheckSum = CalculateChecksum8 (Buffer, (UINTN) FileSize);
- }
-
- //
- // Free the buffer
- //
- if (Buffer) {
- free (Buffer);
- }
-
- //
- // Update the SYM file for this component based on it's start address.
- //
- Status = UpdateSymFile (CompStartAddress, BSF_SYM_FILE, BsfInfo->CompSymName);
- if (EFI_ERROR (Status)) {
-
- //
- // At this time, SYM files are not required, so continue on error.
- //
- }
-
- // !!!!!!!!!!!!!!!!!!!!!
- // BUGBUG:
- // This part of the code is a temporary line since PEICORE is going to be inside
- // BSF till we work out how to determine the SALE_ENTRY through it. We will need
- // to clarify so many related questions
- // !!!!!!!!!!!!!!!!!!!!!!!
- if (BsfInfo->CompType == COMP_TYPE_FIT_PEICORE) {
- Status = UpdateEntryPoint (BsfInfo, &CompStartAddress);
- }
-
- return Status;
-}
-
-EFI_STATUS
-CreateAndUpdatePAL_A (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function reads the binary file for each components and update them
- in BSF Buffer as well as FIT table
-
-Arguments:
-
- BsfInfo - Pointer to Parsed Info
-
-Returns:
-
- EFI_ABORTED - Due to one of the following reasons:
- (a)Error Opening File
- (b)The PAL_A Size is more than specified size status
- One of the values mentioned below returned from
- call to UpdateSymFile
- EFI_SUCCESS - The function completed successfully.
- EFI_INVALID_PARAMETER - One of the input parameters was invalid.
- EFI_ABORTED - An error occurred.UpdateSymFile
- EFI_OUT_OF_RESOURCES - Memory allocation failed.
-
---*/
-{
- EFI_STATUS Status;
- UINT64 PalStartAddress;
- UINT64 AbsAddress;
- UINTN RelativeAddress;
- UINT64 FileSize;
- UINT64 NumByteRead;
- UINT8 *Buffer;
- FILE *Fp;
- FIT_TABLE *PalFitPtr;
-
- Fp = fopen (BsfInfo->CompBinName, "r+b");
-
- if (Fp == NULL) {
- printf ("\nERROR: Opening file %s", BsfInfo->CompBinName);
- return EFI_ABORTED;
- }
-
- FileSize = _filelength (fileno (Fp));
- FileSize -= SIZE_OF_PAL_HEADER;
-
- if (BsfInfo->PreferredSize) {
- if (FileSize > BsfInfo->CompSize) {
- printf ("\nERROR: The PAL_A Size is more than specified size");
- return EFI_ABORTED;
- }
-
- FileSize = BsfInfo->CompSize;
- }
-
- Buffer = malloc ((UINTN) FileSize);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- memset (Buffer, 0, (UINTN) FileSize);
-
- //
- // Read, Get version Info and discard the PAL header.
- //
- NumByteRead = fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);
-
- //
- // Extract the version info from header of PAL_A. Once done, discrad this buffer
- //
- if (!BsfInfo->VersionPresent) {
- GetComponentVersionInfo (BsfInfo, Buffer);
- }
-
- //
- // Read PAL_A file in a buffer
- //
- NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);
- fclose (Fp);
-
- PalStartAddress = Fv1EndAddress - (SIZE_TO_OFFSET_PAL_A_END + FileSize);
- Bsf1LastStartAddress = PalStartAddress;
- Bsf1TotalSize += (UINT32) FileSize;
- Status = UpdateBsfBuffer (PalStartAddress, Buffer, FileSize, FIRST_VTF);
-
- AbsAddress = Fv1EndAddress - SIZE_TO_PAL_A_FIT;
- GetRelativeAddressInBsfBuffer (AbsAddress, &RelativeAddress, FIRST_VTF);
- PalFitPtr = (FIT_TABLE *) RelativeAddress;
- PalFitPtr->CompAddress = PalStartAddress | IPF_CACHE_BIT;
- assert ((FileSize % 16) == 0);
- PalFitPtr->CompSize = (UINT32) (FileSize / 16);
- PalFitPtr->CompVersion = MAKE_VERSION (BsfInfo->MajorVer, BsfInfo->MinorVer);
- PalFitPtr->CvAndType = CV_N_TYPE (BsfInfo->CheckSumRequired, BsfInfo->CompType);
- if (BsfInfo->CheckSumRequired) {
- PalFitPtr->CheckSum = 0;
- PalFitPtr->CheckSum = CalculateChecksum8 (Buffer, (UINTN) FileSize);
- }
-
- if (Buffer) {
- free (Buffer);
- }
-
- //
- // Update the SYM file for this component based on it's start address.
- //
- Status = UpdateSymFile (PalStartAddress, BSF_SYM_FILE, BsfInfo->CompSymName);
- if (EFI_ERROR (Status)) {
-
- //
- // At this time, SYM files are not required, so continue on error.
- //
- }
-
- return Status;
-}
-
-EFI_STATUS
-CreateFitTableAndInitialize (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function creates and intializes FIT table which would be used to
- add component info inside this
-
-Arguments:
-
- BsfInfo - Pointer to Parsed Info
-
-Returns:
-
- EFI_ABORTED - Aborted due to no size information
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- UINT64 PalFitTableAdd;
- UINT64 FitTableAdd;
- UINT64 FitTableAddressOffset;
- FIT_TABLE *PalFitPtr;
- FIT_TABLE *FitStartPtr;
- UINTN NumFitComp;
- UINTN RelativeAddress;
- UINTN Index;
-
- if (!BsfInfo->PreferredSize) {
- printf ("\nERROR: FIT could not be allocated becuase there are no size information");
- return EFI_ABORTED;
- }
-
- if ((BsfInfo->CompSize % 16) != 0) {
- printf ("\nERROR: Invalid Fit Table Size, not multiple of 16 bytes. Please correct the size");
- }
-
- PalFitTableAdd = Fv1EndAddress - SIZE_TO_PAL_A_FIT;
- GetRelativeAddressInBsfBuffer (PalFitTableAdd, &RelativeAddress, FIRST_VTF);
- PalFitPtr = (FIT_TABLE *) RelativeAddress;
- PalFitTableAdd = (PalFitPtr->CompAddress - BsfInfo->CompSize);
-
- FitTableAdd = (PalFitPtr->CompAddress - 0x10) - BsfInfo->CompSize;
- FitTableAddressOffset = Fv1EndAddress - (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT + SIZE_FIT_TABLE_ADD);
- GetRelativeAddressInBsfBuffer (FitTableAddressOffset, &RelativeAddress, FIRST_VTF);
- *(UINT64 *) RelativeAddress = FitTableAdd;
-
- GetRelativeAddressInBsfBuffer (FitTableAdd, &RelativeAddress, FIRST_VTF);
-
- //
- // Update Fit Table with FIT Signature and FIT info in first 16 bytes.
- //
- FitStartPtr = (FIT_TABLE *) RelativeAddress;
-
- strncpy ((CHAR8 *) &FitStartPtr->CompAddress, FIT_SIGNATURE, 8); // "_FIT_ "
- assert (((BsfInfo->CompSize & 0x00FFFFFF) % 16) == 0);
- FitStartPtr->CompSize = (BsfInfo->CompSize & 0x00FFFFFF) / 16;
- FitStartPtr->CompVersion = MAKE_VERSION (BsfInfo->MajorVer, BsfInfo->MinorVer);
-
- //
- // BUGBUG: If a checksum is required, add code to checksum the FIT table. Also
- // determine what to do for things like the FV component that aren't easily checksummed.
- // The checksum will be done once we are done with all the componet update in the FIT
- // table
- //
- FitStartPtr->CvAndType = CV_N_TYPE (BsfInfo->CheckSumRequired, BsfInfo->CompType);
-
- NumFitComp = FitStartPtr->CompSize;
-
- FitStartPtr++;
-
- //
- // Intialize remaining FIT table space to UNUSED fit component type
- // so that when we need to create a FIT entry for a component, we can
- // locate a free one and use it.
- //
- for (Index = 0; Index < (NumFitComp - 1); Index++) {
- FitStartPtr->CvAndType = 0x7F; // Initialize all with UNUSED
- FitStartPtr++;
- }
-
- Bsf1TotalSize += BsfInfo->CompSize;
- Bsf1LastStartAddress -= BsfInfo->CompSize;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-WriteBsfBinary (
- IN CHAR8 *FileName,
- IN UINT32 BsfSize,
- IN LOC_TYPE LocType
- )
-/*++
-
-Routine Description:
-
- Write Firmware Volume from memory to a file.
-
-Arguments:
-
- FileName - Output File Name which needed to be created/
- BsfSize - FileSize
- LocType - The type of the BSF
-
-Returns:
-
- EFI_ABORTED - Returned due to one of the following resons:
- (a) Error Opening File
- (b) Failing to copy buffers
- EFI_SUCCESS - The fuction completes successfully
-
---*/
-{
- FILE *Fp;
- UINTN NumByte;
- VOID *BsfBuffer;
- UINTN RelativeAddress;
-
- if (LocType == FIRST_VTF) {
- GetRelativeAddressInBsfBuffer (Bsf1LastStartAddress, &RelativeAddress, FIRST_VTF);
- BsfBuffer = (VOID *) RelativeAddress;
- } else {
- GetRelativeAddressInBsfBuffer (Bsf2LastStartAddress, &RelativeAddress, SECOND_VTF);
- BsfBuffer = (VOID *) RelativeAddress;
- }
-
- Fp = fopen (FileName, "w+b");
- if (Fp == NULL) {
- printf ("Error in opening file %s\n", FileName);
- return EFI_ABORTED;
- }
-
- NumByte = fwrite (BsfBuffer, sizeof (UINT8), (UINTN) BsfSize, Fp);
-
- if (Fp) {
- fclose (Fp);
- }
-
- if (NumByte != (sizeof (UINT8) * BsfSize)) {
- printf ("\nERROR: Could not copy buffer into file %s ", FileName);
- return EFI_ABORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UpdateBsfBuffer (
- IN UINT64 StartAddress,
- IN UINT8 *Buffer,
- IN UINT64 DataSize,
- IN LOC_TYPE LocType
- )
-/*++
-
-Routine Description:
-
- Update the Firmware Volume Buffer with requested buffer data
-
-Arguments:
-
- StartAddress - StartAddress in buffer. This number will automatically
- point to right address in buffer where data needed
- to be updated.
- Buffer - Buffer pointer from data will be copied to memory mapped buffer.
- DataSize - Size of the data needed to be copied.
- LocType - The type of the BSF
-
-Returns:
-
- EFI_ABORTED - The input parameter is error
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- UINT8 *LocalBufferPtrToWrite;
-
- if (LocType == FIRST_VTF) {
- if ((StartAddress | IPF_CACHE_BIT) < (Bsf1LastStartAddress | IPF_CACHE_BIT)) {
- printf ("ERROR: Start Address is less then the BSF start address\n");
- return EFI_ABORTED;
- }
-
- LocalBufferPtrToWrite = (UINT8 *) Bsf1EndBuffer;
- LocalBufferPtrToWrite -= (Fv1EndAddress - StartAddress);
- } else {
- if ((StartAddress | IPF_CACHE_BIT) < (Bsf2LastStartAddress | IPF_CACHE_BIT)) {
- printf ("ERROR: Start Address is less then the BSF start address\n");
- return EFI_ABORTED;
- }
- LocalBufferPtrToWrite = (UINT8 *) Bsf2EndBuffer;
- LocalBufferPtrToWrite -= (Fv2EndAddress - StartAddress);
- }
-
- memcpy (LocalBufferPtrToWrite, Buffer, (UINTN) DataSize);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UpdateFfsHeader (
- IN UINT32 TotalBsfSize,
- IN LOC_TYPE LocType
- )
-/*++
-
-Routine Description:
-
- Update the Firmware Volume Buffer with requested buffer data
-
-Arguments:
-
- TotalBsfSize - Size of the BSF
- Fileoffset - The start of the file relative to the start of the FV.
- LocType - The type of the BSF
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_INVALID_PARAMETER - The Ffs File Header Pointer is NULL
-
---*/
-{
- EFI_FFS_FILE_HEADER *FileHeader;
- UINTN RelativeAddress;
- EFI_GUID EfiFirmwareVolumeTopFileGuid = EFI_FFS_VOLUME_TOP_FILE_GUID;
-
- //
- // Find the BSF file header location
- //
- if (LocType == FIRST_VTF) {
- GetRelativeAddressInBsfBuffer (Bsf1LastStartAddress, &RelativeAddress, FIRST_VTF);
- FileHeader = (EFI_FFS_FILE_HEADER *) RelativeAddress;
- } else {
- GetRelativeAddressInBsfBuffer (Bsf2LastStartAddress, &RelativeAddress, SECOND_VTF);
- FileHeader = (EFI_FFS_FILE_HEADER *) RelativeAddress;
- }
-
- if (FileHeader == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // write header
- //
- memset (FileHeader, 0, sizeof (EFI_FFS_FILE_HEADER));
- memcpy (&FileHeader->Name, &EfiFirmwareVolumeTopFileGuid, sizeof (EFI_GUID));
- FileHeader->Type = EFI_FV_FILETYPE_FREEFORM;
- FileHeader->Attributes = FFS_ATTRIB_CHECKSUM;
-
- //
- // Now FileSize includes the EFI_FFS_FILE_HEADER
- //
- FileHeader->Size[0] = (UINT8) (TotalBsfSize & 0x000000FF);
- FileHeader->Size[1] = (UINT8) ((TotalBsfSize & 0x0000FF00) >> 8);
- FileHeader->Size[2] = (UINT8) ((TotalBsfSize & 0x00FF0000) >> 16);
-
- //
- // Fill in checksums and state, all three must be zero for the checksums.
- //
- FileHeader->IntegrityCheck.Checksum.Header = 0;
- FileHeader->IntegrityCheck.Checksum.File = 0;
- FileHeader->State = 0;
- FileHeader->IntegrityCheck.Checksum.Header = CalculateChecksum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
- FileHeader->IntegrityCheck.Checksum.File = CalculateChecksum8 ((UINT8 *) FileHeader, TotalBsfSize);
- FileHeader->State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ValidateAddressAndSize (
- IN UINT64 BaseAddress,
- IN UINT64 FwVolSize
- )
-/*++
-
-Routine Description:
-
- Update the Firmware Volume Buffer with requested buffer data
-
-Arguments:
-
- BaseAddress - Base address for the Fw Volume.
-
- FwVolSize - Total Size of the FwVolume to which BSF will be attached..
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_UNSUPPORTED - The input parameter is error
-
---*/
-{
- if ((BaseAddress >= 0) && (FwVolSize > 0x40) && ((BaseAddress + FwVolSize) % 8 == 0)) {
- return EFI_SUCCESS;
- }
-
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-UpdateIA32ResetVector (
- IN CHAR8 *FileName,
- IN UINT64 FirstFwVSize
- )
-/*++
-
-Routine Description:
-
- Update the 16 byte IA32 Reset vector to maintain the compatibility
-
-Arguments:
-
- FileName - Binary file name which contains the IA32 Reset vector info..
- FirstFwVSize - Total Size of the FwVolume to which BSF will be attached..
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - Invalid File Size
- EFI_INVALID_PARAMETER - Bad File Name
- EFI_OUT_OF_RESOURCES - Memory allocation failed.
-
---*/
-{
- UINT8 *Buffer;
- UINT8 *LocalBsfBuffer;
- UINTN FileSize;
- UINTN NumByteRead;
- FILE *Fp;
-
- if (!strcmp (FileName, "")) {
- return EFI_INVALID_PARAMETER;
- }
-
- Fp = fopen (FileName, "r+b");
-
- if (Fp == NULL) {
- printf ("\nERROR: Unable to open the file %s", FileName);
- }
-
- FileSize = _filelength (fileno (Fp));
-
- if (FileSize > 16) {
- return EFI_ABORTED;
- }
-
- Buffer = malloc (FileSize);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NumByteRead = fread (Buffer, sizeof (UINT8), FileSize, Fp);
-
- LocalBsfBuffer = (UINT8 *) Bsf1EndBuffer - SIZE_IA32_RESET_VECT;
- memcpy (LocalBsfBuffer, Buffer, FileSize);
-
- if (Buffer) {
- free (Buffer);
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-CleanUpMemory (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function cleans up any allocated buffer
-
-Arguments:
-
- NONE
-
-Returns:
-
- NONE
-
---*/
-{
- PARSED_BSF_INFO *TempFileListPtr;
-
- if (Bsf1Buffer) {
- free (Bsf1Buffer);
- }
-
- if (Bsf2Buffer) {
- free (Bsf2Buffer);
- }
-
- //
- // Cleanup the buffer which was allocated to read the file names from FV.INF
- //
- FileListPtr = FileListHeadPtr;
- while (FileListPtr != NULL) {
- TempFileListPtr = FileListPtr->NextBsfInfo;
- free (FileListPtr);
- FileListPtr = TempFileListPtr;
- }
-}
-
-EFI_STATUS
-ProcessAndCreateBsf (
- IN UINT64 Size
- )
-/*++
-
-Routine Description:
-
- This function process the link list created during INF file parsing
- and create component in BSF and updates its info in FIT table
-
-Arguments:
-
- Size - Size of the Firmware Volume of which, this BSF belongs to.
-
-Returns:
-
- EFI_UNSUPPORTED - Unknown FIT type
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- EFI_STATUS Status;
- PARSED_BSF_INFO *ParsedInfoPtr;
-
- Status = EFI_SUCCESS;
-
- ParsedInfoPtr = FileListHeadPtr;
-
- while (ParsedInfoPtr != NULL) {
-
- switch (ParsedInfoPtr->CompType) {
- //
- // COMP_TYPE_FIT_HEADER is a special case, hence handle it here
- //
- case COMP_TYPE_FIT_HEADER:
- Status = CreateFitTableAndInitialize (ParsedInfoPtr);
- break;
-
- //
- // COMP_TYPE_FIT_PAL_A is a special case, hence handle it here
- //
- case COMP_TYPE_FIT_PAL_A:
- Status = CreateAndUpdatePAL_A (ParsedInfoPtr);
-
- //
- // Based on BSF specification, once the PAL_A component has been written,
- // update the Firmware Volume info as FIT table. This will be utilized
- // to extract the Firmware Volume Start address where this BSF will be
- // of part.
- //
- if (Status == EFI_SUCCESS) {
- UpdateFitEntryForFwVolume (Size);
- }
- break;
-
- case COMP_TYPE_FIT_FV_BOOT:
- //
- // Since FIT entry for Firmware Volume has been created and it is
- // located at (PAL_A start - 16 byte). So we will not process any
- // Firmware Volume related entry from INF file
- //
- Status = EFI_SUCCESS;
- break;
-
- default:
- //
- // Any other component type should be handled here. This will create the
- // image in specified BSF and create appropriate entry about this
- // component in FIT Entry.
- //
- Status = CreateAndUpdateComponent (ParsedInfoPtr);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: Updating %s component.\n", ParsedInfoPtr->CompName);
- }
- break;
- }
-
- ParsedInfoPtr = ParsedInfoPtr->NextBsfInfo;
- }
-
- return Status;
-}
-
-EFI_STATUS
-GenerateBsfImage (
- IN UINT64 StartAddress1,
- IN UINT64 Size1,
- IN UINT64 StartAddress2,
- IN UINT64 Size2
- )
-/*++
-
-Routine Description:
-
- This is the main function which will be called from application.
-
-Arguments:
-
- StartAddress1 - The start address of the first BSF
- Size1 - The size of the first BSF
- StartAddress2 - The start address of the second BSF
- Size2 - The size of the second BSF
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can not allocate memory
- The return value can be any of the values
- returned by the calls to following functions:
- GetBsfRelatedInfoFromInfFile
- ProcessAndCreateBsf
- UpdateIA32ResetVector
- UpdateFfsHeader
- WriteBsfBinary
-
---*/
-{
- EFI_STATUS Status;
- CHAR8 OutFileName1[FILE_NAME_SIZE];
- CHAR8 OutFileName2[FILE_NAME_SIZE];
- BOOLEAN SecondBSF;
-
- Status = EFI_UNSUPPORTED;
-
- if (StartAddress2 == 0) {
- SecondBSF = FALSE;
- } else {
- SecondBSF = TRUE;
- }
- Fv1BaseAddress = StartAddress1;
- Fv1EndAddress = Fv1BaseAddress + Size1;
-
- memset (OutFileName1, 0, FILE_NAME_SIZE);
- sprintf (
- OutFileName1,
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x-%s",
- Bsf1NameGuid.Data1,
- Bsf1NameGuid.Data2,
- Bsf1NameGuid.Data3,
- Bsf1NameGuid.Data4[0],
- Bsf1NameGuid.Data4[1],
- Bsf1NameGuid.Data4[2],
- Bsf1NameGuid.Data4[3],
- Bsf1NameGuid.Data4[4],
- Bsf1NameGuid.Data4[5],
- Bsf1NameGuid.Data4[6],
- Bsf1NameGuid.Data4[7],
- BSF_OUTPUT_FILE
- );
-
- //
- // The image buffer for the First BSF
- //
- Bsf1Buffer = malloc ((UINTN) Size1);
- if (Bsf1Buffer == NULL) {
- printf ("\nERROR: Not enough resource to create memory mapped file for Boot Strap File");
- return EFI_OUT_OF_RESOURCES;
- }
- memset (Bsf1Buffer, 0x00, (UINTN) Size1);
- Bsf1EndBuffer = (UINT8 *) Bsf1Buffer + Size1;
- Bsf1LastStartAddress = Fv1EndAddress | IPF_CACHE_BIT;
-
- if (SecondBSF) {
- Fv2BaseAddress = StartAddress2;
- Fv2EndAddress = Fv2BaseAddress + Size2;
-
- memset (OutFileName2, 0, FILE_NAME_SIZE);
- sprintf (
- OutFileName2,
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x-%s",
- Bsf2NameGuid.Data1,
- Bsf2NameGuid.Data2,
- Bsf2NameGuid.Data3,
- Bsf2NameGuid.Data4[0],
- Bsf2NameGuid.Data4[1],
- Bsf2NameGuid.Data4[2],
- Bsf2NameGuid.Data4[3],
- Bsf2NameGuid.Data4[4],
- Bsf2NameGuid.Data4[5],
- Bsf2NameGuid.Data4[6],
- Bsf2NameGuid.Data4[7],
- BSF_OUTPUT_FILE
- );
-
- //
- // The image buffer for the second BSF
- //
- Bsf2Buffer = malloc ((UINTN) Size2);
- if (Bsf2Buffer == NULL) {
- printf ("\nERROR: Not enough resource to create memory mapped file for Boot Strap File");
- return EFI_OUT_OF_RESOURCES;
- }
- memset (Bsf2Buffer, 0x00, (UINTN) Size2);
- Bsf2EndBuffer = (UINT8 *) Bsf2Buffer + Size2;
- Bsf2LastStartAddress = Fv2EndAddress | IPF_CACHE_BIT;
- }
-
- Status = GetBsfRelatedInfoFromInfFile (BSF_INPUT_FILE);
- if (Status != EFI_SUCCESS) {
- printf ("\nERROR: Error in parsing input file");
- CleanUpMemory ();
- return Status;
- }
-
- Status = ProcessAndCreateBsf (Size1);
- if (Status != EFI_SUCCESS) {
- CleanUpMemory ();
- return Status;
- }
-
- Status = UpdateIA32ResetVector (IA32BinFile, Bsf1TotalSize);
- if (Status != EFI_SUCCESS) {
- CleanUpMemory ();
- return Status;
- }
-
- //
- // Re arrange the FIT Table for Ascending order of their FIT Type..
- //
- SortFitTable ();
-
- //
- // All components have been updated in FIT table. Now perform the FIT table
- // checksum. The following function will check if Checksum is required,
- // if yes, then it will perform the checksum otherwise not.
- //
- CalculateFitTableChecksum ();
-
- //
- // Write the FFS header
- //
- Bsf1TotalSize += sizeof (EFI_FFS_FILE_HEADER);
- Bsf1LastStartAddress -= sizeof (EFI_FFS_FILE_HEADER);
- Status = UpdateFfsHeader (Bsf1TotalSize, FIRST_VTF);
- if (Status != EFI_SUCCESS) {
- CleanUpMemory ();
- return Status;
- }
- //
- // Update the BSF buffer into specified BSF binary file
- //
- Status = WriteBsfBinary (OutFileName1, Bsf1TotalSize, FIRST_VTF);
-
- if (SecondBSF) {
- Bsf2TotalSize += sizeof (EFI_FFS_FILE_HEADER);
- Bsf2LastStartAddress -= sizeof (EFI_FFS_FILE_HEADER);
- Status = UpdateFfsHeader (Bsf2TotalSize, SECOND_VTF);
- if (Status != EFI_SUCCESS) {
- CleanUpMemory ();
- return Status;
- }
-
- //
- // Update the BSF buffer into specified BSF binary file
- //
- Status = WriteBsfBinary (OutFileName2, Bsf2TotalSize, SECOND_VTF);
- }
-
- CleanUpMemory ();
- printf ("\n");
-
- return Status;
-}
-
-EFI_STATUS
-PeimFixupInFitTable (
- IN UINT64 StartAddress
- )
-/*++
-
-Routine Description:
-
- This function is an entry point to fixup SAL-E entry point.
-
-Arguments:
-
- StartAddress - StartAddress for PEIM.....
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - Error Opening File
- EFI_OUT_OF_RESOURCES - System out of resources for memory allocation.
-
---*/
-{
- EFI_STATUS Status;
- FILE *Fp;
- UINT64 *StartAddressPtr;
- UINTN FirstFwVSize;
- UINTN NumByte;
- CHAR8 OutFileName1[FILE_NAME_SIZE];
-
- StartAddressPtr = malloc (sizeof (UINT64));
- if (StartAddressPtr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- *StartAddressPtr = StartAddress;
-
- memset (OutFileName1, 0, FILE_NAME_SIZE);
-
- sprintf (
- OutFileName1,
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x-%s",
- Bsf1NameGuid.Data1,
- Bsf1NameGuid.Data2,
- Bsf1NameGuid.Data3,
- Bsf1NameGuid.Data4[0],
- Bsf1NameGuid.Data4[1],
- Bsf1NameGuid.Data4[2],
- Bsf1NameGuid.Data4[3],
- Bsf1NameGuid.Data4[4],
- Bsf1NameGuid.Data4[5],
- Bsf1NameGuid.Data4[6],
- Bsf1NameGuid.Data4[7],
- BSF_OUTPUT_FILE
- );
-
- Fp = fopen (OutFileName1, "r+b");
-
- if (Fp == NULL) {
- printf ("\nERROR: Error opening file ");
- if (StartAddressPtr) {
- free (StartAddressPtr);
- }
-
- return EFI_ABORTED;
- }
-
- FirstFwVSize = _filelength (fileno (Fp));
- fseek (Fp, (long) (FirstFwVSize - (UINTN) (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT)), SEEK_SET);
- NumByte = fwrite ((VOID *) StartAddressPtr, sizeof (UINT64), 1, Fp);
-
- if (Fp) {
- fclose (Fp);
- }
-
- if (StartAddressPtr) {
- free (StartAddressPtr);
- }
-
- printf ("\n");
- Status = EFI_SUCCESS;
- return Status;
-}
-
-EFI_STATUS
-UpdateSymFile (
- IN UINT64 BaseAddress,
- IN CHAR8 *DestFileName,
- IN CHAR8 *SourceFileName
- )
-/*++
-
-Routine Description:
-
- This function adds the SYM tokens in the source file to the destination file.
- The SYM tokens are updated to reflect the base address.
-
-Arguments:
-
- BaseAddress - The base address for the new SYM tokens.
- DestFileName - The destination file.
- SourceFileName - The source file.
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully.
- EFI_INVALID_PARAMETER - One of the input parameters was invalid.
- EFI_ABORTED - An error occurred.
-
---*/
-{
- FILE *SourceFile;
- FILE *DestFile;
- CHAR8 Buffer[_MAX_PATH];
- CHAR8 Type[_MAX_PATH];
- CHAR8 Address[_MAX_PATH];
- CHAR8 Section[_MAX_PATH];
- CHAR8 Token[_MAX_PATH];
- CHAR8 BaseToken[_MAX_PATH];
- UINT64 TokenAddress;
- long StartLocation;
-
- //
- // Verify input parameters.
- //
- if (BaseAddress == 0 || DestFileName == NULL || SourceFileName == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Open the source file
- //
- SourceFile = fopen (SourceFileName, "r");
- if (SourceFile == NULL) {
-
- //
- // SYM files are not required.
- //
- return EFI_SUCCESS;
- }
-
- //
- // Use the file name minus extension as the base for tokens
- //
- strcpy (BaseToken, SourceFileName);
- strtok (BaseToken, ". \t\n");
- strcat (BaseToken, "__");
-
- //
- // Open the destination file
- //
- DestFile = fopen (DestFileName, "a+");
- if (DestFile == NULL) {
- fclose (SourceFile);
- return EFI_ABORTED;
- }
-
- //
- // If this is the beginning of the output file, write the symbol format info.
- //
- if (fseek (DestFile, 0, SEEK_END) != 0) {
- fclose (SourceFile);
- fclose (DestFile);
- return EFI_ABORTED;
- }
-
- StartLocation = ftell (DestFile);
-
- if (StartLocation == 0) {
- fprintf (DestFile, "TEXTSYM format | V1.0\n");
- } else if (StartLocation == -1) {
- fclose (SourceFile);
- fclose (DestFile);
- return EFI_ABORTED;
- }
-
- //
- // Read the first line
- //
- if (fgets (Buffer, _MAX_PATH, SourceFile) == NULL) {
- Buffer[0] = 0;
- }
-
- //
- // Make sure it matches the expected sym format
- //
- if (strcmp (Buffer, "TEXTSYM format | V1.0\n")) {
- fclose (SourceFile);
- fclose (DestFile);
- return EFI_ABORTED;
- }
-
- //
- // Read in the file
- //
- while (feof (SourceFile) == 0) {
-
- //
- // Read a line
- //
- if (fscanf (SourceFile, "%s | %s | %s | %s\n", Type, Address, Section, Token) == 4) {
-
- //
- // Get the token address
- //
- AsciiStringToUint64 (Address, TRUE, &TokenAddress);
-
- //
- // Add the base address, the size of the FFS file header and the size of the peim header.
- //
- TokenAddress += BaseAddress &~IPF_CACHE_BIT;
-
- fprintf (DestFile, "%s | %016I64X | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);
- }
- }
-
- fclose (SourceFile);
- fclose (DestFile);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CalculateFitTableChecksum (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will perform byte checksum on the FIT table, if the the checksum required
- field is set to CheckSum required. If the checksum is not required then checksum byte
- will have value as 0;.
-
-Arguments:
-
- NONE
-
-Returns:
-
- Status - Value returned by call to CalculateChecksum8 ()
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- FIT_TABLE *TmpFitPtr;
- UINT64 FitTableAdd;
- UINT64 FitTableAddOffset;
- UINTN RelativeAddress;
- UINTN Size;
-
- //
- // Read the Fit Table address from Itanium-based address map.
- //
- FitTableAddOffset = Fv1EndAddress - (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT + SIZE_FIT_TABLE_ADD);
-
- //
- // Translate this Itanium-based address in terms of local buffer address which
- // contains the image for Boot Strapped File
- //
- GetRelativeAddressInBsfBuffer (FitTableAddOffset, &RelativeAddress, FIRST_VTF);
- FitTableAdd = *(UINTN *) RelativeAddress;
-
- GetRelativeAddressInBsfBuffer (FitTableAdd, &RelativeAddress, FIRST_VTF);
-
- TmpFitPtr = (FIT_TABLE *) RelativeAddress;
-
- Size = TmpFitPtr->CompSize * 16;
-
- if ((TmpFitPtr->CvAndType & CHECKSUM_BIT_MASK) >> 7) {
- TmpFitPtr->CheckSum = 0;
- TmpFitPtr->CheckSum = CalculateChecksum8 ((UINT8 *) TmpFitPtr, Size);
- } else {
- TmpFitPtr->CheckSum = 0;
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf (
- "%s, EFI 2.0 BootStrap File Generation Utility. Version %i.%i.\n",
- UTILITY_NAME,
- UTILITY_MAJOR_VERSION,
- UTILITY_MINOR_VERSION
- );
-}
-
-VOID
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the utility usage syntax to STDOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- Version();
-
- printf (
- "\nUsage: %s -B BaseAddress -S FwVolumeSize\n",
- UTILITY_NAME
- );
- printf (" Where:\n");
- printf (" BaseAddress is the starting address of Firmware Volume where Boot\n");
- printf (" Strapped Image will reside.\n");
- printf (" FwVolumeSize is the size of Firmware Volume.\n");
-}
-
-EFI_STATUS
-main (
- IN UINTN argc,
- IN CHAR8 **argv
- )
-/*++
-
-Routine Description:
-
- This utility uses GenBsfImage.dll to build a Boot Strap File Image which will be
- part of firmware volume image.
-
-Arguments:
-
- argc - The count of the parameters
- argv - The parameters
-
-
-Returns:
-
- 0 - No error conditions detected.
- 1 - One or more of the input parameters is invalid.
- 2 - A resource required by the utility was unavailable.
- - Most commonly this will be memory allocation or file creation.
- 3 - GenFvImage.dll could not be loaded.
- 4 - Error executing the GenFvImage dll.
- 5 - Now this tool does not support the IA32 platform
-
---*/
-{
- UINT8 Index;
- UINT64 StartAddress1;
- UINT64 StartAddress2;
- UINT64 FwVolSize1;
- UINT64 FwVolSize2;
- BOOLEAN FirstRoundB;
- BOOLEAN FirstRoundS;
- EFI_STATUS Status;
- BOOLEAN IsIA32;
-
- //
- // Verify the correct number of IA32 arguments
- //
- IsIA32 = FALSE;
- if (argc == IA32_ARGS) {
- //
- // Now this tool is not used for IA32 platform, if it will be used in future,
- // the IA32-specific functions need to be updated and verified, the updating can
- // refer to IPF relevant functions)
- //
- printf ("ERROR: Now this tool does not support the IA32 platform!\n");
- printf ("ERROR: And the IA32-specific functions need to be updated and verified!\n");
- return 5;
-
- /*
- StartAddress1 = 0;
- IsIA32 = TRUE;
-
- //
- // Parse the command line arguments
- //
- for (Index = 1; Index < IA32_ARGS; Index += 2) {
-
- //
- // Make sure argument pair begin with - or /
- //
- if (argv[Index][0] != '-' && argv[Index][0] != '/') {
- Usage ();
- printf ("ERROR: Argument pair must begin with \"-\" or \"/\"\n");
- return 1;
- }
-
- //
- // Make sure argument specifier is only one letter
- //
- if (argv[Index][2] != 0) {
- Usage ();
- printf ("ERROR: Unrecognized argument \"%s\".\n", argv[Index]);
- return 1;
- }
-
- //
- // Determine argument to read
- //
- switch (argv[Index][1]) {
-
- case 't':
- case 'T':
- Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &StartAddress1);
- if (Status != EFI_SUCCESS) {
- printf ("\nERROR: Bad start of address \"%s\"\n", argv[Index + 1]);
- return 1;
- }
- break;
-
- default:
- Usage ();
- printf ("Unrecognized IA32 argument \"%s\".\n", argv[Index]);
- IsIA32 = FALSE;
- break;
- }
- }
-
- if (IsIA32) {
- //
- // Call the GenBsfImage
- //
- Status = Generate32BsfImage (StartAddress1);
-
- if (EFI_ERROR(Status)) {
- switch (Status) {
-
- case EFI_INVALID_PARAMETER:
- printf ("\nERROR: Invalid parameter passed to GenBsfImage function .\n");
- break;
-
- case EFI_ABORTED:
- printf ("\nERROR: Error detected while creating the file image.\n");
- break;
-
- case EFI_OUT_OF_RESOURCES:
- printf ("\nERROR: GenBsfImage function could not allocate required resources.\n");
- break;
-
- case EFI_VOLUME_CORRUPTED:
- printf ("\nERROR: No base address was specified \n");
- break;
-
- default:
- printf ("\nERROR: GenBsfImage function returned unknown status %X.\n", Status);
- break;
- }
- return 2;
- }
-
- return 0;
- }
- */
- }
-
- //
- // Verify the correct number of arguments
- //
- if (argc == 1) {
- Usage();
- return 1;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return 1;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return 1;
- }
-
- if (argc != ONE_BSF_ARGS && argc != TWO_BSF_ARGS) {
- Usage ();
- return 1;
- }
-
- //
- // Initialize variables
- //
- StartAddress1 = 0;
- StartAddress2 = 0;
- FwVolSize1 = 0;
- FwVolSize2 = 0;
- FirstRoundB = TRUE;
- FirstRoundS = TRUE;
-
- //
- // Parse the command line arguments
- //
- for (Index = 1; Index < argc; Index += 2) {
-
- //
- // Make sure argument pair begin with - or /
- //
- if (argv[Index][0] != '-' && argv[Index][0] != '/') {
- Usage ();
- printf ("ERROR: Argument pair must begin with \"-\" or \"/\"\n");
- return 1;
- }
-
- //
- // Make sure argument specifier is only one letter
- //
- if (argv[Index][2] != 0) {
- Usage ();
- printf ("ERROR: Unrecognized argument \"%s\".\n", argv[Index]);
- return 1;
- }
-
- //
- // Determine argument to read
- //
- switch (argv[Index][1]) {
-
- case 'B':
- case 'b':
- if (FirstRoundB) {
- Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &StartAddress1);
- FirstRoundB = FALSE;
- } else {
- Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &StartAddress2);
- }
-
- if (Status != EFI_SUCCESS) {
- printf ("\nERROR: Bad start of address \"%s\"\n", argv[Index + 1]);
- return 1;
- }
- break;
-
- case 'S':
- case 's':
- if (FirstRoundS) {
- Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &FwVolSize1);
- FirstRoundS = FALSE;
- } else {
- Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &FwVolSize2);
- }
-
- if (Status != EFI_SUCCESS) {
- printf ("\nERROR: Bad size \"%s\"\n", argv[Index + 1]);
- return 1;
- }
- break;
-
- default:
- Usage ();
- printf ("ERROR: Unrecognized argument \"%s\".\n", argv[Index]);
- return 1;
- break;
- }
- }
-
- //
- // Call the GenBsfImage
- //
- Status = GenerateBsfImage (StartAddress1, FwVolSize1, StartAddress2, FwVolSize2);
-
- if (EFI_ERROR (Status)) {
- switch (Status) {
-
- case EFI_INVALID_PARAMETER:
- printf ("\nERROR: Invalid parameter passed to GenBsfImage function .\n");
- break;
-
- case EFI_ABORTED:
- printf ("\nERROR: Error detected while creating the file image.\n");
- break;
-
- case EFI_OUT_OF_RESOURCES:
- printf ("\nERROR: GenBsfImage function could not allocate required resources.\n");
- break;
-
- case EFI_VOLUME_CORRUPTED:
- printf ("\nERROR: No base address was specified \n");
- break;
-
- default:
- printf ("\nERROR: GenBsfImage function returned unknown status %X.\n", Status);
- break;
- }
- return 2;
- }
- return 0;
-}
-
-EFI_STATUS
-Generate32BsfImage (
-IN UINT64 BootFileStartAddress
- )
-/*++
-
-Routine Description:
-
- This is the main IA32 function which will be called from application.
- (Now this tool is not used for IA32 platform, if it will be used in future,
- the relative functions need to be updated, the updating can refer to IPF
- functions)
-
-Arguments:
-
- BootFileStartAddress - Top Address of Boot File
-
-Returns:
-
- The return value can be any of the values
- returned by the calls to following functions:
- Get32BsfRelatedInfoFromInfFile
- CreateBsfBuffer
- ProcessAndCreate32Bsf
- Update32FfsHeader
- WriteBsfBinary
-
---*/
-{
- EFI_STATUS Status;
- UINT32 BsfSize;
- CHAR8 OutFileName[FILE_NAME_SIZE];
-
- EFI_GUID BsfNameGuid = EFI_IA32_BOOT_STRAP_GUID;
-
- Status = EFI_UNSUPPORTED;
-
- memset (OutFileName, 0, FILE_NAME_SIZE);
-
- sprintf (
- OutFileName, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x-%s",
- BsfNameGuid.Data1,
- BsfNameGuid.Data2,
- BsfNameGuid.Data3,
- BsfNameGuid.Data4[0],
- BsfNameGuid.Data4[1],
- BsfNameGuid.Data4[2],
- BsfNameGuid.Data4[3],
- BsfNameGuid.Data4[4],
- BsfNameGuid.Data4[5],
- BsfNameGuid.Data4[6],
- BsfNameGuid.Data4[7],
- BSF_OUTPUT_FILE
- );
-
-
- Status = Get32BsfRelatedInfoFromInfFile (BSF_INPUT_FILE);
-
- if (Status != EFI_SUCCESS) {
- printf ("\nERROR: Error in parsing input file");
- CleanUpMemory ();
- return Status;
- }
-
- if (GetTotal32BsfSize (&BsfSize) == EFI_SUCCESS) {
- Bsf1Buffer = malloc ((UINTN) BsfSize);
- if (Bsf1Buffer == NULL) {
- printf ("\nERROR: Not enough resource to create memory mapped file for Boot Strap File");
- CleanUpMemory ();
- return EFI_OUT_OF_RESOURCES;
- }
- memset (Bsf1Buffer, 0x00, (UINTN) BsfSize);
- } else {
- printf ("\nERROR: Could not get BSF size.");
- CleanUpMemory ();
- return EFI_ABORTED;
- }
-
- //
- //VTF must align properly
- //
- Bsf1LastStartAddress = BootFileStartAddress - BsfSize;
- Bsf1LastStartAddress = Bsf1LastStartAddress & -8;
- BsfSize = (UINT32)BootFileStartAddress - (UINT32)Bsf1LastStartAddress;
- Bsf1LastStartAddress = BsfSize;
- BufferToTop = (UINT32)BootFileStartAddress - BsfSize;
-
- Status = ProcessAndCreate32Bsf (BsfSize);
-
- if (Status != EFI_SUCCESS) {
- CleanUpMemory();
- return Status;
- }
-
- //
- // Write the FFS header
- //
- Status = Update32FfsHeader (BsfSize);
-
- if (Status != EFI_SUCCESS) {
- CleanUpMemory();
- return Status;
- }
-
- //
- // Calculate the Start address of this BSF
- //
- Bsf1Buffer = (UINT8 *)Bsf1Buffer + Bsf1LastStartAddress;
-
- //
- // Update the BSF buffer into specified BSF binary file
- //
- Status = WriteBsfBinary (OutFileName, BsfSize - (UINT32)Bsf1LastStartAddress, FIRST_VTF);
-
- if (Status != EFI_SUCCESS) {
- CleanUpMemory();
- return Status;
- }
-
- Status = Write32SoftFit (IA32_SOFT_FIT, FileListHeadPtr);
-
- if (Status != EFI_SUCCESS) {
- CleanUpMemory();
- return Status;
- }
-
- CleanUpMemory ();
- printf ("\n");
-
- return Status;
-}
-
-EFI_STATUS
-GetTotal32BsfSize(
- IN UINT32 *BsfSize
- )
-/*++
-
-Routine Description:
-
- This function calculates total size for IA32 BSF which would be needed to create
- the buffer. This will be done using Passed Info link list and looking for the
- size of the components which belong to BSF. The addtional file header is accounted.
-
-Arguments:
-
- BSFSize - Pointer to the size of IA32 BSF
-
-Returns:
-
- EFI_ABORTED - Returned due to one of the following resons:
- (a) Error Opening File
- EFI_SUCCESS - The fuction completes successfully
-
---*/
-{
- PARSED_BSF_INFO *BsfInfo;
- FILE *Fp;
- UINT32 Alignment;
-
- *BsfSize = 0;
- Alignment = 0;
-
- BsfInfo = FileListHeadPtr;
-
- while (BsfInfo != NULL) {
- if (BsfInfo->LocationType != SECOND_VTF) {
-
- if ( BsfInfo->Align ) {
- //
- // Create additional align to compensate for component boundary requirements
- //
- Alignment = 1 << BsfInfo->Align;
- *BsfSize += Alignment;
- }
-
- if (BsfInfo->PreferredSize) {
- *BsfSize += BsfInfo->CompSize;
- } else {
- Fp = fopen (BsfInfo->CompBinName,"r+b");
-
- if (Fp == NULL) {
- printf ("\nERROR: Error in opening file %s", BsfInfo->CompBinName);
- return EFI_ABORTED;
- }
-
- *BsfSize += _filelength (fileno (Fp));
-
- if (Fp) {
- fclose (Fp);
- }
- }
- }
- BsfInfo = BsfInfo->NextBsfInfo;
- }
-
- //
- // Add file header space
- //
- *BsfSize += sizeof (EFI_FFS_FILE_HEADER);
-
- //
- // Create additional to IA32 Seccore section header
- //
- *BsfSize += sizeof (EFI_COMMON_SECTION_HEADER);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ProcessAndCreate32Bsf (
- IN UINT64 Size
- )
-/*++
-
-Routine Description:
-
- This function process the link list created during INF file parsing
- and create component in IA32 BSF
-
-Arguments:
-
- Size - Size of the Firmware Volume of which, this BSF belongs to.
-
-Returns:
-
- EFI_UNSUPPORTED - Unknown component type
- EFI_SUCCESS - The function completed successfully
-
---*/
-{
- EFI_STATUS Status;
- PARSED_BSF_INFO *ParsedInfoPtr;
-
- Status = EFI_SUCCESS;
-
- ParsedInfoPtr = FileListHeadPtr;
-
- while (ParsedInfoPtr != NULL) {
-
- switch (ParsedInfoPtr->CompType) {
-
- case COMP_TYPE_SECCORE:
- Status = CreateAndUpdateSeccore (ParsedInfoPtr);
- break;
-
- default:
- //
- // Any other component type should be handled here. This will create the
- // image in specified BSF
- //
- Status = CreateAndUpdate32Component (ParsedInfoPtr);
- if (EFI_ERROR(Status)) {
- printf ("ERROR: Updating %s component.\n", ParsedInfoPtr->CompName);
- }
- break;
- }
-
- ParsedInfoPtr = ParsedInfoPtr->NextBsfInfo;
- }
-
- return Status;
-}
-
-EFI_STATUS
-CreateAndUpdateSeccore (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function reads the binary file for seccore and update them
- in IA32 BSF Buffer
-
-Arguments:
-
- BsfInfo - Pointer to Parsed Info
-
-Returns:
-
- EFI_ABORTED - Due to one of the following reasons:
- (a)Error Opening File
- (b)The PAL_A Size is more than specified size status
- One of the values mentioned below returned from
- call to UpdateSymFile
- EFI_SUCCESS - The function completed successfully.
- EFI_INVALID_PARAMETER - One of the input parameters was invalid.
- EFI_ABORTED - An error occurred.UpdateSymFile
- EFI_OUT_OF_RESOURCES - Memory allocation failed.
-
---*/
-{
- UINT8 *SecbinStartAddress;
- UINT8 *SecfileStartAddress;
- UINT32 FileSize;
- UINT64 NumByteRead;
- UINT8 *Buffer;
- FILE *Fp;
- UINT64 TotalLength;
- EFI_COMMON_SECTION_HEADER *SecHeader;
-
- Fp = fopen (BsfInfo->CompBinName, "r+b");
-
- if (Fp == NULL) {
- printf ("\nERROR: Opening file %s", BsfInfo->CompBinName);
- return EFI_ABORTED;
- }
-
- FileSize = _filelength (fileno (Fp));
-
- if (BsfInfo->PreferredSize) {
- if (FileSize > BsfInfo->CompSize) {
- printf("\nERROR: The Seccore Size is more than specified size");
- return EFI_ABORTED;
- }
-
- FileSize = BsfInfo->CompSize;
- }
-
- BsfInfo->CompSize = FileSize;
-
- Buffer = malloc ((UINTN) FileSize);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- memset (Buffer, 0, (UINTN) FileSize);
-
- //
- // Read seccore in a buffer
- //
- NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);
- fclose (Fp);
-
- SecfileStartAddress = (UINT8 *) Bsf1Buffer + Bsf1LastStartAddress - FileSize - sizeof (EFI_COMMON_SECTION_HEADER);
- if (SecfileStartAddress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- SecbinStartAddress = SecfileStartAddress + sizeof (EFI_COMMON_SECTION_HEADER);
-
- BsfInfo->CompPreferredAddress = Bsf1LastStartAddress - FileSize + BufferToTop;
-
- //
- // write section header
- //
- memset (SecfileStartAddress, 0, sizeof (EFI_COMMON_SECTION_HEADER));
- SecHeader = (EFI_COMMON_SECTION_HEADER *) SecfileStartAddress;
- SecHeader->Type = EFI_SECTION_RAW;
- TotalLength = sizeof (EFI_COMMON_SECTION_HEADER) + (UINT64) FileSize;
- memcpy (SecHeader->Size, &TotalLength, 3);
-
- //
- // write seccore
- //
- memcpy (SecbinStartAddress, Buffer, (UINTN) FileSize);
-
- if (Buffer) {
- free (Buffer);
- }
-
- Bsf1LastStartAddress = SecfileStartAddress - (UINT8 *) Bsf1Buffer;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CreateAndUpdate32Component (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function reads the binary file for each components. Add it at aligned address.
-
-Arguments:
-
- BsfInfo - Pointer to Parsed Info
-
-Returns:
-
- EFI_SUCCESS - The function completed successful
- EFI_ABORTED - Aborted due to one of the many reasons like:
- (a) Component Size greater than the specified size.
- (b) Error opening files.
- EFI_INVALID_PARAMETER - Value returned from call to UpdateEntryPoint()
- EFI_OUT_OF_RESOURCES - Memory allocation failed.
-
---*/
-{
- UINT64 CompStartAddress;
- UINT32 FileSize;
- UINT64 NumByteRead;
- UINT8 *Buffer;
- FILE *Fp;
- UINT8 *LocalBufferPtrToWrite;
- UINT64 Alignment;
-
- Fp = fopen (BsfInfo->CompBinName, "r+b");
-
- if (Fp == NULL) {
- printf("\nERROR: Opening file %s", BsfInfo->CompBinName);
- return EFI_ABORTED;
- }
-
- FileSize = _filelength (fileno (Fp));
-
- if (BsfInfo->PreferredSize) {
- if (FileSize > BsfInfo->CompSize) {
- printf("\nERROR: The component size is more than specified size");
- return EFI_ABORTED;
- }
- FileSize = BsfInfo->CompSize;
- }
- BsfInfo->CompSize = FileSize;
-
- Buffer = malloc ((UINTN) FileSize);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- memset (Buffer,0, (UINTN) FileSize);
-
- NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);
- fclose (Fp);
-
- CompStartAddress = Bsf1LastStartAddress - FileSize + BufferToTop;
-
- if (BsfInfo->Align) {
- //
- // Create additional align to compensate for component boundary requirements
- //
- Alignment = 0 - (1 << BsfInfo->Align);
- CompStartAddress = CompStartAddress & Alignment;
- }
-
- BsfInfo->CompPreferredAddress = CompStartAddress;
-
- //
- // write bin
- //
- LocalBufferPtrToWrite = (UINT8 *) Bsf1Buffer;
- Bsf1LastStartAddress = CompStartAddress - BufferToTop;
- LocalBufferPtrToWrite += Bsf1LastStartAddress;
- memcpy (LocalBufferPtrToWrite, Buffer, (UINTN) FileSize);
- Bsf1LastStartAddress = CompStartAddress - BufferToTop;
-
- //
- // Free the buffer
- //
- if (Buffer) {
- free (Buffer);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Update32FfsHeader(
- IN UINT32 BsfSize
- )
-/*++
-
-Routine Description:
-
- Update the Firmware Volume Buffer with requested buffer data
-
-Arguments:
-
- BsfSize - Size of the IA32 BSF
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_INVALID_PARAMETER - The Ffs File Header Pointer is NULL
-
---*/
-{
- EFI_FFS_FILE_HEADER *FileHeader;
- UINT32 TotalBsfSize;
- EFI_GUID EfiFirmwareVolumeTopFileGuid = EFI_FFS_VOLUME_TOP_FILE_GUID;
-
-
- //
- // Find the BSF file header location, the bsf file must be 8 bytes aligned
- //
- Bsf1LastStartAddress -= sizeof (EFI_FFS_FILE_HEADER);
- Bsf1LastStartAddress += BufferToTop;
- Bsf1LastStartAddress = Bsf1LastStartAddress & -8;
- Bsf1LastStartAddress -= BufferToTop;
- FileHeader = (EFI_FFS_FILE_HEADER*)((UINT8*)Bsf1Buffer + Bsf1LastStartAddress);
-
- if (FileHeader == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // write header
- //
- memset (FileHeader, 0, sizeof(EFI_FFS_FILE_HEADER));
- memcpy (&FileHeader->Name, &EfiFirmwareVolumeTopFileGuid, sizeof (EFI_GUID));
-
- FileHeader->Type = EFI_FV_FILETYPE_FREEFORM;
- FileHeader->Attributes = FFS_ATTRIB_CHECKSUM;
-
- //
- // Now FileSize includes the EFI_FFS_FILE_HEADER
- //
- TotalBsfSize = BsfSize - (UINT32)Bsf1LastStartAddress;
- FileHeader->Size[0] = (UINT8) (TotalBsfSize & 0x000000FF);
- FileHeader->Size[1] = (UINT8) ((TotalBsfSize & 0x0000FF00) >> 8);
- FileHeader->Size[2] = (UINT8) ((TotalBsfSize & 0x00FF0000) >> 16);
-
- //
- // Fill in checksums and state, all three must be zero for the checksums.
- //
- FileHeader->IntegrityCheck.Checksum.Header = 0;
- FileHeader->IntegrityCheck.Checksum.File = 0;
- FileHeader->State = 0;
- FileHeader->IntegrityCheck.Checksum.Header = CalculateChecksum8 ((UINT8*) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
- FileHeader->IntegrityCheck.Checksum.File = CalculateChecksum8 ((UINT8*) FileHeader, TotalBsfSize);
- FileHeader->State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Get32BsfRelatedInfoFromInfFile (
- IN CHAR8 *FileName
- )
-/*++
-
-Routine Description:
-
- This function reads the input file, parse it and create a list of tokens
- which is parsed and used, to intialize the data related to IA32 BSF
-
-Arguments:
-
- FileName FileName which needed to be read to parse data
-
-Returns:
-
- EFI_ABORTED Error in opening file
- EFI_INVALID_PARAMETER File doesn't contain any valid informations
- EFI_OUT_OF_RESOURCES Malloc Failed
- EFI_SUCCESS The function completed successfully
-
---*/
-{
- FILE *Fp;
- UINTN Index;
- EFI_STATUS Status;
-
- Fp = fopen (FileName, "r");
- if (Fp == NULL) {
- printf ("\nERROR: Error in opening %s file\n", FileName);
- return EFI_ABORTED;
- }
-
- ValidLineCount (Fp);
-
- if (ValidLineNum == 0) {
- printf ("\nERROR: File doesn't contain any valid informations");
- return EFI_INVALID_PARAMETER;
- }
-
- TokenStr = (CHAR8 **)malloc (sizeof (UINTN) * (2 * ValidLineNum + 1));
-
- if (TokenStr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- memset (TokenStr, 0, (sizeof (UINTN) * (2 * ValidLineNum + 1)));
- OrgStrTokPtr = TokenStr;
-
- for (Index = 0; Index < (2 * ValidLineNum); Index++) {
- *TokenStr = (CHAR8 *)malloc (sizeof (CHAR8) * FILE_NAME_SIZE);
-
- if (*TokenStr == NULL) {
- free (OrgStrTokPtr);
- return EFI_OUT_OF_RESOURCES;
- }
-
- memset (*TokenStr, 0, FILE_NAME_SIZE);
-// free (*TokenStr);
- TokenStr++;
- }
-
- TokenStr = NULL;
- TokenStr = OrgStrTokPtr;
- fseek (Fp, 0L, SEEK_SET);
-
- Status = InitializeComps();
-
- if (Status != EFI_SUCCESS) {
- free (TokenStr);
- return Status;
- }
- ParseInputFile (Fp);
- Initialize32InFileInfo ();
-
- if (Fp) {
- fclose (Fp);
- }
- free (TokenStr);
- return EFI_SUCCESS;
-}
-
-VOID
-Initialize32InFileInfo (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function intializes the relevant global variable which is being
- used to store the information retrieved from IA32 INF file.
-
-Arguments:
-
- NONE
-
-Returns:
-
- NONE
-
---*/
-{
- UINTN SectionOptionFlag;
- UINTN SectionCompFlag;
-
- SectionOptionFlag =0 ;
- SectionCompFlag = 0;
- TokenStr = OrgStrTokPtr;
- while (*TokenStr != NULL) {
- if (_stricmp (*TokenStr, "[OPTIONS]") == 0) {
- SectionOptionFlag = 1;
- SectionCompFlag = 0;
- }
-
- if (_stricmp (*TokenStr, "[COMPONENTS]") == 0) {
- if (FileListPtr == NULL) {
- FileListPtr = FileListHeadPtr;
- }
-
- SectionCompFlag = 1;
- SectionOptionFlag = 0;
- TokenStr++;
- }
-
- if (SectionOptionFlag) {
- if (_stricmp (*TokenStr, "IA32_RST_BIN") == 0) {
- *TokenStr++;
- strcpy (IA32BinFile, *TokenStr);
- }
- }
-
- if (SectionCompFlag) {
- if (_stricmp (*TokenStr, "COMP_NAME") == 0) {
- TokenStr++;
- strcpy (FileListPtr->CompName, *TokenStr);
- TokenStr++;
- ParseAndUpdate32Components (FileListPtr);
- }
-
- if (*TokenStr != NULL) {
- FileListPtr->NextBsfInfo = malloc (sizeof (PARSED_BSF_INFO));
- if (FileListPtr->NextBsfInfo == NULL) {
- printf ("Error: Out of memory resources.\n");
- break;
- }
- FileListPtr = FileListPtr->NextBsfInfo;
- memset (FileListPtr, 0, sizeof(PARSED_BSF_INFO));
- FileListPtr->NextBsfInfo = NULL;
- continue;
- } else {
- break;
- }
- }
-
- TokenStr++;
- }
-}
-
-VOID
-ParseAndUpdate32Components (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function intializes the relevant global variable which is being
- used to store the information retrieved from INF file.
-
-Arguments:
-
- BsfInfo - A pointer to the BSF Info Structure
-
-
-Returns:
-
- None
-
---*/
-{
- UINT64 StringValue;
- UINT64 AlignStringValue;
-
- while (*TokenStr != NULL && (_stricmp (*TokenStr, "COMP_NAME") != 0)) {
-
- if (_stricmp (*TokenStr, "COMP_LOC") == 0) {
- TokenStr++;
- if (_stricmp (*TokenStr, "B") == 0) {
- BsfInfo->LocationType = FIRST_VTF;
- } else if (_stricmp (*TokenStr, "N") == 0) {
- BsfInfo->LocationType = SECOND_VTF;
- } else {
- BsfInfo->LocationType = NONE;
- printf ("\nERROR: Unknown location for component %s", BsfInfo->CompName);
- }
- } else if (_stricmp (*TokenStr, "COMP_TYPE") == 0) {
- TokenStr++;
- if (AsciiStringToUint64 (*TokenStr, FALSE, &StringValue) != EFI_SUCCESS) {
- printf ("\nERROR: Could not read a numeric value from \"%s\".", TokenStr);
- return;
- }
- BsfInfo->CompType = (UINT8) StringValue;
- } else if (_stricmp (*TokenStr, "COMP_VER") == 0) {
- TokenStr++;
- if (_stricmp (*TokenStr, "-") == 0) {
- BsfInfo->VersionPresent = FALSE;
- BsfInfo->MajorVer = 0;
- BsfInfo->MinorVer = 0;
- } else {
- BsfInfo->VersionPresent = TRUE;
- ConvertVersionInfo (*TokenStr, &BsfInfo->MajorVer, &BsfInfo->MinorVer);
- }
- } else if (_stricmp (*TokenStr, "COMP_BIN") == 0) {
- TokenStr++;
- strcpy (BsfInfo->CompBinName, *TokenStr);
- } else if (_stricmp (*TokenStr, "COMP_SYM") == 0) {
- TokenStr++;
- strcpy (BsfInfo->CompSymName, *TokenStr);
- } else if (_stricmp (*TokenStr, "COMP_SIZE") == 0) {
- TokenStr++;
- if (_stricmp (*TokenStr, "-") == 0) {
- BsfInfo->PreferredSize = FALSE;
- BsfInfo->CompSize = 0;
- } else {
- BsfInfo->PreferredSize = TRUE;
- if (AsciiStringToUint64 (*TokenStr, FALSE, &StringValue) != EFI_SUCCESS) {
- printf ("\nERROR: Could not read a numeric value from \"%s\".", TokenStr);
- return;
- }
- BsfInfo->CompSize = (UINTN) StringValue;
- }
-
- } else if (_stricmp (*TokenStr, "COMP_CS") == 0) {
- TokenStr++;
- if (_stricmp (*TokenStr, "1") == 0) {
- BsfInfo->CheckSumRequired = 1;
- } else if (_stricmp (*TokenStr, "0") == 0) {
- BsfInfo->CheckSumRequired = 0;
- } else {
- printf ("\nERROR: Bad information in INF file about Checksum required field");
- }
- } else if (_stricmp (*TokenStr, "COMP_ALIGN") == 0) {
- TokenStr++;
- if (AsciiStringToUint64 (*TokenStr, FALSE, &AlignStringValue) != EFI_SUCCESS) {
- printf ("\nERROR: Could not read a numeric value from \"%s\".", TokenStr);
- return;
- }
- if (AlignStringValue >= 0) {
- BsfInfo->Align = (UINT32) AlignStringValue;
- } else {
- printf ("\nERROR: invalid align \"%s\".", AlignStringValue);
- return;
- }
- }
- TokenStr++;
- if (*TokenStr == NULL) {
- break;
- }
- }
-}
-
-EFI_STATUS
-Write32SoftFit(
- IN CHAR8 *FileName,
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- Write IA32 Firmware Volume component address from memory to a file.
-
-Arguments:
-
- FileName Output File Name which needed to be created/
- BsfInfo Parsed info link
-
-Returns:
-
- EFI_ABORTED - Returned due to one of the following resons:
- (a) Error Opening File
- (b) Failing to copy buffers
- EFI_SUCCESS - The function completes successfully
-
---*/
-{
- FILE *Fp;
-
- Fp = fopen (FileName, "w+t");
- if (Fp == NULL) {
- printf ("Error in opening file %s\n", FileName);
- return EFI_ABORTED;
- }
-
- while (BsfInfo != NULL) {
- if (strlen (BsfInfo->CompName) != 0) {
- fprintf (Fp, "\n%s\n", BsfInfo->CompName);
- } else {
- fprintf (Fp, "\n%s\n", "Name not available");
- }
-
- fprintf (Fp, "%d\n", BsfInfo->CompPreferredAddress);
- fprintf (Fp, "%d\n", BsfInfo->CompSize);
- fprintf (Fp, "%d\n", BsfInfo->Align);
-
- BsfInfo = BsfInfo->NextBsfInfo;
- }
-
- if (Fp) {
- fclose (Fp);
- }
-
- return EFI_SUCCESS;
-}
diff --git a/Tools/CCode/Source/GenBsfImage/GenBsfImage.h b/Tools/CCode/Source/GenBsfImage/GenBsfImage.h
deleted file mode 100644
index 65183d19e3..0000000000
--- a/Tools/CCode/Source/GenBsfImage/GenBsfImage.h
+++ /dev/null
@@ -1,632 +0,0 @@
-/*++
-
-Copyright (c) 1999 - 2007 Intel Corporation. All rights reserved
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-
-Module Name:
-
- GenBsfImage.h
-
-Abstract:
-
- This file contains the relevant declarations required
- to generate Boot Strap File
-
---*/
-
-//
-// Module Coded to EFI 2.0 Coding Conventions
-//
-#ifndef _EFI_GEN_BSF_IMAGE_H
-#define _EFI_GEN_BSF_IMAGE_H
-
-//
-// External Files Referenced
-//
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "assert.h"
-// #include "TianoCommon.h"
-#include "Common/FirmwareFileSystem.h"
-#include "Common/FirmwareVolumeHeader.h"
-#include "ParseInf.h"
-
-//
-// Internal Constants
-//
-#define EFI_IPF_VTF1_GUID \
- { \
- 0xfa371c9b, 0x5a86, 0x4198, 0xab, 0xc2, 0xed, 0x3f, 0xaa, 0xce, 0xb0, 0x8b \
- };
-
-#define EFI_IPF_VTF2_GUID \
- { \
- 0x624a0d5a, 0x315f, 0x40b6, 0xa6, 0x33, 0xe5, 0xf7, 0xde, 0x58, 0x20, 0xa0 \
- };
-
-#define EFI_IA32_BOOT_STRAP_GUID \
- { \
- 0xd4260a8d, 0x356, 0x4f45, 0x85, 0xe9, 0xad, 0x1d, 0x79, 0x22, 0x79, 0xf0 \
- };
-
-#define CV_N_TYPE(a,b) (UINT8)(((UINT8)a << 7) + (UINT8)b) // Keeps the CV and Type in same byte field
-#define MAKE_VERSION(a,b) (UINT16)(((UINT16)a << 8) + (UINT16)b)
-
-#define FILE_NAME_SIZE 256
-#define COMPONENT_NAME_SIZE 128
-#define BSF_INPUT_FILE "BSF.INF"
-#define BSF_OUTPUT_FILE "Bsf.RAW"
-#define BSF_SYM_FILE "Bsf.SYM"
-#define FIT_SIGNATURE "_FIT_ "
-
-//
-// This is IA32 seccore
-//
-#define COMP_TYPE_SECCORE 0x0F
-
-//
-//Fit Type Definition
-//
-#define COMP_TYPE_FIT_HEADER 0x00
-#define COMP_TYPE_FIT_PAL_B 0x01
-
-//
-// This is generic PAL_A
-//
-#define COMP_TYPE_FIT_PAL_A 0x0F
-#define COMP_TYPE_FIT_PEICORE 0x10
-#define COMP_TYPE_FIT_AUTOSCAN 0x30
-#define COMP_TYPE_FIT_FV_BOOT 0x7E
-
-//
-//This is processor Specific PAL_A
-//
-#define COMP_TYPE_FIT_PAL_A_SPECIFIC 0x0E
-#define COMP_TYPE_FIT_UNUSED 0x7F
-
-#define FIT_TYPE_MASK 0x7F
-#define CHECKSUM_BIT_MASK 0x80
-
-//
-// IPF processor address is cached bit
-//
-#define IPF_CACHE_BIT 0x8000000000000000ULL
-
-//
-// Size definition to calculate the location from top of address for
-// each component
-//
-#define SIZE_IA32_RESET_VECT 0x10 // 16 Bytes
-#define SIZE_SALE_ENTRY_POINT 0x08 // 8 Byte
-#define SIZE_FIT_TABLE_ADD 0x08 // 8 Byte
-#define SIZE_FIT_TABLE_PAL_A 0x10
-#define SIZE_RESERVED 0x10
-
-
-#define SIZE_TO_OFFSET_PAL_A_END (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT + \
- SIZE_FIT_TABLE_ADD + SIZE_FIT_TABLE_PAL_A + \
- SIZE_RESERVED)
-#define SIZE_TO_PAL_A_FIT (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT + \
- SIZE_FIT_TABLE_ADD + SIZE_FIT_TABLE_PAL_A)
-
-#define SIZE_OF_PAL_HEADER 0x40 //PAL has 64 byte header
-
-//
-// Utility Name
-//
-#define UTILITY_NAME "GenBsfImage"
-
-//
-// Utility version information
-//
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-#define UTILITY_DATE __DATE__
-
-//
-// The maximum number of arguments accepted from the command line.
-//
-#define ONE_BSF_ARGS 5
-#define TWO_BSF_ARGS 9
-
-//
-// The number of IA32 bsf arguments accepted from the command line.
-//
-#define IA32_ARGS 3
-
-#define IA32_SOFT_FIT "IA32BsfAddress.inf"
-
-//
-// Internal Data Structure
-//
-typedef enum _LOC_TYPE
-{
- NONE, // In case there is - INF file
- FIRST_VTF, // First VTF
- SECOND_VTF, // Outside BSF
-} LOC_TYPE;
-
-typedef struct _PARSED_BSF_INFO {
- CHAR8 CompName[COMPONENT_NAME_SIZE];
- LOC_TYPE LocationType;
- UINT8 CompType;
- UINT8 MajorVer;
- UINT8 MinorVer;
- UINT8 CheckSumRequired;
- BOOLEAN VersionPresent; // If it is TRUE, then, Version is in INF file
- BOOLEAN PreferredSize;
- BOOLEAN PreferredAddress;
- CHAR8 CompBinName[FILE_NAME_SIZE];
- CHAR8 CompSymName[FILE_NAME_SIZE];
- UINTN CompSize;
- UINT64 CompPreferredAddress;
- UINT32 Align;
-
- //
- // Fixed - warning C4133: '=' : incompatible types - from 'struct _ParsedBsfInfo *' to 'struct _PARSED_BSF_INFO *'
- // Fixed - warning C4133: '=' : incompatible types - from 'struct _ParsedBsfInfo *' to 'struct _PARSED_BSF_INFO *'
- // Fixed - warning C4133: '=' : incompatible types - from 'struct _ParsedBsfInfo *' to 'struct _PARSED_BSF_INFO *'
- // Fixed - warning C4133: '=' : incompatible types - from 'struct _ParsedBsfInfo *' to 'struct _PARSED_BSF_INFO *'
- //
- struct _PARSED_BSF_INFO *NextBsfInfo;
-} PARSED_BSF_INFO;
-
-#pragma pack (1)
-typedef struct {
- UINT64 CompAddress;
- UINT32 CompSize;
- UINT16 CompVersion;
- UINT8 CvAndType;
- UINT8 CheckSum;
-} FIT_TABLE;
-#pragma pack ()
-
-//
-// The function that displays general utility information
-//
-VOID
-PrintUtilityInfo (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-//
-// The function that displays the utility usage message.
-//
-VOID
-PrintUsage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the utility usage syntax to STDOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-//
-// Other Function Prototype Declarations
-//
-
-EFI_STATUS
-UpdateBsfBuffer(
- IN UINT64 StartAddress,
- IN UINT8 *Buffer,
- IN UINT64 DataSize,
- IN LOC_TYPE LocType
- )
-/*++
-
-Routine Description:
-
- Update the Firmware Volume Buffer with requested buffer data
-
-Arguments:
-
- StartAddress - StartAddress in buffer. This number will automatically
- point to right address in buffer where data needed
- to be updated.
- Buffer - Buffer pointer from data will be copied to memory mapped buffer.
- DataSize - Size of the data needed to be copied.
- LocType - The type of the BSF
-
-Returns:
-
- EFI_ABORTED - The input parameter is error
- EFI_SUCCESS - The function completed successfully
-
---*/
-;
-
-EFI_STATUS
-UpdateSymFile (
- IN UINT64 BaseAddress,
- IN CHAR8 *DestFileName,
- IN CHAR8 *SourceFileName
- )
-/*++
-
-Routine Description:
-
- This function adds the SYM tokens in the source file to the destination file.
- The SYM tokens are updated to reflect the base address.
-
-Arguments:
-
- BaseAddress - The base address for the new SYM tokens.
- DestFileName - The destination file.
- SourceFileName - The source file.
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully.
- EFI_INVALID_PARAMETER - One of the input parameters was invalid.
- EFI_ABORTED - An error occurred.
-
---*/
-;
-
-EFI_STATUS
-CalculateFitTableChecksum (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will perform byte checksum on the FIT table, if the the checksum required
- field is set to CheckSum required. If the checksum is not required then checksum byte
- will have value as 0;.
-
-Arguments:
-
- NONE
-
-Returns:
-
- Status - Value returned by call to CalculateChecksum8 ()
- EFI_SUCCESS - The function completed successfully
-
---*/
-;
-
-EFI_STATUS
-GenerateBsfImage (
- IN UINT64 StartAddress1,
- IN UINT64 Size1,
- IN UINT64 StartAddress2,
- IN UINT64 Size2
- )
-/*++
-
-Routine Description:
-
- This is the main function which will be called from application.
-
-Arguments:
-
- StartAddress1 - The start address of the first BSF
- Size1 - The size of the first BSF
- StartAddress2 - The start address of the second BSF
- Size2 - The size of the second BSF
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can not allocate memory
- The return value can be any of the values
- returned by the calls to following functions:
- GetBsfRelatedInfoFromInfFile
- ProcessAndCreateBsf
- UpdateIA32ResetVector
- UpdateFfsHeader
- WriteBsfBinary
-
---*/
-;
-
-EFI_STATUS
-PeimFixupInFitTable (
- IN UINT64 StartAddress
- )
-/*++
-
-Routine Description:
-
- This function is an entry point to fixup SAL-E entry point.
-
-Arguments:
-
- StartAddress - StartAddress for PEIM.....
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - Error Opening File
-
---*/
-;
-
-EFI_STATUS
-Generate32BsfImage (
-IN UINT64 BootFileStartAddress
- )
-/*++
-
-Routine Description:
-
- This is the main IA32 function which will be called from application.
- (Now this tool is not used for IA32 platform, if it will be used in future,
- the relative functions need to be updated, the updating can refer to IPF
- functions)
-
-Arguments:
-
- BootFileStartAddress - Top Address of Boot File
-
-Returns:
-
- The return value can be any of the values
- returned by the calls to following functions:
- Get32BsfRelatedInfoFromInfFile
- CreateBsfBuffer
- ProcessAndCreate32Bsf
- Update32FfsHeader
- WriteBsfBinary
-
---*/
-;
-
-EFI_STATUS
-GetTotal32BsfSize(
- IN UINT32 *BsfSize
- )
-/*++
-
-Routine Description:
-
- This function calculates total size for IA32 BSF which would be needed to create
- the buffer. This will be done using Passed Info link list and looking for the
- size of the components which belong to BSF. The addtional file header is accounted.
-
-Arguments:
-
- BSFSize - Pointer to the size of IA32 BSF
-
-Returns:
-
- EFI_ABORTED - Returned due to one of the following resons:
- (a) Error Opening File
- EFI_SUCCESS - The fuction completes successfully
-
---*/
-;
-
-EFI_STATUS
-ProcessAndCreate32Bsf (
- IN UINT64 Size
- )
-/*++
-
-Routine Description:
-
- This function process the link list created during INF file parsing
- and create component in IA32 BSF
-
-Arguments:
-
- Size - Size of the Firmware Volume of which, this BSF belongs to.
-
-Returns:
-
- EFI_UNSUPPORTED - Unknown component type
- EFI_SUCCESS - The function completed successfully
-
---*/
-;
-
-EFI_STATUS
-CreateAndUpdateSeccore (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function reads the binary file for seccore and update them
- in IA32 BSF Buffer
-
-Arguments:
-
- BsfInfo - Pointer to Parsed Info
-
-Returns:
-
- EFI_ABORTED - Due to one of the following reasons:
- (a)Error Opening File
- (b)The PAL_A Size is more than specified size status
- One of the values mentioned below returned from
- call to UpdateSymFile
- EFI_SUCCESS - The function completed successfully.
- EFI_INVALID_PARAMETER - One of the input parameters was invalid.
- EFI_ABORTED - An error occurred.UpdateSymFile
-
---*/
-;
-
-EFI_STATUS
-CreateAndUpdate32Component (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function reads the binary file for each components. Add it at aligned address.
-
-Arguments:
-
- BsfInfo - Pointer to Parsed Info
-
-Returns:
-
- EFI_SUCCESS - The function completed successful
- EFI_ABORTED - Aborted due to one of the many reasons like:
- (a) Component Size greater than the specified size.
- (b) Error opening files.
- EFI_INVALID_PARAMETER - Value returned from call to UpdateEntryPoint()
-
---*/
-;
-
-EFI_STATUS
-Update32FfsHeader(
- IN UINT32 BsfSize
- )
-/*++
-
-Routine Description:
-
- Update the Firmware Volume Buffer with requested buffer data
-
-Arguments:
-
- BsfSize - Size of the IA32 BSF
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_INVALID_PARAMETER - The Ffs File Header Pointer is NULL
-
---*/
-;
-
-EFI_STATUS
-Get32BsfRelatedInfoFromInfFile (
- IN CHAR8 *FileName
- )
-/*++
-
-Routine Description:
-
- This function reads the input file, parse it and create a list of tokens
- which is parsed and used, to intialize the data related to IA32 BSF
-
-Arguments:
-
- FileName FileName which needed to be read to parse data
-
-Returns:
-
- EFI_ABORTED Error in opening file
- EFI_INVALID_PARAMETER File doesn't contain any valid informations
- EFI_OUT_OF_RESOURCES Malloc Failed
- EFI_SUCCESS The function completed successfully
-
---*/
-;
-
-VOID
-Initialize32InFileInfo (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function intializes the relevant global variable which is being
- used to store the information retrieved from IA32 INF file.
-
-Arguments:
-
- NONE
-
-Returns:
-
- NONE
-
---*/
-;
-
-VOID
-ParseAndUpdate32Components (
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- This function intializes the relevant global variable which is being
- used to store the information retrieved from INF file.
-
-Arguments:
-
- BsfInfo - A pointer to the BSF Info Structure
-
-
-Returns:
-
- None
-
---*/
-;
-
-EFI_STATUS
-Write32SoftFit(
- IN CHAR8 *FileName,
- IN PARSED_BSF_INFO *BsfInfo
- )
-/*++
-
-Routine Description:
-
- Write IA32 Firmware Volume component address from memory to a file.
-
-Arguments:
-
- FileName Output File Name which needed to be created/
- BsfInfo Parsed info link
-
-Returns:
-
- EFI_ABORTED - Returned due to one of the following resons:
- (a) Error Opening File
- (b) Failing to copy buffers
- EFI_SUCCESS - The fuction completes successfully
-
---*/
-;
-
-#endif
diff --git a/Tools/CCode/Source/GenBsfImage/build.xml b/Tools/CCode/Source/GenBsfImage/build.xml
deleted file mode 100644
index fe8f202099..0000000000
--- a/Tools/CCode/Source/GenBsfImage/build.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenFvImage Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenBsfImage"/>
- <property name="FileSet" value="GenBsfImage.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- <if>
- <istrue value="${OSX}"/>
- <then>
- <property name="syslibdirs" value=""/>
- <property name="syslibs" value=""/>
- </then>
- </if>
-
- <if>
- <istrue value="${cygwin}"/>
- <then>
- <property name="syslibdirs" value="${env.CYGWIN_HOME}/lib/e2fsprogs"/>
- <property name="syslibs" value="uuid"/>
- </then>
- </if>
-
- <if>
- <istrue value="${msft}"/>
- <then>
- <property name="syslibdirs" value=""/>
- <property name="syslibs" value="uuid"/>
- </then>
- </if>
-
- <if>
- <istrue value="${linux}"/>
- <then>
- <if>
- <istrue value="${x86_64_linux}"/>
- <then>
- <property name="syslibdirs" value="/lib64"/>
- </then>
- <else>
- <property name="syslibdirs" value="/usr/lib"/>
- </else>
- </if>
- <property name="syslibs" value="uuid"/>
- </then>
- </if>
- <echo message="syslibdirs set to: ${syslibdirs}"/>
- </target>
-
- <target name="Tool" depends="init, GenBsfImage"/>
-
- <target name="GenBsfImage" >
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <defineset>
- <define name="BUILDING_TOOLS"/>
- <define name="TOOL_BUILD_IA32_TARGET"/>
- </defineset>
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"/>
-
- <includepath path="${PACKAGE_DIR}/${ToolName}"/>
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
-
- <!-- <linkerarg value="/nodefaultlib:libc.lib" if="msft"/>
- <syslibset dir="${syslibdirs}" libs="${syslibs}" if="cyglinux"/>
- <syslibset libs="RpcRT4" if="msft"/> -->
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ia32${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_X64${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ipf${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ia32.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}_X64.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ipf.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c b/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c
deleted file mode 100644
index 678275a367..0000000000
--- a/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*++
-
-Copyright (c) 2004-2007, 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.
-
-Module Name:
-
- GenCRC32Section.c
-
-Abstract:
-
- This file contains functions required to generate a Firmware File System
- file. The code is compliant with the Tiano C Coding standards.
-
---*/
-
-#include "GenCRC32Section.h"
-
-#define UTILITY_NAME "GenCrc32Section"
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 2
-
-EFI_GUID gEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
-
-EFI_STATUS
-SignSectionWithCrc32 (
- IN OUT UINT8 *FileBuffer,
- IN OUT UINT32 *BufferSize,
- IN UINT32 DataSize
- )
-/*++
-
-Routine Description:
-
- Signs the section with CRC32 and add GUIDed section header for the
- signed data. data stays in same location (overwrites source data).
-
-Arguments:
-
- FileBuffer - Buffer containing data to sign
-
- BufferSize - On input, the size of FileBuffer. On output, the size of
- actual section data (including added section header).
-
- DataSize - Length of data to Sign
-
- Key - Key to use when signing. Currently only CRC32 is supported.
-
-Returns:
-
- EFI_SUCCESS - Successful
- EFI_OUT_OF_RESOURCES - Not enough resource to complete the operation.
-
---*/
-{
-
- UINT32 Crc32Checksum;
- EFI_STATUS Status;
- UINT32 TotalSize;
- CRC32_SECTION_HEADER Crc32Header;
- UINT8 *SwapBuffer;
-
- Crc32Checksum = 0;
- SwapBuffer = NULL;
-
- if (DataSize == 0) {
- *BufferSize = 0;
-
- return EFI_SUCCESS;
- }
-
- Status = CalculateCrc32 (FileBuffer, DataSize, &Crc32Checksum);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- TotalSize = DataSize + CRC32_SECTION_HEADER_SIZE;
- Crc32Header.GuidSectionHeader.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
- Crc32Header.GuidSectionHeader.CommonHeader.Size[0] = (UINT8) (TotalSize & 0xff);
- Crc32Header.GuidSectionHeader.CommonHeader.Size[1] = (UINT8) ((TotalSize & 0xff00) >> 8);
- Crc32Header.GuidSectionHeader.CommonHeader.Size[2] = (UINT8) ((TotalSize & 0xff0000) >> 16);
- memcpy (&(Crc32Header.GuidSectionHeader.SectionDefinitionGuid), &gEfiCrc32SectionGuid, sizeof (EFI_GUID));
- Crc32Header.GuidSectionHeader.Attributes = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;
- Crc32Header.GuidSectionHeader.DataOffset = CRC32_SECTION_HEADER_SIZE;
- Crc32Header.CRC32Checksum = Crc32Checksum;
-
- SwapBuffer = (UINT8 *) malloc (DataSize);
- if (SwapBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- memcpy (SwapBuffer, FileBuffer, DataSize);
- memcpy (FileBuffer, &Crc32Header, CRC32_SECTION_HEADER_SIZE);
- memcpy (FileBuffer + CRC32_SECTION_HEADER_SIZE, SwapBuffer, DataSize);
-
- //
- // Make sure section ends on a DWORD boundary
- //
- while ((TotalSize & 0x03) != 0) {
- FileBuffer[TotalSize] = 0;
- TotalSize++;
- }
-
- *BufferSize = TotalSize;
-
- if (SwapBuffer != NULL) {
- free (SwapBuffer);
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf (
- "%s v%d.%d -Utility for generating Firmware File System files.\n",
- UTILITY_NAME,
- UTILITY_MAJOR_VERSION,
- UTILITY_MINOR_VERSION
- );
-}
-
-
-VOID
-Usage (
- VOID
- )
-{
- Version();
-
- printf ("\nUsage:\n");
- printf (UTILITY_NAME " -i Inputfile1 Inputfile2 -o Outputfile\n");
- printf (" -i Inputfile: specifies the input files signed to CRC32 Guided section.\n");
- printf (" -o Outputfile: specifies the output file that is a CRC32 Guided section.\n");
-}
-
-INT32
-ReadFilesContentsIntoBuffer (
- IN CHAR8 *argv[],
- IN INT32 Start,
- IN OUT UINT8 **FileBuffer,
- IN OUT UINT32 *BufferSize,
- OUT UINT32 *ContentSize,
- IN INT32 MaximumArguments
- )
-{
- INT32 Index;
- CHAR8 *FileName;
- FILE *InputFile;
- UINT8 Temp;
- UINT32 Size;
-
- FileName = NULL;
- InputFile = NULL;
- Size = 0;
- Index = 0;
-
- //
- // read all input files into one file buffer
- //
- while (argv[Start + Index][0] != '-') {
-
- FileName = argv[Start + Index];
- InputFile = fopen (FileName, "rb");
- if (InputFile == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open input binary file");
- return -1;
- }
-
- fread (&Temp, sizeof (UINT8), 1, InputFile);
- while (!feof (InputFile)) {
- (*FileBuffer)[Size++] = Temp;
- fread (&Temp, sizeof (UINT8), 1, InputFile);
- }
-
- fclose (InputFile);
- InputFile = NULL;
-
- //
- // Make sure section ends on a DWORD boundary
- //
- while ((Size & 0x03) != 0) {
- (*FileBuffer)[Size] = 0;
- Size++;
- }
-
- Index++;
- if (Index == MaximumArguments) {
- break;
- }
- }
-
- *ContentSize = Size;
- return Index;
-}
-
-int
-main (
- INT32 argc,
- CHAR8 *argv[]
- )
-{
- FILE *OutputFile;
- UINT8 *FileBuffer;
- UINT32 BufferSize;
- EFI_STATUS Status;
- UINT32 ContentSize;
- CHAR8 *OutputFileName;
- INT32 ReturnValue;
- INT32 Index;
-
- OutputFile = NULL;
- FileBuffer = NULL;
- ContentSize = 0;
- OutputFileName = NULL;
-
- SetUtilityName (UTILITY_NAME);
-
- if (argc == 1) {
- Usage ();
- return -1;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return -1;
- }
-
- BufferSize = 1024 * 1024 * 16;
- FileBuffer = (UINT8 *) malloc (BufferSize * sizeof (UINT8));
- if (FileBuffer == NULL) {
- Error (NULL, 0, 0, "memory allocation failed", NULL);
- return -1;
- }
-
- ZeroMem (FileBuffer, BufferSize);
-
- for (Index = 0; Index < argc; Index++) {
- if (strcmpi (argv[Index], "-i") == 0) {
- ReturnValue = ReadFilesContentsIntoBuffer (
- argv,
- (Index + 1),
- &FileBuffer,
- &BufferSize,
- &ContentSize,
- (argc - (Index + 1))
- );
- if (ReturnValue == -1) {
- Error (NULL, 0, 0, "failed to read file contents", NULL);
- return -1;
- }
-
- Index += ReturnValue;
- }
-
- if (strcmpi (argv[Index], "-o") == 0) {
- OutputFileName = argv[Index + 1];
- }
- }
-
- OutputFile = fopen (OutputFileName, "wb");
- if (OutputFile == NULL) {
- Error (NULL, 0, 0, OutputFileName, "failed to open output binary file");
- free (FileBuffer);
- return -1;
- }
-
- /*
- //
- // make sure section ends on a DWORD boundary ??
- //
- while ( (Size & 0x03) != 0 ) {
- FileBuffer[Size] = 0;
- Size ++;
- }
-*/
- Status = SignSectionWithCrc32 (FileBuffer, &BufferSize, ContentSize);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "failed to sign section", NULL);
- free (FileBuffer);
- fclose (OutputFile);
- return -1;
- }
-
- ContentSize = fwrite (FileBuffer, sizeof (UINT8), BufferSize, OutputFile);
- if (ContentSize != BufferSize) {
- Error (NULL, 0, 0, "failed to write output buffer", NULL);
- ReturnValue = -1;
- } else {
- ReturnValue = 0;
- }
-
- free (FileBuffer);
- fclose (OutputFile);
- return ReturnValue;
-}
diff --git a/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.h b/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.h
deleted file mode 100644
index 0875b82ad4..0000000000
--- a/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- GenCRC32Section.h
-
-Abstract:
-
- Header file for GenFfsFile. Mainly defines the header of section
- header for CRC32 GUID defined sections. Share with GenSection.c
-
---*/
-
-//
-// External Files Referenced
-//
-
-/* Standard Headers */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-/* MDE Headers */
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-#include <Common/FirmwareFileSystem.h>
-#include <Common/FirmwareVolumeHeader.h>
-#include <Protocol/GuidedSectionExtraction.h>
-
-/* Tool Headers */
-#include "CommonLib.h"
-#include "Crc32.h"
-#include "Compress.h"
-#include "EfiUtilityMsgs.h"
-#include "ParseInf.h"
-
-//
-// Module Coded to Tiano Coding Conventions
-//
-#ifndef _EFI_GEN_CRC32_SECTION_H
-#define _EFI_GEN_CRC32_SECTION_H
-
-
-typedef struct {
- EFI_GUID_DEFINED_SECTION GuidSectionHeader;
- UINT32 CRC32Checksum;
-} CRC32_SECTION_HEADER;
-
-#define EFI_SECTION_CRC32_GUID_DEFINED 0
-#define CRC32_SECTION_HEADER_SIZE (sizeof (CRC32_SECTION_HEADER))
-
-#endif
diff --git a/Tools/CCode/Source/GenCRC32Section/build.xml b/Tools/CCode/Source/GenCRC32Section/build.xml
deleted file mode 100644
index 3ec9ce5089..0000000000
--- a/Tools/CCode/Source/GenCRC32Section/build.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenCRC32Section Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenCRC32Section"/>
- <property name="FileSet" value="GenCRC32Section.c GenCRC32Section.h"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
-
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenCapsuleHdr/CreateGuid.c b/Tools/CCode/Source/GenCapsuleHdr/CreateGuid.c
deleted file mode 100644
index 2a984fa70e..0000000000
--- a/Tools/CCode/Source/GenCapsuleHdr/CreateGuid.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-
-Module Name:
-
- CreateGuid.c
-
-Abstract:
-
- Library routine to create a GUID
-
---*/
-
-#include <windows.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-void
-CreateGuid (
- GUID *Guid
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- Guid - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- CoCreateGuid (Guid);
-}
diff --git a/Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c b/Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c
deleted file mode 100644
index 6f182615a6..0000000000
--- a/Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c
+++ /dev/null
@@ -1,2728 +0,0 @@
-/*++
-
-Copyright (c) 2002-2006 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.
-
-
-Module Name:
-
- GenCapsuleHdr.c
-
-Abstract:
-
- Generate a capsule header for a file, and optionally prepend the
- header to a file or list of files.
-
---*/
-
-#define _UNICODE
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/MultiPhase.h>
-#include <Common/Capsule.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-#include <Common/FirmwareVolumeHeader.h>
-#include <Common/FirmwareFileSystem.h> // for FV header GUID
-#include <Guid/Capsule.h>
-#include <Guid/FirmwareFileSystem.h> // for FV header GUID
-
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.h"
-
-#define MAX_PATH 256
-
-#define UTILITY_NAME "GenCapsuleHdr"
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 0
-
-#define UNICODE_BACKSLASH L'\\'
-#define UNICODE_FILE_START 0xFEFF
-#define UNICODE_CR 0x000D
-#define UNICODE_LF 0x000A
-#define UNICODE_NULL 0x0000
-#define UNICODE_SPACE L' '
-#define UNICODE_SLASH L'/'
-#define UNICODE_DOUBLE_QUOTE L'"'
-#define UNICODE_A L'A'
-#define UNICODE_F L'F'
-#define UNICODE_Z L'Z'
-#define UNICODE_a L'a'
-#define UNICODE_f L'f'
-#define UNICODE_z L'z'
-#define UNICODE_0 L'0'
-#define UNICODE_9 L'9'
-#define UNICODE_TAB L'\t'
-
-#define OEM_HEADER_STRING L"OemHeader"
-#define AUTHOR_INFO_STRING L"AuthorInfo"
-#define REVISION_INFO_STRING L"RevisionInfo"
-#define SHORT_DESCRIPTION_STRING L"ShortDescription"
-#define LONG_DESCRIPTION_STRING L"LongDescription"
-#define EQUAL_STRING L"="
-#define OPEN_BRACE_STRING L"{"
-#define CLOSE_BRACE_STRING L"}"
-#define GUID_STRING L"GUID"
-#define DATA_STRING L"DATA"
-
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
-#define UEFI_CAPSULE_HEADER_NO_FALAGS 0
-#define UEFI_CAPSULE_HEADER_RESET_FALAGS CAPSULE_FLAGS_PERSIST_ACROSS_RESET
-#define UEFI_CAPSULE_HEADER_ALL_FALAGS (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)
-#endif
-
-typedef wchar_t WCHAR;
-
-typedef struct _FILE_LIST {
- struct _FILE_LIST *Next;
- INT8 FileName[MAX_PATH];
-} FILE_LIST;
-
-typedef struct _SIZE_LIST {
- struct _SIZE_LIST *Next;
- UINT32 Size;
-} SIZE_LIST;
-
-typedef struct {
- INT8 FileName[MAX_PATH];
- WCHAR *FileBuffer;
- WCHAR *FileBufferPtr;
- UINT32 FileSize;
- FILE *FilePtr;
- BOOLEAN EndOfFile;
- UINT32 LineNum;
-} SOURCE_FILE;
-
-//
-// Here's all our globals.
-//
-static struct {
- BOOLEAN Dump;
- BOOLEAN Verbose;
- BOOLEAN JoinMode;
- INT8 ScriptFileName[MAX_PATH];
- INT8 OutputFileName[MAX_PATH];
- FILE_LIST *FileList;
- FILE *OutFptr;
- SIZE_LIST *SizeList;
- SIZE_LIST *LastSize;
- SIZE_LIST *CurrentSize;
-} mOptions;
-
-static EFI_GUID mEfiCapsuleHeaderGuid = EFI_CAPSULE_GUID;
-
-void
-CreateGuid (
- EFI_GUID *Guid
- );
-
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- );
-
-static
-void
-SkipWhiteSpace (
- SOURCE_FILE *SourceFile
- );
-
-static
-STATUS
-GetHexValue (
- SOURCE_FILE *SourceFile,
- UINT32 *Value,
- UINT32 NumDigits
- );
-
-static
-BOOLEAN
-GetSplitFileName (
- INT8 *BaseFileName,
- INT8 *NewFileName,
- UINT32 SequenceNumber
- );
-
-static
-STATUS
-SplitCapsule (
- INT8 *CapsuleFileName
- );
-
-static
-void
-Version (
- VOID
- );
-
-static
-void
-Usage (
- VOID
- );
-
-static
-void
-DumpCapsule (
- VOID
- );
-
-static
-STATUS
-JoinCapsule (
- VOID
- );
-
-static
-STATUS
-DumpCapsuleHeaderStrings (
- UINT8 *SectionName,
- WCHAR *Buffer
- );
-
-static
-STATUS
-CheckFirmwareVolumeHeader (
- INT8 *FileName,
- INT8 *Buffer,
- UINT32 BufferSize
- );
-
-static
-BOOLEAN
-IsToken (
- SOURCE_FILE *File,
- WCHAR *Token
- );
-
-static
-BOOLEAN
-GetNumber (
- INT8 *Str,
- UINT32 *Value
- );
-
-static
-STATUS
-ProcessScriptFile (
- INT8 *ScriptFileName,
- FILE *OutFptr,
- EFI_CAPSULE_HEADER *CapsuleHeader
- );
-
-static
-STATUS
-ParseCapsuleInfo (
- SOURCE_FILE *SourceFile,
- FILE *OutFptr,
- WCHAR *SectionName
- );
-
-static
-STATUS
-CreateCapsule (
- VOID
- );
-
-static
-STATUS
-ParseOemInfo (
- SOURCE_FILE *SourceFile,
- FILE *OutFptr
- );
-
-static
-BOOLEAN
-IsWhiteSpace (
- WCHAR Char
- );
-
-static
-BOOLEAN
-EndOfFile (
- SOURCE_FILE *File
- );
-
-int
-main (
- int Argc,
- char *Argv[]
- )
-/*++
-
-Routine Description:
- Call the routine to process the command-line arguments, then
- dispatch to the appropriate function.
-
-Arguments:
- Standard C main() argc and argv.
-
-Returns:
- 0 if successful
- nonzero otherwise
-
---*/
-// GC_TODO: Argc - add argument and description to function comment
-// GC_TODO: ] - add argument and description to function comment
-{
- STATUS Status;
- FILE_LIST *NextFile;
- //
- // Specify our program name to the error printing routines.
- //
- SetUtilityName (UTILITY_NAME);
- //
- // Process the command-line arguments
- //
- Status = ProcessArgs (Argc, Argv);
- if (Status == STATUS_SUCCESS) {
- if (mOptions.Dump) {
- DumpCapsule ();
- } else if (mOptions.JoinMode) {
- JoinCapsule ();
- } else {
- CreateCapsule ();
- }
- }
- //
- // Cleanup
- //
- while (mOptions.FileList != NULL) {
- NextFile = mOptions.FileList->Next;
- free (mOptions.FileList);
- mOptions.FileList = NextFile;
- }
-
- while (mOptions.SizeList != NULL) {
- mOptions.CurrentSize = mOptions.SizeList->Next;
- free (mOptions.SizeList);
- mOptions.SizeList = mOptions.CurrentSize;
- }
-
- return GetUtilityStatus ();
-}
-
-static
-STATUS
-CreateCapsule (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- FILE *InFptr;
- FILE_LIST *FileList;
- INT8 *Buffer;
- UINT32 Size;
- EFI_CAPSULE_HEADER CapsuleHeader;
- UINT8 Zero;
- UINT8 FirstFile;
- UINT32 CapsuleHeaderSize;
- long InsertedBlockMapEntryOffset;
- EFI_FV_BLOCK_MAP_ENTRY InsertedBlockMapEntry;
- UINT64 FirmwareVolumeSize;
- long FileSize;
- EFI_FIRMWARE_VOLUME_HEADER FVHeader;
-
- Buffer = NULL;
- InFptr = NULL;
- FirmwareVolumeSize = 0;
- CapsuleHeaderSize = 0;
- InsertedBlockMapEntryOffset = 0;
- memset (&InsertedBlockMapEntry, 0, sizeof (EFI_FV_BLOCK_MAP_ENTRY));
- memset (&FVHeader, 0, sizeof (EFI_FIRMWARE_VOLUME_HEADER));
-
- if ((mOptions.OutFptr = fopen (mOptions.OutputFileName, "wb")) == NULL) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to open output file for writing");
- return STATUS_ERROR;
- }
-
- memset ((char *) &CapsuleHeader, 0, sizeof (CapsuleHeader));
- memcpy ((void *) &CapsuleHeader.CapsuleGuid, (void *) &mEfiCapsuleHeaderGuid, sizeof (EFI_GUID));
- CapsuleHeader.HeaderSize = sizeof (EFI_CAPSULE_HEADER);
- CapsuleHeader.CapsuleImageSize = sizeof (EFI_CAPSULE_HEADER);
- if (mOptions.ScriptFileName[0] != 0) {
- if (ProcessScriptFile (mOptions.ScriptFileName, mOptions.OutFptr, &CapsuleHeader) != STATUS_SUCCESS) {
- goto Done;
- }
- } else {
- //
- // Insert a default capsule header
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
- CapsuleHeader.HeaderSize = sizeof (EFI_CAPSULE_HEADER);
- CapsuleHeader.Flags = UEFI_CAPSULE_HEADER_ALL_FALAGS;
-#endif
- CapsuleHeader.OffsetToCapsuleBody = sizeof (EFI_CAPSULE_HEADER);
-
- if (fwrite ((void *) &CapsuleHeader, sizeof (CapsuleHeader), 1, mOptions.OutFptr) != 1) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to write to file");
- goto Done;
- }
- }
-
- CapsuleHeaderSize = CapsuleHeader.OffsetToCapsuleBody;
- //
- // Now copy the contents of any other files specified on the command
- // line to the output file. Files must be FFS files, which are aligned
- // on 8-byte boundaries. Don't align the first file, since it's the start
- // of the image once the capsule header has been removed.
- //
- FileList = mOptions.FileList;
- FirstFile = 1;
- Zero = 0;
- while (FileList != NULL) {
- if ((InFptr = fopen (FileList->FileName, "rb")) == NULL) {
- Error (NULL, 0, 0, FileList->FileName, "failed to open file for reading");
- goto Done;
- }
- //
- // Allocate a buffer into which we can read the file.
- //
- fseek (InFptr, 0, SEEK_END);
- Size = ftell (InFptr);
- rewind (InFptr);
- Buffer = (char *) malloc (Size);
- if (Buffer == NULL) {
- Error (__FILE__, __LINE__, 0, FileList->FileName, "failed to allocate buffer to read file into");
- goto Done;
- }
-
- if (fread ((void *) Buffer, Size, 1, InFptr) != 1) {
- Error (NULL, 0, 0, FileList->FileName, "failed to read file contents");
- goto Done;
- }
-
- if (Size > 0) {
- //
- // Align the write of the first bytes from the file if not the first file
- //
- if (FirstFile) {
- //
- // First file must be a firmware volume. Double-check, and then insert
- // an additional block map entry so we can add more files from the command line
- //
- if (CheckFirmwareVolumeHeader (FileList->FileName, Buffer, Size) != STATUS_SUCCESS) {
- goto Done;
- }
- //
- // Save a copy of the firmware volume header for later
- //
- memcpy (&FVHeader, Buffer, sizeof (EFI_FIRMWARE_VOLUME_HEADER));
- FirmwareVolumeSize = FVHeader.FvLength;
- if (FileList->Next != NULL) {
- //
- // Copy the firmware volume header
- //
- InsertedBlockMapEntryOffset = CapsuleHeaderSize + FVHeader.HeaderLength;
- if (fwrite (Buffer, FVHeader.HeaderLength, 1, mOptions.OutFptr) != 1) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to write to file");
- goto Done;
- }
-
- if (fwrite (&InsertedBlockMapEntry, sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, mOptions.OutFptr) != 1) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to write to file");
- goto Done;
- }
-
- if (fwrite (
- Buffer + FVHeader.HeaderLength,
- Size - FVHeader.HeaderLength,
- 1,
- mOptions.OutFptr
- ) != 1) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to write to file");
- goto Done;
- }
- } else {
- //
- // Copy the file contents as-is
- //
- if (fwrite ((void *) Buffer, Size, 1, mOptions.OutFptr) != 1) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to write to file");
- goto Done;
- }
- }
- } else {
- while ((ftell (mOptions.OutFptr) - CapsuleHeaderSize) & 0x07) {
- if (fwrite ((void *) &Zero, 1, 1, mOptions.OutFptr) != 1) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to write to file");
- goto Done;
- }
- }
-
- if (fwrite ((void *) Buffer, Size, 1, mOptions.OutFptr) != 1) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to write to file");
- goto Done;
- }
- }
-
- FirstFile = 0;
- }
-
- free (Buffer);
- Buffer = NULL;
- fclose (InFptr);
- InFptr = NULL;
- FileList = FileList->Next;
- }
-
-Done:
- if (Buffer != NULL) {
- free (Buffer);
- }
-
- if (InFptr != NULL) {
- fclose (InFptr);
- }
- //
- // If we inserted an additional block map entry, then fix it up. Fix up the
- // FV header as well to reflect our new size.
- //
- if (InsertedBlockMapEntryOffset != 0) {
- FileSize = ftell (mOptions.OutFptr);
- InsertedBlockMapEntry.NumBlocks = 1;
- InsertedBlockMapEntry.BlockLength = (UINT32) ((UINT64) FileSize - (UINT64) CapsuleHeaderSize - FirmwareVolumeSize - sizeof (EFI_FV_BLOCK_MAP_ENTRY));
- fseek (mOptions.OutFptr, InsertedBlockMapEntryOffset, SEEK_SET);
- fwrite (&InsertedBlockMapEntry, sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, mOptions.OutFptr);
- //
- // Fix up the firmware volume header and write it out
- //
- fseek (mOptions.OutFptr, CapsuleHeaderSize, SEEK_SET);
- FVHeader.FvLength = FileSize - CapsuleHeaderSize;
- FVHeader.HeaderLength += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
- fwrite (&FVHeader, sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, mOptions.OutFptr);
- //
- // Reposition to the end of the file
- //
- }
- //
- // Close files and free the global string lists we allocated memory for
- //
- if (mOptions.OutFptr != NULL) {
- //
- // We should now know the full capsule image size. Update the header and write it again.
- //
- fseek (mOptions.OutFptr, 0, SEEK_END);
- Size = ftell (mOptions.OutFptr);
- CapsuleHeader.CapsuleImageSize = Size;
- fseek (mOptions.OutFptr, 0, SEEK_SET);
- if (fwrite ((void *) &CapsuleHeader, sizeof (CapsuleHeader), 1, mOptions.OutFptr) != 1) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to write to file");
- }
-
- fseek (mOptions.OutFptr, 0, SEEK_END);
- fclose (mOptions.OutFptr);
- mOptions.OutFptr = NULL;
- }
- //
- // If they are doing split capsule output, then split it up now.
- //
- if ((mOptions.Dump == 0) && (GetUtilityStatus () == STATUS_SUCCESS) && (mOptions.SizeList != NULL)) {
- SplitCapsule (mOptions.OutputFileName);
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-ProcessScriptFile (
- INT8 *ScriptFileName,
- FILE *OutFptr,
- EFI_CAPSULE_HEADER *CapsuleHeader
- )
-/*++
-
-Routine Description:
- Parse a capsule header script file.
-
-Arguments:
- ScriptFileName - name of script file to parse
- OutFptr - output to dump binary data
- CapsuleHeader - capsule header to update with size info
- of parsed fields in the script file
-
-Returns:
- STATUS_SUCCESS - if all went well
-
---*/
-{
-#if 0
- STATUS Status;
- SOURCE_FILE SourceFile;
- WCHAR *WScriptFileName;
- BOOLEAN InComment;
-
- if (fwrite (CapsuleHeader, sizeof (EFI_CAPSULE_HEADER), 1, OutFptr) != 1) {
- Error (NULL, 0, 0, "failed to write capsule header to output file", NULL);
- return STATUS_ERROR;
- }
-
- memset (&SourceFile, 0, sizeof (SOURCE_FILE));
- strcpy (SourceFile.FileName, ScriptFileName);
-
- Status = STATUS_ERROR;
- //
- // Open the input unicode script file and read it into a buffer
- //
- WScriptFileName = (WCHAR *) malloc ((strlen (ScriptFileName) + 1) * sizeof (WCHAR));
- if (WScriptFileName == NULL) {
- Error (__FILE__, __LINE__, 0, "failed to allocate memory", NULL);
- return STATUS_ERROR;
- }
-
- swprintf (WScriptFileName, L"%S", ScriptFileName);
- if ((SourceFile.FilePtr = _wfopen (WScriptFileName, L"r")) == NULL) {
- free (WScriptFileName);
- Error (NULL, 0, 0, ScriptFileName, "failed to open script file for reading");
- goto Done;
- }
-
- free (WScriptFileName);
- fseek (SourceFile.FilePtr, 0, SEEK_END);
- SourceFile.FileSize = ftell (SourceFile.FilePtr);
- rewind (SourceFile.FilePtr);
- SourceFile.FileBuffer = (WCHAR *) malloc (SourceFile.FileSize + sizeof (WCHAR));
- if (SourceFile.FileBuffer == NULL) {
- Error (__FILE__, __LINE__, 0, ScriptFileName, "failed to allocate memory to read in file contents");
- goto Done;
- }
-
- if (fread (SourceFile.FileBuffer, SourceFile.FileSize, 1, SourceFile.FilePtr) != 1) {
- Error (NULL, 0, 0, ScriptFileName, "failed to read file contents");
- goto Done;
- }
-
- SourceFile.FileBufferPtr = SourceFile.FileBuffer;
- SourceFile.LineNum = 1;
- if (SourceFile.FileBuffer[0] != UNICODE_FILE_START) {
- Error (ScriptFileName, 1, 0, "file does not appear to be a unicode file", NULL);
- goto Done;
- }
-
- SourceFile.FileBufferPtr++;
- SourceFile.FileBuffer[SourceFile.FileSize / sizeof (WCHAR)] = 0;
- //
- // Walk the source file buffer and replace all carriage returns with 0 so
- // we can print from the file contents on parse errors.
- //
- InComment = 0;
- while (!EndOfFile (&SourceFile)) {
- if (SourceFile.FileBufferPtr[0] == UNICODE_CR) {
- SourceFile.FileBufferPtr[0] = 0;
- InComment = 0;
- } else if (SourceFile.FileBufferPtr[0] == UNICODE_LF) {
- InComment = 0;
- } else if (InComment) {
- SourceFile.FileBufferPtr[0] = UNICODE_SPACE;
- } else if ((SourceFile.FileBufferPtr[0] == UNICODE_SLASH) && (SourceFile.FileBufferPtr[1] == UNICODE_SLASH)) {
- InComment = 1;
- SourceFile.FileBufferPtr[0] = UNICODE_SPACE;
- }
-
- SourceFile.FileBufferPtr++;
- }
- //
- // Reposition to the start of the file, but skip over the unicode file start
- //
- SourceFile.FileBufferPtr = SourceFile.FileBuffer;
- SourceFile.FileBufferPtr++;
- SourceFile.EndOfFile = 0;
- CapsuleHeader->OffsetToOemDefinedHeader = ftell (OutFptr);
- //
- // Parse the OEM bytes
- //
- if (ParseOemInfo (&SourceFile, OutFptr) != STATUS_SUCCESS) {
- goto Done;
- }
- //
- // Parse the author information
- //
- CapsuleHeader->OffsetToAuthorInformation = ftell (OutFptr);
- if (ParseCapsuleInfo (&SourceFile, OutFptr, AUTHOR_INFO_STRING) != STATUS_SUCCESS) {
- goto Done;
- }
- //
- // Parse the revision information
- //
- CapsuleHeader->OffsetToRevisionInformation = ftell (OutFptr);
- if (ParseCapsuleInfo (&SourceFile, OutFptr, REVISION_INFO_STRING) != STATUS_SUCCESS) {
- goto Done;
- }
- //
- // Parse the short description
- //
- CapsuleHeader->OffsetToShortDescription = ftell (OutFptr);
- if (ParseCapsuleInfo (&SourceFile, OutFptr, SHORT_DESCRIPTION_STRING) != STATUS_SUCCESS) {
- goto Done;
- }
- //
- // Parse the long description
- //
- CapsuleHeader->OffsetToLongDescription = ftell (OutFptr);
- if (ParseCapsuleInfo (&SourceFile, OutFptr, LONG_DESCRIPTION_STRING) != STATUS_SUCCESS) {
- goto Done;
- }
- //
- // Better be end of contents
- //
- SkipWhiteSpace (&SourceFile);
- if (!EndOfFile (&SourceFile)) {
- Error (ScriptFileName, SourceFile.LineNum, 0, NULL, "expected end-of-file, not %.20S", SourceFile.FileBufferPtr);
- goto Done;
- }
-
- CapsuleHeader->OffsetToCapsuleBody = ftell (OutFptr);
- rewind (OutFptr);
- fwrite (CapsuleHeader, sizeof (EFI_CAPSULE_HEADER), 1, OutFptr);
- fseek (OutFptr, 0, SEEK_END);
- Status = STATUS_SUCCESS;
-Done:
- if (SourceFile.FilePtr != NULL) {
- fclose (SourceFile.FilePtr);
- }
-
- if (SourceFile.FileBuffer != NULL) {
- free (SourceFile.FileBuffer);
- }
-
- return Status;
-
-#endif
- return STATUS_SUCCESS;
-}
-//
-// Parse the OEM data of format:
-// OemInfo {
-// GUID = 12345676-1234-1234-123456789ABC
-// DATA = 0x01, 0x02, 0x03...
-// }
-//
-static
-STATUS
-ParseOemInfo (
- SOURCE_FILE *SourceFile,
- FILE *OutFptr
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- SourceFile - GC_TODO: add argument description
- OutFptr - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- long OemHeaderOffset;
- UINT32 Data;
- EFI_CAPSULE_OEM_HEADER OemHeader;
- STATUS Status;
- UINT32 DigitCount;
- WCHAR *SaveFilePos;
- UINT8 ByteData;
-
- Status = STATUS_ERROR;
- memset (&OemHeader, 0, sizeof (EFI_CAPSULE_OEM_HEADER));
- OemHeaderOffset = ftell (OutFptr);
- OemHeader.HeaderSize = sizeof (EFI_CAPSULE_OEM_HEADER);
- if (fwrite (&OemHeader, sizeof (EFI_CAPSULE_OEM_HEADER), 1, OutFptr) != 1) {
- Error (NULL, 0, 0, "failed to write OEM header to output file", NULL);
- goto Done;
- }
-
- if (!IsToken (SourceFile, OEM_HEADER_STRING)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- OEM_HEADER_STRING,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
-
- if (!IsToken (SourceFile, EQUAL_STRING)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- EQUAL_STRING,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
-
- if (!IsToken (SourceFile, OPEN_BRACE_STRING)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- OPEN_BRACE_STRING,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
- //
- // Look for: GUID = xxxxxxx-xxxx-xxxx-xxxxxxxxxxxxx
- //
- if (!IsToken (SourceFile, GUID_STRING)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- GUID_STRING,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
-
- if (!IsToken (SourceFile, EQUAL_STRING)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- EQUAL_STRING,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
- //
- // Parse the xxxxxxxx-xxxx-xxxx-xxxx portion of the GUID
- //
- SkipWhiteSpace (SourceFile);
- if (GetHexValue (SourceFile, &Data, 8) != STATUS_SUCCESS) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "invalid GUID", NULL);
- goto Done;
- }
-
- OemHeader.OemGuid.Data1 = Data;
- if (!IsToken (SourceFile, L"-")) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected dash in GUID, not %S",
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
- //
- // Get 3 word values
- //
- for (DigitCount = 0; DigitCount < 3; DigitCount++) {
- if (GetHexValue (SourceFile, &Data, 4) != STATUS_SUCCESS) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "invalid GUID", NULL);
- goto Done;
- }
-
- switch (DigitCount) {
- case 0:
- OemHeader.OemGuid.Data2 = (UINT16) Data;
- break;
-
- case 1:
- OemHeader.OemGuid.Data3 = (UINT16) Data;
- break;
-
- case 2:
- OemHeader.OemGuid.Data4[1] = (UINT8) Data;
- OemHeader.OemGuid.Data4[0] = (UINT8) (Data >> 8);
- break;
- }
-
- if (!IsToken (SourceFile, L"-")) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected dash in GUID, not %S",
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
- }
- //
- // Pick up the last 6 bytes of the GUID
- //
- SaveFilePos = SourceFile->FileBufferPtr;
- for (DigitCount = 0; DigitCount < 6; DigitCount++) {
- if (GetHexValue (SourceFile, &Data, 2) != STATUS_SUCCESS) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "invalid GUID", NULL);
- goto Done;
- }
-
- OemHeader.OemGuid.Data4[DigitCount + 2] = (UINT8) Data;
- }
- //
- // Now read raw OEM data bytes. May or may not be present.
- // DATA = 0x01, 0x02, 0x02...
- //
- if (IsToken (SourceFile, CLOSE_BRACE_STRING)) {
- Status = STATUS_SUCCESS;
- goto Done;
- }
-
- if (!IsToken (SourceFile, DATA_STRING)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- DATA_STRING,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
-
- if (!IsToken (SourceFile, EQUAL_STRING)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- EQUAL_STRING,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
-
- while (!EndOfFile (SourceFile)) {
- if (IsToken (SourceFile, CLOSE_BRACE_STRING)) {
- Status = STATUS_SUCCESS;
- goto Done;
- }
-
- if (IsToken (SourceFile, L"0x")) {
- if (swscanf (SourceFile->FileBufferPtr, L"%x", &Data) != 1) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected hex byte value, not %.20S",
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
-
- if (Data &~0xFF) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected byte hex byte value at %.20S",
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
- //
- // Skip over the hex digits, then write the data
- //
- while (iswxdigit (SourceFile->FileBufferPtr[0])) {
- SourceFile->FileBufferPtr++;
- }
-
- ByteData = (UINT8) Data;
- if (fwrite (&ByteData, 1, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, "failed to write OEM data to output file", NULL);
- goto Done;
- }
-
- OemHeader.HeaderSize++;
- //
- // Optional comma
- //
- IsToken (SourceFile, L",");
- } else {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected hex OEM data, not %.20S",
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
- }
-
- if (EndOfFile (SourceFile)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S close to OEM header data",
- CLOSE_BRACE_STRING
- );
- goto Done;
- }
-
- Status = STATUS_SUCCESS;
-Done:
- //
- // re-write the oem header if no errors
- //
- if (Status == STATUS_SUCCESS) {
- fseek (OutFptr, OemHeaderOffset, SEEK_SET);
- if (fwrite (&OemHeader, sizeof (EFI_CAPSULE_OEM_HEADER), 1, OutFptr) != 1) {
- Error (NULL, 0, 0, "failed to write OEM header to output file", NULL);
- goto Done;
- }
-
- fseek (OutFptr, 0, SEEK_END);
- }
-
- return Status;
-}
-
-static
-STATUS
-ParseCapsuleInfo (
- SOURCE_FILE *SourceFile,
- FILE *OutFptr,
- WCHAR *SectionName
- )
-// GC_TODO: function comment should start with '/*++'
-//
-// GC_TODO: function comment is missing 'Routine Description:'
-// GC_TODO: function comment is missing 'Arguments:'
-// GC_TODO: function comment is missing 'Returns:'
-// GC_TODO: SourceFile - add argument and description to function comment
-// GC_TODO: OutFptr - add argument and description to function comment
-// GC_TODO: SectionName - add argument and description to function comment
-// Parse: eng "string " "parts"
-// spa "string " "parts"
-// Write out: "eng string parts\0spa string parts\0\0
-//
-{
- STATUS Status;
- int StringCount;
- WCHAR Zero;
- WCHAR Spacebar;
-
- Status = STATUS_ERROR;
- Zero = 0;
- Spacebar = UNICODE_SPACE;
-
- if (!IsToken (SourceFile, SectionName)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- SectionName,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
-
- if (!IsToken (SourceFile, EQUAL_STRING)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- EQUAL_STRING,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
-
- if (!IsToken (SourceFile, OPEN_BRACE_STRING)) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %S, not %.20S",
- OPEN_BRACE_STRING,
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
-
- while (!EndOfFile (SourceFile)) {
- if (IsToken (SourceFile, CLOSE_BRACE_STRING)) {
- break;
- }
- //
- // Look for language identifier (3 lowercase chars)
- //
- if ((SourceFile->FileBufferPtr[0] >= UNICODE_a) &&
- (SourceFile->FileBufferPtr[0] <= UNICODE_z) &&
- (SourceFile->FileBufferPtr[1] >= UNICODE_a) &&
- (SourceFile->FileBufferPtr[1] <= UNICODE_z) &&
- (SourceFile->FileBufferPtr[2] >= UNICODE_a) &&
- (SourceFile->FileBufferPtr[2] <= UNICODE_z) &&
- IsWhiteSpace (SourceFile->FileBufferPtr[3])
- ) {
- //
- // Write the 3 chars followed by a spacebar, and then look for opening quote
- //
- fwrite (SourceFile->FileBufferPtr, sizeof (WCHAR), 1, OutFptr);
- SourceFile->FileBufferPtr++;
- fwrite (SourceFile->FileBufferPtr, sizeof (WCHAR), 1, OutFptr);
- SourceFile->FileBufferPtr++;
- fwrite (SourceFile->FileBufferPtr, sizeof (WCHAR), 1, OutFptr);
- SourceFile->FileBufferPtr++;
- fwrite (&Spacebar, sizeof (WCHAR), 1, OutFptr);
- StringCount = 0;
- while (IsToken (SourceFile, L"\"")) {
- StringCount++;
- while (!EndOfFile (SourceFile)) {
- if (SourceFile->FileBufferPtr[0] == UNICODE_DOUBLE_QUOTE) {
- SourceFile->FileBufferPtr++;
- break;
- } else if ((SourceFile->FileBufferPtr[0] == UNICODE_LF) || (SourceFile->FileBufferPtr[0] == 0)) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "missing closing quote on string", NULL);
- goto Done;
- } else {
- fwrite (SourceFile->FileBufferPtr, sizeof (WCHAR), 1, OutFptr);
- SourceFile->FileBufferPtr++;
- }
- }
- }
-
- if (StringCount == 0) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected quoted string, not %.20S",
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
- //
- // This string's null terminator
- //
- fwrite (&Zero, sizeof (WCHAR), 1, OutFptr);
- } else {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected valid language identifer, not %.20S",
- SourceFile->FileBufferPtr
- );
- goto Done;
- }
- }
- //
- // Double null terminator
- //
- fwrite (&Zero, sizeof (WCHAR), 1, OutFptr);
- Status = STATUS_SUCCESS;
-Done:
- return Status;
-}
-
-static
-STATUS
-SplitCapsule (
- INT8 *CapsuleFileName
- )
-/*++
-
-Routine Description:
- We've created an entire capsule image. Now split it up into the
- size pieces they requested.
-
-Arguments:
- CapsuleFileName - name of an existing capsule file on disk
-
-Returns:
- STATUS_SUCCESS - if no problems
-
-Notes:
- This implementation reads in the entire capsule image from
- disk, then overwrites the original file with the first
- in the series.
-
---*/
-{
-#if 0
- EFI_CAPSULE_HEADER *CapHdr;
-
- EFI_CAPSULE_HEADER Hdr;
- FILE *CapFptr;
- FILE *OutFptr;
- UINT32 SizeLeft;
- UINT32 CurrentSize;
- UINT32 DataSize;
- UINT32 SequenceNumber;
- INT8 *Buffer;
- INT8 FileName[MAX_PATH];
- STATUS Status;
- UINT32 FileSize;
- //
- // Figure out the total size, then rewind the input file and
- // read the entire thing in
- //
- if ((CapFptr = fopen (CapsuleFileName, "rb")) == NULL) {
- Error (NULL, 0, 0, CapsuleFileName, "failed to open capsule image for reading");
- return STATUS_ERROR;
- }
-
- OutFptr = NULL;
- Status = STATUS_SUCCESS;
- fseek (CapFptr, 0, SEEK_END);
- SizeLeft = ftell (CapFptr);
- fseek (CapFptr, 0, SEEK_SET);
- CapHdr = (EFI_CAPSULE_HEADER *) malloc (SizeLeft);
- if (CapHdr == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- goto FailDone;
- }
-
- if (fread (CapHdr, SizeLeft, 1, CapFptr) != 1) {
- Error (NULL, 0, 0, "failed to read capsule contents", "split failed");
- goto FailDone;
- }
-
- fclose (CapFptr);
- CapFptr = NULL;
- //
- // Get a GUID to fill in the InstanceId GUID in the header
- //
- CreateGuid (&CapHdr->InstanceId);
- SequenceNumber = 0;
- //
- // If the split size is larger than the original capsule image, then
- // we're done.
- //
- if (mOptions.SizeList->Size >= SizeLeft) {
- mOptions.SizeList->Size = SizeLeft;
- goto Done;
- }
- //
- // First size has to be big enough for the original header
- //
- if (mOptions.SizeList->Size < CapHdr->OffsetToCapsuleBody) {
- Error (NULL, 0, 0, "first split size is insufficient for the original capsule header", NULL);
- goto FailDone;
- }
- //
- // Initialize the header we'll use on all but the first part
- //
- memset (&Hdr, 0, sizeof (Hdr));
- Hdr.CapsuleGuid = CapHdr->CapsuleGuid;
- Hdr.HeaderSize = sizeof (Hdr);
- Hdr.Flags = CapHdr->Flags;
- Hdr.InstanceId = CapHdr->InstanceId;
- Hdr.CapsuleImageSize = CapHdr->CapsuleImageSize;
- Hdr.OffsetToCapsuleBody = Hdr.HeaderSize;
- Hdr.SequenceNumber = 1;
- //
- // printf ("Created %s - 0x%X bytes\n", CapsuleFileName, mOptions.SizeList->Size);
- //
- Buffer = (UINT8 *) CapHdr;
- //
- // Walk the list of sizes and write out a capsule header, and
- // then the raw capsule data.
- //
- // SizeLeft -= mOptions.SizeList->Size;
- //
- mOptions.CurrentSize = mOptions.SizeList;
- while (SizeLeft) {
- CurrentSize = mOptions.CurrentSize->Size;
- GetSplitFileName (mOptions.OutputFileName, FileName, SequenceNumber);
- if ((OutFptr = fopen (FileName, "wb")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open split file for writing");
- goto FailDone;
- }
-
- if (Buffer == (UINT8 *) CapHdr) {
- //
- // First part -- write out original header and data
- //
- if (fwrite (Buffer, CurrentSize, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to write to split image file");
- goto FailDone;
- }
-
- SizeLeft -= CurrentSize;
- Buffer += CurrentSize;
- DataSize = CurrentSize;
- FileSize = CurrentSize;
- } else {
- //
- // Not the first part. Write the default header, and then the raw bytes from the
- // original image.
- //
- if (CurrentSize <= sizeof (Hdr)) {
- Error (NULL, 0, 0, "split size too small for capsule header + data", "0x%X", CurrentSize);
- goto FailDone;
- }
-
- DataSize = CurrentSize - sizeof (Hdr);
- if (DataSize > SizeLeft) {
- DataSize = SizeLeft;
- }
-
- if (fwrite (&Hdr, sizeof (Hdr), 1, OutFptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to write capsule header to output file");
- fclose (OutFptr);
- goto FailDone;
- }
-
- if (fwrite (Buffer, DataSize, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to write capsule data to output file");
- fclose (OutFptr);
- goto FailDone;
- }
-
- Hdr.SequenceNumber++;
- Buffer += DataSize;
- SizeLeft -= DataSize;
- FileSize = DataSize + sizeof (Hdr);
- }
- //
- // Next size in list if there is one
- //
- if (mOptions.CurrentSize->Next != NULL) {
- mOptions.CurrentSize = mOptions.CurrentSize->Next;
- }
-
- SequenceNumber++;
- fclose (OutFptr);
- OutFptr = NULL;
- printf ("Created %s - 0x%X bytes (0x%X bytes of data)\n", FileName, FileSize, DataSize);
- }
-
- goto Done;
-FailDone:
- Status = STATUS_ERROR;
-Done:
- if (CapHdr != NULL) {
- free (CapHdr);
- }
-
- if (CapFptr != NULL) {
- fclose (CapFptr);
- }
-
- if (OutFptr != NULL) {
- fclose (OutFptr);
- }
-
- return Status;
-
-#endif
- return STATUS_SUCCESS;
-}
-
-static
-BOOLEAN
-GetSplitFileName (
- INT8 *BaseFileName,
- INT8 *NewFileName,
- UINT32 SequenceNumber
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- BaseFileName - GC_TODO: add argument description
- NewFileName - GC_TODO: add argument description
- SequenceNumber - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- /*++
-
-Routine Description:
- Given an initial split capsule file name and a sequence number,
- create an appropriate file name for this split of a capsule image.
-
-Arguments:
- BaseFileName - name of of the first split file in the series
- NewFileName - output name of the split file
- SequenceNumber - 0-based sequence number of split images
-
-Returns:
- TRUE - name created successfully
- FALSE - otherwise
-
---*/
- INT8 *Ptr;
- INT8 *Part2Start;
- UINT32 Digits;
- UINT32 Len;
- UINT32 BaseOffset;
- //
- // Work back from the end of the file name and see if there is a number somewhere
- //
- for (Ptr = BaseFileName + strlen (BaseFileName) - 1; (Ptr > BaseFileName) && !isdigit (*Ptr); Ptr--)
- ;
- if ((Ptr == BaseFileName) && (!isdigit (*Ptr))) {
- //
- // Found no number, so just add it to the end
- //
- sprintf (NewFileName, "%s%d", BaseFileName, SequenceNumber);
- return TRUE;
- } else {
- //
- // Found a number. Look back to find the first digit.
- //
- Part2Start = Ptr + 1;
- for (Digits = 1; isdigit (*Ptr) && (Ptr > BaseFileName); Ptr--, Digits++)
- ;
- if (!isdigit (*Ptr)) {
- Ptr++;
- Digits--;
- }
-
- BaseOffset = atoi (Ptr);
- SequenceNumber = SequenceNumber + BaseOffset;
- if (Digits > 1) {
- //
- // Copy the first part of the original file name to the new filename
- // This is the path for filenames with format path\name001.cap
- //
- Len = (UINT32) Ptr - (UINT32) BaseFileName;
- strncpy (NewFileName, BaseFileName, Len);
- sprintf (NewFileName + Len, "%0*d", Digits, SequenceNumber);
- strcat (NewFileName, Part2Start);
- return TRUE;
- } else {
- //
- // Only one digit found. This is the path for filenames with
- // format path\name1.cap
- //
- Len = (UINT32) Ptr - (UINT32) BaseFileName + 1;
- strncpy (NewFileName, BaseFileName, Len);
- sprintf (NewFileName + Len - 1, "%d", SequenceNumber);
- strcat (NewFileName, Part2Start);
- return TRUE;
- }
- }
-}
-
-static
-BOOLEAN
-IsWhiteSpace (
- WCHAR Char
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- Char - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- switch (Char) {
- case UNICODE_SPACE:
- case UNICODE_TAB:
- case UNICODE_NULL:
- case UNICODE_CR:
- case UNICODE_LF:
- return TRUE;
-
- default:
- return FALSE;
- }
-}
-
-static
-BOOLEAN
-IsToken (
- SOURCE_FILE *File,
- WCHAR *Token
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- File - GC_TODO: add argument description
- Token - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- SkipWhiteSpace (File);
- if (EndOfFile (File)) {
- return FALSE;
- }
-
- if (wcsncmp (Token, File->FileBufferPtr, wcslen (Token)) == 0) {
- File->FileBufferPtr += wcslen (Token);
- return TRUE;
- }
-
- return FALSE;
-}
-
-static
-STATUS
-CheckFirmwareVolumeHeader (
- INT8 *FileName,
- INT8 *Buffer,
- UINT32 BufferSize
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FileName - GC_TODO: add argument description
- Buffer - GC_TODO: add argument description
- BufferSize - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- EFI_FIRMWARE_VOLUME_HEADER *Hdr;
- EFI_GUID FVHeaderGuid = EFI_FIRMWARE_FILE_SYSTEM_GUID;
-
- Hdr = (EFI_FIRMWARE_VOLUME_HEADER *) Buffer;
- if (Hdr->Signature != EFI_FVH_SIGNATURE) {
- Error (NULL, 0, 0, FileName, "file does not appear to be a firmware volume (bad signature)");
- return STATUS_ERROR;
- }
-
- if (Hdr->Revision != EFI_FVH_REVISION) {
- Error (NULL, 0, 0, FileName, "unsupported firmware volume header version");
- return STATUS_ERROR;
- }
-
- if (Hdr->FvLength > BufferSize) {
- Error (NULL, 0, 0, FileName, "malformed firmware volume -- FvLength > file size");
- return STATUS_ERROR;
- }
-
- if (memcmp (&Hdr->FileSystemGuid, &FVHeaderGuid, sizeof (EFI_GUID)) != 0) {
- Error (NULL, 0, 0, FileName, "invalid FFS GUID in firmware volume header");
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-void
-DumpCapsule (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
-#if 0
- FILE *InFptr;
- FILE_LIST *FileList;
- EFI_CAPSULE_HEADER CapsuleHeader;
- EFI_FIRMWARE_VOLUME_HEADER FVHeader;
- EFI_CAPSULE_OEM_HEADER *OemHeader;
- UINT8 *BPtr;
- UINT32 FileSize;
- UINT32 CapsuleHeaderDataSize;
- UINT8 ByteCount;
- UINT8 *CapsuleHeaderData;
- BOOLEAN SplitImage;
-
- InFptr = NULL;
- CapsuleHeaderData = NULL;
- FileList = mOptions.FileList;
- while (FileList != NULL) {
- if ((InFptr = fopen (FileList->FileName, "rb")) == NULL) {
- Error (NULL, 0, 0, FileList->FileName, "failed to open file for reading");
- goto Done;
- }
-
- if (fread (&CapsuleHeader, sizeof (EFI_CAPSULE_HEADER), 1, InFptr) != 1) {
- Error (NULL, 0, 0, FileList->FileName, "failed to read capsule header");
- goto Done;
- }
-
- fseek (InFptr, 0, SEEK_END);
- FileSize = ftell (InFptr);
- if (CapsuleHeader.CapsuleImageSize > FileSize) {
- SplitImage = TRUE;
- } else {
- SplitImage = FALSE;
- }
-
- printf (
- "Capsule %s Size=0x%X CargoSize=0x%X\n",
- FileList->FileName,
- FileSize,
- FileSize - CapsuleHeader.OffsetToCapsuleBody
- );
- printf (
- " GUID %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- CapsuleHeader.CapsuleGuid.Data1,
- (UINT32) CapsuleHeader.CapsuleGuid.Data2,
- (UINT32) CapsuleHeader.CapsuleGuid.Data3,
- (UINT32) CapsuleHeader.CapsuleGuid.Data4[0],
- (UINT32) CapsuleHeader.CapsuleGuid.Data4[1],
- (UINT32) CapsuleHeader.CapsuleGuid.Data4[2],
- (UINT32) CapsuleHeader.CapsuleGuid.Data4[3],
- (UINT32) CapsuleHeader.CapsuleGuid.Data4[4],
- (UINT32) CapsuleHeader.CapsuleGuid.Data4[5],
- (UINT32) CapsuleHeader.CapsuleGuid.Data4[6],
- (UINT32) CapsuleHeader.CapsuleGuid.Data4[7]
- );
- if (memcmp (&CapsuleHeader.CapsuleGuid, &mEfiCapsuleHeaderGuid, sizeof (EFI_GUID)) != 0) {
- printf (" INVALID GUID");
- }
-
- printf ("\n");
- printf (" Header size 0x%08X\n", CapsuleHeader.HeaderSize);
- printf (" Flags 0x%08X\n", CapsuleHeader.Flags);
- if (!SplitImage) {
- printf (" Capsule image size 0x%08X\n", CapsuleHeader.CapsuleImageSize);
- } else {
- printf (" Capsule image size 0x%08X (split)\n", CapsuleHeader.CapsuleImageSize);
- }
-
- printf (" Sequence number %d\n", CapsuleHeader.SequenceNumber);
- printf (
- " InstanceId %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
- CapsuleHeader.InstanceId.Data1,
- (UINT32) CapsuleHeader.InstanceId.Data2,
- (UINT32) CapsuleHeader.InstanceId.Data3,
- (UINT32) CapsuleHeader.InstanceId.Data4[0],
- (UINT32) CapsuleHeader.InstanceId.Data4[1],
- (UINT32) CapsuleHeader.InstanceId.Data4[2],
- (UINT32) CapsuleHeader.InstanceId.Data4[3],
- (UINT32) CapsuleHeader.InstanceId.Data4[4],
- (UINT32) CapsuleHeader.InstanceId.Data4[5],
- (UINT32) CapsuleHeader.InstanceId.Data4[6],
- (UINT32) CapsuleHeader.InstanceId.Data4[7]
- );
- printf (" Offset to capsule 0x%X\n", CapsuleHeader.OffsetToCapsuleBody);
- //
- // Dump header data if there
- //
- CapsuleHeaderDataSize = CapsuleHeader.OffsetToCapsuleBody - CapsuleHeader.HeaderSize;
- if (CapsuleHeaderDataSize != 0) {
- CapsuleHeaderData = (UINT8 *) malloc (CapsuleHeaderDataSize);
- if (CapsuleHeaderData == NULL) {
- Error (
- NULL,
- 0,
- 0,
- "failed to allocate memory to read in capsule header data",
- "0x%X bytes",
- CapsuleHeaderDataSize
- );
- goto Done;
- }
-
- fseek (InFptr, CapsuleHeader.HeaderSize, SEEK_SET);
- if (fread (CapsuleHeaderData, CapsuleHeaderDataSize, 1, InFptr) != 1) {
- Error (
- NULL,
- 0,
- 0,
- "failed to read capsule header data contents from file",
- "0x%X bytes",
- CapsuleHeaderDataSize
- );
- goto Done;
- }
- //
- // ************************************************************************
- //
- // OEM HEADER
- //
- // ************************************************************************
- //
- if (CapsuleHeader.OffsetToOemDefinedHeader != 0) {
- OemHeader = (EFI_CAPSULE_OEM_HEADER *) (CapsuleHeaderData + CapsuleHeader.OffsetToOemDefinedHeader - CapsuleHeader.HeaderSize);
- printf (" OEM Header\n");
- printf (
- " GUID %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
- OemHeader->OemGuid.Data1,
- (UINT32) OemHeader->OemGuid.Data2,
- (UINT32) OemHeader->OemGuid.Data3,
- (UINT32) OemHeader->OemGuid.Data4[0],
- (UINT32) OemHeader->OemGuid.Data4[1],
- (UINT32) OemHeader->OemGuid.Data4[2],
- (UINT32) OemHeader->OemGuid.Data4[3],
- (UINT32) OemHeader->OemGuid.Data4[4],
- (UINT32) OemHeader->OemGuid.Data4[5],
- (UINT32) OemHeader->OemGuid.Data4[6],
- (UINT32) OemHeader->OemGuid.Data4[7]
- );
- printf (" Header size: 0x%X\n", OemHeader->HeaderSize);
- printf (" OEM data");
- BPtr = (UINT8 *) (OemHeader + 1);
- for (ByteCount = 0; ByteCount < OemHeader->HeaderSize - sizeof (EFI_CAPSULE_OEM_HEADER); ByteCount++) {
- if ((ByteCount & 0x7) == 0) {
- printf ("\n ");
- }
-
- printf ("%02X ", (UINT32) *BPtr);
- BPtr++;
- }
-
- printf ("\n");
- }
- //
- // ************************************************************************
- //
- // Author, revision, short description, and long description information
- //
- // ************************************************************************
- //
- if (CapsuleHeader.OffsetToAuthorInformation != 0) {
- if (DumpCapsuleHeaderStrings (
- "Author information",
- (WCHAR *) (CapsuleHeaderData + CapsuleHeader.OffsetToAuthorInformation - CapsuleHeader.HeaderSize)
- ) != STATUS_SUCCESS) {
- goto Done;
- }
- }
-
- if (CapsuleHeader.OffsetToRevisionInformation != 0) {
- if (DumpCapsuleHeaderStrings (
- "Revision information",
- (WCHAR *) (CapsuleHeaderData + CapsuleHeader.OffsetToRevisionInformation - CapsuleHeader.HeaderSize)
- ) != STATUS_SUCCESS) {
- goto Done;
- }
- }
-
- if (CapsuleHeader.OffsetToShortDescription != 0) {
- if (DumpCapsuleHeaderStrings (
- "Short description",
- (WCHAR *) (CapsuleHeaderData + CapsuleHeader.OffsetToShortDescription - CapsuleHeader.HeaderSize)
- ) != STATUS_SUCCESS) {
- goto Done;
- }
- }
-
- if (CapsuleHeader.OffsetToLongDescription != 0) {
- if (DumpCapsuleHeaderStrings (
- "Long description",
- (WCHAR *) (CapsuleHeaderData + CapsuleHeader.OffsetToLongDescription - CapsuleHeader.HeaderSize)
- ) != STATUS_SUCCESS) {
- goto Done;
- }
- }
- }
- //
- // If it's not a split image, or it is a split image and this is the first in the series, then
- // dump the cargo volume.
- //
- if ((!SplitImage) || (CapsuleHeader.SequenceNumber == 0)) {
- printf (" Cargo FV dump\n");
- fseek (InFptr, CapsuleHeader.OffsetToCapsuleBody, SEEK_SET);
- if (fread (&FVHeader, sizeof (EFI_FIRMWARE_VOLUME_HEADER), 1, InFptr) != 1) {
- Error (NULL, 0, 0, FileList->FileName, "failed to read cargo FV header");
- goto Done;
- }
-
- printf (" FV length 0x%X", FVHeader.FvLength);
- if (FileSize - CapsuleHeader.OffsetToCapsuleBody != FVHeader.FvLength) {
- if (!SplitImage) {
- printf (" ERROR: expected 0x%X to jive with file size on disk", FileSize - CapsuleHeader.OffsetToCapsuleBody);
- }
- }
-
- printf ("\n");
- printf (" Signature 0x%X ", FVHeader.Signature);
- if (FVHeader.Signature == EFI_FVH_SIGNATURE) {
- printf ("_FVH\n");
- } else {
- printf ("INVALID\n");
- }
-
- printf (" FV header length 0x%X\n", (UINT32) FVHeader.HeaderLength);
- printf (" Revision 0x%X\n", (UINT32) FVHeader.Revision);
- printf ("\n");
- }
-
- FileList = FileList->Next;
- }
-
-Done:
- if (InFptr != NULL) {
- fclose (InFptr);
- }
-
- if (CapsuleHeaderData != NULL) {
- free (CapsuleHeaderData);
- }
-#endif
-}
-
-static
-STATUS
-JoinCapsule (
- VOID
- )
-/*++
-
-Routine Description:
- Join split capsule images into a single image. This is the
- support function for the -j command-line option.
-
-Arguments:
- None.
-
-Returns:
- STATUS_SUCCESS - no problems encountered
-
---*/
-{
-#if 0
- UINT32 Size;
- FILE *InFptr;
- FILE *OutFptr;
- INT8 *Buffer;
- FILE_LIST *FileList;
- STATUS Status;
- EFI_CAPSULE_HEADER CapHdr;
- EFI_CAPSULE_HEADER *CapHdrPtr;
- UINT32 SizeLeft;
- UINT32 SequenceNumber;
- //
- // Must have at least two files for join mode
- //
- if ((mOptions.FileList == NULL) || (mOptions.FileList->Next == NULL)) {
- Error (NULL, 0, 0, "must specify at least two file names to join", NULL);
- return STATUS_ERROR;
- }
- //
- // Open the output file
- //
- if ((OutFptr = fopen (mOptions.OutputFileName, "wb")) == NULL) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to open output file for writing");
- return STATUS_ERROR;
- }
-
- FileList = mOptions.FileList;
- Buffer = NULL;
- SequenceNumber = 0;
- InFptr = NULL;
- SizeLeft = 0;
- while (FileList != NULL) {
- if ((InFptr = fopen (FileList->FileName, "rb")) == NULL) {
- Error (NULL, 0, 0, FileList->FileName, "failed to open file for reading");
- goto FailDone;
- }
- //
- // Allocate a buffer into which we can read the file.
- //
- fseek (InFptr, 0, SEEK_END);
- Size = ftell (InFptr);
- rewind (InFptr);
- Buffer = (char *) malloc (Size);
- if (Buffer == NULL) {
- Error (__FILE__, __LINE__, 0, FileList->FileName, "failed to allocate buffer to read file into");
- goto FailDone;
- }
-
- CapHdrPtr = (EFI_CAPSULE_HEADER *) Buffer;
- if (fread ((void *) Buffer, Size, 1, InFptr) != 1) {
- Error (NULL, 0, 0, FileList->FileName, "failed to read file contents");
- goto FailDone;
- }
- //
- // Check the header for validity. Check size first.
- //
- if (Size < sizeof (EFI_CAPSULE_HEADER)) {
- Error (NULL, 0, 0, FileList->FileName, "file size is insufficient for a capsule header");
- goto FailDone;
- }
- //
- // Check GUID
- //
- if (memcmp (&CapHdrPtr->CapsuleGuid, &mEfiCapsuleHeaderGuid, sizeof (EFI_GUID)) != 0) {
- Error (NULL, 0, 0, FileList->FileName, "invalid capsule GUID");
- goto FailDone;
- }
- //
- // Check sequence number
- //
- if (CapHdrPtr->SequenceNumber != SequenceNumber) {
- Error (
- NULL,
- 0,
- 0,
- FileList->FileName,
- "invalid sequence number %d (expected %d)",
- CapHdrPtr->SequenceNumber,
- SequenceNumber
- );
- goto FailDone;
- }
- //
- // If the first file, read save the capsule header
- //
- if (SequenceNumber == 0) {
- memcpy (&CapHdr, CapHdrPtr, sizeof (EFI_CAPSULE_HEADER));
- //
- // Erase the InstanceId GUID
- //
- memset (&CapHdrPtr->InstanceId, 0, sizeof (EFI_GUID));
- if (fwrite (Buffer, Size, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, FileList->FileName, "failed to write contents to output file");
- goto FailDone;
- }
-
- if (CapHdr.CapsuleImageSize < Size) {
- Error (NULL, 0, 0, FileList->FileName, "capsule image size in capsule header < image size");
- goto FailDone;
- }
-
- SizeLeft = CapHdr.CapsuleImageSize - Size;
- } else {
- //
- // Check the GUID against the first file's GUID
- //
- if (memcmp (&CapHdr.CapsuleGuid, &CapHdrPtr->CapsuleGuid, sizeof (EFI_GUID)) != 0) {
- Error (NULL, 0, 0, FileList->FileName, "GUID does not match first file's GUID");
- goto FailDone;
- }
- //
- // Make sure we're not throwing out any header info
- //
- if (CapHdrPtr->OffsetToCapsuleBody > sizeof (EFI_CAPSULE_HEADER)) {
- //
- // Could be the split information, so just emit a warning
- //
- Warning (
- NULL,
- 0,
- 0,
- FileList->FileName,
- "image appears to have additional capsule header information -- ignoring"
- );
- } else if (CapHdrPtr->OffsetToCapsuleBody < sizeof (EFI_CAPSULE_HEADER)) {
- Error (NULL, 0, 0, FileList->FileName, "offset to capsule body in capsule header is insufficient");
- goto FailDone;
- }
-
- if (fwrite (Buffer + CapHdrPtr->OffsetToCapsuleBody, Size - CapHdrPtr->OffsetToCapsuleBody, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, mOptions.OutputFileName, "failed to write to file");
- goto FailDone;
- }
-
- if (SizeLeft < (Size - CapHdrPtr->OffsetToCapsuleBody)) {
- Error (NULL, 0, 0, "sum of image sizes exceeds size specified in initial capsule header", NULL);
- goto FailDone;
- }
- //
- // printf ("FILE: %s OffsetToCapsuleBody=0x%X\n", FileList->FileName, CapHdrPtr->OffsetToCapsuleBody);
- //
- SizeLeft = SizeLeft - (Size - CapHdrPtr->OffsetToCapsuleBody);
- }
- //
- // printf ("FILE: %s sizeleft=0x%X\n", FileList->FileName, SizeLeft);
- //
- fclose (InFptr);
- InFptr = NULL;
- free (Buffer);
- Buffer = NULL;
- FileList = FileList->Next;
- SequenceNumber++;
- }
-
- if (SizeLeft) {
- Error (NULL, 0, 0, "sum of capsule images is insufficient", "0x%X bytes missing", SizeLeft);
- goto FailDone;
- }
-
- Status = STATUS_SUCCESS;
- goto Done;
-FailDone:
- Status = STATUS_ERROR;
-Done:
- if (InFptr != NULL) {
- fclose (InFptr);
- }
-
- if (OutFptr != NULL) {
- fclose (OutFptr);
- }
-
- if (Buffer != NULL) {
- free (Buffer);
- }
-
- return Status;
-
-#endif
-return STATUS_SUCCESS;
-}
-
-static
-STATUS
-DumpCapsuleHeaderStrings (
- UINT8 *SectionName,
- WCHAR *Buffer
- )
-/*++
-
-Routine Description:
- Given a pointer to string data from a capsule header, dump
- the strings.
-
-Arguments:
- SectionName - name of the capsule header section to which
- the string data pertains
- Buffer - pointer to string data from a capsule header
-
-Returns:
- STATUS_SUCCESS - all went well
-
---*/
-{
- printf (" %s\n", SectionName);
- while (*Buffer) {
- printf (" Language: %S\n", Buffer);
- while (*Buffer) {
- Buffer++;
- }
-
- Buffer++;
- while (*Buffer) {
- if (wcslen (Buffer) > 60) {
- printf (" %.60S\n", Buffer);
- Buffer += 60;
- } else {
- printf (" %S\n", Buffer);
- Buffer += wcslen (Buffer);
- }
- }
-
- Buffer++;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-GetHexValue (
- SOURCE_FILE *SourceFile,
- UINT32 *Value,
- UINT32 NumDigits
- )
-/*++
-
-Routine Description:
- Scan a hex value from the input stream.
-
-Arguments:
- SourceFile - input file contents
- Value - returned value
- NumDigits - number of digits to read
-
-Returns:
- STATUS_SUCCESS - if NumDigits were read from the file
- STATUS_ERROR - otherwise
-
-
---*/
-{
- WCHAR *SaveFilePos;
- UINT32 Digits;
- WCHAR Nibble;
-
- SaveFilePos = SourceFile->FileBufferPtr;
- *Value = 0;
- Digits = NumDigits;
- while (Digits > 0) {
- Nibble = SourceFile->FileBufferPtr[0];
- if ((Nibble >= UNICODE_0) && (Nibble <= UNICODE_9)) {
- *Value = (*Value << 4) | (Nibble - UNICODE_0);
- } else if ((Nibble >= UNICODE_A) && (Nibble <= UNICODE_F)) {
- *Value = (*Value << 4) | (Nibble - UNICODE_A + 0x10);
- } else if ((Nibble >= UNICODE_a) && (Nibble <= UNICODE_f)) {
- *Value = (*Value << 4) | (Nibble - UNICODE_a + 0x10);
- } else {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- NULL,
- "expected %d valid hex nibbles at %.20S",
- NumDigits,
- SaveFilePos
- );
- return STATUS_ERROR;
- }
-
- SourceFile->FileBufferPtr++;
- Digits--;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-BOOLEAN
-EndOfFile (
- SOURCE_FILE *File
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- File - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- if ((UINT32) File->FileBufferPtr - (UINT32) File->FileBuffer >= File->FileSize) {
- File->EndOfFile = TRUE;
- }
- //
- // Reposition to the end of the file if we went beyond
- //
- if (File->EndOfFile) {
- File->FileBufferPtr = File->FileBuffer + File->FileSize / sizeof (WCHAR);
- }
-
- return File->EndOfFile;
-}
-
-static
-void
-SkipWhiteSpace (
- SOURCE_FILE *SourceFile
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- SourceFile - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- while (!EndOfFile (SourceFile)) {
- switch (*SourceFile->FileBufferPtr) {
- case UNICODE_NULL:
- case UNICODE_CR:
- case UNICODE_SPACE:
- case UNICODE_TAB:
- SourceFile->FileBufferPtr++;
- break;
-
- case UNICODE_LF:
- SourceFile->FileBufferPtr++;
- SourceFile->LineNum++;
- break;
-
- default:
- return ;
- }
- }
-}
-//
-// Parse a number. Possible format:
-// 1234
-// 1234k
-// 1234K
-// 1M
-// 1m
-// 0x100
-//
-static
-BOOLEAN
-GetNumber (
- INT8 *Str,
- UINT32 *Value
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- Str - GC_TODO: add argument description
- Value - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- UINT32 LValue;
-
- *Value = 0;
- LValue = 0;
- if (!isdigit (Str[0])) {
- return FALSE;
- }
- //
- // Look for hex number
- //
- if ((Str[0] == '0') && (tolower (Str[1]) == 'x')) {
- Str += 2;
- if (Str[0] == 0) {
- return FALSE;
- }
-
- while (Str[0]) {
- if ((Str[0] >= '0') && (Str[0] <= '9')) {
- LValue = (LValue << 4) | (Str[0] - '0');
- } else if ((Str[0] >= 'A') && (Str[0] <= 'F')) {
- LValue = (LValue << 4) | (Str[0] - 'A' + 0x10);
- } else if ((Str[0] >= 'a') && (Str[0] <= 'f')) {
- LValue = (LValue << 4) | (Str[0] - 'a' + 0x10);
- } else {
- break;
- }
-
- Str++;
- }
- } else {
- LValue = atoi (Str);
- while (isdigit (*Str)) {
- Str++;
- }
- }
- //
- // If string left over, better be one character we recognize
- //
- if (Str[0]) {
- if (Str[1]) {
- return FALSE;
- }
-
- switch (Str[0]) {
- case 'k':
- case 'K':
- LValue *= 1024;
- break;
-
- case 'm':
- case 'M':
- LValue *= 1024 * 1024;
- break;
-
- default:
- return FALSE;
- }
- }
-
- *Value = LValue;
- return TRUE;
-}
-//
-// Process the command-line arguments
-//
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- )
-/*++
-
-Routine Description:
-
- Processes command line arguments.
-
-Arguments:
-
- Argc - Number of command line arguments
- Argv[] - Array of files input on command line
-
-Returns:
-
- STATUS_ERROR - Function exited with an error
- STATUS_SUCCESS - Function executed successfully
-
---*/
-{
- FILE_LIST *NewFile;
-
- FILE_LIST *LastFile;
- SIZE_LIST *NewSize;
-
- NewFile = NULL;
- NewSize = NULL;
-
- //
- // Clear our globals
- //
- memset ((char *) &mOptions, 0, sizeof (mOptions));
-
- //
- // Skip program name
- //
- Argc--;
- Argv++;
-
- if (Argc == 0) {
- Usage ();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
- (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- if (Argc == 1) {
- Usage ();
- return STATUS_ERROR;
- }
-
- //
- // Process until no more options
- //
- while ((Argc > 0) && (Argv[0][0] == '-')) {
- if (stricmp (Argv[0], "-script") == 0) {
- //
- // Check for one more arg
- //
- if (Argc > 1) {
- //
- // Save the file name
- //
- if (strlen (Argv[1]) >= sizeof (mOptions.ScriptFileName)) {
- Error (NULL, 0, 0, NULL, "input script file name length exceeds internal buffer size");
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
-
- strcpy (mOptions.ScriptFileName, Argv[1]);
- } else {
- Error (NULL, 0, 0, Argv[0], "missing script file name with option");
- Usage ();
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- //
- // -o outfilename -- specify output file name (required)
- //
- } else if (stricmp (Argv[0], "-o") == 0) {
- //
- // check for one more arg
- //
- if (Argc > 1) {
- //
- // Try to open the file
- //
- // if ((mOptions.OutFptr = fopen (Argv[1], "wb")) == NULL) {
- // Error (NULL, 0, 0, Argv[1], "failed to open output file for writing");
- // return STATUS_ERROR;
- // }
- //
- strcpy (mOptions.OutputFileName, Argv[1]);
- } else {
- Error (NULL, 0, 0, Argv[0], "missing output filename with option");
- Usage ();
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-j") == 0) {
- mOptions.JoinMode = TRUE;
- //
- // -split <size> option (multiple allowed)
- //
- } else if (stricmp (Argv[0], "-split") == 0) {
- if (Argc > 1) {
- NewSize = (SIZE_LIST *) malloc (sizeof (SIZE_LIST));
- if (NewSize == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
-
- memset (NewSize, 0, sizeof (SIZE_LIST));
- //
- // Get the size from the next arg, and then add this size
- // to our size list
- //
- if (!GetNumber (Argv[1], &NewSize->Size)) {
- Error (NULL, 0, 0, Argv[1], "invalid split size argument");
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
-
- if (mOptions.SizeList == NULL) {
- mOptions.SizeList = NewSize;
- mOptions.CurrentSize = NewSize;
- } else {
- mOptions.LastSize->Next = NewSize;
- }
-
- mOptions.LastSize = NewSize;
- free (NewSize);
- } else {
- Error (NULL, 0, 0, Argv[0], "missing size parameter with option");
- Usage ();
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- } else if ((stricmp (Argv[0], "-h") == 0) || (strcmp (Argv[0], "-?") == 0)) {
- Usage ();
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- //
- // Default minimum header
- //
- } else if (stricmp (Argv[0], "-dump") == 0) {
- mOptions.Dump = TRUE;
- } else if (stricmp (Argv[0], "-v") == 0) {
- mOptions.Verbose = TRUE;
- } else {
- Error (NULL, 0, 0, Argv[0], "unrecognized option");
- Usage ();
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- }
- //
- // Can't -j join files and -s split output capsule
- //
- if ((mOptions.SizeList != NULL) && (mOptions.JoinMode)) {
- Error (NULL, 0, 0, "cannot specify both -j and -size", NULL);
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
- //
- // Must have specified an output file name if not -dump
- //
- if ((mOptions.Dump == 0) && (mOptions.OutputFileName[0] == 0)) {
- Error (NULL, 0, 0, NULL, "-o OutputFileName must be specified");
- Usage ();
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
- //
- // Rest of arguments are input files. The first one is a firmware
- // volume image, and the rest are FFS files that are to be inserted
- // into the firmware volume.
- //
- LastFile = NULL;
- while (Argc > 0) {
- NewFile = (FILE_LIST *) malloc (sizeof (FILE_LIST));
- if (NewFile == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
-
- memset ((char *) NewFile, 0, sizeof (FILE_LIST));
- strcpy (NewFile->FileName, Argv[0]);
- if (mOptions.FileList == NULL) {
- mOptions.FileList = NewFile;
- } else {
- if (LastFile == NULL) {
- LastFile = NewFile;
- } else {
- LastFile->Next = NewFile;
- }
- }
-
- LastFile = NewFile;
- Argc--;
- Argv++;
- }
-
- //
- // Must have provided at least one file name
- //
- if (mOptions.FileList == NULL) {
- Error (NULL, 0, 0, "must specify at least one file name", NULL);
- Usage ();
-
- if (NewFile != NULL) {
- free (NewFile);
- }
- if (NewSize != NULL) {
- free (NewSize);
- }
-
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-void
-Version(
- void
- )
-/*++
-
-Routine Description:
-
- Print out version information for this utility.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -EDK utility to create a capsule header.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2006 Intel Corporation. All rights reserved.\n");
-}
-
-static
-void
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Print usage information for this utility.
-
-Arguments:
-
- None.
-
-Returns:
-
- Nothing.
-
---*/
-{
- int Index;
- static const char *Str[] = {
- "\nUsage: "UTILITY_NAME " {options} [CapsuleFV]",
- //
- // {FfsFileNames}",
- //
- " Options include:",
- " -h,--help,-?,/? to display help messages",
- " -V,--version to display version information",
- " -script fname to take capsule header info from unicode script",
- " file fname",
- " -o fname write output to file fname (required)",
- " -split size split capsule image into multiple output files",
- " -dump to dump a capsule header",
- " -v for verbose output\n",
- " -j to join split capsule images into a single image",
- "",
- " CapsuleFV is the name of an existing well-formed Tiano firmware",
- " volume file.",
- //
- // FfsFileNames are the names of one or more Tiano FFS files to",
- // " insert into the output capsule image.",
- //
- NULL
- };
-
- Version();
-
- for (Index = 0; Str[Index] != NULL; Index++) {
- fprintf (stdout, "%s\n", Str[Index]);
- }
-}
diff --git a/Tools/CCode/Source/GenCapsuleHdr/build.xml b/Tools/CCode/Source/GenCapsuleHdr/build.xml
deleted file mode 100644
index db72d166ca..0000000000
--- a/Tools/CCode/Source/GenCapsuleHdr/build.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenCapsuleHdr Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenCapsuleHdr"/>
- <property name="FileSet" value="GenCapsuleHdr.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- <syslibset dir="${env.CYGWIN_HOME}/lib/mingw" libs="msvcr71" if="cygwin"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenDepex/DepexParser.c b/Tools/CCode/Source/GenDepex/DepexParser.c
deleted file mode 100644
index 9f0a0cbbab..0000000000
--- a/Tools/CCode/Source/GenDepex/DepexParser.c
+++ /dev/null
@@ -1,903 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- DepexParser.c
-
-Abstract:
-
- Validate Dependency Expression syntax
- recursive descent Algorithm
-
- The original BNF grammar(taken from "Pre EFI Initialization Core Interface Specification
- draft review 0.9") is thus:
- <depex> ::= BEFORE <guid> END
- | AFTER <guid> END
- | SOR <bool> END
- | <bool> END
- <bool> ::= <bool> AND <term>
- | <bool> OR <term>
- | <term>
- <term> ::= NOT <factor>
- | <factor>
- <factor> ::= <bool>
- | TRUE
- | FALSE
- | GUID
-
- <guid> ::= '{' <hex32> ',' <hex16> ',' <hex16> ','
- <hex8> ',' <hex8> ',' <hex8> ',' <hex8> ','
- <hex8> ',' <hex8> ',' <hex8> ',' <hex8> '}'
- <hex32> ::= <hexprefix> <hexvalue>
- <hex16> ::= <hexprefix> <hexvalue>
- <hex8> ::= <hexprefix> <hexvalue>
- <hexprefix>::= '0' 'x'
- | '0' 'X'
- <hexvalue> ::= <hexdigit> <hexvalue>
- | <hexdigit>
- <hexdigit> ::= [0-9]
- | [a-f]
- | [A-F]
-
- After cleaning left recursive and parentheses supported, the BNF grammar used in this module is thus:
- <depex> ::= BEFORE <guid>
- | AFTER <guid>
- | SOR <bool>
- | <bool>
- <bool> ::= <term><rightbool>
- <rightbool>::= AND <term><rightbool>
- | OR <term><rightbool>
- | ''
- <term> ::= NOT <factor>
- | <factor>
- <factor> ::= '('<bool>')'<rightfactor>
- | NOT <factor> <rightbool> <rightfactor>
- | TRUE <rightfactor>
- | FALSE <rightfactor>
- | END <rightfactor>
- | <guid> <rightfactor>
- <rightfactor> ::=AND <term><rightbool> <rightfactor>
- | OR <term><rightbool> <rightfactor>
- | ''
- <guid> ::= '{' <hex32> ',' <hex16> ',' <hex16> ','
- <hex8> ',' <hex8> ',' <hex8> ',' <hex8> ','
- <hex8> ',' <hex8> ',' <hex8> ',' <hex8> '}'
- <hex32> ::= <hexprefix> <hexvalue>
- <hex16> ::= <hexprefix> <hexvalue>
- <hex8> ::= <hexprefix> <hexvalue>
- <hexprefix>::= '0' 'x'
- | '0' 'X'
- <hexvalue> ::= <hexdigit> <hexvalue>
- | <hexdigit>
- <hexdigit> ::= [0-9]
- | [a-f]
- | [A-F]
-
- Note: 1. There's no precedence in operators except parentheses;
- 2. For hex32, less and equal than 8 bits is valid, more than 8 bits is invalid.
- Same constraint for hex16 is 4, hex8 is 2. All hex should contains at least 1 bit.
- 3. "<factor> ::= '('<bool>')'<rightfactor>" is added to support parentheses;
- 4. "<factor> ::= GUID" is changed to "<factor> ::= <guid>";
- 5. "DEPENDENCY_END" is the terminal of the expression. But it has been filtered by caller.
- During parsing, "DEPENDENCY_END" will be treated as illegal factor;
-
- This code should build in any environment that supports a standard C-library w/ string
- operations and File I/O services.
-
- As an example of usage, consider the following:
-
- The input string could be something like:
-
- NOT ({ 0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72,
- 0x3b } AND { 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69,
- 0x72, 0x3b }) OR { 0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27,
- 0x3f, 0xc1, 0x4d } AND
-
- It's invalid for an extra "AND" in the end.
-
- Complies with Tiano C Coding Standards Document, version 0.33, 16 Aug 2001.
-
---*/
-
-#include "DepexParser.h"
-
-BOOLEAN
-ParseBool (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- );
-
-BOOLEAN
-ParseTerm (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- );
-
-BOOLEAN
-ParseRightBool (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- );
-
-BOOLEAN
-ParseFactor (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- );
-
-VOID
-LeftTrim (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Left trim the space, '\n' and '\r' character in string.
- The space at the end does not need trim.
-
-
-Arguments:
-
- Pbegin The pointer to the string
- length length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- None
-
-
---*/
-{
- while
- (
- ((*Pindex) < (Pbegin + length)) &&
- ((strncmp (*Pindex, " ", 1) == 0) || (strncmp (*Pindex, "\n", 1) == 0) || (strncmp (*Pindex, "\r", 1) == 0))
- ) {
- (*Pindex)++;
- }
-}
-
-BOOLEAN
-ParseHexdigit (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse Hex bit in dependency expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length Length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- BOOLEAN If parses a valid hex bit, return TRUE, otherwise FALSE
-
-
---*/
-{
- //
- // <hexdigit> ::= [0-9] | [a-f] | [A-F]
- //
- if (((**Pindex) >= '0' && (**Pindex) <= '9') ||
- ((**Pindex) >= 'a' && (**Pindex) <= 'f') ||
- ((**Pindex) >= 'A' && (**Pindex) <= 'F')
- ) {
- (*Pindex)++;
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-ParseHex32 (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse Hex32 in dependency expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length Length of the string
- Pindex The pointer of point to the next parse character in the string
-
-Returns:
-
- BOOLEAN If parses a valid hex32, return TRUE, otherwise FALSE
-
-
---*/
-{
- INT32 Index;
- INT8 *Pin;
-
- Index = 0;
- Pin = *Pindex;
- LeftTrim (Pbegin, length, Pindex);
-
- if ((strncmp (*Pindex, "0x", 2) != 0) && (strncmp (*Pindex, "0X", 2) != 0)) {
- return FALSE;
- }
- (*Pindex) += 2;
-
- while (ParseHexdigit (Pbegin, length, Pindex)) {
- Index++;
- }
-
- if (Index > 0 && Index <= 8) {
- return TRUE;
- } else {
- *Pindex = Pin;
- return FALSE;
- }
-}
-
-BOOLEAN
-ParseHex16 (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse Hex16 in dependency expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length Length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- BOOLEAN If parses a valid hex16, return TRUE, otherwise FALSE
-
-
---*/
-{
- int Index;
- INT8 *Pin;
-
- Index = 0;
- Pin = *Pindex;
- LeftTrim (Pbegin, length, Pindex);
-
- if ((strncmp (*Pindex, "0x", 2) != 0) && (strncmp (*Pindex, "0X", 2) != 0)) {
- return FALSE;
- }
- (*Pindex) += 2;
-
- while (ParseHexdigit (Pbegin, length, Pindex)) {
- Index++;
- }
-
- if (Index > 0 && Index <= 4) {
- return TRUE;
- } else {
- *Pindex = Pin;
- return FALSE;
- }
-}
-
-BOOLEAN
-ParseHex8 (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse Hex8 in dependency expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length Length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- BOOLEAN If parses a valid hex8, return TRUE, otherwise FALSE
-
-
---*/
-{
- int Index;
- INT8 *Pin;
-
- Index = 0;
- Pin = *Pindex;
- LeftTrim (Pbegin, length, Pindex);
-
- if ((strncmp (*Pindex, "0x", 2) != 0) && (strncmp (*Pindex, "0X", 2) != 0)) {
- return FALSE;
- }
- (*Pindex) += 2;
-
- while (ParseHexdigit (Pbegin, length, Pindex)) {
- Index++;
- }
-
- if (Index > 0 && Index <= 2) {
- return TRUE;
- } else {
- *Pindex = Pin;
- return FALSE;
- }
-}
-
-BOOLEAN
-ParseGuid (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse guid in dependency expression.
- There can be any number of spaces between '{' and hexword, ',' and hexword,
- hexword and ',', hexword and '}'. The hexword include hex32, hex16 and hex8.
-
-Arguments:
-
- Pbegin The pointer to the string
- length length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- BOOLEAN If parses a valid guid, return TRUE, otherwise FALSE
-
-
---*/
-{
- INT32 Index;
- INT8 *Pin;
- Pin = *Pindex;
- LeftTrim (Pbegin, length, Pindex);
- if (strncmp (*Pindex, "{", 1) != 0) {
- return FALSE;
- }
- (*Pindex)++;
-
- LeftTrim (Pbegin, length, Pindex);
- if (!ParseHex32 (Pbegin, length, Pindex)) {
- *Pindex = Pin;
- return FALSE;
- }
-
- LeftTrim (Pbegin, length, Pindex);
- if (strncmp (*Pindex, ",", 1) != 0) {
- return FALSE;
- } else {
- (*Pindex)++;
- }
-
- for (Index = 0; Index < 2; Index++) {
- LeftTrim (Pbegin, length, Pindex);
- if (!ParseHex16 (Pbegin, length, Pindex)) {
- *Pindex = Pin;
- return FALSE;
- }
-
- LeftTrim (Pbegin, length, Pindex);
- if (strncmp (*Pindex, ",", 1) != 0) {
- return FALSE;
- } else {
- (*Pindex)++;
- }
- }
-
- LeftTrim (Pbegin, length, Pindex);
- if (strncmp (*Pindex, "{", 1) != 0) {
- return FALSE;
- }
- (*Pindex)++;
-
- for (Index = 0; Index < 7; Index++) {
- LeftTrim (Pbegin, length, Pindex);
- if (!ParseHex8 (Pbegin, length, Pindex)) {
- *Pindex = Pin;
- return FALSE;
- }
-
- LeftTrim (Pbegin, length, Pindex);
- if (strncmp (*Pindex, ",", 1) != 0) {
- return FALSE;
- } else {
- (*Pindex)++;
- }
- }
-
- LeftTrim (Pbegin, length, Pindex);
- if (!ParseHex8 (Pbegin, length, Pindex)) {
- *Pindex = Pin;
- return FALSE;
- }
-
- LeftTrim (Pbegin, length, Pindex);
- if (strncmp (*Pindex, "}", 1) != 0) {
- return FALSE;
- } else {
- (*Pindex)++;
- }
-
- LeftTrim (Pbegin, length, Pindex);
- if (strncmp (*Pindex, "}", 1) != 0) {
- return FALSE;
- } else {
- (*Pindex)++;
- }
-
- return TRUE;
-}
-
-BOOLEAN
-ParseRightFactor (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse rightfactor in bool expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- BOOLEAN If string is a valid rightfactor expression, return TRUE, otherwise FALSE
-
-
---*/
-{
- INT8 *Pin;
-
- Pin = *Pindex;
- LeftTrim (Pbegin, length, Pindex);
-
- //
- // <rightfactor> ::=AND <term> <rightbool> <rightfactor>
- //
- if (strncmp (*Pindex, OPERATOR_AND, strlen (OPERATOR_AND)) == 0) {
- *Pindex += strlen (OPERATOR_AND);
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseTerm (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightBool (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
- if (ParseRightFactor (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- }
- } else {
- *Pindex = Pin;
- }
- } else {
- *Pindex = Pin;
- }
- }
- //
- // <rightfactor> ::=OR <term> <rightbool> <rightfactor>
- //
- if (strncmp (*Pindex, OPERATOR_OR, strlen (OPERATOR_OR)) == 0) {
- *Pindex += strlen (OPERATOR_OR);
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseTerm (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightBool (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
- if (ParseRightFactor (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- }
- } else {
- *Pindex = Pin;
- }
- } else {
- *Pindex = Pin;
- }
- }
- //
- // <rightfactor> ::= ''
- //
- *Pindex = Pin;
- return TRUE;
-}
-
-BOOLEAN
-ParseRightBool (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse rightbool in bool expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- BOOLEAN If string is a valid rightbool expression, return TRUE, otherwise FALSE
-
-
---*/
-{
- INT8 *Pin;
-
- Pin = *Pindex;
- LeftTrim (Pbegin, length, Pindex);
-
- //
- // <rightbool>::= AND <term><rightbool>
- //
- if (strncmp (*Pindex, OPERATOR_AND, strlen (OPERATOR_AND)) == 0) {
- *Pindex += strlen (OPERATOR_AND);
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseTerm (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightBool (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- }
- } else {
- *Pindex = Pin;
- }
- }
- //
- // <rightbool>::= OR <term><rightbool>
- //
- if (strncmp (*Pindex, OPERATOR_OR, strlen (OPERATOR_OR)) == 0) {
- *Pindex += strlen (OPERATOR_OR);
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseTerm (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightBool (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- }
- } else {
- *Pindex = Pin;
- }
- }
- //
- // <rightbool>::= ''
- //
- *Pindex = Pin;
- return TRUE;
-}
-
-BOOLEAN
-ParseFactor (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse factor in bool expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- BOOLEAN If string is a valid factor, return TRUE, otherwise FALSE
-
-
---*/
-{
- INT8 *Pin;
-
- Pin = *Pindex;
- LeftTrim (Pbegin, length, Pindex);
-
- //
- // <factor> ::= '('<bool>')'<rightfactor>
- //
- if (strncmp (*Pindex, OPERATOR_LEFT_PARENTHESIS, strlen (OPERATOR_LEFT_PARENTHESIS)) == 0) {
- *Pindex += strlen (OPERATOR_LEFT_PARENTHESIS);
- LeftTrim (Pbegin, length, Pindex);
-
- if (!ParseBool (Pbegin, length, Pindex)) {
- *Pindex = Pin;
- } else {
- LeftTrim (Pbegin, length, Pindex);
-
- if (strncmp (*Pindex, OPERATOR_RIGHT_PARENTHESIS, strlen (OPERATOR_RIGHT_PARENTHESIS)) == 0) {
- *Pindex += strlen (OPERATOR_RIGHT_PARENTHESIS);
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightFactor (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- }
- }
- }
- }
- //
- // <factor> ::= NOT <factor> <rightbool> <rightfactor>
- //
- if (strncmp (*Pindex, OPERATOR_NOT, strlen (OPERATOR_NOT)) == 0) {
- *Pindex += strlen (OPERATOR_NOT);
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseFactor (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightBool (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightFactor (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- }
- } else {
- *Pindex = Pin;
- }
- } else {
- *Pindex = Pin;
- }
- }
- //
- // <factor> ::= TRUE <rightfactor>
- //
- if (strncmp (*Pindex, OPERATOR_TRUE, strlen (OPERATOR_TRUE)) == 0) {
- *Pindex += strlen (OPERATOR_TRUE);
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightFactor (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- }
- }
- //
- // <factor> ::= FALSE <rightfactor>
- //
- if (strncmp (*Pindex, OPERATOR_FALSE, strlen (OPERATOR_FALSE)) == 0) {
- *Pindex += strlen (OPERATOR_FALSE);
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightFactor (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- }
- }
- //
- // <factor> ::= <guid> <rightfactor>
- //
- if (ParseGuid (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseRightFactor (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- return FALSE;
- }
- } else {
- *Pindex = Pin;
- return FALSE;
- }
-}
-
-BOOLEAN
-ParseTerm (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse term in bool expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- BOOLEAN If string is a valid term, return TRUE, otherwise FALSE
-
-
---*/
-{
- INT8 *Pin;
-
- Pin = *Pindex;
- LeftTrim (Pbegin, length, Pindex);
-
- //
- // <term> ::= NOT <factor>
- //
- if (strncmp (*Pindex, OPERATOR_NOT, strlen (OPERATOR_NOT)) == 0) {
- *Pindex += strlen (OPERATOR_NOT);
- LeftTrim (Pbegin, length, Pindex);
-
- if (!ParseFactor (Pbegin, length, Pindex)) {
- *Pindex = Pin;
- } else {
- return TRUE;
- }
- }
- //
- // <term> ::=<factor>
- //
- if (ParseFactor (Pbegin, length, Pindex)) {
- return TRUE;
- } else {
- *Pindex = Pin;
- return FALSE;
- }
-}
-
-BOOLEAN
-ParseBool (
- IN INT8 *Pbegin,
- IN UINT32 length,
- IN OUT INT8 **Pindex
- )
-/*++
-
-Routine Description:
-
- Parse bool expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length length of the string
- Pindex The pointer of pointer to the next parse character in the string
-
-Returns:
-
- BOOLEAN If string is a valid bool expression, return TRUE, otherwise FALSE
-
-
---*/
-{
- INT8 *Pin;
- Pin = *Pindex;
- LeftTrim (Pbegin, length, Pindex);
-
- if (ParseTerm (Pbegin, length, Pindex)) {
- LeftTrim (Pbegin, length, Pindex);
-
- if (!ParseRightBool (Pbegin, length, Pindex)) {
- *Pindex = Pin;
- return FALSE;
- } else {
- return TRUE;
- }
- } else {
- *Pindex = Pin;
- return FALSE;
- }
-}
-
-BOOLEAN
-ParseDepex (
- IN INT8 *Pbegin,
- IN UINT32 length
- )
-/*++
-
-Routine Description:
-
- Parse whole dependency expression.
-
-Arguments:
-
- Pbegin The pointer to the string
- length length of the string
-
-Returns:
-
- BOOLEAN If string is a valid dependency expression, return TRUE, otherwise FALSE
-
-
---*/
-{
- BOOLEAN Result;
- INT8 **Pindex;
- INT8 *temp;
-
- Result = FALSE;
- temp = Pbegin;
- Pindex = &temp;
-
- LeftTrim (Pbegin, length, Pindex);
- if (strncmp (*Pindex, OPERATOR_BEFORE, strlen (OPERATOR_BEFORE)) == 0) {
- (*Pindex) += strlen (OPERATOR_BEFORE);
- Result = ParseGuid (Pbegin, length, Pindex);
-
- } else if (strncmp (*Pindex, OPERATOR_AFTER, strlen (OPERATOR_AFTER)) == 0) {
- (*Pindex) += strlen (OPERATOR_AFTER);
- Result = ParseGuid (Pbegin, length, Pindex);
-
- } else if (strncmp (*Pindex, OPERATOR_SOR, strlen (OPERATOR_SOR)) == 0) {
- (*Pindex) += strlen (OPERATOR_SOR);
- Result = ParseBool (Pbegin, length, Pindex);
-
- } else {
- Result = ParseBool (Pbegin, length, Pindex);
-
- }
-
- LeftTrim (Pbegin, length, Pindex);
- return (BOOLEAN) (Result && (*Pindex) >= (Pbegin + length));
-}
diff --git a/Tools/CCode/Source/GenDepex/DepexParser.h b/Tools/CCode/Source/GenDepex/DepexParser.h
deleted file mode 100644
index 29e0884a3e..0000000000
--- a/Tools/CCode/Source/GenDepex/DepexParser.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-Copyright (c) 2004, 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.
-
- Module Name:
- GenDepex.h
-
- Abstract:
- This file contains the relevant declarations required
- to generate a binary Dependency File
-
- Complies with Tiano C Coding Standards Document, version 0.31, 12 Dec 2000.
-
---*/
-
-// TODO: fix comment to set correct module name: DepexParser.h
-#ifndef _EFI_DEPEX_PARSER_H_
-#define _EFI_DEPEX_PARSER_H_
-#include "GenDepex.h"
-#endif
diff --git a/Tools/CCode/Source/GenDepex/GenDepex.c b/Tools/CCode/Source/GenDepex/GenDepex.c
deleted file mode 100644
index 5c27797a9b..0000000000
--- a/Tools/CCode/Source/GenDepex/GenDepex.c
+++ /dev/null
@@ -1,933 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006, 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.
-
-Module Name:
-
- GenDepex.c
-
-Abstract:
-
- Generate Dependency Expression ("GenDepex")
-
- Infix to Postfix Algorithm
-
- This code has been scrubbed to be free of having any EFI core tree dependencies.
- It should build in any environment that supports a standard C-library w/ string
- operations and File I/O services.
-
- As an example of usage, consider the following:
-
- The input user file could be something like "Sample.DXS" whose contents are
-
- #include "Tiano.h"
-
- DEPENDENCY_START
- NOT (DISK_IO_PROTOCOL AND SIMPLE_FILE_SYSTEM_PROTOCOL)
- OR EFI_PXE_BASE_CODE_PROTOCOL
- DEPENDENCY_END
-
- This file is then washed through the C-preprocessor, viz.,
-
- cl /EP Sample.DXS > Sample.TMP1
-
- This yields the following file "Sample.TMP1" whose contents are
-
- DEPENDENCY_START
- NOT ({ 0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72,
- 0x3b } AND { 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69,
- 0x72, 0x3b }) OR { 0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27,
- 0x3f, 0xc1, 0x4d }
- DEPENDENCY_END
-
- This file, in turn, will be fed into the utility, viz.,
-
- GenDepex Sample.TMP1 Sample.TMP2
-
- With a file that is 55 bytes long:
-
- 55 bytes for the grammar binary
- PUSH opcode - 1 byte
- GUID Instance - 16 bytes
- PUSH opcode - 1 byte
- GUID Instance - 16 bytes
- AND opcode - 1 byte
- NOT opcode - 1 byte
- PUSH opcode - 1 byte
- GUID Instance - 16 bytes
- OR opcode - 1 byte
- END opcode - 1 byte
-
- The file "Sample.TMP2" could be fed via a Section-builder utility
- (GenSection) that would be used for the creation of a dependency
- section file (.DPX) which in turn would be used by a generate FFS
- utility (GenFfsFile) to produce a DXE driver/core (.DXE) or
- a DXE application (.APP) file.
-
- Complies with Tiano C Coding Standards Document, version 0.31, 12 Dec 2000.
-
---*/
-
-#include "GenDepex.h"
-
-#define TOOL_NAME "GenDepex"
-
-extern
-ParseDepex (
- IN INT8 *Pbegin,
- IN UINT32 length
- );
-
-VOID
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf (
- "%s v%d.%d -Tiano utility to generate dependency expression.\n",
- UTILITY_NAME,
- UTILITY_MAJOR_VERSION,
- UTILITY_MINOR_VERSION
- );
- printf ("Copyright (C) 1996-2006 Intel Corporation. All rights reserved.\n");
-}
-
-VOID
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the utility usage syntax to STDOUT.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- Version();
- printf (
- "\nUsage: %s -I InputFile -O OutputFile [-P <Optional Boundary for padding up>] \n",
- UTILITY_NAME
- );
- printf (" Where:\n");
- printf (" InputFile is the input pre-processed dependency text files name.\n");
- printf (" OutputFile is the output binary dependency files name.\n");
- printf (" <Optional Boundary for padding up> is the padding integer value.\n");
- printf (" This is the boundary to align the output file size to.\n");
-}
-
-DEPENDENCY_OPCODE
-PopOpCode (
- IN OUT VOID **Stack
- )
-/*++
-
-Routine Description:
-
- Pop an element from the Opcode stack.
-
-Arguments:
-
- Stack Current top of the OpCode stack location
-
-Returns:
-
- DEPENDENCY_OPCODE OpCode at the top of the OpCode stack.
- Stack New top of the OpCode stack location
-
-
---*/
-{
- DEPENDENCY_OPCODE *OpCodePtr;
-
- OpCodePtr = *Stack;
- OpCodePtr--;
- *Stack = OpCodePtr;
- return *OpCodePtr;
-}
-
-VOID
-PushOpCode (
- IN OUT VOID **Stack,
- IN DEPENDENCY_OPCODE OpCode
- )
-/*++
-
-Routine Description:
-
- Push an element onto the Opcode Stack
-
-Arguments:
-
- Stack Current top of the OpCode stack location
- OpCode OpCode to push onto the stack
-
-Returns:
-
- Stack New top of the OpCode stack location
-
---*/
-{
- DEPENDENCY_OPCODE *OpCodePtr;
-
- OpCodePtr = *Stack;
- *OpCodePtr = OpCode;
- OpCodePtr++;
- *Stack = OpCodePtr;
-}
-
-EFI_STATUS
-GenerateDependencyExpression (
- IN FILE *InFile,
- IN OUT FILE *OutFile,
- IN INT8 Padding OPTIONAL
- )
-/*++
-
-Routine Description:
-
- This takes the pre-compiled dependency text file and
- converts it into a binary dependency file.
-
- The BNF for the dependency expression is as follows
- (from the DXE 1.0 Draft specification).
-
- The inputted BNF grammar is thus:
- <depex> ::= sor <dep> |
- before GUID <dep> |
- after GUID <dep> |
- <bool>
-
- <dep> ::= <bool> |
-
- <bool> ::= <bool> and <term> |
- <bool> or <term> |
- <term>
-
- <term> ::= not <factor> |
- <factor>
-
- <factor> ::= ( <bool> ) |
- <term> <term> |
- GUID |
- <boolval>
-
- <boolval> ::= true |
- false
-
- The outputed binary grammer is thus:
- <depex> ::= sor <dep> |
- before <depinst> <dep> |
- after <depinst> <dep> |
- <bool>
-
- <dep> ::= <bool> |
-
- <bool> ::= <bool> and <term> |
- <bool> or <term> | <term>
-
- <term> ::= not <factor> |
- <factor>
-
- <factor> ::= ( <bool> ) |
- <term> <term> |
- <boolval> |
- <depinst> |
- <termval>
-
- <boolval> ::= true |
- false
-
- <depinst> ::= push GUID
-
- <termval> ::= end
-
- BugBug: A correct grammer is parsed correctly. A file that violates the
- grammer may parse when it should generate an error. There is some
- error checking and it covers most of the case when it's an include
- of definition issue. An ill formed expresion may not be detected.
-
-Arguments:
-
- InFile - Input pre-compiled text file of the dependency expression.
- This needs to be in ASCII.
- The file pointer can not be NULL.
-
- OutFile - Binary dependency file.
- The file pointer can not be NULL.
-
- Padding - OPTIONAL integer value to pad the output file to.
-
-
-Returns:
-
- EFI_SUCCESS The function completed successfully.
- EFI_INVALID_PARAMETER One of the parameters in the text file was invalid.
- EFI_OUT_OF_RESOURCES Unable to allocate memory.
- EFI_ABORTED An misc error occurred.
-
---*/
-{
- INT8 *Ptrx;
- INT8 *Pend;
- INT8 *EvaluationStack;
- INT8 *StackPtr;
- INT8 *Buffer;
- INT8 Line[LINESIZE];
- UINTN Index;
- UINTN OutFileSize;
- UINTN FileSize;
- UINTN Results;
- BOOLEAN NotDone;
- BOOLEAN Before_Flag;
- BOOLEAN After_Flag;
- BOOLEAN Dep_Flag;
- BOOLEAN SOR_Flag;
- EFI_GUID Guid;
- UINTN ArgCountParsed;
- DEPENDENCY_OPCODE Opcode;
-
- Before_Flag = FALSE;
- After_Flag = FALSE;
- Dep_Flag = FALSE;
- SOR_Flag = FALSE;
-
- memset (Line, 0, LINESIZE);
-
- OutFileSize = 0;
-
- EvaluationStack = (INT8 *) malloc (EVAL_STACK_SIZE);
-
- if (EvaluationStack != NULL) {
- StackPtr = EvaluationStack;
- } else {
- printf ("Unable to allocate memory to EvaluationStack - Out of resources\n");
- return EFI_OUT_OF_RESOURCES;
- }
-
- Results = (UINTN) fseek (InFile, 0, SEEK_END);
-
- if (Results != 0) {
- printf ("FSEEK failed - Aborted\n");
- return EFI_ABORTED;
- }
-
- FileSize = ftell (InFile);
-
- if (FileSize == -1L) {
- printf ("FTELL failed - Aborted\n");
- return EFI_ABORTED;
- }
-
- Buffer = (INT8 *) malloc (FileSize + BUFFER_SIZE);
-
- if (Buffer == NULL) {
- printf ("Unable to allocate memory to Buffer - Out of resources\n");
- free (EvaluationStack);
-
- Results = (UINTN) fclose (InFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- Results = (UINTN) fclose (OutFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- return EFI_OUT_OF_RESOURCES;
- }
-
- Results = (UINTN) fseek (InFile, 0, SEEK_SET);
-
- if (Results != 0) {
- printf ("FSEEK failed - Aborted\n");
- return EFI_ABORTED;
- }
-
- memset (Buffer, 0, FileSize + BUFFER_SIZE);
- fread (Buffer, FileSize, 1, InFile);
-
- Ptrx = Buffer;
- Pend = Ptrx + FileSize - strlen (DEPENDENCY_END);
- Index = FileSize;
-
- NotDone = TRUE;
- while ((Index--) && NotDone) {
-
- if (strncmp (Pend, DEPENDENCY_END, strlen (DEPENDENCY_END)) == 0) {
- NotDone = FALSE;
- } else {
- Pend--;
- }
- }
-
- if (NotDone) {
- printf ("Couldn't find end string %s\n", DEPENDENCY_END);
-
- Results = (UINTN) fclose (InFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- Results = (UINTN) fclose (OutFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- free (Buffer);
- free (EvaluationStack);
-
- return EFI_INVALID_PARAMETER;
- }
-
- Index = FileSize;
-
- NotDone = TRUE;
- while ((Index--) && NotDone) {
-
- if (strncmp (Ptrx, DEPENDENCY_START, strlen (DEPENDENCY_START)) == 0) {
- Ptrx += sizeof (DEPENDENCY_START);
- NotDone = FALSE;
- //
- // BUGBUG -- should Index be decremented by sizeof(DEPENDENCY_START)?
- //
- } else {
- Ptrx++;
- }
- }
-
- if (NotDone) {
- printf ("Couldn't find start string %s\n", DEPENDENCY_START);
-
- Results = (UINTN) fclose (InFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- Results = (UINTN) fclose (OutFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- free (Buffer);
- free (EvaluationStack);
-
- return EFI_INVALID_PARAMETER;
- }
- //
- // validate the syntax of expression
- //
- if (!ParseDepex (Ptrx, Pend - Ptrx - 1)) {
- printf ("The syntax of expression is wrong\n");
-
- Results = (UINTN) fclose (InFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- Results = (UINTN) fclose (OutFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- free (Buffer);
- free (EvaluationStack);
-
- return EFI_INVALID_PARAMETER;
- }
-
- NotDone = TRUE;
-
- while ((Index--) && NotDone) {
-
- if (*Ptrx == ' ') {
- Ptrx++;
- } else if (*Ptrx == '\n' || *Ptrx == '\r') {
- Ptrx++;
- } else if (strncmp (Ptrx, OPERATOR_SOR, strlen (OPERATOR_SOR)) == 0) {
- //
- // Checks for some invalid dependencies
- //
- if (Before_Flag) {
-
- printf ("A BEFORE operator was detected.\n");
- printf ("There can only be one SOR or one AFTER or one BEFORE operator\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (After_Flag) {
-
- printf ("An AFTER operator was detected.\n");
- printf ("There can only be one SOR or one AFTER or one BEFORE operator\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (SOR_Flag) {
-
- printf ("Another SOR operator was detected.\n");
- printf ("There can only be one SOR or one AFTER or one BEFORE operator\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (Dep_Flag) {
-
- printf ("The Schedule On Request - SOR operator must be the first operator following DEPENDENCY_START\n");
- return EFI_INVALID_PARAMETER;
-
- } else {
- //
- // BUGBUG - This was not in the spec but is in the CORE code
- // An OPERATOR_SOR has to be first - following the DEPENDENCY_START
- //
- fputc (EFI_DEP_SOR, OutFile);
- OutFileSize++;
- Ptrx += sizeof (OPERATOR_SOR);
- SOR_Flag = TRUE;
-
- }
- } else if (strncmp (Ptrx, OPERATOR_BEFORE, strlen (OPERATOR_BEFORE)) == 0) {
- //
- // Checks for some invalid dependencies
- //
- if (Before_Flag) {
-
- printf ("Another BEFORE operator was detected.\n");
- printf ("There can only be one SOR or one AFTER or one BEFORE operator\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (After_Flag) {
-
- printf ("An AFTER operator was detected.\n");
- printf ("There can only be one SOR or one AFTER or one BEFORE operator\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (SOR_Flag) {
-
- printf ("A SOR operator was detected.\n");
- printf ("There can only be one SOR or one AFTER or one BEFORE operator\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (Dep_Flag) {
-
- printf ("The BEFORE operator must be the first operator following DEPENDENCY_START\n");
- return EFI_INVALID_PARAMETER;
-
- } else {
- fputc (EFI_DEP_BEFORE, OutFile);
- OutFileSize++;
- Ptrx += sizeof (OPERATOR_BEFORE);
- Before_Flag = TRUE;
- }
- } else if (strncmp (Ptrx, OPERATOR_AFTER, strlen (OPERATOR_AFTER)) == 0) {
- //
- // Checks for some invalid dependencies
- //
- if (Before_Flag) {
-
- printf ("A BEFORE operator was detected.\n");
- printf ("There can only be one SOR or one AFTER or one BEFORE operator\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (After_Flag) {
-
- printf ("Another AFTER operator was detected.\n");
- printf ("There can only be one SOR or one AFTER or one BEFORE operator\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (SOR_Flag) {
-
- printf ("A SOR operator was detected.\n");
- printf ("There can only be one SOR or one AFTER or one BEFORE operator\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (Dep_Flag) {
-
- printf ("The AFTER operator must be the first operator following DEPENDENCY_START\n");
- return EFI_INVALID_PARAMETER;
-
- } else {
- fputc (EFI_DEP_AFTER, OutFile);
- OutFileSize++;
- Ptrx += sizeof (OPERATOR_AFTER);
- Dep_Flag = TRUE;
- After_Flag = TRUE;
- }
- } else if (strncmp (Ptrx, OPERATOR_AND, strlen (OPERATOR_AND)) == 0) {
- while (StackPtr != EvaluationStack) {
- Opcode = PopOpCode ((VOID **) &StackPtr);
- if (Opcode != DXE_DEP_LEFT_PARENTHESIS) {
- fputc (Opcode, OutFile);
- OutFileSize++;
- } else {
- PushOpCode ((VOID **) &StackPtr, DXE_DEP_LEFT_PARENTHESIS);
- break;
- }
- }
-
- PushOpCode ((VOID **) &StackPtr, EFI_DEP_AND);
- Ptrx += sizeof (OPERATOR_AND);
- Dep_Flag = TRUE;
-
- } else if (strncmp (Ptrx, OPERATOR_OR, strlen (OPERATOR_OR)) == 0) {
- while (StackPtr != EvaluationStack) {
- Opcode = PopOpCode ((VOID **) &StackPtr);
- if (Opcode != DXE_DEP_LEFT_PARENTHESIS) {
- fputc (Opcode, OutFile);
- OutFileSize++;
- } else {
- PushOpCode ((VOID **) &StackPtr, DXE_DEP_LEFT_PARENTHESIS);
- break;
- }
- }
-
- PushOpCode ((VOID **) &StackPtr, EFI_DEP_OR);
- Ptrx += sizeof (OPERATOR_OR);
- Dep_Flag = TRUE;
-
- } else if (strncmp (Ptrx, OPERATOR_NOT, strlen (OPERATOR_NOT)) == 0) {
- while (StackPtr != EvaluationStack) {
- Opcode = PopOpCode ((VOID **) &StackPtr);
- if (Opcode != DXE_DEP_LEFT_PARENTHESIS) {
- fputc (Opcode, OutFile);
- OutFileSize++;
- } else {
- PushOpCode ((VOID **) &StackPtr, DXE_DEP_LEFT_PARENTHESIS);
- break;
- }
- }
-
- PushOpCode ((VOID **) &StackPtr, EFI_DEP_NOT);
- Ptrx += sizeof (OPERATOR_NOT);
- Dep_Flag = TRUE;
-
- } else if (*Ptrx == '\t') {
-
- printf ("File contains tabs. This violates the coding standard\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (*Ptrx == '\n') {
- //
- // Skip the newline character in the file
- //
- Ptrx++;
-
- } else if (strncmp (Ptrx, OPERATOR_LEFT_PARENTHESIS, strlen (OPERATOR_LEFT_PARENTHESIS)) == 0) {
- PushOpCode ((VOID **) &StackPtr, DXE_DEP_LEFT_PARENTHESIS);
-
- Ptrx += strlen (OPERATOR_LEFT_PARENTHESIS);
- Dep_Flag = TRUE;
-
- } else if (strncmp (Ptrx, OPERATOR_RIGHT_PARENTHESIS, strlen (OPERATOR_RIGHT_PARENTHESIS)) == 0) {
- while (StackPtr != EvaluationStack) {
- Opcode = PopOpCode ((VOID **) &StackPtr);
- if (Opcode != DXE_DEP_LEFT_PARENTHESIS) {
- fputc (Opcode, OutFile);
- OutFileSize++;
- } else {
- break;
- }
- }
-
- Ptrx += strlen (OPERATOR_RIGHT_PARENTHESIS);
- Dep_Flag = TRUE;
-
- } else if (strncmp (Ptrx, OPERATOR_TRUE, strlen (OPERATOR_TRUE)) == 0) {
-
- fputc (EFI_DEP_TRUE, OutFile);
-
- OutFileSize++;
-
- //
- // OutFileSize += sizeof (EFI_DEP_TRUE);
- //
- Dep_Flag = TRUE;
-
- Ptrx += strlen (OPERATOR_TRUE);
-
- } else if (strncmp (Ptrx, OPERATOR_FALSE, strlen (OPERATOR_FALSE)) == 0) {
-
- fputc (EFI_DEP_FALSE, OutFile);
-
- OutFileSize++;
-
- //
- // OutFileSize += sizeof (EFI_DEP_FALSE);
- //
- Dep_Flag = TRUE;
-
- Ptrx += strlen (OPERATOR_FALSE);
-
- } else if (*Ptrx == '{') {
- Ptrx++;
-
- if (*Ptrx == ' ') {
- Ptrx++;
- }
-
- {
- int byte_index;
- // This is an array of UINT32s. sscanf will trash memory
- // if you try to read into a UINT8 with a %x formatter.
- UINT32 Guid_Data4[8];
-
- ArgCountParsed = sscanf (
- Ptrx,
- "%x, %x, %x, { %x, %x, %x, %x, %x, %x, %x, %x }",
- &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]
- );
-
- // Now we can copy the 32 bit ints into the GUID.
- for (byte_index=0; byte_index<8; byte_index++) {
- Guid.Data4[byte_index] = (UINT8) Guid_Data4[byte_index];
- }
- }
-
- if (ArgCountParsed != 11) {
- printf ("We have found an illegal GUID\n");
- printf ("Fix your depex\n");
- exit (-1);
- }
-
- while (*Ptrx != '}') {
- Ptrx++;
- }
-
- Ptrx++;
- while (*Ptrx != '}') {
- Ptrx++;
- }
- //
- // Absorb the closing }
- //
- Ptrx++;
-
- //
- // Don't provide a PUSH Opcode for the Before and After case
- //
- if ((!Before_Flag) && (!After_Flag)) {
- fputc (EFI_DEP_PUSH, OutFile);
- OutFileSize++;
- }
-
- fwrite (&Guid, sizeof (EFI_GUID), 1, OutFile);
-
- OutFileSize += sizeof (EFI_GUID);
- Dep_Flag = TRUE;
-
- } else if (strncmp (Ptrx, DEPENDENCY_END, strlen (DEPENDENCY_END)) == 0) {
- NotDone = FALSE;
- } else {
- //
- // Not a valid construct. Null terminate somewhere out there and
- // print an error message.
- //
- *(Ptrx + 20) = 0;
- printf (TOOL_NAME " ERROR: Unrecognized input at: \"%s\"...\n", Ptrx);
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // DRAIN();
- //
- while (StackPtr != EvaluationStack) {
- fputc (PopOpCode ((VOID **) &StackPtr), OutFile);
- OutFileSize++;
- }
-
- if (OutFileSize == 0) {
- printf ("Grammer contains no operators or constants\n");
- return EFI_INVALID_PARAMETER;
- }
-
- fputc (EFI_DEP_END, OutFile);
-
- OutFileSize++;
-
- //
- // Checks for invalid padding values
- //
- if (Padding < 0) {
-
- printf ("The inputted padding value was %d\n", Padding);
- printf ("The optional padding value can not be less than ZERO\n");
- return EFI_INVALID_PARAMETER;
-
- } else if (Padding > 0) {
-
- while ((OutFileSize % Padding) != 0) {
-
- fputc (' ', OutFile);
- OutFileSize++;
- }
- }
-
- Results = (UINTN) fclose (InFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- Results = (UINTN) fclose (OutFile);
- if (Results != 0) {
- printf ("FCLOSE failed\n");
- }
-
- free (Buffer);
- free (EvaluationStack);
-
- return EFI_SUCCESS;
-} // End GenerateDependencyExpression function
-
-int
-main (
- IN UINTN argc,
- IN CHAR8 *argv[]
- )
-/*++
-
-Routine Description:
-
- Parse user entries. Print some rudimentary help
-
-Arguments:
-
- argc The count of input arguments
- argv The input arguments string array
-
-Returns:
-
- EFI_SUCCESS The function completed successfully.
- EFI_INVALID_PARAMETER One of the input parameters was invalid or one of the parameters in the text file was invalid.
- EFI_OUT_OF_RESOURCES Unable to allocate memory.
- EFI_ABORTED Unable to open/create a file or a misc error.
-
---*/
-{
- FILE *OutFile;
- FILE *InFile;
- UINT8 Padding;
- UINTN Index;
- BOOLEAN Input_Flag;
- BOOLEAN Output_Flag;
- BOOLEAN Pad_Flag;
-
- InFile = NULL;
- OutFile = NULL;
- Padding = 0;
- Input_Flag = FALSE;
- Output_Flag = FALSE;
- Pad_Flag = FALSE;
-
- if (argc == 1) {
- Usage();
- return EFI_INVALID_PARAMETER;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return EFI_INVALID_PARAMETER;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return EFI_INVALID_PARAMETER;
- }
-
- if (argc < 5) {
- printf ("Not enough arguments\n");
- Usage();
- return EFI_INVALID_PARAMETER;
- }
-
- for (Index = 1; Index < argc - 1; Index++) {
-
- if ((strcmp (argv[Index], "-I") == 0) || (strcmp (argv[Index], "-i") == 0)) {
-
- if (!Input_Flag) {
-
- InFile = fopen (argv[Index + 1], "rb");
- Input_Flag = TRUE;
-
- } else {
- printf ("GenDepex only allows one INPUT (-I) argument\n");
- return EFI_INVALID_PARAMETER;
- }
-
- } else if ((strcmp (argv[Index], "-O") == 0) || (strcmp (argv[Index], "-o") == 0)) {
-
- if (!Output_Flag) {
-
- OutFile = fopen (argv[Index + 1], "wb");
- Output_Flag = TRUE;
-
- } else {
- printf ("GenDepex only allows one OUTPUT (-O) argument\n");
- return EFI_INVALID_PARAMETER;
- }
-
- } else if ((strcmp (argv[Index], "-P") == 0) || (strcmp (argv[Index], "-p") == 0)) {
-
- if (!Pad_Flag) {
-
- Padding = (UINT8) atoi (argv[Index + 1]);
- Pad_Flag = TRUE;
-
- } else {
- printf ("GenDepex only allows one PADDING (-P) argument\n");
- return EFI_INVALID_PARAMETER;
- }
- }
- }
-
- if (InFile == NULL) {
- printf ("Can not open <INFILE> for reading.\n");
- Usage();
- return EFI_ABORTED;
- }
-
- if (OutFile == NULL) {
- printf ("Can not open <OUTFILE> for writting.\n");
- Usage();
- return EFI_ABORTED;
- }
-
- return GenerateDependencyExpression (InFile, OutFile, Padding);
-}
diff --git a/Tools/CCode/Source/GenDepex/GenDepex.h b/Tools/CCode/Source/GenDepex/GenDepex.h
deleted file mode 100644
index b198156baa..0000000000
--- a/Tools/CCode/Source/GenDepex/GenDepex.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*++
-Copyright (c) 2004, 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.
-
- Module Name:
- GenDepex.h
-
- Abstract:
- This file contains the relevant declarations required
- to generate a binary Dependency File
-
- Complies with Tiano C Coding Standards Document, version 0.31, 12 Dec 2000.
-
---*/
-
-#ifndef _EFI_GEN_DEPEX_H
-#define _EFI_GEN_DEPEX_H
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-#include <string.h>
-#ifndef __GNUC__
-#include <malloc.h>
-#endif
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/Dependency.h>
-
-#define DEPENDENCY_START "DEPENDENCY_START"
-#define OPERATOR_BEFORE "BEFORE"
-#define OPERATOR_AFTER "AFTER"
-#define OPERATOR_AND "AND"
-#define OPERATOR_OR "OR"
-#define OPERATOR_NOT "NOT"
-#define OPERATOR_TRUE "TRUE"
-#define OPERATOR_FALSE "FALSE"
-#define OPERATOR_SOR "SOR"
-#define OPERATOR_END "END"
-#define OPERATOR_LEFT_PARENTHESIS "("
-#define OPERATOR_RIGHT_PARENTHESIS ")"
-#define DEPENDENCY_END "DEPENDENCY_END"
-
-#define DXE_DEP_LEFT_PARENTHESIS 0x0a
-#define DXE_DEP_RIGHT_PARENTHESIS 0x0b
-
-#define LINESIZE 320
-#define SIZE_A_SYMBOL 60
-#define DEPENDENCY_OPCODE UINT8
-#define EVAL_STACK_SIZE 0x1024
-#define BUFFER_SIZE 0x100
-
-//
-// Utility Name
-//
-#define UTILITY_NAME "GenDepex"
-
-//
-// Utility version information
-//
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 5
-
-#endif
diff --git a/Tools/CCode/Source/GenDepex/build.xml b/Tools/CCode/Source/GenDepex/build.xml
deleted file mode 100644
index e74943110a..0000000000
--- a/Tools/CCode/Source/GenDepex/build.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenDepex Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenDepex"/>
- <property name="FileSet" value="DepexParser.c GenDepex.c GenDepex.h"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}" />
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenFfsFile/GenFfsFile.c b/Tools/CCode/Source/GenFfsFile/GenFfsFile.c
deleted file mode 100644
index 81708cfc8c..0000000000
--- a/Tools/CCode/Source/GenFfsFile/GenFfsFile.c
+++ /dev/null
@@ -1,2694 +0,0 @@
-/*++
-
-Copyright (c) 2004-2007, 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.
-
-Module Name:
-
- GenFfsFile.c
-
-Abstract:
-
- This file contains functions required to generate a Firmware File System
- file.
-
---*/
-
-#include <stdio.h>
-#include <ctype.h> // for isalpha()
-//
-// include file for _spawnv
-//
-#ifndef __GNUC__
-#include <process.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-#include <Common/FirmwareFileSystem.h>
-#include <Common/FirmwareVolumeHeader.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-
-#include "ParseInf.h"
-#include "Compress.h"
-#include "EfiCustomizedCompress.h"
-#include "Crc32.h"
-#include "GenFfsFile.h"
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.h"
-#include "SimpleFileParsing.h"
-
-#define UTILITY_NAME "GenFfsFile"
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 32
-
-#define MAX_ARRAY_SIZE 100
-
-static
-INT32
-GetNextLine (
- OUT CHAR8 *Destination,
- IN FILE *Package,
- IN OUT UINT32 *LineNumber
- );
-
-static
-void
-CheckSlash (
- IN OUT CHAR8 *String,
- IN FILE *In,
- IN OUT UINT32 *LineNumber
- );
-
-static
-INT32
-FindSectionInPackage (
- IN CHAR8 *BuildDirectory,
- IN FILE *OverridePackage,
- IN OUT UINT32 *LineNumber
- );
-
-static
-STATUS
-ProcessCommandLineArgs (
- int Argc,
- char *Argv[]
- );
-
-static
-void
-Version (
- void
- );
-
-static
-void
-Usage (
- void
- );
-
-//
-// Keep globals in this structure
-//
-static struct {
- UINT8 BuildDirectory[_MAX_PATH];
- UINT8 PrimaryPackagePath[_MAX_PATH];
- UINT8 OverridePackagePath[_MAX_PATH];
- BOOLEAN Verbose;
-} mGlobals;
-
-static EFI_GUID mZeroGuid = { 0 };
-
-static
-void
-StripQuotes (
- IN OUT CHAR8 *String
- )
-/*++
-
-Routine Description:
-
- Removes quotes and/or whitespace from around a string
-
-Arguments:
-
- String - String to remove quotes from
-
-Returns:
-
- None
-
---*/
-{
- UINTN Index;
- UINTN Index2;
- UINTN StrLen;
-
- Index2 = strspn (String, "\" \t\n");
- StrLen = strlen (String);
-
- for (Index = Index2; String[Index] != '\"', Index < StrLen; Index++) {
- String[Index - Index2] = String[Index];
- }
-
- String[Index - Index2] = 0;
-}
-
-static
-void
-Version(
- void
- )
-/*++
-
-Routine Description:
-
- Print out version information for this utility.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -EDK utility to generate a Firmware File System files.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-static
-void
-Usage (
- void
- )
-/*++
-
-Routine Description:
-
- Print Error / Help message.
-
-Arguments:
-
- void
-
-Returns:
-
- None
-
---*/
-{
- Version();
-
- printf ("\nUsage:\n");
- printf (UTILITY_NAME " -b \"build directory\" -p1 \"package1.inf\" -p2 \"package2.inf\" -v\n");
- printf (" -b \"build directory\":\n ");
- printf (" specifies the full path to the component build directory.\n");
- printf (" -p1 \"P1_path\":\n");
- printf (" specifies fully qualified file name to the primary package file.\n");
- printf (" This file will normally exist in the same directory as the makefile\n");
- printf (" for the component. Required.\n");
- printf (" -p2 \"P2_path\":\n");
- printf (" specifies fully qualified file name to the override package file.\n");
- printf (" This file will normally exist in the build tip. Optional.\n");
-}
-
-static
-INT32
-TestComment (
- IN CHAR8 *String,
- IN FILE *In
- )
-/*++
-
-Routine Description:
-
- Tests input string to see if it is a comment, and if so goes to the next line in the file that is not a comment
-
-Arguments:
-
- String - String to test
-
- In - Open file to move pointer within
-
-Returns:
-
- -1 - End of file reached
- 0 - Not a comment
- 1 - Comment bypassed
-
---*/
-{
- CHAR8 CharBuffer;
-
- CharBuffer = 0;
- if ((String[0] == '/') && (String[1] == '/')) {
- while (CharBuffer != '\n') {
- fscanf (In, "%c", &CharBuffer);
- if (feof (In)) {
- return -1;
- }
- }
- } else {
- return 0;
- }
-
- return 1;
-}
-
-static
-void
-BreakString (
- IN CONST CHAR8 *Source,
- OUT CHAR8 *Destination,
- IN INTN Direction
- )
-/*++
-
-Routine Description:
-
- Takes an input string and returns either the part before the =, or the part after the =, depending on direction
-
-Arguments:
-
- Source - String to break
-
- Destination - Buffer to place new string in
-
- Direction - 0 to return all of source string before =
- 1 to return all of source string after =
-
-Returns:
-
- None
-
---*/
-{
- UINTN Index;
- UINTN Index2;
-
- Index = 0;
- Index2 = 0;
-
- if (strchr (Source, '=') == NULL) {
- strcpy (Destination, Source);
-
- return ;
- }
-
- if (Direction == 0) {
- //
- // return part of string before =
- //
- while (Source[Index] != '=') {
- Destination[Index] = Source[Index++];
- }
-
- Destination[Index] = 0;
- } else {
- //
- // return part of string after =
- //
- strcpy (Destination, strchr (Source, '=') + 1);
- }
-}
-
-static
-INT32
-GetNextLine (
- OUT CHAR8 *Destination,
- IN FILE *Package,
- IN OUT UINT32 *LineNumber
- )
-/*++
-
-Routine Description:
-
- Gets the next non-commented line from the file
-
-Arguments:
-
- Destination - Where to put string
-
- Package - Package to get string from
-
- LineNumber - The actual line number.
-
-Returns:
-
- -1 - End of file reached
- 0 - Success
-
---*/
-{
- CHAR8 String[_MAX_PATH];
- fscanf (Package, "%s", &String);
- if (feof (Package)) {
- return -1;
- }
-
- while (TestComment (String, Package) == 1) {
- fscanf (Package, "%s", &String);
- if (feof (Package)) {
- return -1;
- }
- }
-
- strcpy (Destination, String);
- return 0;
-}
-
-static
-VOID
-CheckSlash (
- IN OUT CHAR8 *String,
- IN FILE *In,
- IN OUT UINT32 *LineNumber
- )
-/*++
-
-Routine Description:
-
- Checks to see if string is line continuation character, if so goes to next valid line
-
-Arguments:
-
- String - String to test
-
- In - Open file to move pointer within
-
- LineNumber - The line number.
-
-Returns:
-
- None
-
---*/
-{
- CHAR8 ByteBuffer;
- ByteBuffer = 0;
-
- switch (String[0]) {
-
- case '\\':
- while (String[0] == '\\') {
- while (ByteBuffer != '\n') {
- fscanf (In, "%c", &ByteBuffer);
- }
- (*LineNumber)++;
- if (GetNextLine (String, In, LineNumber) == -1) {
- return ;
- }
- }
- break;
-
- case '\n':
- (*LineNumber)++;
- while (String[0] == '\n') {
- if (GetNextLine (String, In, LineNumber) == -1) {
- return ;
- }
- }
- break;
-
- default:
- break;
-
- }
-
-}
-
-static
-INT32
-FindSectionInPackage (
- IN CHAR8 *BuildDirectory,
- IN FILE *OverridePackage,
- IN OUT UINT32 *LineNumber
- )
-/*++
-
-Routine Description:
-
- Finds the matching section within the package
-
-Arguments:
-
- BuildDirectory - name of section to find
-
- OverridePackage - Package file to search within
-
- LineNumber - The line number.
-
-Returns:
-
- -1 - End of file reached
- 0 - Success
-
---*/
-{
- CHAR8 String[_MAX_PATH];
- CHAR8 NewString[_MAX_PATH];
- String[0] = 0;
-
- while (strcmp (BuildDirectory, String) != 0) {
- if (GetNextLine (NewString, OverridePackage, LineNumber) != 0) {
- return -1;
- }
-
- if (NewString[0] == '[') {
- if (NewString[strlen (NewString) - 1] != ']') {
- //
- // have to construct string.
- //
- strcpy (String, NewString + 1);
-
- while (1) {
- fscanf (OverridePackage, "%s", &NewString);
- if (feof (OverridePackage)) {
- return -1;
- }
-
- if (NewString[0] != ']') {
- if (strlen (String) != 0) {
- strcat (String, " ");
- }
-
- strcat (String, NewString);
- if (String[strlen (String) - 1] == ']') {
- String[strlen (String) - 1] = 0;
- break;
- }
- } else {
- break;
- }
- }
- } else {
- NewString[strlen (NewString) - 1] = 0;
- strcpy (String, NewString + 1);
- }
- }
- }
-
- return 0;
-}
-
-static
-EFI_STATUS
-GenSimpleGuidSection (
- IN OUT UINT8 *FileBuffer,
- IN OUT UINT32 *BufferSize,
- IN UINT32 DataSize,
- IN EFI_GUID SignGuid,
- IN UINT16 GuidedSectionAttributes
- )
-/*++
-
-Routine Description:
-
- add GUIDed section header for the data buffer.
- data stays in same location (overwrites source data).
-
-Arguments:
-
- FileBuffer - Buffer containing data to sign
-
- BufferSize - On input, the size of FileBuffer. On output, the size of
- actual section data (including added section header).
-
- DataSize - Length of data to Sign
-
- SignGuid - Guid to be add.
-
- GuidedSectionAttributes - The section attribute.
-
-Returns:
-
- EFI_SUCCESS - Successful
- EFI_OUT_OF_RESOURCES - Not enough resource.
-
---*/
-{
- UINT32 TotalSize;
-
- EFI_GUID_DEFINED_SECTION GuidSectionHeader;
- UINT8 *SwapBuffer;
-
- SwapBuffer = NULL;
-
- if (DataSize == 0) {
- *BufferSize = 0;
-
- return EFI_SUCCESS;
- }
-
- TotalSize = DataSize + sizeof (EFI_GUID_DEFINED_SECTION);
- GuidSectionHeader.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
- GuidSectionHeader.CommonHeader.Size[0] = (UINT8) (TotalSize & 0xff);
- GuidSectionHeader.CommonHeader.Size[1] = (UINT8) ((TotalSize & 0xff00) >> 8);
- GuidSectionHeader.CommonHeader.Size[2] = (UINT8) ((TotalSize & 0xff0000) >> 16);
- memcpy (&(GuidSectionHeader.SectionDefinitionGuid), &SignGuid, sizeof (EFI_GUID));
- GuidSectionHeader.Attributes = GuidedSectionAttributes;
- GuidSectionHeader.DataOffset = sizeof (EFI_GUID_DEFINED_SECTION);
-
- SwapBuffer = (UINT8 *) malloc (DataSize);
- if (SwapBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- memcpy (SwapBuffer, FileBuffer, DataSize);
- memcpy (FileBuffer, &GuidSectionHeader, sizeof (EFI_GUID_DEFINED_SECTION));
- memcpy (FileBuffer + sizeof (EFI_GUID_DEFINED_SECTION), SwapBuffer, DataSize);
-
- //
- // Make sure section ends on a DWORD boundary
- //
- while ((TotalSize & 0x03) != 0) {
- FileBuffer[TotalSize] = 0;
- TotalSize++;
- }
-
- *BufferSize = TotalSize;
-
- if (SwapBuffer != NULL) {
- free (SwapBuffer);
- }
-
- return EFI_SUCCESS;
-}
-
-static
-EFI_STATUS
-CompressSection (
- UINT8 *FileBuffer,
- UINT32 *BufferSize,
- UINT32 DataSize,
- CHAR8 *Type
- )
-/*++
-
-Routine Description:
-
- Compress the data and add section header for the compressed data.
- Compressed data (with section header) stays in same location as the source
- (overwrites source data).
-
-Arguments:
-
- FileBuffer - Buffer containing data to Compress
-
- BufferSize - On input, the size of FileBuffer. On output, the size of
- actual compressed data (including added section header).
- When buffer is too small, this value indicates the size needed.
-
- DataSize - The size of data to compress
-
- Type - The compression type (not used currently).
- Assume EFI_HEAVY_COMPRESSION.
-
-Returns:
-
- EFI_BUFFER_TOO_SMALL - Buffer size is too small.
- EFI_UNSUPPORTED - Compress type can not be supported.
- EFI_SUCCESS - Successful
- EFI_OUT_OF_RESOURCES - Not enough resource.
-
---*/
-{
- EFI_STATUS Status;
- UINT8 *CompData;
- UINT32 CompSize;
- UINT32 TotalSize;
- EFI_COMPRESSION_SECTION CompressionSet;
- UINT8 CompressionType;
- COMPRESS_FUNCTION CompressFunction;
-
- Status = EFI_SUCCESS;
- CompData = NULL;
- CompSize = 0;
- TotalSize = 0;
- CompressFunction = NULL;
-
- //
- // Get the compress type
- //
- if (strcmpi (Type, "Dummy") == 0) {
- //
- // Added "Dummy" to keep backward compatibility.
- //
- CompressionType = EFI_STANDARD_COMPRESSION;
- CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
-
- } else if (strcmpi (Type, "LZH") == 0) {
- //
- // EFI stardard compression (LZH)
- //
- CompressionType = EFI_STANDARD_COMPRESSION;
- CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
-
- } else {
- //
- // Customized compression
- //
- Status = SetCustomizedCompressionType (Type);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CompressionType = EFI_CUSTOMIZED_COMPRESSION;
- CompressFunction = (COMPRESS_FUNCTION) CustomizedCompress;
- }
- //
- // Compress the raw data
- //
- Status = CompressFunction (FileBuffer, DataSize, CompData, &CompSize);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- CompData = malloc (CompSize);
- if (!CompData) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = CompressFunction (FileBuffer, DataSize, CompData, &CompSize);
- }
-
- if (EFI_ERROR (Status)) {
- if (CompData != NULL) {
- free (CompData);
- }
-
- return Status;
- }
-
- TotalSize = CompSize + sizeof (EFI_COMPRESSION_SECTION);
-
- //
- // Buffer too small?
- //
- if (TotalSize > *BufferSize) {
- *BufferSize = TotalSize;
- if (CompData != NULL) {
- free (CompData);
- }
-
- return EFI_BUFFER_TOO_SMALL;
- }
- //
- // Add the section header for the compressed data
- //
- CompressionSet.CommonHeader.Type = EFI_SECTION_COMPRESSION;
- CompressionSet.CommonHeader.Size[0] = (UINT8) (TotalSize & 0xff);
- CompressionSet.CommonHeader.Size[1] = (UINT8) ((TotalSize & 0xff00) >> 8);
- CompressionSet.CommonHeader.Size[2] = (UINT8) ((TotalSize & 0xff0000) >> 16);
- CompressionSet.CompressionType = CompressionType;
- CompressionSet.UncompressedLength = DataSize;
-
- //
- // Copy header and data to the buffer
- //
- memcpy (FileBuffer, &CompressionSet, sizeof (EFI_COMPRESSION_SECTION));
- memcpy (FileBuffer + sizeof (CompressionSet), CompData, CompSize);
-
- //
- // Make sure section ends on a DWORD boundary
- //
- while ((TotalSize & 0x03) != 0) {
- FileBuffer[TotalSize] = 0;
- TotalSize++;
- }
-
- *BufferSize = TotalSize;
-
- if (CompData != NULL) {
- free (CompData);
- }
-
- return EFI_SUCCESS;
-}
-
-static
-void
-StripParens (
- IN OUT CHAR8 *String
- )
-/*++
-
-Routine Description:
-
- Removes Parenthesis from around a string
-
-Arguments:
-
- String - String to remove parens from
-
-Returns:
-
- None
-
---*/
-{
- INT32 Index;
-
- if (String[0] != '(') {
- return ;
- }
-
- for (Index = 1; String[Index] != ')'; Index++) {
- String[Index - 1] = String[Index];
- if (String[Index] == 0) {
- return ;
- }
- }
-
- String[Index - 1] = 0;
-
- return ;
-}
-
-static
-void
-StripEqualMark (
- IN OUT CHAR8 *String
- )
-/*++
-
-Routine Description:
-
- Removes Equal Mark from around a string
-
-Arguments:
-
- String - String to remove equal mark from
-
-Returns:
-
- None
-
---*/
-{
- INT32 Index;
-
- if (String[0] != '=' && String[strlen (String) - 1] != '=') {
- return ;
- }
-
- if (String[0] == '=') {
-
- for (Index = 1; String[Index] != 0; Index++) {
- String[Index - 1] = String[Index];
- }
-
- String[Index - 1] = 0;
- }
-
- if (String[strlen (String) - 1] == '=') {
- String[strlen (String) - 1] = 0;
- }
-
- return ;
-}
-
-static
-INT32
-ProcessEnvironmentVariable (
- IN CHAR8 *Buffer,
- OUT CHAR8 *NewBuffer
- )
-/*++
-
-Routine Description:
-
- Converts environment variables to values
-
-Arguments:
-
- Buffer - Buffer containing Environment Variable String
-
- NewBuffer - Buffer containing value of environment variable
-
-
-Returns:
-
- Number of characters from Buffer used
-
---*/
-{
- INT32 Index;
- INT32 Index2;
- CHAR8 VariableBuffer[_MAX_PATH];
-
- Index = 2;
- Index2 = 0;
-
- while (Buffer[Index] != ')') {
- VariableBuffer[Index - 2] = Buffer[Index++];
- }
-
- VariableBuffer[Index - 2] = 0;
- Index++;
-
- if (getenv (VariableBuffer) != NULL) {
- strcpy (NewBuffer, getenv (VariableBuffer));
- } else {
- printf ("Environment variable %s not found!\n", VariableBuffer);
- }
-
- return Index;
-}
-
-static
-void
-SplitAttributesField (
- IN CHAR8 *Buffer,
- IN CHAR8 *AttributesArray[],
- IN OUT UINT32 *NumberOfAttributes
- )
-/*
- NumberOfAttributes: on input, it specifies the current number of attributes
- stored in AttributeArray.
- on output, it is updated to the latest number of attributes
- stored in AttributesArray.
-*/
-{
- UINT32 Index;
- UINT32 Index2;
- UINT32 z;
- CHAR8 *CharBuffer;
-
- CharBuffer = NULL;
- CharBuffer = (CHAR8 *) malloc (_MAX_PATH);
- ZeroMem (CharBuffer, _MAX_PATH);
-
- for (Index = 0, z = 0, Index2 = 0; Index < strlen (Buffer); Index++) {
-
- if (Buffer[Index] != '|') {
- CharBuffer[z] = Buffer[Index];
- z++;
- } else {
-
- CharBuffer[z] = 0;
- AttributesArray[*NumberOfAttributes + Index2] = CharBuffer;
- Index2++;
-
- //
- // allocate new char buffer for the next attributes string
- //
- CharBuffer = (CHAR8 *) malloc (_MAX_PATH);
- ZeroMem (CharBuffer, _MAX_PATH);
- z = 0;
- }
- }
-
- CharBuffer[z] = 0;
- //
- // record the last attributes string in the Buffer
- //
- AttributesArray[*NumberOfAttributes + Index2] = CharBuffer;
- Index2++;
-
- *NumberOfAttributes += Index2;
-
- return ;
-}
-
-static
-INT32
-GetToolArguments (
- CHAR8 *ToolArgumentsArray[],
- FILE *Package,
- CHAR8 **PtrInputFileName,
- CHAR8 **PtrOutputFileName,
- EFI_GUID *Guid,
- UINT16 *GuidedSectionAttributes
- )
-{
- CHAR8 Buffer[_MAX_PATH];
- BOOLEAN ArgumentsFlag;
- BOOLEAN InputFlag;
- BOOLEAN OutputFlag;
- BOOLEAN GuidFlag;
- BOOLEAN AttributesFlag;
- UINT32 argc;
- UINT32 Index2;
- UINT32 z;
- CHAR8 *CharBuffer;
- INT32 Index;
- INT32 ReturnValue;
- EFI_STATUS Status;
-
- CHAR8 *AttributesArray[MAX_ARRAY_SIZE];
- UINT32 NumberOfAttributes;
- CHAR8 *InputFileName;
- CHAR8 *OutputFileName;
- UINT32 LineNumber;
- Buffer[_MAX_PATH];
-
- ArgumentsFlag = FALSE;
- InputFlag = FALSE;
- OutputFlag = FALSE;
- GuidFlag = FALSE;
- AttributesFlag = FALSE;
- //
- // Start at 1, since ToolArgumentsArray[0]
- // is the program name.
- //
- argc = 1;
- Index2 = 0;
-
- z = 0;
- ReturnValue = 0;
- NumberOfAttributes = 0;
- InputFileName = NULL;
- OutputFileName = NULL;
-
- ZeroMem (Buffer, _MAX_PATH);
- ZeroMem (AttributesArray, sizeof (CHAR8 *) * MAX_ARRAY_SIZE);
- LineNumber = 0;
- while (Buffer[0] != ')') {
-
- if (GetNextLine (Buffer, Package, &LineNumber) != -1) {
- CheckSlash (Buffer, Package, &LineNumber);
- StripEqualMark (Buffer);
- } else {
- Error (NULL, 0, 0, "failed to get next line from package file", NULL);
- return -1;
- }
-
- if (Buffer[0] == ')') {
- break;
- } else if (strcmpi (Buffer, "ARGS") == 0) {
-
- ArgumentsFlag = TRUE;
- AttributesFlag = FALSE;
- continue;
-
- } else if (strcmpi (Buffer, "INPUT") == 0) {
-
- InputFlag = TRUE;
- ArgumentsFlag = FALSE;
- AttributesFlag = FALSE;
- continue;
-
- } else if (strcmpi (Buffer, "OUTPUT") == 0) {
-
- OutputFlag = TRUE;
- ArgumentsFlag = FALSE;
- AttributesFlag = FALSE;
- continue;
-
- } else if (strcmpi (Buffer, "GUID") == 0) {
-
- GuidFlag = TRUE;
- ArgumentsFlag = FALSE;
- AttributesFlag = FALSE;
- //
- // fetch the GUID for the section
- //
- continue;
-
- } else if (strcmpi (Buffer, "ATTRIBUTES") == 0) {
-
- AttributesFlag = TRUE;
- ArgumentsFlag = FALSE;
- //
- // fetch the GUIDed Section's Attributes
- //
- continue;
-
- } else if (strcmpi (Buffer, "") == 0) {
- continue;
- }
- //
- // get all command arguments into ToolArgumentsArray
- //
- if (ArgumentsFlag) {
-
- StripEqualMark (Buffer);
-
- CharBuffer = (CHAR8 *) malloc (_MAX_PATH);
- if (CharBuffer == NULL) {
- goto ErrorExit;
- }
-
- ZeroMem (CharBuffer, sizeof (_MAX_PATH));
-
- ToolArgumentsArray[argc] = CharBuffer;
-
- if (Buffer[0] == '$') {
- Index = ProcessEnvironmentVariable (&Buffer[0], ToolArgumentsArray[argc]);
- //
- // if there is string after the environment variable, cat it.
- //
- if ((UINT32) Index < strlen (Buffer)) {
- strcat (ToolArgumentsArray[argc], &Buffer[Index]);
- }
- } else {
- strcpy (ToolArgumentsArray[argc], Buffer);
- }
-
- argc += 1;
- ToolArgumentsArray[argc] = NULL;
- continue;
- }
-
- if (InputFlag) {
-
- StripEqualMark (Buffer);
-
- InputFileName = (CHAR8 *) malloc (_MAX_PATH);
- if (InputFileName == NULL) {
- goto ErrorExit;
- }
-
- ZeroMem (InputFileName, sizeof (_MAX_PATH));
-
- if (Buffer[0] == '$') {
- Index = ProcessEnvironmentVariable (&Buffer[0], InputFileName);
- //
- // if there is string after the environment variable, cat it.
- //
- if ((UINT32) Index < strlen (Buffer)) {
- strcat (InputFileName, &Buffer[Index]);
- }
- } else {
- strcpy (InputFileName, Buffer);
- }
-
- InputFlag = FALSE;
- continue;
- }
-
- if (OutputFlag) {
-
- StripEqualMark (Buffer);
-
- OutputFileName = (CHAR8 *) malloc (_MAX_PATH);
- if (OutputFileName == NULL) {
- goto ErrorExit;
- }
-
- ZeroMem (OutputFileName, sizeof (_MAX_PATH));
-
- if (Buffer[0] == '$') {
- Index = ProcessEnvironmentVariable (&Buffer[0], OutputFileName);
- //
- // if there is string after the environment variable, cat it.
- //
- if ((UINT32) Index < strlen (Buffer)) {
- strcat (OutputFileName, &Buffer[Index]);
- }
- } else {
- strcpy (OutputFileName, Buffer);
- }
-
- OutputFlag = FALSE;
- continue;
- }
-
- if (GuidFlag) {
-
- StripEqualMark (Buffer);
-
- Status = StringToGuid (Buffer, Guid);
- if (EFI_ERROR (Status)) {
- ReturnValue = -1;
- goto ErrorExit;
- }
-
- GuidFlag = FALSE;
- }
-
- if (AttributesFlag) {
-
- StripEqualMark (Buffer);
-
- //
- // there might be no space between each attribute in the statement,
- // split them aside and return each attribute string
- // in the AttributesArray
- //
- SplitAttributesField (Buffer, AttributesArray, &NumberOfAttributes);
- }
- }
- //
- // ReplaceVariableInBuffer (ToolArgumentsArray,&i,"INPUT",InputVariable,j);
- // ReplaceVariableInBuffer (ToolArgumentsArray,&i,"OUTPUT",&TargetFileName,1);
- //
- for (z = 0; z < NumberOfAttributes; z++) {
- if (strcmpi (AttributesArray[z], "PROCESSING_REQUIRED") == 0) {
- *GuidedSectionAttributes |= EFI_GUIDED_SECTION_PROCESSING_REQUIRED;
- } else if (strcmpi (AttributesArray[z], "AUTH_STATUS_VALID") == 0) {
- *GuidedSectionAttributes |= EFI_GUIDED_SECTION_AUTH_STATUS_VALID;
- }
- }
-
-ErrorExit:
-
- for (Index2 = 0; Index2 < MAX_ARRAY_SIZE; Index2++) {
- if (AttributesArray[Index2] == NULL) {
- break;
- }
-
- free (AttributesArray[Index2]);
- }
-
- *PtrInputFileName = InputFileName;
- *PtrOutputFileName = OutputFileName;
-
- return ReturnValue;
-}
-
-static
-INT32
-ProcessScript (
- IN OUT UINT8 *FileBuffer,
- IN FILE *Package,
- IN CHAR8 *BuildDirectory,
- IN BOOLEAN ForceUncompress
- )
-/*++
-
-Routine Description:
-
- Signs the section, data stays in same location
-
-Arguments:
-
- FileBuffer - Data Buffer
-
- Package - Points to curly brace in Image Script
-
- BuildDirectory - Name of the source directory parameter
-
- ForceUncompress - Whether to force uncompress.
-
-Returns:
-
- Number of bytes added to file buffer
- -1 on error
-
---*/
-{
- EFI_STATUS Status;
- UINT32 Size;
- CHAR8 Buffer[_MAX_PATH];
- CHAR8 Type[_MAX_PATH];
- CHAR8 FileName[_MAX_PATH];
- CHAR8 NewBuffer[_MAX_PATH];
- INT32 Index3;
- INT32 Index2;
- UINT32 ReturnValue;
- UINT8 ByteBuffer;
- FILE *InFile;
- UINT32 SourceDataSize;
- CHAR8 *ToolArgumentsArray[MAX_ARRAY_SIZE];
- CHAR8 *OutputFileName;
- CHAR8 *InputFileName;
- CHAR8 ToolName[_MAX_PATH];
- FILE *OutputFile;
- FILE *InputFile;
- UINT8 Temp;
- int returnint;
- INT32 Index;
- UINT32 LineNumber;
- BOOLEAN IsError;
- EFI_GUID SignGuid;
- UINT16 GuidedSectionAttributes;
- UINT8 *TargetFileBuffer;
-
- OutputFileName = NULL;
- InputFileName = NULL;
- OutputFile = NULL;
- InputFile = NULL;
- IsError = FALSE;
- GuidedSectionAttributes = 0;
- TargetFileBuffer = NULL;
-
- Size = 0;
- LineNumber = 0;
- Buffer[0] = 0;
- for (Index3 = 0; Index3 < MAX_ARRAY_SIZE; ++Index3) {
- ToolArgumentsArray[Index3] = NULL;
- }
-
- while (Buffer[0] != '}') {
- if (GetNextLine (Buffer, Package, &LineNumber) != -1) {
- CheckSlash (Buffer, Package, &LineNumber);
- } else {
- printf ("ERROR in IMAGE SCRIPT!\n");
- IsError = TRUE;
- goto Done;
- }
-
- if (strcmpi (Buffer, "Compress") == 0) {
- //
- // Handle compress
- //
- //
- // read compression type
- //
- if (GetNextLine (Buffer, Package, &LineNumber) != -1) {
- CheckSlash (Buffer, Package, &LineNumber);
- }
-
- StripParens (Buffer);
- if (Buffer[0] == '$') {
- ProcessEnvironmentVariable (&Buffer[0], Type);
- } else {
- strcpy (Type, Buffer);
- }
- //
- // build buffer
- //
- while (Buffer[0] != '{') {
- if (GetNextLine (Buffer, Package, &LineNumber) != -1) {
- CheckSlash (Buffer, Package, &LineNumber);
- }
- }
-
- ReturnValue = ProcessScript (&FileBuffer[Size], Package, BuildDirectory, ForceUncompress);
- if (ReturnValue == -1) {
- IsError = TRUE;
- goto Done;
- }
- //
- // Call compress routine on buffer.
- // Occasionally, compressed data + section header would
- // be largere than the source and EFI_BUFFER_TOO_SMALL is
- // returned from CompressSection()
- //
- SourceDataSize = ReturnValue;
-
- if (!ForceUncompress) {
-
- Status = CompressSection (
- &FileBuffer[Size],
- &ReturnValue,
- SourceDataSize,
- Type
- );
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- Status = CompressSection (
- &FileBuffer[Size],
- &ReturnValue,
- SourceDataSize,
- Type
- );
- }
-
- if (EFI_ERROR (Status)) {
- IsError = TRUE;
- goto Done;
- }
- }
-
- Size += ReturnValue;
-
- } else if (strcmpi (Buffer, "Tool") == 0) {
-
- ZeroMem (ToolName, _MAX_PATH);
- ZeroMem (ToolArgumentsArray, sizeof (CHAR8 *) * MAX_ARRAY_SIZE);
- ZeroMem (&SignGuid, sizeof (EFI_GUID));
-
- //
- // handle signing Tool
- //
- while (Buffer[0] != '(') {
- if (GetNextLine (Buffer, Package, &LineNumber) != -1) {
- CheckSlash (Buffer, Package, &LineNumber);
- }
- }
-
- if (strcmpi (Buffer, "(") == 0) {
- if (GetNextLine (Buffer, Package, &LineNumber) != -1) {
- CheckSlash (Buffer, Package, &LineNumber);
- }
- }
-
- StripParens (Buffer);
-
- if (Buffer[0] == '$') {
- Index = ProcessEnvironmentVariable (&Buffer[0], ToolName);
- //
- // if there is string after the environment variable, cat it.
- //
- if ((UINT32) Index < strlen (Buffer)) {
- strcat (ToolName, &Buffer[Index]);
- }
- } else {
- strcpy (ToolName, Buffer);
- }
-
- ToolArgumentsArray[0] = ToolName;
-
- //
- // read ARGS
- //
- if (GetToolArguments (
- ToolArgumentsArray,
- Package,
- &InputFileName,
- &OutputFileName,
- &SignGuid,
- &GuidedSectionAttributes
- ) == -1) {
- IsError = TRUE;
- goto Done;
- }
- //
- // if the tool need input file,
- // dump the file buffer to the specified input file.
- //
- if (InputFileName != NULL) {
- InputFile = fopen (InputFileName, "wb");
- if (InputFile == NULL) {
- Error (NULL, 0, 0, InputFileName, "failed to open output file for writing");
- IsError = TRUE;
- goto Done;
- }
-
- fwrite (FileBuffer, sizeof (UINT8), Size, InputFile);
- fclose (InputFile);
- InputFile = NULL;
- free (InputFileName);
- InputFileName = NULL;
- }
- //
- // dispatch signing tool
- //
-#ifdef __GNUC__
- {
- char CommandLine[1000];
- sprintf(CommandLine, "%s %s", ToolName, ToolArgumentsArray);
- returnint = system(CommandLine);
- }
-#else
- returnint = _spawnv (_P_WAIT, ToolName, ToolArgumentsArray);
-#endif
- if (returnint != 0) {
- Error (NULL, 0, 0, ToolName, "external tool failed");
- IsError = TRUE;
- goto Done;
- }
- //
- // if the tool has output file,
- // dump the output file to the file buffer
- //
- if (OutputFileName != NULL) {
-
- OutputFile = fopen (OutputFileName, "rb");
- if (OutputFile == NULL) {
- Error (NULL, 0, 0, OutputFileName, "failed to open output file for writing");
- IsError = TRUE;
- goto Done;
- }
-
- TargetFileBuffer = &FileBuffer[Size];
- SourceDataSize = Size;
-
- fread (&Temp, sizeof (UINT8), 1, OutputFile);
- while (!feof (OutputFile)) {
- FileBuffer[Size++] = Temp;
- fread (&Temp, sizeof (UINT8), 1, OutputFile);
- }
-
- while ((Size & 0x03) != 0) {
- FileBuffer[Size] = 0;
- Size++;
- }
-
- SourceDataSize = Size - SourceDataSize;
-
- fclose (OutputFile);
- OutputFile = NULL;
- free (OutputFileName);
- OutputFileName = NULL;
-
- if (CompareGuid (&SignGuid, &mZeroGuid) != 0) {
- ReturnValue = SourceDataSize;
- Status = GenSimpleGuidSection (
- TargetFileBuffer,
- &ReturnValue,
- SourceDataSize,
- SignGuid,
- GuidedSectionAttributes
- );
- if (EFI_ERROR (Status)) {
- IsError = TRUE;
- goto Done;
- }
-
- Size = ReturnValue;
- }
- }
-
- } else if (Buffer[0] != '}') {
- //
- // if we are here, we should see either a file name,
- // or a }.
- //
- Index3 = 0;
- FileName[0] = 0;
- //
- // Prepend the build directory to the file name if the
- // file name does not already contain a full path.
- //
- if (!isalpha (Buffer[0]) || (Buffer[1] != ':')) {
- sprintf (FileName, "%s\\", BuildDirectory);
- }
-
- while (Buffer[Index3] != '\n') {
- if (Buffer[Index3] == '$') {
- Index3 += ProcessEnvironmentVariable (&Buffer[Index3], NewBuffer);
- strcat (FileName, NewBuffer);
- }
-
- if (Buffer[Index3] == 0) {
- break;
- } else {
- Index2 = strlen (FileName);
- FileName[Index2++] = Buffer[Index3++];
- FileName[Index2] = 0;
- }
- }
-
- InFile = fopen (FileName, "rb");
- if (InFile == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open file for reading");
- IsError = TRUE;
- goto Done;
- }
-
- fread (&ByteBuffer, sizeof (UINT8), 1, InFile);
- while (!feof (InFile)) {
- FileBuffer[Size++] = ByteBuffer;
- fread (&ByteBuffer, sizeof (UINT8), 1, InFile);
- }
-
- fclose (InFile);
- InFile = NULL;
-
- //
- // Make sure section ends on a DWORD boundary
- //
- while ((Size & 0x03) != 0) {
- FileBuffer[Size] = 0;
- Size++;
- }
-
- }
- }
-
-Done:
- for (Index3 = 1; Index3 < MAX_ARRAY_SIZE; Index3++) {
- if (ToolArgumentsArray[Index3] == NULL) {
- break;
- }
-
- free (ToolArgumentsArray[Index3]);
- }
-
- if (IsError) {
- return -1;
- }
-
- return Size;
-
-}
-
-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
-
---*/
-{
- if (strcmpi (String, "EFI_FV_FILETYPE_RAW") == 0) {
- return EFI_FV_FILETYPE_RAW;
- }
-
- if (strcmpi (String, "EFI_FV_FILETYPE_FREEFORM") == 0) {
- return EFI_FV_FILETYPE_FREEFORM;
- }
-
- if (strcmpi (String, "EFI_FV_FILETYPE_SECURITY_CORE") == 0) {
- return EFI_FV_FILETYPE_SECURITY_CORE;
- }
-
- if (strcmpi (String, "EFI_FV_FILETYPE_PEI_CORE") == 0) {
- return EFI_FV_FILETYPE_PEI_CORE;
- }
-
- if (strcmpi (String, "EFI_FV_FILETYPE_DXE_CORE") == 0) {
- return EFI_FV_FILETYPE_DXE_CORE;
- }
-
- if (strcmpi (String, "EFI_FV_FILETYPE_PEIM") == 0) {
- return EFI_FV_FILETYPE_PEIM;
- }
-
- if (strcmpi (String, "EFI_FV_FILETYPE_DRIVER") == 0) {
- return EFI_FV_FILETYPE_DRIVER;
- }
-
- if (strcmpi (String, "EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER") == 0) {
- return EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER;
- }
-
- if (strcmpi (String, "EFI_FV_FILETYPE_APPLICATION") == 0) {
- return EFI_FV_FILETYPE_APPLICATION;
- }
-
- if (strcmpi (String, "EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE") == 0) {
- return EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE;
- }
-
- return EFI_FV_FILETYPE_ALL;
-}
-
-static
-UINT32
-AdjustFileSize (
- IN UINT8 *FileBuffer,
- IN UINT32 FileSize
- )
-/*++
-
-Routine Description:
- Adjusts file size to insure sectioned file is exactly the right length such
- that it ends on exactly the last byte of the last section. ProcessScript()
- may have padded beyond the end of the last section out to a 4 byte boundary.
- This padding is stripped.
-
-Arguments:
- FileBuffer - Data Buffer - contains a section stream
- FileSize - Size of FileBuffer as returned from ProcessScript()
-
-Returns:
- Corrected size of file.
-
---*/
-{
- UINT32 TotalLength;
- UINT32 CurrentLength;
- UINT32 SectionLength;
- UINT32 SectionStreamLength;
- EFI_COMMON_SECTION_HEADER *SectionHeader;
- EFI_COMMON_SECTION_HEADER *NextSectionHeader;
-
- TotalLength = 0;
- CurrentLength = 0;
- SectionStreamLength = FileSize;
-
- SectionHeader = (EFI_COMMON_SECTION_HEADER *) FileBuffer;
-
- while (TotalLength < SectionStreamLength) {
- SectionLength = *((UINT32 *) SectionHeader->Size) & 0x00ffffff;
- TotalLength += SectionLength;
-
- if (TotalLength == SectionStreamLength) {
- return TotalLength;
- }
- //
- // Move to the next byte following the section...
- //
- SectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) SectionHeader + SectionLength);
- CurrentLength = (UINTN) SectionHeader - (UINTN) FileBuffer;
-
- //
- // Figure out where the next section begins
- //
- NextSectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) SectionHeader + 3);
- NextSectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) NextSectionHeader &~ (UINTN) 3);
- TotalLength += (UINTN) NextSectionHeader - (UINTN) SectionHeader;
- SectionHeader = NextSectionHeader;
- }
-
- return CurrentLength;
-}
-
-static
-INT32
-MainEntry (
- INT32 argc,
- CHAR8 *argv[],
- BOOLEAN ForceUncompress
- )
-/*++
-
-Routine Description:
-
- MainEntry function.
-
-Arguments:
-
- argc - Number of command line parameters.
- argv - Array of pointers to command line parameter strings.
- ForceUncompress - If TRUE, force to do not compress the sections even if compression
- is specified in the script. Otherwise, FALSE.
-
-Returns:
- STATUS_SUCCESS - Function exits successfully.
- STATUS_ERROR - Some error occurred during execution.
-
---*/
-{
- FILE *PrimaryPackage;
- FILE *OverridePackage;
- FILE *Out;
- CHAR8 BaseName[_MAX_PATH];
- EFI_GUID FfsGuid;
- CHAR8 GuidString[_MAX_PATH];
- EFI_FFS_FILE_HEADER FileHeader;
- CHAR8 FileType[_MAX_PATH];
- EFI_FFS_FILE_ATTRIBUTES FfsAttrib;
- EFI_FFS_FILE_ATTRIBUTES FfsAttribDefined;
- UINT64 FfsAlignment;
- UINT32 FfsAlignment32;
- CHAR8 InputString[_MAX_PATH];
- BOOLEAN ImageScriptInOveride;
- UINT32 FileSize;
- UINT8 *FileBuffer;
- EFI_STATUS Status;
- UINT32 LineNumber;
- EFI_FFS_FILE_TAIL TailValue;
-
- BaseName[0] = 0;
- FileType[0] = 0;
- FfsAttrib = 0;
- FfsAttribDefined = 0;
- FfsAlignment = 0;
- FfsAlignment32 = 0;
- PrimaryPackage = NULL;
- Out = NULL;
- OverridePackage = NULL;
- FileBuffer = NULL;
-
- strcpy (GuidString, "00000000-0000-0000-0000-000000000000");
- Status = StringToGuid (GuidString, &FfsGuid);
- if (Status != 0) {
- Error (NULL, 0, 0, GuidString, "error parsing GUID string");
- return STATUS_ERROR;
- }
-
- GuidString[0] = 0;
- ImageScriptInOveride = FALSE;
- //
- // Initialize the simple file parsing routines. Then open
- // the primary package file for parsing.
- //
- SFPInit ();
- if (SFPOpenFile (mGlobals.PrimaryPackagePath) != STATUS_SUCCESS) {
- Error (NULL, 0, 0, mGlobals.PrimaryPackagePath, "unable to open primary package file");
- goto Done;
- }
- //
- // First token in the file must be "PACKAGE.INF"
- //
- if (!SFPIsToken ("PACKAGE.INF")) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected 'PACKAGE.INF'", NULL);
- goto Done;
- }
- //
- // Find the [.] section
- //
- if (!SFPSkipToToken ("[.]")) {
- Error (mGlobals.PrimaryPackagePath, 1, 0, "could not locate [.] section in package file", NULL);
- goto Done;
- }
- //
- // Start parsing the data. The algorithm is essentially the same for each keyword:
- // 1. Identify the keyword
- // 2. Verify that the keyword/value pair has not already been defined
- // 3. Set some flag indicating that the keyword/value pair has been defined
- // 4. Skip over the "="
- // 5. Get the value, which may be a number, TRUE, FALSE, or a string.
- //
- while (1) {
- if (SFPIsToken ("BASE_NAME")) {
- //
- // Found BASE_NAME, format:
- // BASE_NAME = MyBaseName
- //
- if (BaseName[0] != 0) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "BASE_NAME already defined", NULL);
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected '='", NULL);
- goto Done;
- }
-
- if (!SFPGetNextToken (BaseName, sizeof (BaseName))) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected valid base name", NULL);
- goto Done;
- }
- } else if (SFPIsToken ("IMAGE_SCRIPT")) {
- //
- // Found IMAGE_SCRIPT. Break out and process below.
- //
- break;
- } else if (SFPIsToken ("FFS_FILEGUID")) {
- //
- // found FILEGUID, format:
- // FFS_FILEGUID = F7845C4F-EDF5-42C5-BD8F-A02AF63DD93A
- //
- if (GuidString[0] != 0) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "FFS_FILEGUID already defined", NULL);
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected '='", NULL);
- goto Done;
- }
-
- if (SFPGetGuidToken (GuidString, sizeof (GuidString)) != TRUE) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected file GUID", NULL);
- goto Done;
- }
-
- Status = StringToGuid (GuidString, &FfsGuid);
- if (Status != 0) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected valid file GUID", NULL);
- goto Done;
- }
- } else if (SFPIsToken ("FFS_FILETYPE")) {
- //
- // ***********************************************************************
- //
- // Found FFS_FILETYPE, format:
- // FFS_FILETYPE = EFI_FV_FILETYPE_APPLICATION
- //
- if (FileType[0] != 0) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "FFS_FILETYPE previously defined", NULL);
- goto Done;
- }
-
- if (!SFPIsToken ("=")) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected '='", NULL);
- goto Done;
- }
-
- if (!SFPGetNextToken (FileType, sizeof (FileType))) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected valid FFS_FILETYPE", NULL);
- goto Done;
- }
- } else if (SFPIsToken ("FFS_ATTRIB_HEADER_EXTENSION")) {
- //
- // ***********************************************************************
- //
- // Found: FFS_ATTRIB_HEADER_EXTENSION = FALSE
- // Spec says the bit is for future expansion, and must be false.
- //
- if (FfsAttribDefined & FFS_ATTRIB_HEADER_EXTENSION) {
- Error (
- mGlobals.PrimaryPackagePath,
- SFPGetLineNumber (),
- 0,
- "FFS_ATTRIB_HEADER_EXTENSION previously defined",
- NULL
- );
- goto Done;
- }
-
- FfsAttribDefined |= FFS_ATTRIB_HEADER_EXTENSION;
- if (!SFPIsToken ("=")) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected '='", NULL);
- goto Done;
- }
-
- if (SFPIsToken ("TRUE")) {
- Error (
- mGlobals.PrimaryPackagePath,
- SFPGetLineNumber (),
- 0,
- "only FFS_ATTRIB_HEADER_EXTENSION = FALSE is supported",
- NULL
- );
- goto Done;
- } else if (SFPIsToken ("FALSE")) {
- //
- // Default is FALSE
- //
- } else {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected 'FALSE'", NULL);
- goto Done;
- }
- } else if (SFPIsToken ("FFS_ATTRIB_TAIL_PRESENT")) {
- //
- // ***********************************************************************
- //
- // Found: FFS_ATTRIB_TAIL_PRESENT = TRUE | FALSE
- //
- if (FfsAttribDefined & FFS_ATTRIB_TAIL_PRESENT) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "FFS_ATTRIB_TAIL_PRESENT previously defined", NULL);
- goto Done;
- }
-
- FfsAttribDefined |= FFS_ATTRIB_TAIL_PRESENT;
- if (!SFPIsToken ("=")) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected '='", NULL);
- goto Done;
- }
-
- if (SFPIsToken ("TRUE")) {
- FfsAttrib |= FFS_ATTRIB_TAIL_PRESENT;
- } else if (SFPIsToken ("FALSE")) {
- //
- // Default is FALSE
- //
- } else {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected 'TRUE' or 'FALSE'", NULL);
- goto Done;
- }
- } else if (SFPIsToken ("FFS_ATTRIB_RECOVERY")) {
- //
- // ***********************************************************************
- //
- // Found: FFS_ATTRIB_RECOVERY = TRUE | FALSE
- //
- if (FfsAttribDefined & FFS_ATTRIB_RECOVERY) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "FFS_ATTRIB_RECOVERY previously defined", NULL);
- goto Done;
- }
-
- FfsAttribDefined |= FFS_ATTRIB_RECOVERY;
- if (!SFPIsToken ("=")) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected '='", NULL);
- goto Done;
- }
-
- if (SFPIsToken ("TRUE")) {
- FfsAttrib |= FFS_ATTRIB_RECOVERY;
- } else if (SFPIsToken ("FALSE")) {
- //
- // Default is FALSE
- //
- } else {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected 'TRUE' or 'FALSE'", NULL);
- goto Done;
- }
- } else if (SFPIsToken ("FFS_ATTRIB_CHECKSUM")) {
- //
- // ***********************************************************************
- //
- // Found: FFS_ATTRIB_CHECKSUM = TRUE | FALSE
- //
- if (FfsAttribDefined & FFS_ATTRIB_CHECKSUM) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "FFS_ATTRIB_CHECKSUM previously defined", NULL);
- goto Done;
- }
-
- FfsAttribDefined |= FFS_ATTRIB_CHECKSUM;
- if (!SFPIsToken ("=")) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected '='", NULL);
- goto Done;
- }
-
- if (SFPIsToken ("TRUE")) {
- FfsAttrib |= FFS_ATTRIB_CHECKSUM;
- } else if (SFPIsToken ("FALSE")) {
- //
- // Default is FALSE
- //
- } else {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected 'TRUE' or 'FALSE'", NULL);
- goto Done;
- }
- } else if (SFPIsToken ("FFS_ALIGNMENT") || SFPIsToken ("FFS_ATTRIB_DATA_ALIGNMENT")) {
- //
- // ***********************************************************************
- //
- // Found FFS_ALIGNMENT, formats:
- // FFS_ALIGNMENT = 0-7
- // FFS_ATTRIB_DATA_ALIGNMENT = 0-7
- //
- if (FfsAttribDefined & FFS_ATTRIB_DATA_ALIGNMENT) {
- Error (
- mGlobals.PrimaryPackagePath,
- SFPGetLineNumber (),
- 0,
- "FFS_ALIGNMENT/FFS_ATTRIB_DATA_ALIGNMENT previously defined",
- NULL
- );
- goto Done;
- }
-
- FfsAttribDefined |= FFS_ATTRIB_DATA_ALIGNMENT;
- if (!SFPIsToken ("=")) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected '='", NULL);
- goto Done;
- }
-
- if (!SFPGetNumber (&FfsAlignment32)) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected numeric value for alignment", NULL);
- goto Done;
- }
-
- if (FfsAlignment32 > 7) {
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, "expected 0 <= alignment <= 7", NULL);
- goto Done;
- }
-
- FfsAttrib |= (((EFI_FFS_FILE_ATTRIBUTES) FfsAlignment32) << 3);
- } else {
- SFPGetNextToken (InputString, sizeof (InputString));
- Error (mGlobals.PrimaryPackagePath, SFPGetLineNumber (), 0, InputString, "unrecognized/unexpected token");
- goto Done;
- }
- }
- //
- // Close the primary package file
- //
- SFPCloseFile ();
- //
- // TODO: replace code below with basically a copy of the code above. Don't
- // forget to reset the FfsAttribDefined variable first. Also, you'll need
- // to somehow keep track of whether or not the basename is defined multiple
- // times in the override package. Ditto on the file GUID.
- //
- if (mGlobals.OverridePackagePath[0] != 0) {
- OverridePackage = fopen (mGlobals.OverridePackagePath, "r");
- //
- // NOTE: For package override to work correctly, the code below must be modified to
- // SET or CLEAR bits properly. For example, if the primary package set
- // FFS_ATTRIB_CHECKSUM = TRUE, and the override set FFS_ATTRIB_CHECKSUM = FALSE, then
- // we'd need to clear the bit below. Since this is not happening, I'm guessing that
- // the override functionality is not being used, so should be made obsolete. If I'm
- // wrong, and it is being used, then it needs to be fixed. Thus emit an error if it is
- // used, and we'll address it then. 4/10/2003
- //
- Error (__FILE__, __LINE__, 0, "package override functionality is not implemented correctly", NULL);
- goto Done;
- } else {
- OverridePackage = NULL;
- }
-
-#ifdef OVERRIDE_SUPPORTED
- if (OverridePackage != NULL) {
- //
- // Parse override package file
- //
- fscanf (OverridePackage, "%s", &InputString);
- if (strcmpi (InputString, "PACKAGE.INF") != 0) {
- Error (mGlobals.OverridePackagePath, 1, 0, "invalid package file", "expected 'PACKAGE.INF'");
- goto Done;
- }
- //
- // Match [dir] to Build Directory
- //
- if (FindSectionInPackage (mGlobals.BuildDirectory, OverridePackage, &LineNumber) != 0) {
- Error (mGlobals.OverridePackagePath, 1, 0, mGlobals.BuildDirectory, "section not found in package file");
- goto Done;
- }
-
- InputString[0] = 0;
- while ((InputString[0] != '[') && (!feof (OverridePackage))) {
- if (GetNextLine (InputString, OverridePackage, &LineNumber) != -1) {
- if (InputString[0] != '[') {
-here:
- if (strcmpi (InputString, "BASE_NAME") == 0) {
- //
- // found BASE_NAME, next is = and string.
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- if (strlen (InputString) == 1) {
- //
- // string is just =
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- strcpy (BaseName, InputString);
- } else {
- BreakString (InputString, InputString, 1);
- strcpy (BaseName, InputString);
- }
- } else if (strcmpi (InputString, "IMAGE_SCRIPT") == 0) {
- //
- // found IMAGE_SCRIPT, come back later to process it
- //
- ImageScriptInOveride = TRUE;
- fscanf (OverridePackage, "%s", &InputString);
- } else if (strcmpi (InputString, "FFS_FILEGUID") == 0) {
- //
- // found FILEGUID, next is = and string.
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- if (strlen (InputString) == 1) {
- //
- // string is just =
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- Status = StringToGuid (InputString, &FfsGuid);
- if (Status != 0) {
- Error (mGlobals.OverridePackagePath, 1, 0, InputString, "bad FFS_FILEGUID format");
- goto Done;
- }
- } else {
- BreakString (InputString, InputString, 1);
- Status = StringToGuid (InputString, &FfsGuid);
- if (Status != 0) {
- Error (mGlobals.OverridePackagePath, 1, 0, InputString, "bad FFS_FILEGUID format");
- goto Done;
- }
- }
- } else if (strcmpi (InputString, "FFS_FILETYPE") == 0) {
- //
- // found FILETYPE, next is = and string.
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- if (strlen (InputString) == 1) {
- //
- // string is just =
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- strcpy (FileType, InputString);
- } else {
- BreakString (InputString, InputString, 1);
- strcpy (FileType, InputString);
- }
-
- } else if (strcmpi (InputString, "FFS_ATTRIB_RECOVERY") == 0) {
- //
- // found FFS_ATTRIB_RECOVERY, next is = and string.
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- if (strlen (InputString) == 1) {
- //
- // string is just =
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- if (strcmpi (InputString, "TRUE") == 0) {
- FfsAttrib |= FFS_ATTRIB_RECOVERY;
- }
- } else {
- BreakString (InputString, InputString, 1);
- if (strcmpi (InputString, "TRUE") == 0) {
- FfsAttrib |= FFS_ATTRIB_RECOVERY;
- }
- }
- } else if (strcmpi (InputString, "FFS_ATTRIB_CHECKSUM") == 0) {
- //
- // found FFS_ATTRIB_CHECKSUM, next is = and string.
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- if (strlen (InputString) == 1) {
- //
- // string is just =
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- if (strcmpi (InputString, "TRUE") == 0) {
- FfsAttrib |= FFS_ATTRIB_CHECKSUM;
- }
- } else {
- BreakString (InputString, InputString, 1);
- if (strcmpi (InputString, "TRUE") == 0) {
- FfsAttrib |= FFS_ATTRIB_CHECKSUM;
- }
- }
- } else if (strcmpi (InputString, "FFS_ALIGNMENT") == 0) {
- //
- // found FFS_ALIGNMENT, next is = and string.
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- if (strlen (InputString) == 1) {
- //
- // string is just =
- //
- fscanf (OverridePackage, "%s", &InputString);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- } else {
- BreakString (InputString, InputString, 1);
- }
-
- AsciiStringToUint64 (InputString, FALSE, &FfsAlignment);
- if (FfsAlignment > 7) {
- Error (mGlobals.OverridePackagePath, 1, 0, InputString, "invalid FFS_ALIGNMENT value");
- goto Done;
- }
-
- FfsAttrib |= (((EFI_FFS_FILE_ATTRIBUTES) FfsAlignment) << 3);
- } else if (strchr (InputString, '=') != NULL) {
- BreakString (InputString, String, 1);
- fseek (OverridePackage, (-1 * (strlen (String) + 1)), SEEK_CUR);
- BreakString (InputString, InputString, 0);
- goto here;
- }
- }
- }
- }
- }
-#endif // #ifdef OVERRIDE_SUPPORTED
- //
- // Require that they specified a file GUID at least, since that's how we're
- // naming the file.
- //
- if (GuidString[0] == 0) {
- Error (mGlobals.PrimaryPackagePath, 1, 0, "FFS_FILEGUID must be specified", NULL);
- return STATUS_ERROR;
- }
- //
- // Build Header and process image script
- //
- FileBuffer = (UINT8 *) malloc ((1024 * 1024 * 16) * sizeof (UINT8));
- if (FileBuffer == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failed", NULL);
- goto Done;
- }
-
- FileSize = 0;
- if (ImageScriptInOveride) {
-#ifdef OVERRIDE_SUPORTED
- rewind (OverridePackage);
- LineNumber = 0;
- FindSectionInPackage (mGlobals.BuildDirectory, OverridePackage, &LineNumber);
- while (strcmpi (InputString, "IMAGE_SCRIPT") != 0) {
- GetNextLine (InputString, OverridePackage, &LineNumber);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- if (strchr (InputString, '=') != NULL) {
- BreakString (InputString, InputString, 0);
- }
- }
-
- while (InputString[0] != '{') {
- GetNextLine (InputString, OverridePackage, &LineNumber);
- CheckSlash (InputString, OverridePackage, &LineNumber);
- }
- //
- // Found start of image script, process it
- //
- FileSize += ProcessScript (FileBuffer, OverridePackage, mGlobals.BuildDirectory, ForceUncompress);
- if (FileSize == -1) {
- return -1;
- }
-
- if (StringToType (FileType) != EFI_FV_FILETYPE_RAW) {
- FileSize = AdjustFileSize (FileBuffer, FileSize);
- }
-
- if (BaseName[0] == '\"') {
- StripQuotes (BaseName);
- }
-
- if (BaseName[0] != 0) {
- sprintf (InputString, "%s-%s", GuidString, BaseName);
- } else {
- strcpy (InputString, GuidString);
- }
-
- switch (StringToType (FileType)) {
-
- case EFI_FV_FILETYPE_SECURITY_CORE:
- strcat (InputString, ".SEC");
- break;
-
- case EFI_FV_FILETYPE_PEIM:
- case EFI_FV_FILETYPE_PEI_CORE:
- case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER:
- strcat (InputString, ".PEI");
- break;
-
- case EFI_FV_FILETYPE_DRIVER:
- case EFI_FV_FILETYPE_DXE_CORE:
- strcat (InputString, ".DXE");
- break;
-
- case EFI_FV_FILETYPE_APPLICATION:
- strcat (InputString, ".APP");
- break;
-
- case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE:
- strcat (InputString, ".FVI");
- break;
-
- case EFI_FV_FILETYPE_ALL:
- Error (mGlobals.OverridePackagePath, 1, 0, "invalid FFS file type for this utility", NULL);
- goto Done;
-
- default:
- strcat (InputString, ".FFS");
- break;
- }
-
- if (ForceUncompress) {
- strcat (InputString, ".ORG");
- }
-
- Out = fopen (InputString, "wb");
- if (Out == NULL) {
- Error (NULL, 0, 0, InputString, "could not open output file for writing");
- goto Done;
- }
- //
- // create ffs header
- //
- memset (&FileHeader, 0, sizeof (EFI_FFS_FILE_HEADER));
- memcpy (&FileHeader.Name, &FfsGuid, sizeof (EFI_GUID));
- FileHeader.Type = StringToType (FileType);
- FileHeader.Attributes = FfsAttrib;
- //
- // Now FileSize includes the EFI_FFS_FILE_HEADER
- //
- FileSize += sizeof (EFI_FFS_FILE_HEADER);
- FileHeader.Size[0] = (UINT8) (FileSize & 0xFF);
- FileHeader.Size[1] = (UINT8) ((FileSize & 0xFF00) >> 8);
- FileHeader.Size[2] = (UINT8) ((FileSize & 0xFF0000) >> 16);
- //
- // Fill in checksums and state, these must be zero for checksumming
- //
- // FileHeader.IntegrityCheck.Checksum.Header = 0;
- // FileHeader.IntegrityCheck.Checksum.File = 0;
- // FileHeader.State = 0;
- //
- FileHeader.IntegrityCheck.Checksum.Header = CalculateChecksum8 (
- (UINT8 *) &FileHeader,
- sizeof (EFI_FFS_FILE_HEADER)
- );
- if (FileHeader.Attributes & FFS_ATTRIB_CHECKSUM) {
- FileHeader.IntegrityCheck.Checksum.File = CalculateChecksum8 ((UINT8 *) &FileHeader, FileSize);
- } else {
- FileHeader.IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
- }
-
- FileHeader.State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
- //
- // write header
- //
- if (fwrite (&FileHeader, sizeof (FileHeader), 1, Out) != 1) {
- Error (NULL, 0, 0, "failed to write file header to output file", NULL);
- goto Done;
- }
- //
- // write data
- //
- if (fwrite (FileBuffer, FileSize - sizeof (EFI_FFS_FILE_HEADER), 1, Out) != 1) {
- Error (NULL, 0, 0, "failed to write all bytes to output file", NULL);
- goto Done;
- }
-
- fclose (Out);
- Out = NULL;
-#endif // #ifdef OVERRIDE_SUPPORTED
- } else {
- //
- // Open primary package file and process the IMAGE_SCRIPT section
- //
- PrimaryPackage = fopen (mGlobals.PrimaryPackagePath, "r");
- if (PrimaryPackage == NULL) {
- Error (NULL, 0, 0, mGlobals.PrimaryPackagePath, "unable to open primary package file");
- goto Done;
- }
-
- LineNumber = 1;
- FindSectionInPackage (".", PrimaryPackage, &LineNumber);
- while (strcmpi (InputString, "IMAGE_SCRIPT") != 0) {
- GetNextLine (InputString, PrimaryPackage, &LineNumber);
- CheckSlash (InputString, PrimaryPackage, &LineNumber);
- if (strchr (InputString, '=') != NULL) {
- BreakString (InputString, InputString, 0);
- }
- }
-
- while (InputString[0] != '{') {
- GetNextLine (InputString, PrimaryPackage, &LineNumber);
- CheckSlash (InputString, PrimaryPackage, &LineNumber);
- }
- //
- // Found start of image script, process it
- //
- FileSize += ProcessScript (FileBuffer, PrimaryPackage, mGlobals.BuildDirectory, ForceUncompress);
- if (FileSize == -1) {
- goto Done;
- }
-
- if (StringToType (FileType) != EFI_FV_FILETYPE_RAW) {
- FileSize = AdjustFileSize (FileBuffer, FileSize);
- }
-
- if (BaseName[0] == '\"') {
- StripQuotes (BaseName);
- }
-
- if (BaseName[0] != 0) {
- sprintf (InputString, "%s-%s", GuidString, BaseName);
- } else {
- strcpy (InputString, GuidString);
- }
-
- switch (StringToType (FileType)) {
-
- case EFI_FV_FILETYPE_SECURITY_CORE:
- strcat (InputString, ".SEC");
- break;
-
- case EFI_FV_FILETYPE_PEIM:
- case EFI_FV_FILETYPE_PEI_CORE:
- case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER:
- strcat (InputString, ".PEI");
- break;
-
- case EFI_FV_FILETYPE_DRIVER:
- case EFI_FV_FILETYPE_DXE_CORE:
- strcat (InputString, ".DXE");
- break;
-
- case EFI_FV_FILETYPE_APPLICATION:
- strcat (InputString, ".APP");
- break;
-
- case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE:
- strcat (InputString, ".FVI");
- break;
-
- case EFI_FV_FILETYPE_ALL:
- Error (mGlobals.PrimaryPackagePath, 1, 0, "invalid FFS file type for this utility", NULL);
- goto Done;
-
- default:
- strcat (InputString, ".FFS");
- break;
- }
-
- if (ForceUncompress) {
- strcat (InputString, ".ORG");
- }
-
- Out = fopen (InputString, "wb");
- if (Out == NULL) {
- Error (NULL, 0, 0, InputString, "failed to open output file for writing");
- goto Done;
- }
- //
- // Initialize the FFS file header
- //
- memset (&FileHeader, 0, sizeof (EFI_FFS_FILE_HEADER));
- memcpy (&FileHeader.Name, &FfsGuid, sizeof (EFI_GUID));
- FileHeader.Type = StringToType (FileType);
- FileHeader.Attributes = FfsAttrib;
- //
- // From this point on FileSize includes the size of the EFI_FFS_FILE_HEADER
- //
- FileSize += sizeof (EFI_FFS_FILE_HEADER);
- //
- // If using a tail, then it adds two bytes
- //
- if (FileHeader.Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- //
- // Tail is not allowed for pad and 0-length files
- //
- if ((FileHeader.Type == EFI_FV_FILETYPE_FFS_PAD) || (FileSize == sizeof (EFI_FFS_FILE_HEADER))) {
- Error (
- mGlobals.PrimaryPackagePath,
- 1,
- 0,
- "FFS_ATTRIB_TAIL_PRESENT=TRUE is invalid for PAD or 0-length files",
- NULL
- );
- goto Done;
- }
-
- FileSize += sizeof (EFI_FFS_FILE_TAIL);
- }
-
- FileHeader.Size[0] = (UINT8) (FileSize & 0xFF);
- FileHeader.Size[1] = (UINT8) ((FileSize & 0xFF00) >> 8);
- FileHeader.Size[2] = (UINT8) ((FileSize & 0xFF0000) >> 16);
- //
- // Fill in checksums and state, they must be 0 for checksumming.
- //
- // FileHeader.IntegrityCheck.Checksum.Header = 0;
- // FileHeader.IntegrityCheck.Checksum.File = 0;
- // FileHeader.State = 0;
- //
- FileHeader.IntegrityCheck.Checksum.Header = CalculateChecksum8 (
- (UINT8 *) &FileHeader,
- sizeof (EFI_FFS_FILE_HEADER)
- );
- if (FileHeader.Attributes & FFS_ATTRIB_CHECKSUM) {
- //
- // Cheating here. Since the header checksums, just calculate the checksum of the body.
- // Checksum does not include the tail
- //
- if (FileHeader.Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- FileHeader.IntegrityCheck.Checksum.File = CalculateChecksum8 (
- FileBuffer,
- FileSize - sizeof (EFI_FFS_FILE_HEADER) - sizeof (EFI_FFS_FILE_TAIL)
- );
- } else {
- FileHeader.IntegrityCheck.Checksum.File = CalculateChecksum8 (
- FileBuffer,
- FileSize - sizeof (EFI_FFS_FILE_HEADER)
- );
- }
- } else {
- FileHeader.IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
- }
- //
- // Set the state now. Spec says the checksum assumes the state is 0
- //
- FileHeader.State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
- //
- // If there is a tail, then set it
- //
- if (FileHeader.Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailValue = FileHeader.IntegrityCheck.TailReference;
- TailValue = (UINT16) (~TailValue);
- memcpy (
- (UINT8 *) FileBuffer + FileSize - sizeof (EFI_FFS_FILE_HEADER) - sizeof (EFI_FFS_FILE_TAIL),
- &TailValue,
- sizeof (TailValue)
- );
- }
- //
- // Write the FFS file header
- //
- if (fwrite (&FileHeader, sizeof (FileHeader), 1, Out) != 1) {
- Error (NULL, 0, 0, "failed to write file header contents", NULL);
- goto Done;
- }
- //
- // Write data
- //
- if (fwrite (FileBuffer, FileSize - sizeof (EFI_FFS_FILE_HEADER), 1, Out) != 1) {
- Error (NULL, 0, 0, "failed to write file contents", NULL);
- goto Done;
- }
- }
-
-Done:
- SFPCloseFile ();
- if (Out != NULL) {
- fclose (Out);
- }
-
- if (PrimaryPackage != NULL) {
- fclose (PrimaryPackage);
- }
-
- if (FileBuffer != NULL) {
- free (FileBuffer);
- }
-
- if (OverridePackage != NULL) {
- fclose (OverridePackage);
- }
-
- return GetUtilityStatus ();
-}
-
-int
-main (
- INT32 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.
-
---*/
-{
- STATUS Status;
- //
- // Set the name of our utility for error reporting purposes.
- //
- SetUtilityName (UTILITY_NAME);
- Status = ProcessCommandLineArgs (argc, argv);
- if (Status != STATUS_SUCCESS) {
- return Status;
- }
-
- Status = MainEntry (argc, argv, TRUE);
- if (Status == STATUS_SUCCESS) {
- MainEntry (argc, argv, FALSE);
- }
- //
- // 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.
- //
- return GetUtilityStatus ();
-}
-
-static
-STATUS
-ProcessCommandLineArgs (
- int Argc,
- char *Argv[]
- )
-/*++
-
-Routine Description:
- Process the command line arguments.
-
-Arguments:
- Argc - as passed in to main()
- Argv - as passed in to main()
-
-Returns:
- STATUS_SUCCESS - arguments all ok
- STATUS_ERROR - problem with args, so caller should exit
-
---*/
-{
- //
- // If no args, then print usage instructions and return an error
- //
- Argc--;
- Argv++;
-
- if (Argc < 1) {
- Usage ();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
- (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- memset (&mGlobals, 0, sizeof (mGlobals));
-
- while (Argc > 0) {
- if (strcmpi (Argv[0], "-b") == 0) {
- //
- // OPTION: -b BuildDirectory
- // Make sure there is another argument, then save it to our globals.
- //
- if (Argc < 2) {
- Error (NULL, 0, 0, "-b option requires the build directory name", NULL);
- return STATUS_ERROR;
- }
-
- if (mGlobals.BuildDirectory[0]) {
- Error (NULL, 0, 0, Argv[0], "option can only be specified once");
- return STATUS_ERROR;
- }
-
- strcpy (mGlobals.BuildDirectory, Argv[1]);
- Argc--;
- Argv++;
- } else if (strcmpi (Argv[0], "-p1") == 0) {
- //
- // OPTION: -p1 PrimaryPackageFile
- // Make sure there is another argument, then save it to our globals.
- //
- if (Argc < 2) {
- Error (NULL, 0, 0, Argv[0], "option requires the primary package file name");
- return STATUS_ERROR;
- }
-
- if (mGlobals.PrimaryPackagePath[0]) {
- Error (NULL, 0, 0, Argv[0], "option can only be specified once");
- return STATUS_ERROR;
- }
-
- strcpy (mGlobals.PrimaryPackagePath, Argv[1]);
- Argc--;
- Argv++;
- } else if (strcmpi (Argv[0], "-p2") == 0) {
- //
- // OPTION: -p2 OverridePackageFile
- // Make sure there is another argument, then save it to our globals.
- //
- if (Argc < 2) {
- Error (NULL, 0, 0, Argv[0], "option requires the override package file name");
- return STATUS_ERROR;
- }
-
- if (mGlobals.OverridePackagePath[0]) {
- Error (NULL, 0, 0, Argv[0], "option can only be specified once");
- return STATUS_ERROR;
- }
-
- strcpy (mGlobals.OverridePackagePath, Argv[1]);
- Argc--;
- Argv++;
- } else if (strcmpi (Argv[0], "-v") == 0) {
- //
- // OPTION: -v verbose
- //
- mGlobals.Verbose = TRUE;
- } else if (strcmpi (Argv[0], "-h") == 0) {
- //
- // OPTION: -h help
- //
- Usage ();
- return STATUS_ERROR;
- } else if (strcmpi (Argv[0], "-?") == 0) {
- //
- // OPTION: -? help
- //
- Usage ();
- return STATUS_ERROR;
- } else {
- Error (NULL, 0, 0, Argv[0], "unrecognized option");
- Usage ();
- return STATUS_ERROR;
- }
-
- Argv++;
- Argc--;
- }
- //
- // Must have at least specified the package file name
- //
- if (mGlobals.PrimaryPackagePath[0] == 0) {
- Error (NULL, 0, 0, "must specify primary package file", NULL);
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
-}
diff --git a/Tools/CCode/Source/GenFfsFile/GenFfsFile.h b/Tools/CCode/Source/GenFfsFile/GenFfsFile.h
deleted file mode 100644
index f5bc718716..0000000000
--- a/Tools/CCode/Source/GenFfsFile/GenFfsFile.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- GenFfsFile.h
-
-Abstract:
-
- Header file for GenFfsFile.
-
---*/
-
-//
-// Module Coded to Tiano Coding Conventions
-//
-#ifndef _EFI_GEN_FFSFILE_H
-#define _EFI_GEN_FFSFILE_H
-
-//
-// External Files Referenced
-//
-#include <Common/UefiBaseTypes.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-
-#include "MyAlloc.h"
-
-#endif
diff --git a/Tools/CCode/Source/GenFfsFile/SimpleFileParsing.c b/Tools/CCode/Source/GenFfsFile/SimpleFileParsing.c
deleted file mode 100644
index 5fa5a22096..0000000000
--- a/Tools/CCode/Source/GenFfsFile/SimpleFileParsing.c
+++ /dev/null
@@ -1,969 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- SimpleFileParsing.c
-
-Abstract:
-
- Generic but simple file parsing routines.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include <Common/UefiBaseTypes.h>
-
-#include "EfiUtilityMsgs.h"
-#include "SimpleFileParsing.h"
-
-#define MAX_PATH 255
-#define MAX_NEST_DEPTH 20 // just in case we get in an endless loop.
-#define MAX_STRING_IDENTIFIER_NAME 100 // number of wchars
-#define MAX_LINE_LEN 400
-
-#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'
-
-//
-// We keep a linked list of these for the source files we process
-//
-typedef struct _SOURCE_FILE {
- FILE *Fptr;
- T_CHAR *FileBuffer;
- T_CHAR *FileBufferPtr;
- UINT32 FileSize;
- INT8 FileName[MAX_PATH];
- UINT32 LineNum;
- BOOLEAN EndOfFile;
- BOOLEAN SkipToHash;
- struct _SOURCE_FILE *Previous;
- struct _SOURCE_FILE *Next;
- T_CHAR ControlCharacter;
-} SOURCE_FILE;
-
-//
-// Here's all our module globals.
-//
-static struct {
- SOURCE_FILE SourceFile;
- BOOLEAN Verbose;
-} mGlobals;
-
-static
-UINT32
-t_strcmp (
- T_CHAR *Buffer,
- T_CHAR *Str
- );
-
-static
-UINT32
-t_strncmp (
- T_CHAR *Str1,
- T_CHAR *Str2,
- UINT32 Len
- );
-
-static
-UINT32
-t_strlen (
- T_CHAR *Str
- );
-
-static
-void
-RewindFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-BOOLEAN
-SkipTo (
- SOURCE_FILE *SourceFile,
- T_CHAR TChar,
- BOOLEAN StopAfterNewline
- );
-
-static
-BOOLEAN
-IsWhiteSpace (
- SOURCE_FILE *SourceFile
- );
-
-static
-UINT32
-SkipWhiteSpace (
- SOURCE_FILE *SourceFile
- );
-
-static
-BOOLEAN
-EndOfFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-void
-PreprocessFile (
- SOURCE_FILE *SourceFile
- );
-
-//
-// static
-// T_CHAR *
-// GetQuotedString (
-// SOURCE_FILE *SourceFile,
-// BOOLEAN Optional
-// );
-//
-static
-T_CHAR *
-t_strcpy (
- T_CHAR *Dest,
- T_CHAR *Src
- );
-
-static
-STATUS
-ProcessIncludeFile (
- SOURCE_FILE *SourceFile,
- SOURCE_FILE *ParentSourceFile
- );
-
-static
-STATUS
-ParseFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-FILE *
-FindFile (
- IN INT8 *FileName,
- OUT INT8 *FoundFileName,
- IN UINT32 FoundFileNameLen
- );
-
-static
-STATUS
-ProcessFile (
- SOURCE_FILE *SourceFile
- );
-
-STATUS
-SFPInit (
- VOID
- )
-{
- memset ((void *) &mGlobals, 0, sizeof (mGlobals));
- return STATUS_SUCCESS;
-}
-
-UINT32
-SFPGetLineNumber (
- VOID
- )
-{
- return mGlobals.SourceFile.LineNum;
-}
-
-/*++
-
-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
-
---*/
-T_CHAR *
-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 (
- IN INT8 *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 (
- T_CHAR *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.
-
---*/
-{
- UINT32 Len;
- SkipWhiteSpace (&mGlobals.SourceFile);
-
- if ((Len = t_strcmp (mGlobals.SourceFile.FileBufferPtr, Str)) > 0) {
- mGlobals.SourceFile.FileBufferPtr += Len;
- return TRUE;
- }
-
- return FALSE;
-
-}
-
-BOOLEAN
-SFPGetNextToken (
- T_CHAR *Str,
- UINT32 Len
- )
-{
- UINT32 Index;
- SkipWhiteSpace (&mGlobals.SourceFile);
- 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 (
- T_CHAR *Str
- )
-{
- UINT32 Len;
- T_CHAR *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 (
- UINT32 *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
-
---*/
-{
- //
- // UINT32 Len;
- //
- SkipWhiteSpace (&mGlobals.SourceFile);
- if (EndOfFile (&mGlobals.SourceFile)) {
- return FALSE;
- }
-
- if (isdigit (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 (mGlobals.SourceFile.FileBufferPtr[2])) {
- return FALSE;
- }
-
- mGlobals.SourceFile.FileBufferPtr += 2;
- sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", Value);
- while (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) {
- mGlobals.SourceFile.FileBufferPtr++;
- }
-
- return TRUE;
- } else {
- *Value = atoi (mGlobals.SourceFile.FileBufferPtr);
- while (isdigit (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 UINT32 NestDepth = 0;
- INT8 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.Verbose) {
- fprintf (stdout, "%*cProcessing file '%s'\n", NestDepth * 2, ' ', SourceFile->FileName);
- }
-
- //
- // Make sure we didn't exceed our maximum nesting depth
- //
- if (NestDepth > MAX_NEST_DEPTH) {
- Error (NULL, 0, 0, SourceFile->FileName, "max nesting depth (%d) exceeded", 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 (FoundFileName, "r")) == NULL) {
- //
- // Try to find it among the paths if it has a parent (that is, it is included
- // by someone else).
- //
- Error (NULL, 0, 0, SourceFile->FileName, "file not found");
- 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
- )
-{
- //
- // Get the file size, and then read the entire thing into memory.
- // Allocate space for a terminator character.
- //
- fseek (SourceFile->Fptr, 0, SEEK_END);
- SourceFile->FileSize = ftell (SourceFile->Fptr);
- fseek (SourceFile->Fptr, 0, SEEK_SET);
- SourceFile->FileBuffer = (T_CHAR *) malloc (SourceFile->FileSize + sizeof (T_CHAR));
- if (SourceFile->FileBuffer == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- fread ((VOID *) SourceFile->FileBuffer, SourceFile->FileSize, 1, SourceFile->Fptr);
- SourceFile->FileBuffer[(SourceFile->FileSize / sizeof (T_CHAR))] = 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 from the file to the screen.
-
-Arguments:
- SourceFile - structure that we use to keep track of an input file.
-
-Returns:
- Nothing.
-
---*/
-{
- BOOLEAN InComment;
-
- RewindFile (SourceFile);
- InComment = FALSE;
- while (!EndOfFile (SourceFile)) {
- //
- // If a line-feed, then no longer in a comment
- //
- if (SourceFile->FileBufferPtr[0] == T_CHAR_LF) {
- SourceFile->FileBufferPtr++;
- SourceFile->LineNum++;
- InComment = 0;
- } 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++;
- } else if (InComment) {
- SourceFile->FileBufferPtr[0] = T_CHAR_SPACE;
- SourceFile->FileBufferPtr++;
- } else if ((SourceFile->FileBufferPtr[0] == T_CHAR_SLASH) && (SourceFile->FileBufferPtr[1] == T_CHAR_SLASH)) {
- SourceFile->FileBufferPtr += 2;
- 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);
-}
-
-#if 0
-static
-T_CHAR *
-GetQuotedString (
- SOURCE_FILE *SourceFile,
- BOOLEAN Optional
- )
-{
- T_CHAR *String;
- T_CHAR *Start;
- T_CHAR *Ptr;
- UINT32 Len;
- BOOLEAN PreviousBackslash;
-
- if (SourceFile->FileBufferPtr[0] != T_CHAR_DOUBLE_QUOTE) {
- if (!Optional) {
- 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)) {
- 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 = (T_CHAR *) malloc ((Len + 1) * sizeof (T_CHAR));
- if (String == NULL) {
- Error (NULL, 0, 0, "memory allocation failed", 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 (T_CHAR)) {
- SourceFile->EndOfFile = TRUE;
- return TRUE;
- }
-
- if (SourceFile->EndOfFile) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-#if 0
-static
-void
-ProcessTokenInclude (
- SOURCE_FILE *SourceFile
- )
-{
- INT8 IncludeFileName[MAX_PATH];
- INT8 *To;
- UINT32 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 = UNICODE_TO_ASCII(SourceFile->FileBufferPtr[0]);
- //
- *To = (T_CHAR) SourceFile->FileBufferPtr[0];
- To++;
- }
-
- SourceFile->FileBufferPtr++;
- }
-
- if (!ReportedError) {
- *To = 0;
- memset ((char *) &IncludedSourceFile, 0, sizeof (SOURCE_FILE));
- strcpy (IncludedSourceFile.FileName, IncludeFileName);
- //
- // IncludedSourceFile.ControlCharacter = DEFAULT_CONTROL_CHARACTER;
- //
- ProcessIncludeFile (&IncludedSourceFile, SourceFile);
- //
- // printf ("including file '%s'\n", IncludeFileName);
- //
- }
-
- 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;
- }
-}
-
-UINT32
-SkipWhiteSpace (
- SOURCE_FILE *SourceFile
- )
-{
- UINT32 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++;
- if (mGlobals.Verbose) {
- printf ("%d: %S\n", SourceFile->LineNum, SourceFile->FileBufferPtr);
- }
- 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
-UINT32
-t_strcmp (
- T_CHAR *Buffer,
- T_CHAR *Str
- )
-{
- UINT32 Len;
-
- Len = 0;
- while (*Str == *Buffer) {
- Buffer++;
- Str++;
- Len++;
- }
-
- if (*Str) {
- return 0;
- }
-
- return Len;
-}
-
-static
-UINT32
-t_strlen (
- T_CHAR *Str
- )
-{
- UINT32 Len;
- Len = 0;
- while (*Str) {
- Len++;
- Str++;
- }
-
- return Len;
-}
-
-static
-UINT32
-t_strncmp (
- T_CHAR *Str1,
- T_CHAR *Str2,
- UINT32 Len
- )
-{
- while (Len > 0) {
- if (*Str1 != *Str2) {
- return Len;
- }
-
- Len--;
- Str1++;
- Str2++;
- }
-
- return 0;
-}
-
-static
-T_CHAR *
-t_strcpy (
- T_CHAR *Dest,
- T_CHAR *Src
- )
-{
- T_CHAR *SaveDest;
- SaveDest = Dest;
- while (*Src) {
- *Dest = *Src;
- Dest++;
- Src++;
- }
-
- *Dest = 0;
- return SaveDest;
-}
-
-#if 0
-static
-BOOLEAN
-IsValidIdentifierChar (
- INT8 Char,
- BOOLEAN FirstChar
- )
-{
- //
- // If it's the first character of an identifier, then
- // it must be one of [A-Za-z_].
- //
- if (FirstChar) {
- if (isalpha (Char) || (Char == '_')) {
- return TRUE;
- }
- } else {
- //
- // If it's not the first character, then it can
- // be one of [A-Za-z_0-9]
- //
- if (isalnum (Char) || (Char == '_')) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-#endif
-static
-void
-RewindFile (
- SOURCE_FILE *SourceFile
- )
-{
- SourceFile->LineNum = 1;
- SourceFile->FileBufferPtr = SourceFile->FileBuffer;
- SourceFile->EndOfFile = 0;
-}
-
-#if 0
-static
-BOOLEAN
-SkipTo (
- SOURCE_FILE *SourceFile,
- T_CHAR TChar,
- BOOLEAN StopAfterNewline
- )
-{
- while (!EndOfFile (SourceFile)) {
- //
- // Check for the character of interest
- //
- if (SourceFile->FileBufferPtr[0] == TChar) {
- return TRUE;
- } else {
- if (SourceFile->FileBufferPtr[0] == T_CHAR_LF) {
- SourceFile->LineNum++;
- if (StopAfterNewline) {
- SourceFile->FileBufferPtr++;
- if (SourceFile->FileBufferPtr[0] == 0) {
- SourceFile->FileBufferPtr++;
- }
-
- return FALSE;
- }
- }
-
- SourceFile->FileBufferPtr++;
- }
- }
-
- return FALSE;
-}
-#endif
diff --git a/Tools/CCode/Source/GenFfsFile/build.xml b/Tools/CCode/Source/GenFfsFile/build.xml
deleted file mode 100644
index 71f8bc99c7..0000000000
--- a/Tools/CCode/Source/GenFfsFile/build.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenFfsFile Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenFfsFile"/>
- <property name="FileSet" value="GenFfsFile.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools CustomizedCompress"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenFvImage/Ebc/PeCoffLoaderEx.c b/Tools/CCode/Source/GenFvImage/Ebc/PeCoffLoaderEx.c
deleted file mode 100644
index e8cf8b6457..0000000000
--- a/Tools/CCode/Source/GenFvImage/Ebc/PeCoffLoaderEx.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- PeCoffLoaderEx.c
-
-Abstract:
-
- EBC Specific relocation fixups
-
-Revision History
-
---*/
-
-
-
-
-RETURN_STATUS
-PeCoffLoaderRelocateImageEx (
- 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;
-}
diff --git a/Tools/CCode/Source/GenFvImage/GenFvImageExe.c b/Tools/CCode/Source/GenFvImage/GenFvImageExe.c
deleted file mode 100644
index 294c303085..0000000000
--- a/Tools/CCode/Source/GenFvImage/GenFvImageExe.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*++
-
-Copyright (c) 2004-2007, 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.
-
-Module Name:
-
- GenFvImageExe.c
-
-Abstract:
-
- 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.
-
---*/
-
-//
-// File included in build
-//
-#include "GenFvImageExe.h"
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.h"
-
-static
-void
-Version(
- void
-)
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Tiano Firmware Volume Generation Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-
-static
-void
-Usage(
- void
- )
-/*++
-
-Routine Description:
-
- Displays the utility usage syntax to STDOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- Version();
-
- printf ("\nUsage: %s -I FvInfFileName\n", UTILITY_NAME);
- printf (" Where:\n");
- printf (" FvInfFileName is the name of the image description file.\n\n");
-}
-
-int
-main (
- IN INTN argc,
- IN CHAR8 **argv
- )
-/*++
-
-Routine Description:
-
- This utility uses GenFvImage.Lib to build a firmware volume image.
-
-Arguments:
-
- FvInfFileName The name of an FV image description file.
-
- 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[_MAX_PATH];
- CHAR8 *InfFileImage;
- UINTN InfFileSize;
- UINT8 *FvImage;
- UINTN FvImageSize;
- UINT8 Index;
- CHAR8 FvFileNameBuffer[_MAX_PATH];
- CHAR8 *FvFileName;
- FILE *FvFile;
- FILE *SymFile;
- CHAR8 SymFileNameBuffer[_MAX_PATH];
- CHAR8 *SymFileName;
- UINT8 *SymImage;
- UINTN SymImageSize = 0;
- CHAR8 *CurrentSymString;
-
- FvFileName = FvFileNameBuffer;
- SymFileName = SymFileNameBuffer;
-
- SetUtilityName (UTILITY_NAME);
-
- if (argc == 1) {
- Usage ();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return GetUtilityStatus ();
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return GetUtilityStatus ();
- }
-
- //
- // Verify the correct number of arguments
- //
- if (argc != MAX_ARGS) {
- Error (NULL, 0, 0, "invalid number of input parameters specified", NULL);
- Usage ();
- return GetUtilityStatus ();
- }
- //
- // Initialize variables
- //
- strcpy (InfFileName, "");
-
- //
- // Parse the command line arguments
- //
- for (Index = 1; Index < MAX_ARGS; Index += 2) {
- //
- // Make sure argument pair begin with - or /
- //
- if (argv[Index][0] != '-' && argv[Index][0] != '/') {
- Error (NULL, 0, 0, argv[Index], "argument pair must begin with \"-\" or \"/\"");
- Usage ();
- return GetUtilityStatus ();
- }
- //
- // Make sure argument specifier is only one letter
- //
- if (argv[Index][2] != 0) {
- Error (NULL, 0, 0, argv[Index], "unrecognized argument");
- Usage ();
- return GetUtilityStatus ();
- }
- //
- // Determine argument to read
- //
- switch (argv[Index][1]) {
-
- case 'I':
- case 'i':
- if (strlen (InfFileName) == 0) {
- strcpy (InfFileName, argv[Index + 1]);
- } else {
- Error (NULL, 0, 0, argv[Index + 1], "FvInfFileName may only be specified once");
- Usage ();
- return GetUtilityStatus ();
- }
- break;
-
- default:
- Error (NULL, 0, 0, argv[Index], "unrecognized argument");
- Usage ();
- return GetUtilityStatus ();
- break;
- }
- }
- //
- // Read the INF file image
- //
- Status = GetFileImage (InfFileName, &InfFileImage, &InfFileSize);
- if (EFI_ERROR (Status)) {
- return STATUS_ERROR;
- }
- //
- // Call the GenFvImage lib
- //
- Status = GenerateFvImage (
- InfFileImage,
- InfFileSize,
- &FvImage,
- &FvImageSize,
- &FvFileName,
- &SymImage,
- &SymImageSize,
- &SymFileName
- );
-
- //
- // free InfFileImage memory
- //
- free (InfFileImage);
-
- if (EFI_ERROR (Status)) {
- switch (Status) {
-
- case EFI_INVALID_PARAMETER:
- Error (NULL, 0, 0, "invalid parameter passed to GenFvImage Lib", NULL);
- return GetUtilityStatus ();
- break;
-
- case EFI_ABORTED:
- Error (NULL, 0, 0, "error detected while creating the file image", NULL);
- return GetUtilityStatus ();
- break;
-
- case EFI_OUT_OF_RESOURCES:
- Error (NULL, 0, 0, "GenFvImage Lib could not allocate required resources", NULL);
- return GetUtilityStatus ();
- break;
-
- case EFI_VOLUME_CORRUPTED:
- Error (NULL, 0, 0, "no base address was specified, but the FV.INF included a PEI or BSF file", NULL);
- return GetUtilityStatus ();
- break;
-
- case EFI_LOAD_ERROR:
- Error (NULL, 0, 0, "could not load FV image generation library", NULL);
- return GetUtilityStatus ();
- break;
-
- default:
- Error (NULL, 0, 0, "GenFvImage Lib returned unknown status", "status returned = 0x%X", Status);
- return GetUtilityStatus ();
- break;
- }
- }
- //
- // Write file
- //
- FvFile = fopen (FvFileName, "wb");
- if (FvFile == NULL) {
- Error (NULL, 0, 0, FvFileName, "could not open output file");
- free (FvImage);
- free (SymImage);
- return GetUtilityStatus ();
- }
-
- if (fwrite (FvImage, 1, FvImageSize, FvFile) != FvImageSize) {
- Error (NULL, 0, 0, FvFileName, "failed to write to output file");
- free (FvImage);
- free (SymImage);
- fclose (FvFile);
- return GetUtilityStatus ();
- }
-
- fclose (FvFile);
- free (FvImage);
-
- //
- // Write symbol file
- //
- if (strcmp (SymFileName, "")) {
- SymFile = fopen (SymFileName, "wt");
- if (SymFile == NULL) {
- Error (NULL, 0, 0, SymFileName, "could not open output symbol file");
- free (SymImage);
- return GetUtilityStatus ();
- }
-
- fprintf (SymFile, "TEXTSYM format | V1.0\n");
-
- CurrentSymString = SymImage;
- while (((UINTN) CurrentSymString - (UINTN) SymImage) < SymImageSize) {
- fprintf (SymFile, "%s", CurrentSymString);
- CurrentSymString = (CHAR8 *) (((UINTN) CurrentSymString) + strlen (CurrentSymString) + 1);
- }
-
- fclose (SymFile);
- }
-
- free (SymImage);
-
- return GetUtilityStatus ();
-}
diff --git a/Tools/CCode/Source/GenFvImage/GenFvImageExe.h b/Tools/CCode/Source/GenFvImage/GenFvImageExe.h
deleted file mode 100644
index 9b97935656..0000000000
--- a/Tools/CCode/Source/GenFvImage/GenFvImageExe.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- GenFvImageExe.h
-
-Abstract:
-
- Definitions for the PeimFixup exe utility.
-
---*/
-
-//
-// Coded to Tiano Coding Standards
-//
-#ifndef _EFI_GEN_FV_IMAGE_EXE_H
-#define _EFI_GEN_FV_IMAGE_EXE_H
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "GenFvImageLib.h"
-
-//
-// Utility Name
-//
-#define UTILITY_NAME "GenFvImage"
-
-//
-// Utility version information
-//
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-#define UTILITY_DATE __DATE__
-
-//
-// The maximum number of arguments accepted from the command line.
-//
-#define MAX_ARGS 3
-
-//
-// The function that displays general utility information
-//
-VOID
-PrintUtilityInfo (
- VOID
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// The function that displays the utility usage message.
-//
-VOID
-PrintUsage (
- VOID
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/Tools/CCode/Source/GenFvImage/GenFvImageLib.c b/Tools/CCode/Source/GenFvImage/GenFvImageLib.c
deleted file mode 100644
index dfed0aefa2..0000000000
--- a/Tools/CCode/Source/GenFvImage/GenFvImageLib.c
+++ /dev/null
@@ -1,2762 +0,0 @@
-/*++
-i
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- GenFvImageLib.c
-
-Abstract:
-
- This file contains functions required to generate a Firmware Volume.
-
---*/
-
-//
-// Include files
-//
-#ifdef __GNUC__
-#include <uuid/uuid.h>
-#include <sys/stat.h>
-#endif
-#include <string.h>
-#ifndef __GNUC__
-#include <io.h>
-#endif
-#include <assert.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-#include <Common/Variable.h>
-#include <Common/WorkingBlockHeader.h>
-#include <Guid/FirmwareFileSystem.h>
-
-#include "GenFvImageLib.h"
-#include "GenFvImageLibInternal.h"
-#include "CommonLib.h"
-#include "Crc32.h"
-#include "EfiUtilityMsgs.h"
-#include "FvLib.h"
-#include "Compress.h"
-#include "WinNtInclude.h"
-
-//
-// Different file separater for Linux and Windows
-//
-#ifdef __GNUC__
-#define FILE_SEP_CHAR '/'
-#define FILE_SEP_STRING "/"
-#else
-#define FILE_SEP_CHAR '\\'
-#define FILE_SEP_STRING "\\"
-#endif
-
-static UINT32 MaxFfsAlignment = 0;
-//
-// Local function prototypes
-//
-EFI_STATUS
-GetPe32Info (
- IN UINT8 *Pe32,
- OUT UINT32 *EntryPoint,
- OUT UINT32 *BaseOfCode,
- OUT UINT16 *MachineType
- );
-
-//
-// Local function implementations.
-//
-EFI_GUID FfsGuid = EFI_FIRMWARE_FILE_SYSTEM_GUID;
-EFI_GUID DefaultFvPadFileNameGuid = { 0x78f54d4, 0xcc22, 0x4048, 0x9e, 0x94, 0x87, 0x9c, 0x21, 0x4d, 0x56, 0x2f };
-
-//
-// 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 starutp 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
-};
-
-EFI_STATUS
-ParseFvInf (
- IN MEMORY_FILE *InfFile,
- IN 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_PATH];
- UINT64 Value64;
- UINTN Index;
- EFI_STATUS Status;
-
- //
- // Initialize FV info
- //
- memset (FvInfo, 0, sizeof (FV_INFO));
-
- //
- // Read the FV base address
- //
- 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, 0, EFI_FV_BASE_ADDRESS_STRING, "invalid value");
- return EFI_ABORTED;
- }
-
- FvInfo->BaseAddress = Value64;
- } else {
- Error (NULL, 0, 0, EFI_FV_BASE_ADDRESS_STRING, "could not find value");
- return EFI_ABORTED;
- }
- //
- // Read the FV Guid
- //
- Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_FV_GUID_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Get the guid value
- //
- Status = StringToGuid (Value, &FvInfo->FvGuid);
- if (EFI_ERROR (Status)) {
- memcpy (&FvInfo->FvGuid, &FfsGuid, sizeof (EFI_GUID));
- }
- } else {
- memcpy (&FvInfo->FvGuid, &FfsGuid, sizeof (EFI_GUID));
- }
- //
- // 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);
- } else {
- Error (NULL, 0, 0, EFI_FV_FILE_NAME_STRING, "value not specified");
- return EFI_ABORTED;
- }
- //
- // Read the Sym file name
- //
- Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_SYM_FILE_NAME_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // copy the file name
- //
- strcpy (FvInfo->SymName, Value);
- } else {
- //
- // Symbols not required, so init to NULL.
- //
- strcpy (FvInfo->SymName, "");
- }
- //
- // Read the read disabled capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_READ_DISABLED_CAP_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the read disabled flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_READ_DISABLED_CAP;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_READ_DISABLED_CAP_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_READ_DISABLED_CAP_STRING, "value not specified");
- return Status;
- }
- //
- // Read the read enabled capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_READ_ENABLED_CAP_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the read disabled flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_READ_ENABLED_CAP;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_READ_ENABLED_CAP_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_READ_ENABLED_CAP_STRING, "value not specified");
- return Status;
- }
- //
- // Read the read status attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_READ_STATUS_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the read disabled flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_READ_STATUS;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_READ_STATUS_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_READ_STATUS_STRING, "value not specified");
- return Status;
- }
- //
- // Read the write disabled capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_WRITE_DISABLED_CAP_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the write disabled flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_WRITE_DISABLED_CAP;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_WRITE_DISABLED_CAP_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_WRITE_DISABLED_CAP_STRING, "value not specified");
- return Status;
- }
- //
- // Read the write enabled capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_WRITE_ENABLED_CAP_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the write disabled flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_WRITE_ENABLED_CAP;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_WRITE_ENABLED_CAP_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_WRITE_ENABLED_CAP_STRING, "value not specified");
- return Status;
- }
- //
- // Read the write status attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_WRITE_STATUS_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the write disabled flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_WRITE_STATUS;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_WRITE_STATUS_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_WRITE_STATUS_STRING, "value not specified");
- return Status;
- }
- //
- // Read the lock capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_LOCK_CAP_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the attribute flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_LOCK_CAP;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_LOCK_CAP_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_LOCK_CAP_STRING, "value not specified");
- return Status;
- }
- //
- // Read the lock status attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_LOCK_STATUS_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the attribute flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_LOCK_STATUS;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_LOCK_STATUS_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_LOCK_STATUS_STRING, "value not specified");
- return Status;
- }
- //
- // Read the sticky write attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_STICKY_WRITE_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the attribute flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_STICKY_WRITE;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_STICKY_WRITE_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_STICKY_WRITE_STRING, "value not specified");
- return Status;
- }
- //
- // Read the memory mapped attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_MEMORY_MAPPED_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the attribute flag
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_MEMORY_MAPPED;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_MEMORY_MAPPED_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_MEMORY_MAPPED_STRING, "value not specified");
- return Status;
- }
- //
- // Read the erase polarity attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ERASE_POLARITY_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the attribute flag
- //
- if (strcmp (Value, ONE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ERASE_POLARITY;
- } else if (strcmp (Value, ZERO_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ERASE_POLARITY_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ERASE_POLARITY_STRING, "value not specified");
- return Status;
- }
- //
- // Read the alignment capabilities attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_CAP_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_CAP;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_CAP_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_CAP_STRING, "value not specified");
- return Status;
- }
- //
- // Read the word alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_2_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_2;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_2_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_2_STRING, "value not specified");
- return Status;
- }
- //
- // Read the dword alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_4_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_4;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_4_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_4_STRING, "value not specified");
- return Status;
- }
- //
- // Read the word alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_8_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_8;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_8_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_8_STRING, "value not specified");
- return Status;
- }
- //
- // Read the qword alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_16_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_16;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_16_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_16_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 32 byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_32_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_32;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_32_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_32_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 64 byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_64_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_64;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_64_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_64_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 128 byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_128_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_128;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_128_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_128_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 256 byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_256_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_256;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_256_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_256_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 512 byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_512_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_512;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_512_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_512_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 1K byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_1K_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_1K;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_1K_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_1K_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 2K byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_2K_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_2K;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_2K_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_2K_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 4K byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_4K_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_4K;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_4K_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_4K_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 8K byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_8K_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_8K;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_8K_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_8K_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 16K byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_16K_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_16K;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_16K_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_16K_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 32K byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_32K_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_32K;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_32K_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_32K_STRING, "value not specified");
- return Status;
- }
- //
- // Read the 64K byte alignment capability attribute
- //
- Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FVB_ALIGNMENT_64K_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update attribute
- //
- if (strcmp (Value, TRUE_STRING) == 0) {
- FvInfo->FvAttributes |= EFI_FVB_ALIGNMENT_64K;
- } else if (strcmp (Value, FALSE_STRING) != 0) {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_64K_STRING, "expected %s | %s", TRUE_STRING, FALSE_STRING);
- return EFI_ABORTED;
- }
- } else {
- Error (NULL, 0, 0, EFI_FVB_ALIGNMENT_64K_STRING, "value not specified");
- return Status;
- }
-
- if (!(FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_CAP) &&
- (
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_2) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_4) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_8) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_16) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_32) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_64) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_128) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_256) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_512) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_1K) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_2K) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_4K) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_8K) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_16K) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_32K) ||
- (FvInfo->FvAttributes & EFI_FVB_ALIGNMENT_64K)
- )
- ) {
- Error (
- NULL,
- 0,
- 0,
- "illegal combination of alignment attributes",
- "if %s is not %s, no individual alignments can be %s",
- EFI_FVB_ALIGNMENT_CAP_STRING,
- TRUE_STRING,
- TRUE_STRING
- );
- return EFI_ABORTED;
- }
- //
- // Read block maps
- //
- for (Index = 0; Index < MAX_NUMBER_OF_FV_BLOCKS; Index++) {
- //
- // Read the number of blocks
- //
- 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, 0, Value, "invalid value for %s", EFI_NUM_BLOCKS_STRING);
- return EFI_ABORTED;
- }
-
- FvInfo->FvBlocks[Index].NumBlocks = (UINT32) Value64;
- } else {
- //
- // If there is no number of blocks, but there is a size, then we have a mismatched pair
- // and should return an error.
- //
- Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_BLOCK_SIZE_STRING, Index, Value);
- if (!EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "must specify both", "%s and %s", EFI_NUM_BLOCKS_STRING, EFI_BLOCK_SIZE_STRING);
- return EFI_ABORTED;
- } else {
- //
- // We are done
- //
- break;
- }
- }
- //
- // Read the size of blocks
- //
- Status = FindToken (InfFile, OPTIONS_SECTION_STRING, EFI_BLOCK_SIZE_STRING, Index, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Update the number of blocks
- //
- Status = AsciiStringToUint64 (Value, FALSE, &Value64);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, Value, "invalid value specified for %s", EFI_BLOCK_SIZE_STRING);
- return EFI_ABORTED;
- }
-
- FvInfo->FvBlocks[Index].BlockLength = (UINT32) Value64;
- } else {
- //
- // There is a number of blocks, but there is no size, so we have a mismatched pair
- // and should return an error.
- //
- Error (NULL, 0, 0, "must specify both", "%s and %s", EFI_NUM_BLOCKS_STRING, EFI_BLOCK_SIZE_STRING);
- return EFI_ABORTED;
- }
- }
- //
- // Read files
- //
- for (Index = 0; Index < MAX_NUMBER_OF_FILES_IN_FV; Index++) {
- //
- // Read the number of blocks
- //
- Status = FindToken (InfFile, FILES_SECTION_STRING, EFI_FILE_NAME_STRING, Index, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Add the file
- //
- strcpy (FvInfo->FvFiles[Index], Value);
- } else {
- break;
- }
- }
-
- if (FindSection (InfFile, COMPONENT_SECTION_STRING)) {
- Index = 0;
- //
- // Read component FV_VARIABLE
- //
- Status = FindToken (InfFile, COMPONENT_SECTION_STRING, EFI_NV_VARIABLE_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Add the component
- //
- strcpy (FvInfo->FvComponents[Index].ComponentName, EFI_NV_VARIABLE_STRING);
- Status = AsciiStringToUint64 (Value, FALSE, &Value64);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: %s is not a valid integer.\n", EFI_NV_VARIABLE_STRING);
- return EFI_ABORTED;
- }
-
- FvInfo->FvComponents[Index].Size = (UINTN) Value64;
- } else {
- printf ("WARNING: Could not read %s.\n", EFI_NV_VARIABLE_STRING);
- }
-
- Index++;
- //
- // Read component FV_EVENT_LOG
- //
- Status = FindToken (InfFile, COMPONENT_SECTION_STRING, EFI_NV_EVENT_LOG_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Add the component
- //
- strcpy (FvInfo->FvComponents[Index].ComponentName, EFI_NV_EVENT_LOG_STRING);
- Status = AsciiStringToUint64 (Value, FALSE, &Value64);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: %s is not a valid integer.\n", EFI_NV_EVENT_LOG_STRING);
- return EFI_ABORTED;
- }
-
- FvInfo->FvComponents[Index].Size = (UINTN) Value64;
- } else {
- printf ("WARNING: Could not read %s.\n", EFI_NV_EVENT_LOG_STRING);
- }
-
- Index++;
- //
- // Read component FV_FTW_WORKING
- //
- Status = FindToken (InfFile, COMPONENT_SECTION_STRING, EFI_NV_FTW_WORKING_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Add the component
- //
- strcpy (FvInfo->FvComponents[Index].ComponentName, EFI_NV_FTW_WORKING_STRING);
- Status = AsciiStringToUint64 (Value, FALSE, &Value64);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: %s is not a valid integer.\n", EFI_NV_FTW_WORKING_STRING);
- return EFI_ABORTED;
- }
-
- FvInfo->FvComponents[Index].Size = (UINTN) Value64;
- } else {
- printf ("WARNING: Could not read %s.\n", EFI_NV_FTW_WORKING_STRING);
- }
-
- Index++;
- //
- // Read component FV_FTW_SPARE
- //
- Status = FindToken (InfFile, COMPONENT_SECTION_STRING, EFI_NV_FTW_SPARE_STRING, 0, Value);
-
- if (Status == EFI_SUCCESS) {
- //
- // Add the component
- //
- strcpy (FvInfo->FvComponents[Index].ComponentName, EFI_NV_FTW_SPARE_STRING);
- Status = AsciiStringToUint64 (Value, FALSE, &Value64);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: %s is not a valid integer.\n", EFI_NV_FTW_SPARE_STRING);
- return EFI_ABORTED;
- }
-
- FvInfo->FvComponents[Index].Size = (UINTN) Value64;
- } else {
- printf ("WARNING: Could not read %s.\n", EFI_NV_FTW_SPARE_STRING);
- }
- }
- //
- // Compute size for easy access later
- //
- FvInfo->Size = 0;
- for (Index = 0; FvInfo->FvBlocks[Index].NumBlocks; Index++) {
- FvInfo->Size += FvInfo->FvBlocks[Index].NumBlocks * FvInfo->FvBlocks[Index].BlockLength;
- }
-
- 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.
-
-Arguments:
-
- FfsFile File header.
- FvHeader FV header.
-
-Returns:
-
- None
-
---*/
-{
- if (FvHeader->Attributes & EFI_FVB_ERASE_POLARITY) {
- FfsFile->State = (UINT8)~(FfsFile->State);
- }
-}
-
-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 of the FFS file, in bytes
-
-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:
- //
- // 8 byte alignment, mini alignment requirement for FFS file.
- //
- *Alignment = (1 << 3);
- break;
-
- case 1:
- //
- // 16 byte alignment
- //
- *Alignment = (1 << 4);
- break;
-
- case 2:
- //
- // 128 byte alignment
- //
- *Alignment = (1 << 7);
- break;
-
- case 3:
- //
- // 512 byte alignment
- //
- *Alignment = (1 << 9);
- break;
-
- case 4:
- //
- // 1K byte alignment
- //
- *Alignment = (1 << 10);
- break;
-
- case 5:
- //
- // 4K byte alignment
- //
- *Alignment = (1 << 12);
- break;
-
- case 6:
- //
- // 32K byte alignment
- //
- *Alignment = (1 << 15);
- break;
-
- case 7:
- //
- // 64K byte alignment
- //
- *Alignment = (1 << 16);
- break;
-
- default:
- Error (NULL, 0, 0, "nvalid file attribute calculated, this is most likely a utility error", NULL);
- return EFI_ABORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-AddPadFile (
- IN OUT MEMORY_FILE *FvImage,
- IN UINT32 DataAlignment
- )
-/*++
-
-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.
-
-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;
- EFI_GUID PadFileGuid;
- UINTN PadFileSize;
-
- //
- // Verify input parameters.
- //
- if (FvImage == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Basic assumption is we start from an 8 byte aligned address
- // and our file header is a multiple of 8 bytes
- //
- assert ((UINTN) FvImage->CurrentFilePointer % 8 == 0);
- assert (sizeof (EFI_FFS_FILE_HEADER) % 8 == 0);
-
- //
- // Check if a pad file is necessary
- //
- if (((UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + sizeof (EFI_FFS_FILE_HEADER)) % DataAlignment == 0) {
- return EFI_SUCCESS;
- }
- //
- // Write pad file header
- //
- PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;
-
- //
- // Verify that we have enough space for the file header
- //
- if ((UINTN) (PadFile + sizeof (EFI_FFS_FILE_HEADER)) >= (UINTN) FvImage->Eof) {
- return EFI_OUT_OF_RESOURCES;
- }
-
-#ifdef __GNUC__
- {
- uuid_t tmp_id;
- uuid_generate (tmp_id);
- memcpy (&PadFileGuid, tmp_id, sizeof (EFI_GUID));
- }
-#else
- UuidCreate (&PadFileGuid);
-#endif
- memset (PadFile, 0, sizeof (EFI_FFS_FILE_HEADER));
- memcpy (&PadFile->Name, &PadFileGuid, sizeof (EFI_GUID));
- PadFile->Type = EFI_FV_FILETYPE_FFS_PAD;
- PadFile->Attributes = 0;
-
- //
- // Calculate the pad file size
- //
- //
- // This is the earliest possible valid offset (current plus pad file header
- // plus the next file header)
- //
- PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2);
-
- //
- // Add whatever it takes to get to the next aligned address
- //
- while ((PadFileSize % DataAlignment) != 0) {
- PadFileSize++;
- }
- //
- // Subtract the next file header size
- //
- PadFileSize -= sizeof (EFI_FFS_FILE_HEADER);
-
- //
- // Subtract the starting offset to get size
- //
- PadFileSize -= (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage;
-
- //
- // Write pad file size (calculated size minus next file header size)
- //
- 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, sizeof (EFI_FFS_FILE_HEADER));
- if (PadFile->Attributes & FFS_ATTRIB_CHECKSUM) {
- PadFile->IntegrityCheck.Checksum.File = CalculateChecksum8 ((UINT8 *) PadFile, PadFileSize);
- } else {
- 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
- );
-
- //
- // Verify that we have enough space (including the padding
- //
- if ((UINTN) (PadFile + sizeof (EFI_FFS_FILE_HEADER)) >= (UINTN) FvImage->Eof) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Update the current FV pointer
- //
- FvImage->CurrentFilePointer += PadFileSize;
-
- 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
-
---*/
-{
- EFI_GUID VtfGuid = EFI_FFS_VOLUME_TOP_FILE_GUID;
- if (!memcmp (&FileBuffer->Name, &VtfGuid, sizeof (EFI_GUID))) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-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
-AddSymFile (
- IN UINT64 BaseAddress,
- IN EFI_FFS_FILE_HEADER *FfsFile,
- IN OUT MEMORY_FILE *SymImage,
- IN CHAR8 *SourceFileName
- )
-/*++
-
-Routine Description:
-
- This function adds the SYM tokens in the source file to the destination file.
- The SYM tokens are updated to reflect the base address.
-
-Arguments:
-
- BaseAddress The base address for the new SYM tokens.
- FfsFile Pointer to the beginning of the FFS file in question.
- SymImage The memory file to update with symbol information.
- SourceFileName The source file.
-
-Returns:
-
- EFI_SUCCESS The function completed successfully.
- EFI_INVALID_PARAMETER One of the input parameters was invalid.
- EFI_ABORTED An error occurred.
-
---*/
-{
- FILE *SourceFile;
-
- CHAR8 Buffer[_MAX_PATH];
- CHAR8 Type[_MAX_PATH];
- CHAR8 Address[_MAX_PATH];
- CHAR8 Section[_MAX_PATH];
- CHAR8 Token[_MAX_PATH];
- CHAR8 SymFileName[_MAX_PATH];
- CHAR8 CodeModuleName[_MAX_PATH];
- CHAR8 *Ptr;
-
- UINT64 TokenAddress;
-
- EFI_STATUS Status;
- EFI_FILE_SECTION_POINTER Pe32Section;
- UINT32 EntryPoint;
- UINT32 BaseOfCode;
- UINT16 MachineType;
-
- //
- // Verify input parameters.
- //
- if (BaseAddress == 0 || FfsFile == NULL || SymImage == NULL || SourceFileName == NULL) {
- Error (NULL, 0, 0, "invalid parameter passed to AddSymFile()", NULL);
- return EFI_INVALID_PARAMETER;
- }
- //
- // Check if we want to add this file
- //
- //
- // Get the file name
- //
- strcpy (Buffer, SourceFileName);
-
- //
- // Copy the file name for the path of the sym file and truncate the name portion.
- //
- strcpy (SymFileName, Buffer);
- Ptr = strrchr (SymFileName, FILE_SEP_CHAR);
- assert (Ptr);
- Ptr[0] = 0;
-
- //
- // Find the file extension and make it lower case
- //
- Ptr = strrchr (SymFileName, '.');
- if (Ptr != NULL) {
- strlwr (Ptr);
- }
- //
- // Check if it is PEI file
- //
- if (strstr (Buffer, ".pei") != NULL) {
- //
- // Find the human readable portion
- //
- if (!strtok (Buffer, "-") ||
- !strtok (NULL, "-") ||
- !strtok (NULL, "-") ||
- !strtok (NULL, "-") ||
- !strtok (NULL, "-") ||
- !strcpy (Buffer, strtok (NULL, "."))
- ) {
- Error (NULL, 0, 0, "failed to find human readable portion of the file name in AddSymFile()", NULL);
- return EFI_ABORTED;
- }
- //
- // Save code module name
- //
- strcpy (CodeModuleName, Buffer);
-
- //
- // Add the symbol file name and extension to the file path.
- //
- strcat (Buffer, ".sym");
- strcat (SymFileName, FILE_SEP_CHAR);
- strcat (SymFileName, Buffer);
- } else {
- //
- // Only handle PEIM files.
- //
- return EFI_SUCCESS;
- }
- //
- // Find PE32 section
- //
- Status = GetSectionByType (FfsFile, EFI_SECTION_PE32, 1, &Pe32Section);
-
- //
- // BUGBUG: Assume if no PE32 section it is PIC and hardcode base address
- //
- if (Status == EFI_NOT_FOUND) {
- Status = GetSectionByType (FfsFile, EFI_SECTION_TE, 1, &Pe32Section);
- }
-
- if (Status == EFI_SUCCESS) {
- Status = GetPe32Info (
- (VOID *) ((UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32)),
- &EntryPoint,
- &BaseOfCode,
- &MachineType
- );
- } else if (Status == EFI_NOT_FOUND) {
- //
- // For PIC, hardcode.
- //
- BaseOfCode = 0x60;
- Status = EFI_SUCCESS;
- } else {
- Error (NULL, 0, 0, "could not parse a PE32 section from the PEI file", NULL);
- return Status;
- }
-
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "GetPe32Info() could not get PE32 entry point for PEI file", NULL);
- return Status;
- }
-
- //
- // Open the source file
- //
- SourceFile = fopen (SymFileName, "r");
- if (SourceFile == NULL) {
- //
- // SYM files are not required.
- //
- return EFI_SUCCESS;
- }
- //
- // Read the first line
- //
- if (fgets (Buffer, _MAX_PATH, SourceFile) == NULL) {
- Buffer[0] = 0;
- }
- //
- // Make sure it matches the expected sym format
- //
- if (strcmp (Buffer, "TEXTSYM format | V1.0\n")) {
- fclose (SourceFile);
- Error (NULL, 0, 0, "AddSymFile() found unexpected sym format in input file", NULL);
- return EFI_ABORTED;
- }
- //
- // Read in the file
- //
- while (feof (SourceFile) == 0) {
- //
- // Read a line
- //
- if (fscanf (
- SourceFile,
- "%s | %s | %s | %s\n",
- Type,
- Address,
- Section,
- Token
- ) == 4) {
- //
- // If the token starts with "??" ignore it
- //
- if (Token[0] == '?' && Token[1] == '?') {
- continue;
- }
- //
- // Get the token address
- //
- AsciiStringToUint64 (Address, TRUE, &TokenAddress);
-
- //
- // Add the base address
- //
- TokenAddress += BaseAddress;
-
- //
- // If PE32 or TE section then find the start of code. For PIC it is hardcoded.
- //
- if (Pe32Section.Pe32Section) {
- //
- // Add the offset of the PE32 section
- //
- TokenAddress += (UINTN) Pe32Section.Pe32Section - (UINTN) FfsFile;
-
- //
- // Add the size of the PE32 section header
- //
- TokenAddress += sizeof (EFI_PE32_SECTION);
- } else {
- //
- // For PIC hardcoded.
- //
- TokenAddress += 0x28;
- }
-
- //
- // Add the beginning of the code
- //
- TokenAddress += BaseOfCode;
-
- sprintf (
- Buffer,
- "%s | %016I64X | %s | _%s%s\n",
- Type,
- TokenAddress,
- Section,
- CodeModuleName,
- Token
- );
- memcpy (SymImage->CurrentFilePointer, Buffer, strlen (Buffer) + 1);
- SymImage->CurrentFilePointer = (UINT8 *) (((UINTN) SymImage->CurrentFilePointer) + strlen (Buffer) + 1);
- }
- }
-
- fclose (SourceFile);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-AddFile (
- IN OUT MEMORY_FILE *FvImage,
- IN FV_INFO *FvInfo,
- IN UINTN Index,
- IN OUT EFI_FFS_FILE_HEADER **VtfFileImage,
- IN OUT MEMORY_FILE *SymImage
- )
-/*++
-
-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.
- SymImage The memory image of the Sym file to update if symbols are present.
- The current offset must be valid.
-
-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;
- EFI_PHYSICAL_ADDRESS CurrentFileBaseAddress;
- UINT8 VtfHeaderChecksum;
- UINT8 VtfFileChecksum;
- UINT8 FileState;
- EFI_FFS_FILE_TAIL TailValue;
- UINT32 TailSize;
- //
- // Verify input parameters.
- //
- if (FvImage == NULL || FvInfo == NULL || FvInfo->FvFiles[Index][0] == 0 || VtfFileImage == NULL || SymImage == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Read the file to add
- //
- NewFile = fopen (FvInfo->FvFiles[Index], "rb");
-
- if (NewFile == NULL) {
- Error (NULL, 0, 0, FvInfo->FvFiles[Index], "failed to open file for reading");
- return EFI_ABORTED;
- }
- //
- // Get the file size
- //
- FileSize = _filelength (fileno (NewFile));
-
- //
- // Read the file into a buffer
- //
- FileBuffer = malloc (FileSize);
- if (FileBuffer == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- 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, 0, FvInfo->FvFiles[Index], "failed to read input file contents");
- return EFI_ABORTED;
- }
- //
- // Verify space exists to add the file
- //
- if (FileSize > (UINTN) ((UINTN) *VtfFileImage - (UINTN) FvImage->CurrentFilePointer)) {
- Error (NULL, 0, 0, FvInfo->FvFiles[Index], "insufficient space remains to add the file");
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Update the file state based on polarity of the FV.
- //
- UpdateFfsFileState (
- (EFI_FFS_FILE_HEADER *) FileBuffer,
- (EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage
- );
-
- //
- // 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) & 0x07) != 0) {
- Error (NULL, 0, 0, "VTF file does not align on 8-byte boundary", NULL);
- }
- //
- // copy VTF File Header
- //
- memcpy (*VtfFileImage, FileBuffer, sizeof (EFI_FFS_FILE_HEADER));
-
- //
- // Copy VTF body
- //
- memcpy (
- (UINT8 *) *VtfFileImage + sizeof (EFI_FFS_FILE_HEADER),
- FileBuffer + sizeof (EFI_FFS_FILE_HEADER),
- FileSize - sizeof (EFI_FFS_FILE_HEADER)
- );
-
- //
- // re-calculate the VTF File Header
- //
- FileState = (*VtfFileImage)->State;
- (*VtfFileImage)->State = 0;
- *(UINT32 *) ((*VtfFileImage)->Size) = FileSize;
- (*VtfFileImage)->IntegrityCheck.Checksum.Header = 0;
- (*VtfFileImage)->IntegrityCheck.Checksum.File = 0;
-
- VtfHeaderChecksum = CalculateChecksum8 ((UINT8 *) *VtfFileImage, sizeof (EFI_FFS_FILE_HEADER));
- (*VtfFileImage)->IntegrityCheck.Checksum.Header = VtfHeaderChecksum;
- //
- // Determine if it has a tail
- //
- if ((*VtfFileImage)->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailSize = sizeof (EFI_FFS_FILE_TAIL);
- } else {
- TailSize = 0;
- }
-
- if ((*VtfFileImage)->Attributes & FFS_ATTRIB_CHECKSUM) {
- VtfFileChecksum = CalculateChecksum8 ((UINT8 *) *VtfFileImage, FileSize - TailSize);
- (*VtfFileImage)->IntegrityCheck.Checksum.File = VtfFileChecksum;
- } else {
- (*VtfFileImage)->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
- }
- //
- // If it has a file tail, update it
- //
- if ((*VtfFileImage)->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailValue = (EFI_FFS_FILE_TAIL) (~((*VtfFileImage)->IntegrityCheck.TailReference));
- *(EFI_FFS_FILE_TAIL *) (((UINTN) (*VtfFileImage) + GetLength ((*VtfFileImage)->Size) - sizeof (EFI_FFS_FILE_TAIL))) = TailValue;
- }
- (*VtfFileImage)->State = FileState;
- free (FileBuffer);
- return EFI_SUCCESS;
- } else {
- //
- // Already found a VTF file.
- //
- Error (NULL, 0, 0, "multiple VTF files are illegal in a single FV", NULL);
- free (FileBuffer);
- return EFI_ABORTED;
- }
- }
- //
- // Check if alignment is required
- //
- Status = ReadFfsAlignment ((EFI_FFS_FILE_HEADER *) FileBuffer, &CurrentFileAlignment);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: Could not determine alignment of file %s.\n", FvInfo->FvFiles[Index]);
- free (FileBuffer);
- return EFI_ABORTED;
- }
-
- //
- // Find the largest alignment of all the FFS files in the FV
- //
- if (CurrentFileAlignment > MaxFfsAlignment) {
- MaxFfsAlignment = CurrentFileAlignment;
- }
- //
- // Add pad file if necessary
- //
- Status = AddPadFile (FvImage, CurrentFileAlignment);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: Could not align the file data properly.\n");
- free (FileBuffer);
- return EFI_ABORTED;
- }
- //
- // Add file
- //
- if ((FvImage->CurrentFilePointer + FileSize) < FvImage->Eof) {
- //
- // Copy the file
- //
- memcpy (FvImage->CurrentFilePointer, FileBuffer, FileSize);
-
- //
- // If the file is XIP, rebase
- //
- CurrentFileBaseAddress = FvInfo->BaseAddress + ((UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage);
- //
- // Status = RebaseFfsFile ((EFI_FFS_FILE_HEADER*) FvImage->CurrentFilePointer, CurrentFileBaseAddress);
- // if (EFI_ERROR(Status)) {
- // printf ("ERROR: Could not rebase the file %s.\n", FvInfo->FvFiles[Index]);
- // return EFI_ABORTED;
- // }
- //
- // Update Symbol file
- //
- Status = AddSymFile (
- CurrentFileBaseAddress,
- (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer,
- SymImage,
- FvInfo->FvFiles[Index]
- );
- assert (!EFI_ERROR (Status));
-
- //
- // Update the current pointer in the FV image
- //
- FvImage->CurrentFilePointer += FileSize;
- } else {
- printf ("ERROR: The firmware volume is out of space, could not add file %s.\n", FvInfo->FvFiles[Index]);
- return EFI_ABORTED;
- }
- //
- // Make next file start at QWord Boundry
- //
- while (((UINTN) FvImage->CurrentFilePointer & 0x07) != 0) {
- FvImage->CurrentFilePointer++;
- }
- //
- // Free allocated memory.
- //
- free (FileBuffer);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-AddVariableBlock (
- IN UINT8 *FvImage,
- IN UINTN Size,
- IN FV_INFO *FvInfo
- )
-{
- EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
- VARIABLE_STORE_HEADER *VarStoreHeader;
- //
- // Variable block should exclude FvHeader. Since the length of
- // FvHeader depends on the block map, which is variable length,
- // we could only decide the actual variable block length here.
- //
- FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) FvImage;
- FvImage = FvImage + FvHeader->HeaderLength;
-
- VarStoreHeader = (VARIABLE_STORE_HEADER *) FvImage;
-
- VarStoreHeader->Signature = VARIABLE_STORE_SIGNATURE;
- VarStoreHeader->Size = Size - FvHeader->HeaderLength;
- VarStoreHeader->Format = VARIABLE_STORE_FORMATTED;
- VarStoreHeader->State = VARIABLE_STORE_HEALTHY;
- VarStoreHeader->Reserved = 0;
- VarStoreHeader->Reserved1 = 0;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-AddEventLogBlock (
- IN UINT8 *FvImage,
- IN UINTN Size,
- IN FV_INFO *FvInfo
- )
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-AddFTWWorkingBlock (
- IN UINT8 *FvImage,
- IN UINTN Size,
- IN FV_INFO *FvInfo
- )
-{
- EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *FTWHeader;
- UINT32 Crc32;
-
- Crc32 = 0;
- FTWHeader = (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *) FvImage;
- memcpy (&FTWHeader->Signature, &(FvInfo->FvGuid), sizeof (EFI_GUID));
- FTWHeader->WriteQueueSize = Size - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER);
- CalculateCrc32 (FvImage, sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER), &Crc32);
- FTWHeader->Crc = Crc32;
- if (FvInfo->FvAttributes & EFI_FVB_ERASE_POLARITY) {
- FTWHeader->WorkingBlockValid = 0;
- FTWHeader->WorkingBlockInvalid = 1;
- } else {
- FTWHeader->WorkingBlockValid = 1;
- FTWHeader->WorkingBlockInvalid = 0;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-AddFTWSpareBlock (
- IN UINT8 *FvImage,
- IN UINTN Size,
- IN FV_INFO *FvInfo
- )
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GenNonFFSFv (
- IN UINT8 *FvImage,
- IN FV_INFO *FvInfo
- )
-/*++
-
-Routine Description:
-
- This function generate the non FFS FV image, such as the working block
- and spare block. How each component of the FV is built is component
- specific.
-
-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.
-
-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.
-
---*/
-{
- UINTN Index;
- EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
- UINT64 TotalSize;
-
- FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) FvImage;
- TotalSize = 0;
-
- for (Index = 0; FvInfo->FvComponents[Index].Size != 0; Index++) {
- if (stricmp (FvInfo->FvComponents[Index].ComponentName, EFI_NV_VARIABLE_STRING) == 0) {
- AddVariableBlock (FvImage, FvInfo->FvComponents[Index].Size, FvInfo);
- } else if (stricmp (FvInfo->FvComponents[Index].ComponentName, EFI_NV_EVENT_LOG_STRING) == 0) {
- AddEventLogBlock (FvImage, FvInfo->FvComponents[Index].Size, FvInfo);
- } else if (stricmp (FvInfo->FvComponents[Index].ComponentName, EFI_NV_FTW_WORKING_STRING) == 0) {
- AddFTWWorkingBlock (FvImage, FvInfo->FvComponents[Index].Size, FvInfo);
- } else if (stricmp (FvInfo->FvComponents[Index].ComponentName, EFI_NV_FTW_SPARE_STRING) == 0) {
- AddFTWSpareBlock (FvImage, FvInfo->FvComponents[Index].Size, FvInfo);
- } else {
- printf ("Error. Unknown Non-FFS block %s \n", FvInfo->FvComponents[Index].ComponentName);
- return EFI_ABORTED;
- }
-
- FvImage = FvImage + FvInfo->FvComponents[Index].Size;
- TotalSize = TotalSize + FvInfo->FvComponents[Index].Size;
- }
- //
- // Index and TotalSize is zero mean there's no component, so this is an empty fv
- //
- if ((Index != 0 || TotalSize != 0) && TotalSize != FvInfo->Size) {
- printf ("Error. Component size does not sum up to FV size.\n");
- return EFI_ABORTED;
- }
-
- 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;
-
- //
- // 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 || (void *) FvImage->CurrentFilePointer == (void *) VtfFileImage) {
- return EFI_SUCCESS;
- }
- //
- // Pad file starts at beginning of free space
- //
- PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;
-
- //
- // write header
- //
- memset (PadFile, 0, sizeof (EFI_FFS_FILE_HEADER));
- memcpy (&PadFile->Name, &DefaultFvPadFileNameGuid, sizeof (EFI_GUID));
- PadFile->Type = EFI_FV_FILETYPE_FFS_PAD;
- PadFile->Attributes = 0;
-
- //
- // FileSize includes the EFI_FFS_FILE_HEADER
- //
- FileSize = (UINTN) VtfFileImage - (UINTN) FvImage->CurrentFilePointer;
- PadFile->Size[0] = (UINT8) (FileSize & 0x000000FF);
- PadFile->Size[1] = (UINT8) ((FileSize & 0x0000FF00) >> 8);
- PadFile->Size[2] = (UINT8) ((FileSize & 0x00FF0000) >> 16);
-
- //
- // 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, sizeof (EFI_FFS_FILE_HEADER));
- if (PadFile->Attributes & FFS_ATTRIB_CHECKSUM) {
- PadFile->IntegrityCheck.Checksum.File = CalculateChecksum8 ((UINT8 *) PadFile, FileSize);
- } else {
- 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;
- EFI_PHYSICAL_ADDRESS *SecCoreEntryAddressPtr;
- UINT32 *Ia32ResetAddressPtr;
- UINT8 *BytePointer;
- UINT8 *BytePointer2;
- UINT16 *WordPointer;
- UINT16 CheckSum;
- UINTN Index;
- EFI_FFS_FILE_STATE SavedState;
- EFI_FFS_FILE_TAIL TailValue;
- UINT32 TailSize;
- UINT64 FitAddress;
- FIT_TABLE *FitTablePtr;
-
- //
- // Verify input parameters
- //
- if (FvImage == NULL || FvInfo == NULL || VtfFile == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Initialize FV library
- //
- InitializeFvLib (FvImage->FileImage, (UINTN) FvImage->Eof - (UINTN) FvImage->FileImage);
-
- //
- // Verify VTF file
- //
- Status = VerifyFfsFile (VtfFile);
- if (EFI_ERROR (Status)) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Find the PEI Core
- //
- Status = GetFileByType (EFI_FV_FILETYPE_PEI_CORE, 1, &PeiCoreFile);
- if (EFI_ERROR (Status) || PeiCoreFile == NULL) {
- Error (NULL, 0, 0, "could not find the PEI core in the FV", NULL);
- return EFI_ABORTED;
- }
-
- //
- // 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, 0, "could not find PE32 or TE section in PEI core file", NULL);
- return EFI_ABORTED;
- }
-
- Status = GetPe32Info (
- (VOID *) ((UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32)),
- &EntryPoint,
- &BaseOfCode,
- &MachineType
- );
-
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "could not get PE32 entry point for PEI core", NULL);
- return EFI_ABORTED;
- }
- //
- // Physical address is FV base + offset of PE32 + offset of the entry point
- //
- PeiCorePhysicalAddress = FvInfo->BaseAddress;
- PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
- PeiCorePhysicalAddress += EntryPoint;
-
- if (MachineType == EFI_IMAGE_MACHINE_IA64) {
- //
- // Update PEI_CORE address
- //
- //
- // Set the uncached attribute bit in the physical address
- //
- PeiCorePhysicalAddress |= 0x8000000000000000ULL;
-
- //
- // Check if address is aligned on a 16 byte boundary
- //
- if (PeiCorePhysicalAddress & 0xF) {
- printf (
- "ERROR: PEI_CORE entry point is not aligned on a 16 byte boundary, address specified is %Xh.\n",
- PeiCorePhysicalAddress
- );
- return EFI_ABORTED;
- }
- //
- // First Get the FIT table address
- //
- FitAddress = (*(UINT64 *) (FvImage->Eof - IPF_FIT_ADDRESS_OFFSET)) & 0xFFFFFFFF;
-
- FitTablePtr = (FIT_TABLE *) (FvImage->FileImage + (FitAddress - FvInfo->BaseAddress));
-
- Status = UpdatePeiCoreEntryInFit (FitTablePtr, PeiCorePhysicalAddress);
-
- if (!EFI_ERROR (Status)) {
- UpdateFitCheckSum (FitTablePtr);
- }
- //
- // Find the Sec Core
- //
- Status = GetFileByType (EFI_FV_FILETYPE_SECURITY_CORE, 1, &SecCoreFile);
- if (EFI_ERROR (Status) || SecCoreFile == NULL) {
- Error (NULL, 0, 0, "could not find the Sec core in the FV", NULL);
- return EFI_ABORTED;
- }
- //
- // Sec Core found, now find PE32 section
- //
- Status = GetSectionByType (SecCoreFile, EFI_SECTION_PE32, 1, &Pe32Section);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "could not find PE32 section in SEC core file", NULL);
- return EFI_ABORTED;
- }
-
- Status = GetPe32Info (
- (VOID *) ((UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32)),
- &EntryPoint,
- &BaseOfCode,
- &MachineType
- );
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "could not get PE32 entry point for SEC core", NULL);
- return EFI_ABORTED;
- }
- //
- // Physical address is FV base + offset of PE32 + offset of the entry point
- //
- SecCorePhysicalAddress = FvInfo->BaseAddress;
- SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
- SecCorePhysicalAddress += EntryPoint;
-
- //
- // Update SEC_CORE address
- //
- //
- // Set the uncached attribute bit in the physical address
- //
- SecCorePhysicalAddress |= 0x8000000000000000ULL;
-
- //
- // Update the address
- //
- SecCoreEntryAddressPtr = (EFI_PHYSICAL_ADDRESS *) ((UINTN) FvImage->Eof - IPF_SALE_ENTRY_ADDRESS_OFFSET);
- *SecCoreEntryAddressPtr = SecCorePhysicalAddress;
-
- //
- // Check if address is aligned on a 16 byte boundary
- //
- if (SecCorePhysicalAddress & 0xF) {
- printf (
- "ERROR: SALE_ENTRY entry point is not aligned on a 16 byte boundary, address specified is %Xh.\n",
- SecCorePhysicalAddress
- );
- return EFI_ABORTED;
- }
- } else if (MachineType == EFI_IMAGE_MACHINE_IA32) {
- //
- // Get the location to update
- //
- Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - IA32_PEI_CORE_ENTRY_OFFSET);
-
- //
- // Write lower 32 bits of physical address
- //
- *Ia32ResetAddressPtr = (UINT32) PeiCorePhysicalAddress;
-
- //
- // Update the BFV base address
- //
- Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - 4);
- *Ia32ResetAddressPtr = (UINT32) (FvInfo->BaseAddress);
-
- CheckSum = 0x0000;
-
- //
- // Update the Startup AP in the FVH header block ZeroVector region.
- //
- BytePointer = (UINT8 *) ((UINTN) FvImage->FileImage);
- BytePointer2 = (FvInfo->Size == 0x10000) ? m64kRecoveryStartupApDataArray : m128kRecoveryStartupApDataArray;
- for (Index = 0; Index < SIZEOF_STARTUP_DATA_ARRAY; Index++) {
- *BytePointer++ = *BytePointer2++;
- }
- //
- // Calculate the checksum
- //
- WordPointer = (UINT16 *) ((UINTN) FvImage->FileImage);
- for (Index = 0; Index < SIZEOF_STARTUP_DATA_ARRAY / 2; Index++) {
- CheckSum = (UINT16) (CheckSum + ((UINT16) *WordPointer));
- WordPointer++;
- }
- //
- // Update the checksum field
- //
- BytePointer = (UINT8 *) ((UINTN) FvImage->FileImage);
- BytePointer += (SIZEOF_STARTUP_DATA_ARRAY - 2);
- WordPointer = (UINT16 *) BytePointer;
- *WordPointer = (UINT16) (0x10000 - (UINT32) CheckSum);
- } else {
- Error (NULL, 0, 0, "invalid machine type in PEI core", "machine type=0x%X", (UINT32) MachineType);
- return EFI_ABORTED;
- }
- //
- // Determine if it has an FFS file tail.
- //
- if (VtfFile->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailSize = sizeof (EFI_FFS_FILE_TAIL);
- } else {
- TailSize = 0;
- }
- //
- // Now update file checksum
- //
- SavedState = VtfFile->State;
- VtfFile->IntegrityCheck.Checksum.File = 0;
- VtfFile->State = 0;
- if (VtfFile->Attributes & FFS_ATTRIB_CHECKSUM) {
- VtfFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (
- (UINT8 *) VtfFile,
- GetLength (VtfFile->Size) - TailSize
- );
- } else {
- VtfFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
- }
-
- VtfFile->State = SavedState;
-
- //
- // Update tail if present
- //
- if (VtfFile->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailValue = (EFI_FFS_FILE_TAIL) (~(VtfFile->IntegrityCheck.TailReference));
- *(EFI_FFS_FILE_TAIL *) (((UINTN) (VtfFile) + GetLength (VtfFile->Size) - sizeof (EFI_FFS_FILE_TAIL))) = TailValue;
- }
-
- 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_NT_HEADERS *NtHeader;
- 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) {
- printf ("ERROR: Unknown magic number in the DOS header, 0x%04X.\n", DosHeader->e_magic);
- return EFI_UNSUPPORTED;
- }
- //
- // Immediately following is the NT header.
- //
- NtHeader = (EFI_IMAGE_NT_HEADERS *) ((UINTN) Pe32 + DosHeader->e_lfanew);
-
- //
- // Verify NT header is expected
- //
- if (NtHeader->Signature != EFI_IMAGE_NT_SIGNATURE) {
- printf ("ERROR: Unrecognized image signature 0x%08X.\n", NtHeader->Signature);
- return EFI_UNSUPPORTED;
- }
- //
- // Get output
- //
- *EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
- *BaseOfCode = NtHeader->OptionalHeader.BaseOfCode;
- *MachineType = NtHeader->FileHeader.Machine;
- }
-
- //
- // Verify machine type is supported
- //
- if (*MachineType != EFI_IMAGE_MACHINE_IA32 && *MachineType != EFI_IMAGE_MACHINE_IA64 && *MachineType != EFI_IMAGE_MACHINE_X64 && *MachineType != EFI_IMAGE_MACHINE_EBC) {
- printf ("ERROR: Unrecognized machine type in the PE32 file.\n");
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-//
-// Exposed function implementations (prototypes are defined in GenFvImageLib.h)
-//
-EFI_STATUS
-GenerateFvImage (
- IN CHAR8 *InfFileImage,
- IN UINTN InfFileSize,
- OUT UINT8 **FvImage,
- OUT UINTN *FvImageSize,
- OUT CHAR8 **FvFileName,
- OUT UINT8 **SymImage,
- OUT UINTN *SymImageSize,
- OUT CHAR8 **SymFileName
- )
-/*++
-
-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.
- FvImage Pointer to the FV image created.
- FvImageSize Size of the FV image created and pointed to by FvImage.
- FvFileName Requested name for the FV file.
- SymImage Pointer to the Sym image created.
- SymImageSize Size of the Sym image created and pointed to by SymImage.
- SymFileName Requested name for the Sym 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 Status;
- MEMORY_FILE InfMemoryFile;
- MEMORY_FILE FvImageMemoryFile;
- MEMORY_FILE SymImageMemoryFile;
- FV_INFO FvInfo;
- UINTN Index;
- EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
- EFI_FFS_FILE_HEADER *VtfFileImage;
-
- //
- // Check for invalid parameter
- //
- if (InfFileImage == NULL || FvImage == NULL || FvImageSize == NULL || FvFileName == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Initialize file structures
- //
- InfMemoryFile.FileImage = InfFileImage;
- InfMemoryFile.CurrentFilePointer = InfFileImage;
- InfMemoryFile.Eof = InfFileImage + InfFileSize;
-
- //
- // Parse the FV inf file for header information
- //
- Status = ParseFvInf (&InfMemoryFile, &FvInfo);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: Could not parse the input INF file.\n");
- return EFI_ABORTED;
- }
- //
- // Update the file name return values
- //
- strcpy (*FvFileName, FvInfo.FvName);
- strcpy (*SymFileName, FvInfo.SymName);
-
- //
- // Calculate the FV size
- //
- *FvImageSize = FvInfo.Size;
-
- //
- // Allocate the FV
- //
- *FvImage = malloc (*FvImageSize);
- if (*FvImage == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Allocate space for symbol file storage
- //
- *SymImage = malloc (SYMBOL_FILE_SIZE);
- if (*SymImage == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize the FV to the erase polarity
- //
- if (FvInfo.FvAttributes & EFI_FVB_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 FFS GUID
- //
- memcpy (&FvHeader->FileSystemGuid, &FvInfo.FvGuid, sizeof (EFI_GUID));
-
- FvHeader->FvLength = *FvImageSize;
- FvHeader->Signature = EFI_FVH_SIGNATURE;
- FvHeader->Attributes = FvInfo.FvAttributes;
- FvHeader->Revision = EFI_FVH_REVISION;
- FvHeader->Reserved[0] = 0;
- FvHeader->Reserved[1] = 0;
- FvHeader->Reserved[2] = 0;
-
- //
- // Copy firmware block map
- //
- for (Index = 0; FvInfo.FvBlocks[Index].NumBlocks != 0; Index++) {
- FvHeader->FvBlockMap[Index].NumBlocks = FvInfo.FvBlocks[Index].NumBlocks;
- FvHeader->FvBlockMap[Index].BlockLength = FvInfo.FvBlocks[Index].BlockLength;
- }
- //
- // Add block map terminator
- //
- FvHeader->FvBlockMap[Index].NumBlocks = 0;
- FvHeader->FvBlockMap[Index].BlockLength = 0;
-
- //
- // Complete the header
- //
- FvHeader->HeaderLength = (UINT16) (((UINTN) &(FvHeader->FvBlockMap[Index + 1])) - (UINTN) *FvImage);
- FvHeader->Checksum = 0;
- FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
-
- //
- // If there is no FFS file, find and generate each components of the FV
- //
- if (FvInfo.FvFiles[0][0] == 0) {
- Status = GenNonFFSFv (*FvImage, &FvInfo);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: Could not generate NonFFS FV.\n");
- free (*FvImage);
- return EFI_ABORTED;
- }
-
- return EFI_SUCCESS;
- }
- //
- // Initialize our "file" view of the buffer
- //
- FvImageMemoryFile.FileImage = *FvImage;
- FvImageMemoryFile.CurrentFilePointer = *FvImage + FvHeader->HeaderLength;
- FvImageMemoryFile.Eof = *FvImage +*FvImageSize;
-
- //
- // Initialize our "file" view of the symbol file.
- //
- SymImageMemoryFile.FileImage = *SymImage;
- SymImageMemoryFile.CurrentFilePointer = *SymImage;
- SymImageMemoryFile.Eof = *FvImage + SYMBOL_FILE_SIZE;
-
- //
- // Initialize the FV library.
- //
- InitializeFvLib (FvImageMemoryFile.FileImage, FvInfo.Size);
-
- //
- // Files start on 8 byte alignments, so move to the next 8 byte aligned
- // address. For now, just assert if it isn't. Currently FV header is
- // always a multiple of 8 bytes.
- // BUGBUG: Handle this better
- //
- assert ((((UINTN) FvImageMemoryFile.CurrentFilePointer) % 8) == 0);
-
- //
- // Initialize the VTF file address.
- //
- VtfFileImage = (EFI_FFS_FILE_HEADER *) FvImageMemoryFile.Eof;
-
- //
- // Add files to FV
- //
- for (Index = 0; FvInfo.FvFiles[Index][0] != 0; Index++) {
- //
- // Add the file
- //
- Status = AddFile (&FvImageMemoryFile, &FvInfo, Index, &VtfFileImage, &SymImageMemoryFile);
-
- //
- // Exit if error detected while adding the file
- //
- if (EFI_ERROR (Status)) {
- printf ("ERROR: Could not add file %s.\n", FvInfo.FvFiles[Index]);
- free (*FvImage);
- return EFI_ABORTED;
- }
- }
- //
- // 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.
- //
- Status = PadFvImage (&FvImageMemoryFile, VtfFileImage);
- if (EFI_ERROR (Status)) {
- printf ("ERROR: Could not create the pad file between the last file and the VTF file.\n");
- free (*FvImage);
- return EFI_ABORTED;
- }
- //
- // 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. 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 ((FvInfo.BaseAddress + FvInfo.Size) == FV_IMAGES_TOP_ADDRESS) {
- Status = UpdateResetVector (&FvImageMemoryFile, &FvInfo, VtfFileImage);
- if (EFI_ERROR(Status)) {
- printf ("ERROR: Could not update the reset vector.\n");
- free (*FvImage);
- return EFI_ABORTED;
- }
- }
- }
- //
- // Determine final Sym file size
- //
- *SymImageSize = SymImageMemoryFile.CurrentFilePointer - SymImageMemoryFile.FileImage;
-
- //
- // Update FV Alignment attribute to the largest alignment of all the FFS files in the FV
- //
- if (FvHeader->Attributes | EFI_FVB_ALIGNMENT_CAP) {
- for (Index = 1; Index <= 16; Index ++) {
- if ((1 << Index) < MaxFfsAlignment) {
- //
- // Unset the unsupported alignment attribute.
- //
- FvHeader->Attributes = FvHeader->Attributes & ~((1 << Index) * EFI_FVB_ALIGNMENT_CAP);
- } else {
- //
- // Set the supported alignment attribute.
- //
- FvHeader->Attributes = FvHeader->Attributes | ((1 << Index) * EFI_FVB_ALIGNMENT_CAP);
- }
- }
-
- //
- // Update Checksum for FvHeader
- //
- FvHeader->Checksum = 0;
- FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
- }
-
- return EFI_SUCCESS;
-}
-
-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);
- }
-}
diff --git a/Tools/CCode/Source/GenFvImage/GenFvImageLib.h b/Tools/CCode/Source/GenFvImage/GenFvImageLib.h
deleted file mode 100644
index 47a5a3b1b2..0000000000
--- a/Tools/CCode/Source/GenFvImage/GenFvImageLib.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- GenFvImageLib.h
-
-Abstract:
-
- This file contains describes the public interfaces to the GenFvImage Library.
- The basic purpose of the library is to create Firmware Volume images.
-
---*/
-
-#ifndef _EFI_GEN_FV_IMAGE_LIB_H
-#define _EFI_GEN_FV_IMAGE_LIB_H
-
-//
-// Include files
-//
-#include <Common/UefiBaseTypes.h>
-#include <Common/MultiPhase.h>
-
-#include "ParseInf.h"
-
-//
-// 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
-
-#pragma pack(1)
-
-typedef struct {
- UINT64 CompAddress;
- UINT32 CompSize;
- UINT16 CompVersion;
- UINT8 CvAndType;
- UINT8 CheckSum;
-} FIT_TABLE;
-
-#pragma pack()
-//
-// Exported function prototypes
-//
-EFI_STATUS
-GenerateFvImage (
- IN CHAR8 *InfFileImage,
- IN UINTN InfFileSize,
- OUT UINT8 **FvImage,
- OUT UINTN *FvImageSize,
- OUT CHAR8 **FvFileName,
- OUT UINT8 **SymImage,
- OUT UINTN *SymImageSize,
- OUT CHAR8 **SymFileName
- )
-;
-
-/*++
-
-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.
- FvImage Pointer to the FV image created.
- FvImageSize Size of the FV image created and pointed to by FvImage.
- FvFileName Requested name for the FV file.
- SymImage Pointer to the Sym image created.
- SymImageSize Size of the Sym image created and pointed to by SymImage.
- SymFileName Requested name for the Sym 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
-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.
-
---*/
-#endif
diff --git a/Tools/CCode/Source/GenFvImage/GenFvImageLibInternal.h b/Tools/CCode/Source/GenFvImage/GenFvImageLibInternal.h
deleted file mode 100644
index cff3b1aea4..0000000000
--- a/Tools/CCode/Source/GenFvImage/GenFvImageLibInternal.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- GenFvImageLibInternal.h
-
-Abstract:
-
- This file contains describes the private declarations for the GenFvImage Library.
- The basic purpose of the library is to create Firmware Volume images.
-
---*/
-
-#ifndef _EFI_GEN_FV_IMAGE_LIB_INTERNAL_H
-#define _EFI_GEN_FV_IMAGE_LIB_INTERNAL_H
-
-//
-// Include files
-//
-#include <stdlib.h>
-
-#include <Common/FirmwareVolumeHeader.h>
-
-#include "CommonLib.h"
-#include "GenFvImageLib.h"
-
-//
-// Private data declarations
-//
-//
-// 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_COMPONENTS_IN_FV 10
-
-//
-// INF file strings
-//
-#define OPTIONS_SECTION_STRING "[options]"
-#define ATTRIBUTES_SECTION_STRING "[attributes]"
-#define FILES_SECTION_STRING "[files]"
-#define COMPONENT_SECTION_STRING "[components]"
-
-#define EFI_FV_BASE_ADDRESS_STRING "EFI_BASE_ADDRESS"
-#define EFI_FV_FILE_NAME_STRING "EFI_FILE_NAME"
-#define EFI_SYM_FILE_NAME_STRING "EFI_SYM_FILE_NAME"
-#define EFI_NUM_BLOCKS_STRING "EFI_NUM_BLOCKS"
-#define EFI_BLOCK_SIZE_STRING "EFI_BLOCK_SIZE"
-#define EFI_FV_GUID_STRING "EFI_FV_GUID"
-
-#define EFI_FVB_READ_DISABLED_CAP_STRING "EFI_READ_DISABLED_CAP"
-#define EFI_FVB_READ_ENABLED_CAP_STRING "EFI_READ_ENABLED_CAP"
-#define EFI_FVB_READ_STATUS_STRING "EFI_READ_STATUS"
-
-#define EFI_FVB_WRITE_DISABLED_CAP_STRING "EFI_WRITE_DISABLED_CAP"
-#define EFI_FVB_WRITE_ENABLED_CAP_STRING "EFI_WRITE_ENABLED_CAP"
-#define EFI_FVB_WRITE_STATUS_STRING "EFI_WRITE_STATUS"
-
-#define EFI_FVB_LOCK_CAP_STRING "EFI_LOCK_CAP"
-#define EFI_FVB_LOCK_STATUS_STRING "EFI_LOCK_STATUS"
-
-#define EFI_FVB_STICKY_WRITE_STRING "EFI_STICKY_WRITE"
-#define EFI_FVB_MEMORY_MAPPED_STRING "EFI_MEMORY_MAPPED"
-#define EFI_FVB_ERASE_POLARITY_STRING "EFI_ERASE_POLARITY"
-
-#define EFI_FVB_ALIGNMENT_CAP_STRING "EFI_ALIGNMENT_CAP"
-#define EFI_FVB_ALIGNMENT_2_STRING "EFI_ALIGNMENT_2"
-#define EFI_FVB_ALIGNMENT_4_STRING "EFI_ALIGNMENT_4"
-#define EFI_FVB_ALIGNMENT_8_STRING "EFI_ALIGNMENT_8"
-#define EFI_FVB_ALIGNMENT_16_STRING "EFI_ALIGNMENT_16"
-#define EFI_FVB_ALIGNMENT_32_STRING "EFI_ALIGNMENT_32"
-#define EFI_FVB_ALIGNMENT_64_STRING "EFI_ALIGNMENT_64"
-#define EFI_FVB_ALIGNMENT_128_STRING "EFI_ALIGNMENT_128"
-#define EFI_FVB_ALIGNMENT_256_STRING "EFI_ALIGNMENT_256"
-#define EFI_FVB_ALIGNMENT_512_STRING "EFI_ALIGNMENT_512"
-#define EFI_FVB_ALIGNMENT_1K_STRING "EFI_ALIGNMENT_1K"
-#define EFI_FVB_ALIGNMENT_2K_STRING "EFI_ALIGNMENT_2K"
-#define EFI_FVB_ALIGNMENT_4K_STRING "EFI_ALIGNMENT_4K"
-#define EFI_FVB_ALIGNMENT_8K_STRING "EFI_ALIGNMENT_8K"
-#define EFI_FVB_ALIGNMENT_16K_STRING "EFI_ALIGNMENT_16K"
-#define EFI_FVB_ALIGNMENT_32K_STRING "EFI_ALIGNMENT_32K"
-#define EFI_FVB_ALIGNMENT_64K_STRING "EFI_ALIGNMENT_64K"
-
-//
-// Component sections
-//
-#define EFI_NV_VARIABLE_STRING "EFI_NV_VARIABLE"
-#define EFI_NV_EVENT_LOG_STRING "EFI_NV_EVENT_LOG"
-#define EFI_NV_FTW_WORKING_STRING "EFI_NV_FTW_WORKING"
-#define EFI_NV_FTW_SPARE_STRING "EFI_NV_FTW_SPARE"
-
-#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"
-
-//
-// Defines to calculate the offset for PEI CORE entry points
-//
-#define IA32_PEI_CORE_ENTRY_OFFSET 0x20
-
-//
-// Defines to calculate the FIT table
-//
-#define IPF_FIT_ADDRESS_OFFSET 0x20
-
-//
-// Defines to calculate the offset for SALE_ENTRY
-//
-#define IPF_SALE_ENTRY_ADDRESS_OFFSET 0x18
-
-//
-// Symbol file definitions, current max size if 512K
-//
-#define SYMBOL_FILE_SIZE 0x80000
-
-#define FV_IMAGES_TOP_ADDRESS 0x100000000ULL
-
-//
-// Private data types
-//
-//
-// Component information
-//
-typedef struct {
- UINTN Size;
- CHAR8 ComponentName[_MAX_PATH];
-} COMPONENT_INFO;
-
-//
-// FV information holder
-//
-typedef struct {
- EFI_PHYSICAL_ADDRESS BaseAddress;
- EFI_GUID FvGuid;
- UINTN Size;
- CHAR8 FvName[_MAX_PATH];
- CHAR8 SymName[_MAX_PATH];
- EFI_FV_BLOCK_MAP_ENTRY FvBlocks[MAX_NUMBER_OF_FV_BLOCKS];
- EFI_FVB_ATTRIBUTES FvAttributes;
- CHAR8 FvFiles[MAX_NUMBER_OF_FILES_IN_FV][_MAX_PATH];
- COMPONENT_INFO FvComponents[MAX_NUMBER_OF_COMPONENTS_IN_FV];
-} FV_INFO;
-
-//
-// Private function prototypes
-//
-EFI_STATUS
-ParseFvInf (
- IN MEMORY_FILE *InfFile,
- IN FV_INFO *FvInfo
- )
-;
-
-#endif
diff --git a/Tools/CCode/Source/GenFvImage/build.xml b/Tools/CCode/Source/GenFvImage/build.xml
deleted file mode 100644
index 421b38fa34..0000000000
--- a/Tools/CCode/Source/GenFvImage/build.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenFvImage Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenFvImage"/>
- <property name="FileSet" value="GenFvImageLib.c GenFvImageExe.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- <if>
- <istrue value="${OSX}"/>
- <then>
- <property name="syslibdirs" value=""/>
- <property name="syslibs" value=""/>
- </then>
- </if>
-
- <if>
- <istrue value="${cygwin}"/>
- <then>
- <property name="syslibdirs" value="${env.CYGWIN_HOME}/lib/e2fsprogs"/>
- <property name="syslibs" value="uuid"/>
- </then>
- </if>
-
- <if>
- <istrue value="${msft}"/>
- <then>
- <property name="syslibdirs" value=""/>
- <property name="syslibs" value="uuid"/>
- </then>
- </if>
-
- <if>
- <istrue value="${linux}"/>
- <then>
- <if>
- <istrue value="${x86_64_linux}"/>
- <then>
- <property name="syslibdirs" value="/lib64"/>
- </then>
- <else>
- <property name="syslibdirs" value="/usr/lib"/>
- </else>
- </if>
- <property name="syslibs" value="uuid"/>
- </then>
- </if>
- <echo message="syslibdirs set to: ${syslibdirs}"/>
- </target>
-
- <target name="Tool" depends="init, GenFvImage"/>
-
- <target name="GenFvImage" >
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <defineset>
- <define name="BUILDING_TOOLS"/>
- <define name="TOOL_BUILD_IA32_TARGET"/>
- </defineset>
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"/>
-
- <includepath path="${PACKAGE_DIR}/${ToolName}"/>
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
-
- <linkerarg value="/nodefaultlib:libc.lib" if="msft"/>
- <syslibset dir="${syslibdirs}" libs="${syslibs}" if="cyglinux"/>
- <syslibset libs="RpcRT4" if="msft"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ia32${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_X64${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ipf${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ia32.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}_X64.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ipf.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenFvMap/GenFvMap.cpp b/Tools/CCode/Source/GenFvMap/GenFvMap.cpp
deleted file mode 100644
index 27a2180b91..0000000000
--- a/Tools/CCode/Source/GenFvMap/GenFvMap.cpp
+++ /dev/null
@@ -1,666 +0,0 @@
-//****************************************************************************
-//**
-//** Copyright (C) 2006 Intel Corporation. All rights reserved.
-//**
-//** The information and source code contained herein is the exclusive
-//** property of Intel Corporation and may not be disclosed, examined
-//** or reproduced in whole or in part without explicit written authorization
-//** from the company.
-//**
-//****************************************************************************
-#include <cstdio>
-#include <iostream>
-#include <fstream>
-#include <iomanip>
-#include <stdexcept>
-#include <set>
-#include <string>
-#include <sstream>
-#include <vector>
-#include <map>
-#include <algorithm>
-using namespace std;
-
-#include "ProcessorBind.h"
-
-class putUINT64
-{
-public:
- putUINT64(UINT64 ullVal) : m_ull(ullVal) {}
- putUINT64(const putUINT64& r) : m_ull(r.m_ull) {}
-
- template <class _E, class _Tr>
- friend basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>&, putUINT64);
-
-private:
- UINT64 m_ull;
-};
-
-template <class _E, class _Tr>
-basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>& os, putUINT64 ull)
-{
- static const char cDigits[] = "0123456789abcdef";
-
- UINT64 base = 10;
- if (os.flags() & ios_base::hex)
- base = 16;
- else if (os.flags() & ios_base::oct)
- base = 8;
-
- ostringstream ostr;
- UINT64 ullVal = ull.m_ull;
- while (ullVal != 0)
- {
- ostr << cDigits[ullVal % base];
- ullVal /= base;
- }
-
- string s1(ostr.str());
- string s2(s1.rbegin(), s1.rend());
- return os << s2;
-}
-
-class getUINT64
-{
-public:
- getUINT64(UINT64& ullVal) : m_ull(ullVal) {}
- getUINT64(const getUINT64& r) : m_ull(r.m_ull) {}
-
- template <class _E, class _Tr>
- friend basic_istream<_E, _Tr>& operator >> (basic_istream<_E, _Tr>&, getUINT64);
-
-private:
- UINT64& m_ull;
-
-private:
- getUINT64& operator = (const getUINT64&);
-};
-
-template <class _E, class _Tr>
-basic_istream<_E, _Tr>& operator >> (basic_istream<_E, _Tr>& is, getUINT64 ull)
-{
- string strBuf;
- is >> strBuf;
-
- UINT64 base = 10;
- if (is.flags() & ios_base::hex)
- base = 16;
- else if (is.flags() & ios_base::oct)
- base = 8;
-
- UINT64 ullVal = 0;
- for (string::iterator i = strBuf.begin(); i != strBuf.end(); i++)
- {
- if (*i <= '9' && *i >= '0')
- *i -= '0';
- else if (*i <= 'F' && *i >= 'A')
- *i -= 'A' - '\x0a';
- else if (*i <= 'f' && *i >= 'a')
- *i -= 'a' - '\x0a';
- else throw runtime_error("Invalid number format");
-
- ullVal = ullVal * base + *i;
- }
- ull.m_ull = ullVal;
- return is;
-}
-
-class EMemoryLeak : public logic_error
-{
-public:
- EMemoryLeak() : logic_error("Memory leak detected") {}
-};
-
-class EInvalidGuidString : public invalid_argument
-{
-public:
- EInvalidGuidString() : invalid_argument("Unexpected format of GUID string") {}
-};
-
-class ELogFileError : public logic_error
-{
-public:
- ELogFileError(const string& strMsg) : logic_error(strMsg) {}
-};
-
-class EDuplicatedFfsFile : public ELogFileError
-{
-public:
- EDuplicatedFfsFile() : ELogFileError("Duplicated FFS found in LOG file") {}
-};
-
-class EUnexpectedLogFileToken : public ELogFileError
-{
-public:
- EUnexpectedLogFileToken() : ELogFileError("Unexpected LOG file token") {}
-};
-
-class EFileNotFound : public invalid_argument
-{
-public:
- EFileNotFound(const string& strFName) : invalid_argument("File not found - " + strFName) {}
-};
-
-class EUnexpectedMapFile : public logic_error
-{
-public:
- EUnexpectedMapFile(const string& strKeyWord) : logic_error("Unexpected map file format - " + strKeyWord) {}
-};
-
-class EUsage : public invalid_argument
-{
-public:
- EUsage() : invalid_argument("Usage: GenFvMap <FV.LOG> <FV.INF> <FV.MAP>") {}
-};
-
-template <class T>
-class CMemoryLeakChecker : public set<T*>
-{
-protected:
- CMemoryLeakChecker()
- {
- }
-
-public:
- virtual ~CMemoryLeakChecker();
- static CMemoryLeakChecker<T>& GetInstance();
-
-private:
- CMemoryLeakChecker(const CMemoryLeakChecker<T>&);
-};
-
-template <class T>
-CMemoryLeakChecker<T>::~CMemoryLeakChecker()
-{
- if (!CMemoryLeakChecker<T>::empty())
- throw EMemoryLeak();
-}
-
-template <class T>
-CMemoryLeakChecker<T>& CMemoryLeakChecker<T>::GetInstance()
-{
- static CMemoryLeakChecker<T> s_instance;
- return s_instance;
-}
-
-class CObjRoot
-{
-protected:
- CObjRoot()
- {
-#ifdef _CHK_MEM_LEAK
- CMemoryLeakChecker<CObjRoot>::GetInstance().insert(this);
-#endif
- }
-
-public:
- virtual ~CObjRoot()
- {
-#ifdef _CHK_MEM_LEAK
- CMemoryLeakChecker<CObjRoot>::GetInstance().erase(this);
-#endif
- }
-
-private:
- CObjRoot(const CObjRoot&);
-};
-
-class CIdentity : public CObjRoot
-{
-public:
- CIdentity(const string&);
- operator string (void) const;
-
- bool operator < (const CIdentity& id) const
- {
- return memcmp(this, &id, sizeof(*this)) < 0;
- }
-
- CIdentity() : ulD1(0), wD2(0), wD3(0), wD4(0), ullD5(0)
- {
- }
-
- CIdentity(const CIdentity& r) : ulD1(r.ulD1), wD2(r.wD2), wD3(r.wD3), wD4(r.wD4), ullD5(r.ullD5)
- {
- }
-
- template <class _E, class _Tr>
- basic_istream<_E, _Tr>& ReadId(basic_istream<_E, _Tr>&);
- template <class _E, class _Tr>
- basic_ostream<_E, _Tr>& WriteId(basic_ostream<_E, _Tr>&);
-
- template <class _E, class _Tr>
- friend basic_istream<_E, _Tr>& operator >> (basic_istream<_E, _Tr>&, CIdentity&);
- template <class _E, class _Tr>
- friend basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>&, CIdentity);
-
-private:
- UINT32 ulD1;
- UINT16 wD2, wD3, wD4;
- UINT64 ullD5;
-};
-
-CIdentity::CIdentity(const string& strGuid)
-{
- try
- {
- string str(strGuid);
- str.erase(0, str.find_first_not_of(" {"));
- str.resize(str.find_last_not_of(" }") + 1);
- str[str.find('-')] = ' ';
- str[str.find('-')] = ' ';
- str[str.find('-')] = ' ';
- str[str.find('-')] = ' ';
-
- istringstream is(str);
- is >> hex >> ulD1 >> wD2 >> wD3 >> wD4 >> getUINT64(ullD5);
- }
- catch (const exception&)
- {
- throw EInvalidGuidString();
- }
-}
-
-CIdentity::operator string(void) const
-{
- ostringstream os;
- os << hex << setfill('0')
- << setw(8) << ulD1 << '-'
- << setw(4) << wD2 << '-'
- << setw(4) << wD3 << '-'
- << setw(4) << wD4 << '-'
- << setw(12) << putUINT64(ullD5);
- return os.str();
-}
-
-template <class _E, class _Tr>
-basic_istream<_E, _Tr>& CIdentity::ReadId(basic_istream<_E, _Tr>& is)
-{
- string str;
- if (!!(is >> str))
- *this = CIdentity(str);
- return is;
-}
-
-template <class _E, class _Tr>
-basic_ostream<_E, _Tr>& CIdentity::WriteId(basic_ostream<_E, _Tr>& os)
-{
- return os << (string)(*this);
-}
-
-template <class _E, class _Tr>
-basic_istream<_E, _Tr>& operator >> (basic_istream<_E, _Tr>& is, CIdentity& id)
-{
- return id.ReadId(is);
-}
-
-template <class _E, class _Tr>
-basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>& os, CIdentity id)
-{
- return id.WriteId(os);
-}
-
-template <class T>
-class IVectorContainerByReference : virtual public CObjRoot, public vector<T*>
-{
-};
-
-template <class T>
-class IMapContainer : virtual public CObjRoot, public map<CIdentity, T>
-{
-};
-
-struct ISymbol : virtual public CObjRoot
-{
- string strAddress;
- string strName;
- string strFrom;
- UINT64 ullRva;
- bool bStatic;
- bool bFunction;
- virtual void Relocate(UINT64)=0;
-};
-
-class IModule : public IVectorContainerByReference<ISymbol>
-{
-public:
- string strName;
- CIdentity id;
- virtual UINT64 BaseAddress(void) const=0;
- virtual UINT64 BaseAddress(UINT64)=0;
- virtual const ISymbol *EntryPoint(void) const=0;
-};
-
-class IFirmwareVolume : public IVectorContainerByReference<IModule>
-{
-};
-
-class IMapFileSet : public IMapContainer<istream*>
-{
-};
-
-class IFfsSet : public IMapContainer<UINT64>
-{
-};
-
-class CFfsSetFromLogFile : public IFfsSet
-{
-public:
- CFfsSetFromLogFile(const string&);
-};
-
-CFfsSetFromLogFile::CFfsSetFromLogFile(const string& strFName)
-{
- ifstream ifs(strFName.c_str());
- if (!ifs)
- throw EFileNotFound(strFName);
-
- CIdentity ffsId;
- while (!!ffsId.ReadId(ifs))
- {
- UINT64 ullBase;
- if (!(ifs >> hex >> getUINT64(ullBase)))
- throw EUnexpectedLogFileToken();
- if (!insert(value_type(ffsId, ullBase)).second)
- throw EDuplicatedFfsFile();
- }
-}
-
-class CMapFileSetFromInfFile : public IMapFileSet
-{
-public:
- CMapFileSetFromInfFile(const string&);
- ~CMapFileSetFromInfFile();
-};
-
-CMapFileSetFromInfFile::CMapFileSetFromInfFile(const string& strFName)
-{
- static const char cszEfiFileName[] = "EFI_FILE_NAME";
-
- ifstream ifs(strFName.c_str());
- if (!ifs)
- throw EFileNotFound(strFName);
-
- string strFile;
- getline(ifs, strFile, ifstream::traits_type::to_char_type(ifstream::traits_type::eof()));
- strFile.erase(0, strFile.find("[files]"));
-
- istringstream is(strFile);
- string strTmp;
- while (!!getline(is, strTmp))
- {
- string::size_type pos = strTmp.find(cszEfiFileName);
- if (pos == string::npos)
- continue;
-
- strTmp.erase(0, strTmp.find_first_not_of(" =", pos + sizeof(cszEfiFileName) - 1));
- pos = strTmp.find_last_of("\\/");
- string strId(
- strTmp.begin() + pos + 1,
- strTmp.begin() + strTmp.find('-', strTmp.find('-', strTmp.find('-', strTmp.find('-', strTmp.find('-') + 1) + 1) + 1) + 1)
- );
- strTmp.erase(pos + 1, strId.length() + 1);
- strTmp.replace(strTmp.rfind('.'), string::npos, ".map");
-
- istream *ifmaps = new ifstream(strTmp.c_str());
- if (ifmaps && !!*ifmaps &&
- !insert(value_type(CIdentity(strId), ifmaps)).second)
- throw EDuplicatedFfsFile();
- }
-}
-
-CMapFileSetFromInfFile::~CMapFileSetFromInfFile()
-{
- for (iterator i = begin(); i != end(); i++)
- delete i->second;
-}
-
-class CSymbolFromString : public ISymbol
-{
-public:
- CSymbolFromString(const string&, bool = false);
- void Relocate(UINT64);
-};
-
-CSymbolFromString::CSymbolFromString(const string& strSymbol, bool b)
-{
- bStatic = b;
-
- istringstream is(strSymbol);
- is >> strAddress >> strName >> hex >> getUINT64(ullRva) >> strFrom;
- if (strFrom == "f")
- {
- bFunction = true;
- is >> strFrom;
- }
- else bFunction = false;
- if (!is)
- throw EUnexpectedMapFile("Symbol line format");
-}
-
-void CSymbolFromString::Relocate(UINT64 ullDelta)
-{
- if (ullRva > 0)
- ullRva += ullDelta;
-}
-
-class CModuleFromMap : public IModule
-{
-public:
- CModuleFromMap(istream&);
- ~CModuleFromMap();
-
- UINT64 BaseAddress() const;
- UINT64 BaseAddress(UINT64);
- const ISymbol *EntryPoint() const;
-
-private:
- UINT64 m_ullLoadAddress;
- iterator m_iEntryPoint;
-
- static pair<string, string::size_type> FindToken(istream&, const string&);
-};
-
-pair<string, string::size_type> CModuleFromMap::FindToken(istream& is, const string& strToken)
-{
- for (string strTmp; !!getline(is, strTmp);)
- {
- string::size_type pos = strTmp.find(strToken);
- if (pos != string::npos)
- return pair<string, string::size_type>(strTmp, pos);
- }
- throw EUnexpectedMapFile(strToken);
-}
-
-CModuleFromMap::CModuleFromMap(istream& imaps)
-{
- static const char cszLoadAddr[] = "Preferred load address is";
- static const char cszGlobal[] = "Address";
- static const char cszEntryPoint[] = "entry point at";
- static const char cszStatic[] = "Static symbols";
-
- pair<string, string::size_type> pairTmp;
- istringstream iss;
-
- getline(imaps, strName);
- strName.erase(0, strName.find_first_not_of(' '));
-
- pairTmp = FindToken(imaps, cszLoadAddr);
- iss.str(pairTmp.first.substr(pairTmp.second + sizeof(cszLoadAddr) - 1));
- iss >> getUINT64(m_ullLoadAddress);
-
- pairTmp = FindToken(imaps, cszGlobal);
- while (!!getline(imaps, pairTmp.first) &&
- pairTmp.first.find(cszEntryPoint) == string::npos)
- if (pairTmp.first.find_first_not_of(' ') != string::npos)
- push_back(new CSymbolFromString(pairTmp.first));
-
- iss.str(pairTmp.first.substr(pairTmp.first.find(cszEntryPoint) + sizeof(cszEntryPoint) - 1));
- iss.clear();
- string strEntryPoint;
- iss >> strEntryPoint;
-
- pairTmp = FindToken(imaps, cszStatic);
- if (pairTmp.second)
- while (!!getline(imaps, pairTmp.first))
- if (pairTmp.first.find_first_not_of(' ') != string::npos)
- push_back(new CSymbolFromString(pairTmp.first, true));
-
- for (m_iEntryPoint = begin();
- m_iEntryPoint != end() && (*m_iEntryPoint)->strAddress != strEntryPoint;
- m_iEntryPoint++);
- if (m_iEntryPoint == end())
- throw EUnexpectedMapFile("Entry point not found");
-}
-
-CModuleFromMap::~CModuleFromMap()
-{
- for (iterator i = begin(); i != end(); i++)
- delete *i;
-}
-
-UINT64 CModuleFromMap::BaseAddress(void) const
-{
- return m_ullLoadAddress;
-}
-
-UINT64 CModuleFromMap::BaseAddress(UINT64 ullNewBase)
-{
- ullNewBase -= m_ullLoadAddress;
- for (iterator i = begin(); i != end(); i++)
- (*i)->Relocate(ullNewBase);
- m_ullLoadAddress += ullNewBase;
- return m_ullLoadAddress - ullNewBase;
-}
-
-const ISymbol *CModuleFromMap::EntryPoint(void) const
-{
- return *m_iEntryPoint;
-}
-
-class CFvMap : public IFirmwareVolume
-{
-public:
- CFvMap(IFfsSet*, IMapFileSet*);
- ~CFvMap();
-
-private:
- CFvMap(const CFvMap&);
-};
-
-CFvMap::CFvMap(IFfsSet *pFfsSet, IMapFileSet *pMapSet)
-{
- for (IFfsSet::iterator i = pFfsSet->begin(); i != pFfsSet->end(); i++)
- {
- IMapFileSet::iterator j = pMapSet->find(i->first);
- if (j != pMapSet->end())
- {
- IModule *pModule = new CModuleFromMap(*j->second);
- pModule->id = i->first;
- pModule->BaseAddress(i->second);
- push_back(pModule);
- }
- }
-}
-
-CFvMap::~CFvMap()
-{
- for (iterator i = begin(); i != end(); i++)
- delete *i;
-}
-
-class CFvMapGenerator : public CObjRoot
-{
-public:
- CFvMapGenerator(const IFirmwareVolume *pFv) : m_pFv(pFv) {}
- CFvMapGenerator(const CFvMapGenerator& r) : m_pFv(r.m_pFv) {}
-
- template <class _E, class _Tr>
- friend basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>&, CFvMapGenerator);
-
-private:
- static bool Less(const IModule*, const IModule*);
-
-private:
- const IFirmwareVolume *m_pFv;
-};
-
-template <class _E, class _Tr>
-basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>& os, CFvMapGenerator fvMapFmt)
-{
- vector<IModule*> rgMods(fvMapFmt.m_pFv->begin(), fvMapFmt.m_pFv->end());
- sort(rgMods.begin(), rgMods.end(), CFvMapGenerator::Less);
- for (vector<IModule*>::iterator i = rgMods.begin(); i != rgMods.end(); i++)
- {
- os << (*i)->strName << hex << " (BaseAddress=" << putUINT64((*i)->BaseAddress());
- os << ", EntryPoint=" << hex << putUINT64((*i)->EntryPoint()->ullRva);
- os << ", GUID=";
- (*i)->id.WriteId(os);
- os << ")" << endl << endl;
-
- for (IModule::iterator j = (*i)->begin(); j != (*i)->end(); j++)
- {
- os << hex << " " << setw(16) << setfill('0') << putUINT64((*j)->ullRva);
- os << ((*j)->bFunction ? " F" : " ")
- << ((*j)->bStatic ? "S " : " ")
- << (*j)->strName << endl;
- }
-
- os << endl << endl;
- }
- return os;
-}
-
-bool CFvMapGenerator::Less(const IModule *pModL, const IModule *pModR)
-{
- return pModL->BaseAddress() < pModR->BaseAddress();
-}
-
-class CApplication : public CObjRoot
-{
-public:
- CApplication(int, char**);
- int Run(void);
-
-private:
- char **m_ppszArg;
-private:
- CApplication(const CApplication&);
-};
-
-CApplication::CApplication(int cArg, char *ppszArg[])
-: m_ppszArg(ppszArg)
-{
- if (cArg != 4)
- throw EUsage();
-}
-
-int CApplication::Run(void)
-{
- CFfsSetFromLogFile ffsSet(m_ppszArg[1]);
- CMapFileSetFromInfFile mapSet(m_ppszArg[2]);
- ofstream ofs(m_ppszArg[3]);
- CFvMap fvMap(&ffsSet, &mapSet);
- ofs << CFvMapGenerator(&fvMap);
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- try
- {
- CApplication app(argc, argv);
- return app.Run();
- }
- catch (const exception& e)
- {
- cerr << e.what() << endl;
- return -1;
- }
-}
-
-#ifdef _DDK3790x1830_WORKAROUND
-extern "C" void __fastcall __security_check_cookie(int)
-{
-}
-#endif
diff --git a/Tools/CCode/Source/GenFvMap/build.xml b/Tools/CCode/Source/GenFvMap/build.xml
deleted file mode 100644
index cf8e34c120..0000000000
--- a/Tools/CCode/Source/GenFvMap/build.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenTEImage Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenFvMap"/>
- <property name="FileSet" value="*.cpp"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <condition property="gxx_extra_libs" value="stdc++ System gcc_s.10.4 gcc">
- <os family="mac"/>
- </condition>
-
- <condition property="gxx_extra_libs" value="stdc++">
- <os name="linux"/>
- </condition>
-
- <condition property="gxx_extra_libs" value="stdc++">
- <os family="windows"/>
- </condition>
-
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
- <compilerarg value="-x" if="gcc"/>
- <compilerarg value="c++" if="gcc"/>
- <compilerarg value="/EHsc" unless="gcc"/>
-
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- <syslibset libs="${gxx_extra_libs}" if="gcc"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenSection/GenSection.c b/Tools/CCode/Source/GenSection/GenSection.c
deleted file mode 100644
index e3f173f656..0000000000
--- a/Tools/CCode/Source/GenSection/GenSection.c
+++ /dev/null
@@ -1,981 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- GenSection.c
-
-Abstract:
-
- Creates output file that is a properly formed section per the FV spec.
-
---*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-#include <Protocol/GuidedSectionExtraction.h>
-
-#include "CommonLib.h"
-#include "Compress.h"
-#include "EfiCustomizedCompress.h"
-#include "Crc32.h"
-#include "EfiUtilityMsgs.h"
-#include "GenSection.h"
-
-
-#define UTILITY_NAME "GenSection"
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-
-
-#define PARAMETER_NOT_SPECIFIED "Parameter not specified"
-#define MAXIMUM_INPUT_FILE_NUM 10
-
-char *SectionTypeName[] = {
- 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
-};
-
-char *CompressionTypeName[] = { "NONE", "STANDARD" };
-char *GUIDedSectionTypeName[] = { "CRC32" };
-EFI_GUID gEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
-
-static
-void
-Version(
- void
- )
-/*++
-
-Routine Description:
-
- Print out version information for this utility.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Utility to create output file with formed section per the FV spec.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-static
-VOID
-Usage (
- VOID
- )
-{
- UINTN SectionType;
- UINTN DisplayCount;
-
- Version();
-
- printf ("\nUsage: "UTILITY_NAME " -i InputFile -o OutputFile -s SectionType [SectionType params]\n\n");
- printf (" Where SectionType is one of the following section types:\n\n");
-
- DisplayCount = 0;
- for (SectionType = 0; SectionType <= EFI_SECTION_LAST_SECTION_TYPE; SectionType++) {
- if (SectionTypeName[SectionType] != NULL) {
- printf (" %s\n", SectionTypeName[SectionType]);
- }
- }
-
- printf ("\n and SectionType dependent parameters are as follows:\n\n");
- printf (
- " %s: -t < %s | %s >\n",
- SectionTypeName[EFI_SECTION_COMPRESSION],
- CompressionTypeName[EFI_NOT_COMPRESSED],
- CompressionTypeName[EFI_STANDARD_COMPRESSION]
- );
- printf (
- " %s: -t < %s >\n"" // Currently only CRC32 is supported\n\n",
- SectionTypeName[EFI_SECTION_GUID_DEFINED],
- GUIDedSectionTypeName[EFI_SECTION_CRC32_GUID_DEFINED]
- );
- printf (
- " %s: -v VersionNumber\n"" [-a \"Version string\"]\n\n",
- SectionTypeName[EFI_SECTION_VERSION]
- );
- printf (
- " %s: -a \"Human readable name\"\n\n",
- SectionTypeName[EFI_SECTION_USER_INTERFACE]
- );
-}
-
-VOID
-Ascii2UnicodeWriteString (
- char *String,
- FILE *OutFile,
- BOOLEAN WriteLangCode
- )
-{
- UINTN Index;
- UINT8 AsciiNull;
- //
- // BUGBUG need to get correct language code...
- //
- char *EnglishLangCode = "eng";
- AsciiNull = 0;
- //
- // first write the language code (english only)
- //
- if (WriteLangCode) {
- fwrite (EnglishLangCode, 1, 4, OutFile);
- }
- //
- // Next, write out the string... Convert ASCII to Unicode in the process.
- //
- Index = 0;
- do {
- fwrite (&String[Index], 1, 1, OutFile);
- fwrite (&AsciiNull, 1, 1, OutFile);
- } while (String[Index++] != 0);
-}
-
-STATUS
-GenSectionCommonLeafSection (
- char **InputFileName,
- int InputFileNum,
- UINTN SectionType,
- FILE *OutFile
- )
-/*++
-
-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
-
- OutFile - Output file handle
-
-Returns:
-
- STATUS_ERROR - can't continue
- STATUS_SUCCESS - successful return
-
---*/
-{
- UINT64 InputFileLength;
- FILE *InFile;
- UINT8 *Buffer;
- INTN TotalLength;
- EFI_COMMON_SECTION_HEADER CommonSect;
- STATUS Status;
-
- if (InputFileNum > 1) {
- Error (NULL, 0, 0, "invalid parameter", "more than one input file specified");
- return STATUS_ERROR;
- } else if (InputFileNum < 1) {
- Error (NULL, 0, 0, "no input file specified", NULL);
- return STATUS_ERROR;
- }
- //
- // Open the input file
- //
- InFile = fopen (InputFileName[0], "rb");
- if (InFile == NULL) {
- Error (NULL, 0, 0, InputFileName[0], "failed to open input file");
- 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);
- fgetpos (InFile, &InputFileLength);
- fseek (InFile, 0, SEEK_SET);
- //
- // Fill in the fields in the local section header structure
- //
- CommonSect.Type = (EFI_SECTION_TYPE) SectionType;
- TotalLength = sizeof (CommonSect) + (INTN) InputFileLength;
- //
- // Size must fit in 3 bytes
- //
- if (TotalLength >= 0x1000000) {
- Error (NULL, 0, 0, InputFileName[0], "file size (0x%X) exceeds section size limit", TotalLength);
- goto Done;
- }
- //
- // Now copy the size into the section header and write out the section header
- //
- memcpy (&CommonSect.Size, &TotalLength, 3);
- fwrite (&CommonSect, sizeof (CommonSect), 1, OutFile);
- //
- // Allocate a buffer to read in the contents of the input file. Then
- // read it in as one block and write it to the output file.
- //
- if (InputFileLength != 0) {
- Buffer = (UINT8 *) malloc ((size_t) InputFileLength);
- if (Buffer == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- goto Done;
- }
-
- if (fread (Buffer, (size_t) InputFileLength, 1, InFile) != 1) {
- Error (NULL, 0, 0, InputFileName[0], "failed to read contents of file");
- goto Done;
- }
-
- if (fwrite (Buffer, (size_t) InputFileLength, 1, OutFile) != 1) {
- Error (NULL, 0, 0, "failed to write to output file", NULL);
- goto Done;
- }
- }
-
- Status = STATUS_SUCCESS;
-Done:
- fclose (InFile);
- if (Buffer != NULL) {
- free (Buffer);
- }
-
- return Status;
-}
-
-EFI_STATUS
-GetSectionContents (
- char **InputFileName,
- int InputFileNum,
- UINT8 *FileBuffer,
- UINTN *BufferLength
- )
-/*++
-
-Routine Description:
-
- Get the contents of all section files specified in InputFileName
- into FileBuffer.
-
-Arguments:
-
- InputFileName - Name of the input file.
-
- InputFileNum - Number of input files. Should be at least 1.
-
- FileBuffer - Output buffer to contain data
-
- BufferLength - Actual length of the data
-
-Returns:
-
- EFI_SUCCESS on successful return
- EFI_INVALID_PARAMETER if InputFileNum is less than 1
- EFI_ABORTED if unable to open input file.
-
---*/
-{
- UINTN Size;
- UINTN FileSize;
- INTN Index;
- FILE *InFile;
-
- if (InputFileNum < 1) {
- Error (NULL, 0, 0, "must specify at least one input file", NULL);
- return EFI_INVALID_PARAMETER;
- }
-
- Size = 0;
- //
- // Go through our array of file names and copy their contents
- // to the output buffer.
- //
- for (Index = 0; Index < InputFileNum; Index++) {
- InFile = fopen (InputFileName[Index], "rb");
- if (InFile == NULL) {
- Error (NULL, 0, 0, InputFileName[Index], "failed to open input file");
- return EFI_ABORTED;
- }
-
- fseek (InFile, 0, SEEK_END);
- FileSize = ftell (InFile);
- fseek (InFile, 0, SEEK_SET);
- //
- // Now read the contents of the file into the buffer
- //
- if (FileSize > 0) {
- if (fread (FileBuffer + Size, (size_t) FileSize, 1, InFile) != 1) {
- Error (NULL, 0, 0, InputFileName[Index], "failed to read contents of input file");
- fclose (InFile);
- return EFI_ABORTED;
- }
- }
-
- fclose (InFile);
- Size += (UINTN) FileSize;
- //
- // make sure section ends on a DWORD boundary
- //
- while ((Size & 0x03) != 0) {
- FileBuffer[Size] = 0;
- Size++;
- }
- }
-
- *BufferLength = Size;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GenSectionCompressionSection (
- char **InputFileName,
- int InputFileNum,
- UINTN SectionType,
- UINTN SectionSubType,
- FILE *OutFile
- )
-/*++
-
-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.
-
- InputFileNum - Number of input files. Should be at least 1.
-
- SectionType - Section type to generate. Should be
- EFI_SECTION_COMPRESSION
-
- SectionSubType - Specify the compression algorithm requested.
-
- OutFile - Output file handle
-
-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.
---*/
-{
- UINTN TotalLength;
- UINTN InputLength;
- UINTN CompressedLength;
- UINT8 *FileBuffer;
- UINT8 *OutputBuffer;
- EFI_STATUS Status;
- EFI_COMPRESSION_SECTION CompressionSect;
- COMPRESS_FUNCTION CompressFunction;
-
- if (SectionType != EFI_SECTION_COMPRESSION) {
- Error (NULL, 0, 0, "parameter must be EFI_SECTION_COMPRESSION", NULL);
- return EFI_INVALID_PARAMETER;
- }
-
- InputLength = 0;
- FileBuffer = NULL;
- OutputBuffer = NULL;
- CompressedLength = 0;
- FileBuffer = (UINT8 *) malloc ((1024 * 1024 * 4) * sizeof (UINT8));
- if (FileBuffer == NULL) {
- Error (__FILE__, __LINE__, 0, "application error", "failed to allocate memory");
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // read all input file contents into a buffer
- //
- Status = GetSectionContents (
- InputFileName,
- InputFileNum,
- FileBuffer,
- &InputLength
- );
- if (EFI_ERROR (Status)) {
- free (FileBuffer);
- return Status;
- }
-
- CompressFunction = NULL;
-
- //
- // Now data is in FileBuffer, compress the data
- //
- switch (SectionSubType) {
- case EFI_NOT_COMPRESSED:
- CompressedLength = InputLength;
- break;
-
- case EFI_STANDARD_COMPRESSION:
- CompressFunction = (COMPRESS_FUNCTION) EfiCompress;
- break;
-
- case EFI_CUSTOMIZED_COMPRESSION:
- CompressFunction = (COMPRESS_FUNCTION) CustomizedCompress;
- break;
-
- default:
- Error (NULL, 0, 0, "unknown compression type", NULL);
- free (FileBuffer);
- return EFI_ABORTED;
- }
-
- if (CompressFunction != NULL) {
-
- Status = CompressFunction (FileBuffer, InputLength, OutputBuffer, &CompressedLength);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- OutputBuffer = malloc (CompressedLength);
- if (!OutputBuffer) {
- free (FileBuffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = CompressFunction (FileBuffer, InputLength, OutputBuffer, &CompressedLength);
- }
-
- free (FileBuffer);
- FileBuffer = OutputBuffer;
-
- if (EFI_ERROR (Status)) {
- if (FileBuffer != NULL) {
- free (FileBuffer);
- }
-
- return Status;
- }
- }
-
- TotalLength = CompressedLength + sizeof (EFI_COMPRESSION_SECTION);
- //
- // Add the section header for the compressed data
- //
- CompressionSect.CommonHeader.Type = (EFI_SECTION_TYPE) SectionType;
- 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 = (UINT8) SectionSubType;
- CompressionSect.UncompressedLength = InputLength;
-
- fwrite (&CompressionSect, sizeof (CompressionSect), 1, OutFile);
- fwrite (FileBuffer, CompressedLength, 1, OutFile);
- free (FileBuffer);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GenSectionGuidDefinedSection (
- char **InputFileName,
- int InputFileNum,
- UINTN SectionType,
- UINTN SectionSubType,
- FILE *OutFile
- )
-/*++
-
-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.
-
- InputFileNum - Number of input files. Should be at least 1.
-
- SectionType - Section type to generate. Should be
- EFI_SECTION_GUID_DEFINED
-
- SectionSubType - Specify the authentication algorithm requested.
-
- OutFile - Output file handle
-
-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.
-
---*/
-{
- INTN TotalLength;
- INTN InputLength;
- UINT8 *FileBuffer;
- UINT32 Crc32Checksum;
- EFI_STATUS Status;
- CRC32_SECTION_HEADER Crc32GuidSect;
-
- if (SectionType != EFI_SECTION_GUID_DEFINED) {
- Error (NULL, 0, 0, "parameter must be EFI_SECTION_GUID_DEFINED", NULL);
- return EFI_INVALID_PARAMETER;
- }
-
- InputLength = 0;
- FileBuffer = NULL;
- FileBuffer = (UINT8 *) malloc ((1024 * 1024 * 4) * sizeof (UINT8));
- if (FileBuffer == NULL) {
- Error (__FILE__, __LINE__, 0, "application error", "failed to allocate memory");
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // read all input file contents into a buffer
- //
- Status = GetSectionContents (
- InputFileName,
- InputFileNum,
- FileBuffer,
- &InputLength
- );
- if (EFI_ERROR (Status)) {
- free (FileBuffer);
- return Status;
- }
- //
- // Now data is in FileBuffer, compress the data
- //
- switch (SectionSubType) {
- case EFI_SECTION_CRC32_GUID_DEFINED:
- Crc32Checksum = 0;
- CalculateCrc32 (FileBuffer, InputLength, &Crc32Checksum);
- if (EFI_ERROR (Status)) {
- free (FileBuffer);
- return Status;
- }
-
- TotalLength = InputLength + CRC32_SECTION_HEADER_SIZE;
- Crc32GuidSect.GuidSectionHeader.CommonHeader.Type = (EFI_SECTION_TYPE) SectionType;
- 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), &gEfiCrc32SectionGuid, sizeof (EFI_GUID));
- Crc32GuidSect.GuidSectionHeader.Attributes = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;
- Crc32GuidSect.GuidSectionHeader.DataOffset = CRC32_SECTION_HEADER_SIZE;
- Crc32GuidSect.CRC32Checksum = Crc32Checksum;
-
- break;
-
- default:
- Error (NULL, 0, 0, "invalid parameter", "unknown GUID defined type");
- free (FileBuffer);
- return EFI_ABORTED;
- }
-
- fwrite (&Crc32GuidSect, sizeof (Crc32GuidSect), 1, OutFile);
- fwrite (FileBuffer, InputLength, 1, OutFile);
-
- free (FileBuffer);
-
- 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.
-
---*/
-{
- INTN Index;
- INTN VersionNumber;
- UINTN SectionType;
- UINTN SectionSubType;
- BOOLEAN InputFileRequired;
- BOOLEAN SubTypeRequired;
- FILE *InFile;
- FILE *OutFile;
- INTN InputFileNum;
-
- char **InputFileName;
- char *OutputFileName;
- char AuxString[500] = { 0 };
-
- char *ParamSectionType;
- char *ParamSectionSubType;
- char *ParamLength;
- char *ParamVersion;
- char *ParamDigitalSignature;
-
- EFI_STATUS Status;
- EFI_COMMON_SECTION_HEADER CommonSect;
-
- InputFileName = NULL;
- OutputFileName = PARAMETER_NOT_SPECIFIED;
- ParamSectionType = PARAMETER_NOT_SPECIFIED;
- ParamSectionSubType = PARAMETER_NOT_SPECIFIED;
- ParamLength = PARAMETER_NOT_SPECIFIED;
- ParamVersion = PARAMETER_NOT_SPECIFIED;
- ParamDigitalSignature = PARAMETER_NOT_SPECIFIED;
- Status = EFI_SUCCESS;
-
- VersionNumber = 0;
- SectionType = 0;
- SectionSubType = 0;
- InputFileRequired = TRUE;
- SubTypeRequired = FALSE;
- InFile = NULL;
- OutFile = NULL;
- InputFileNum = 0;
- Status = EFI_SUCCESS;
-
- SetUtilityName (UTILITY_NAME);
-
- if (argc == 1) {
- Usage ();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- //
- // Parse command line
- //
- Index = 1;
- while (Index < argc) {
- if (strcmpi (argv[Index], "-i") == 0) {
- //
- // Input File found
- //
- Index++;
- InputFileName = (char **) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (char *));
- if (InputFileName == NULL) {
- Error (__FILE__, __LINE__, 0, "application error", "failed to allocate memory");
- return EFI_OUT_OF_RESOURCES;
- }
-
- memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (char *)));
- InputFileName[InputFileNum] = argv[Index];
- InputFileNum++;
- Index++;
- //
- // Parse subsequent parameters until another switch is encountered
- //
- while ((Index < argc) && (argv[Index][0] != '-')) {
- if ((InputFileNum % MAXIMUM_INPUT_FILE_NUM) == 0) {
- //
- // InputFileName buffer too small, need to realloc
- //
- InputFileName = (char **) realloc (
- InputFileName,
- (InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (char *)
- );
- if (InputFileName == NULL) {
- Error (__FILE__, __LINE__, 0, "application error", "failed to allocate memory");
- return EFI_OUT_OF_RESOURCES;
- }
-
- memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (char *)));
- }
-
- InputFileName[InputFileNum] = argv[Index];
- InputFileNum++;
- Index++;
- }
-
- }
-
- if (strcmpi (argv[Index], "-o") == 0) {
- //
- // Output file found
- //
- Index++;
- OutputFileName = argv[Index];
- } else if (strcmpi (argv[Index], "-s") == 0) {
- //
- // Section Type found
- //
- Index++;
- ParamSectionType = argv[Index];
- } else if (strcmpi (argv[Index], "-t") == 0) {
- //
- // Compression or Authentication type
- //
- Index++;
- ParamSectionSubType = argv[Index];
- } else if (strcmpi (argv[Index], "-l") == 0) {
- //
- // Length
- //
- Index++;
- ParamLength = argv[Index];
- } else if (strcmpi (argv[Index], "-v") == 0) {
- //
- // VersionNumber
- //
- Index++;
- ParamVersion = argv[Index];
- } else if (strcmpi (argv[Index], "-a") == 0) {
- //
- // Aux string
- //
- Index++;
- //
- // Note, the MSVC C-Start parses out and consolidates quoted strings from the command
- // line. Quote characters are stripped. If this tool is ported to other environments
- // this will need to be taken into account
- //
- strncpy (AuxString, argv[Index], 499);
- } else if (strcmpi (argv[Index], "-d") == 0) {
- //
- // Digital signature for EFI_TEST_AUTHENTICAION (must be 0 or 1)
- //
- Index++;
- ParamDigitalSignature = argv[Index];
- } else if (strcmpi (argv[Index], "-?") == 0) {
- Usage ();
- return STATUS_ERROR;
- } else {
- Error (NULL, 0, 0, argv[Index], "unknown option");
- return GetUtilityStatus ();
- }
-
- Index++;
- }
- //
- // At this point, all command line parameters are verified as not being totally
- // bogus. Next verify the command line parameters are complete and make
- // sense...
- //
- if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_COMPRESSION]) == 0) {
- SectionType = EFI_SECTION_COMPRESSION;
- SubTypeRequired = TRUE;
- if (stricmp (ParamSectionSubType, CompressionTypeName[EFI_NOT_COMPRESSED]) == 0) {
- SectionSubType = EFI_NOT_COMPRESSED;
- } else if (stricmp (ParamSectionSubType, CompressionTypeName[EFI_STANDARD_COMPRESSION]) == 0) {
- SectionSubType = EFI_STANDARD_COMPRESSION;
- } else {
- Error (NULL, 0, 0, ParamSectionSubType, "unknown compression type");
- Usage ();
- return GetUtilityStatus ();
- }
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {
- SectionType = EFI_SECTION_GUID_DEFINED;
- SubTypeRequired = TRUE;
- if (stricmp (ParamSectionSubType, GUIDedSectionTypeName[EFI_SECTION_CRC32_GUID_DEFINED]) == 0) {
- SectionSubType = EFI_SECTION_CRC32_GUID_DEFINED;
- } else {
- Error (NULL, 0, 0, ParamSectionSubType, "unknown GUID defined section type", ParamSectionSubType);
- Usage ();
- return GetUtilityStatus ();
- }
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_PE32]) == 0) {
- SectionType = EFI_SECTION_PE32;
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_PIC]) == 0) {
- SectionType = EFI_SECTION_PIC;
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_TE]) == 0) {
- SectionType = EFI_SECTION_TE;
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_DXE_DEPEX]) == 0) {
- SectionType = EFI_SECTION_DXE_DEPEX;
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_VERSION]) == 0) {
- SectionType = EFI_SECTION_VERSION;
- InputFileRequired = FALSE;
- Index = sscanf (ParamVersion, "%d", &VersionNumber);
- if (Index != 1 || VersionNumber < 0 || VersionNumber > 65565) {
- Error (NULL, 0, 0, ParamVersion, "illegal version number");
- Usage ();
- return GetUtilityStatus ();
- }
-
- if (strcmp (AuxString, PARAMETER_NOT_SPECIFIED) == 0) {
- AuxString[0] = 0;
- }
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_USER_INTERFACE]) == 0) {
- SectionType = EFI_SECTION_USER_INTERFACE;
- InputFileRequired = FALSE;
- if (strcmp (AuxString, PARAMETER_NOT_SPECIFIED) == 0) {
- Error (NULL, 0, 0, "user interface string not specified", NULL);
- Usage ();
- return GetUtilityStatus ();
- }
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_COMPATIBILITY16]) == 0) {
- SectionType = EFI_SECTION_COMPATIBILITY16;
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_FIRMWARE_VOLUME_IMAGE]) == 0) {
- SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_FREEFORM_SUBTYPE_GUID]) == 0) {
- SectionType = EFI_SECTION_FREEFORM_SUBTYPE_GUID;
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_RAW]) == 0) {
- SectionType = EFI_SECTION_RAW;
- } else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_PEI_DEPEX]) == 0) {
- SectionType = EFI_SECTION_PEI_DEPEX;
- } else {
- Error (NULL, 0, 0, ParamSectionType, "unknown section type");
- Usage ();
- return GetUtilityStatus ();
- }
- //
- // Open output file
- //
- OutFile = fopen (OutputFileName, "wb");
- if (OutFile == NULL) {
- Error (NULL, 0, 0, OutputFileName, "failed to open output file for writing");
- if (InFile != NULL) {
- fclose (InFile);
- }
-
- return GetUtilityStatus ();
- }
- //
- // 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 (SectionType) {
- case EFI_SECTION_COMPRESSION:
- Status = GenSectionCompressionSection (
- InputFileName,
- InputFileNum,
- SectionType,
- SectionSubType,
- OutFile
- );
- break;
-
- case EFI_SECTION_GUID_DEFINED:
- Status = GenSectionGuidDefinedSection (
- InputFileName,
- InputFileNum,
- SectionType,
- SectionSubType,
- OutFile
- );
- break;
-
- case EFI_SECTION_VERSION:
- CommonSect.Type = (EFI_SECTION_TYPE) SectionType;
-
- Index = sizeof (CommonSect);
- //
- // 2 characters for the build number
- //
- Index += 2;
- //
- // Aux string is ascii.. unicode is 2X + 2 bytes for terminating unicode null.
- //
- Index += (strlen (AuxString) * 2) + 2;
- memcpy (&CommonSect.Size, &Index, 3);
- fwrite (&CommonSect, sizeof (CommonSect), 1, OutFile);
- fwrite (&VersionNumber, 2, 1, OutFile);
- Ascii2UnicodeWriteString (AuxString, OutFile, FALSE);
- break;
-
- case EFI_SECTION_USER_INTERFACE:
- CommonSect.Type = (EFI_SECTION_TYPE) SectionType;
- Index = sizeof (CommonSect);
- //
- // Aux string is ascii.. unicode is 2X + 2 bytes for terminating unicode null.
- //
- Index += (strlen (AuxString) * 2) + 2;
- memcpy (&CommonSect.Size, &Index, 3);
- fwrite (&CommonSect, sizeof (CommonSect), 1, OutFile);
- Ascii2UnicodeWriteString (AuxString, OutFile, FALSE);
- break;
-
- default:
- //
- // All other section types are caught by default (they're all the same)
- //
- Status = GenSectionCommonLeafSection (
- InputFileName,
- InputFileNum,
- SectionType,
- OutFile
- );
- break;
- }
-
- if (InputFileName != NULL) {
- free (InputFileName);
- }
-
- fclose (OutFile);
- //
- // If we had errors, then delete the output file
- //
- if (GetUtilityStatus () == STATUS_ERROR) {
- remove (OutputFileName);
- }
-
- return GetUtilityStatus ();
-}
diff --git a/Tools/CCode/Source/GenSection/GenSection.h b/Tools/CCode/Source/GenSection/GenSection.h
deleted file mode 100644
index 36064632db..0000000000
--- a/Tools/CCode/Source/GenSection/GenSection.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- GenSection.h
-
-Abstract:
-
- Header file for GenSection.
-
---*/
-
-//
-// Module Coded to Tiano Coding Conventions
-//
-#ifndef _EFI_GEN_SECTION_H
-#define _EFI_GEN_SECTION_H
-
-//
-// External Files Referenced
-//
-#include <Common/UefiBaseTypes.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-
-typedef struct {
- EFI_GUID_DEFINED_SECTION GuidSectionHeader;
- UINT32 CRC32Checksum;
-} CRC32_SECTION_HEADER;
-
-#define EFI_SECTION_CRC32_GUID_DEFINED 0
-#define CRC32_SECTION_HEADER_SIZE (sizeof (CRC32_SECTION_HEADER))
-
-#endif
diff --git a/Tools/CCode/Source/GenSection/build.xml b/Tools/CCode/Source/GenSection/build.xml
deleted file mode 100644
index 391028e9b0..0000000000
--- a/Tools/CCode/Source/GenSection/build.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenSection Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenSection"/>
- <property name="FileSet" value="GenSection.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools CustomizedCompress"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GenTEImage/GenTEImage.c b/Tools/CCode/Source/GenTEImage/GenTEImage.c
deleted file mode 100644
index 665498ac2c..0000000000
--- a/Tools/CCode/Source/GenTEImage/GenTEImage.c
+++ /dev/null
@@ -1,974 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-Module Name:
-
- GenTEImage.c
-
-Abstract:
-
- Utility program to shrink a PE32 image down by replacing
- the DOS, PE, and optional headers with a minimal header.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h> // for PE32 structure definitions
-
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.h"
-
-//
-// Version of this utility
-//
-#define UTILITY_NAME "GenTEImage"
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 11
-
-//
-// Define the max length of a filename
-//
-#define MAX_PATH 256
-#define DEFAULT_OUTPUT_EXTENSION ".te"
-
-//
-// Use this to track our command-line options and globals
-//
-struct {
- INT8 OutFileName[MAX_PATH];
- INT8 InFileName[MAX_PATH];
- INT8 Verbose;
- INT8 Dump;
-} mOptions;
-
-//
-// Use these to convert from machine type value to a named type
-//
-typedef struct {
- UINT16 Value;
- INT8 *Name;
-} STRING_LOOKUP;
-
-static STRING_LOOKUP mMachineTypes[] = {
- EFI_IMAGE_MACHINE_IA32,
- "IA32",
- EFI_IMAGE_MACHINE_IA64,
- "IA64",
- EFI_IMAGE_MACHINE_EBC,
- "EBC",
- 0,
- NULL
-};
-
-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
- );
-
-static
-void
-Usage (
- VOID
- );
-
-static
-STATUS
-ParseCommandLine (
- int Argc,
- char *Argv[]
- );
-
-static
-STATUS
-CheckPE32File (
- INT8 *FileName,
- FILE *Fptr,
- UINT16 *MachineType,
- UINT16 *SubSystem
- );
-
-static
-STATUS
-ProcessFile (
- INT8 *InFileName,
- INT8 *OutFileName
- );
-
-static
-void
-DumpImage (
- INT8 *FileName
- );
-
-static
-INT8 *
-GetMachineTypeStr (
- UINT16 MachineType
- );
-
-static
-INT8 *
-GetSubsystemTypeStr (
- UINT16 SubsystemType
- );
-
-main (
- int Argc,
- char *Argv[]
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
- Argc - standard C main() argument count
-
- Argv - standard C main() argument list
-
-Returns:
-
- 0 success
- non-zero otherwise
-
---*/
-// GC_TODO: ] - add argument and description to function comment
-{
- INT8 *Ext;
- UINT32 Status;
-
- SetUtilityName (UTILITY_NAME);
- //
- // Parse the command line arguments
- //
- if (ParseCommandLine (Argc, Argv)) {
- return STATUS_ERROR;
- }
- //
- // If dumping an image, then do that and quit
- //
- if (mOptions.Dump) {
- DumpImage (mOptions.InFileName);
- goto Finish;
- }
- //
- // 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]) {
- strcpy (mOptions.OutFileName, mOptions.InFileName);
- //
- // Find the last . on the line and replace the filename extension with
- // the default
- //
- for (Ext = mOptions.OutFileName + strlen (mOptions.OutFileName) - 1;
- (Ext >= mOptions.OutFileName) && (*Ext != '.') && (*Ext != '\\');
- 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
- //
- if (stricmp (mOptions.OutFileName, mOptions.InFileName) == 0) {
- Error (NULL, 0, 0, mOptions.OutFileName, "input and output file names must be different");
- goto Finish;
- }
- //
- // Process the file
- //
- ProcessFile (mOptions.InFileName, mOptions.OutFileName);
-Finish:
- Status = GetUtilityStatus ();
- return Status;
-}
-
-static
-STATUS
-ProcessFile (
- INT8 *InFileName,
- INT8 *OutFileName
- )
-/*++
-
-Routine Description:
-
- Process a PE32 EFI file.
-
-Arguments:
-
- InFileName - the file name pointer to the input file
- OutFileName - the file name pointer to the output file
-
-Returns:
-
- STATUS_SUCCESS - the process has been finished successfully
- STATUS_ERROR - error occured during the processing
-
---*/
-{
- STATUS Status;
- FILE *InFptr;
- FILE *OutFptr;
- UINT16 MachineType;
- UINT16 SubSystem;
- EFI_TE_IMAGE_HEADER TEImageHeader;
- UINT32 PESigOffset;
- EFI_IMAGE_FILE_HEADER FileHeader;
- EFI_IMAGE_OPTIONAL_HEADER32 OptionalHeader32;
- EFI_IMAGE_OPTIONAL_HEADER64 OptionalHeader64;
- UINT32 BytesStripped;
- UINT32 FileSize;
- UINT8 *Buffer;
- long SaveFilePosition;
-
- InFptr = NULL;
- OutFptr = NULL;
- Buffer = NULL;
- Status = STATUS_ERROR;
-
- //
- // Try to open the input file
- //
- if ((InFptr = fopen (InFileName, "rb")) == NULL) {
- Error (NULL, 0, 0, InFileName, "failed to open input file for reading");
- return STATUS_ERROR;
- }
- //
- // Double-check the file to make sure it's what we expect it to be
- //
-
- if (CheckPE32File (InFileName, InFptr, &MachineType, &SubSystem) != STATUS_SUCCESS) {
- goto Finish;
- }
- //
- // Initialize our new header
- //
- memset (&TEImageHeader, 0, sizeof (EFI_TE_IMAGE_HEADER));
-
- //
- // Seek to the end to get the file size
- //
- fseek (InFptr, 0, SEEK_END);
- FileSize = ftell (InFptr);
- fseek (InFptr, 0, SEEK_SET);
-
- //
- // Per the PE/COFF specification, at offset 0x3C in the file is a 32-bit
- // offset (from the start of the file) to the PE signature, which always
- // follows the MSDOS stub. The PE signature is immediately followed by the
- // COFF file header.
- //
- //
- if (fseek (InFptr, 0x3C, SEEK_SET) != 0) {
- Error (NULL, 0, 0, InFileName, "failed to seek to PE signature in file", NULL);
- goto Finish;
- }
-
- if (fread (&PESigOffset, sizeof (PESigOffset), 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to read PE signature offset from file");
- goto Finish;
- }
-
- if (fseek (InFptr, PESigOffset + 4, SEEK_SET) != 0) {
- Error (NULL, 0, 0, InFileName, "failed to seek to PE signature");
- goto Finish;
- }
- //
- // We should now be at the COFF file header. Read it in and verify it's
- // of an image type we support.
- //
- if (fread (&FileHeader, sizeof (EFI_IMAGE_FILE_HEADER), 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to read file header from image");
- goto Finish;
- }
-
- if ((FileHeader.Machine != EFI_IMAGE_MACHINE_IA32) && (FileHeader.Machine != EFI_IMAGE_MACHINE_IA64)) {
- Error (NULL, 0, 0, InFileName, "image is of an unsupported machine type 0x%X", (UINT32) FileHeader.Machine);
- goto Finish;
- }
- //
- // Calculate the total number of bytes we're going to strip off. The '4' is for the
- // PE signature PE\0\0. Then sanity check the size.
- //
- BytesStripped = PESigOffset + 4 + sizeof (EFI_IMAGE_FILE_HEADER) + FileHeader.SizeOfOptionalHeader;
- if (BytesStripped >= FileSize) {
- Error (NULL, 0, 0, InFileName, "attempt to strip more bytes than the total file size");
- goto Finish;
- }
-
- if (BytesStripped &~0xFFFF) {
- Error (NULL, 0, 0, InFileName, "attempt to strip more than 64K bytes", NULL);
- goto Finish;
- }
-
- TEImageHeader.StrippedSize = (UINT16) BytesStripped;
-
- //
- // Read in the optional header. Assume PE32, and if not, then re-read as PE32+
- //
- SaveFilePosition = ftell (InFptr);
- if (fread (&OptionalHeader32, sizeof (EFI_IMAGE_OPTIONAL_HEADER32), 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to read optional header from input file");
- goto Finish;
- }
-
- if (OptionalHeader32.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
- //
- // Fill in our new header with required data directory entries
- //
- TEImageHeader.AddressOfEntryPoint = OptionalHeader32.AddressOfEntryPoint;
- //
- // - BytesStripped + sizeof (EFI_TE_IMAGE_HEADER);
- //
- // We're going to pack the subsystem into 1 byte. Make sure it fits
- //
- if (OptionalHeader32.Subsystem &~0xFF) {
- Error (
- NULL,
- 0,
- 0,
- InFileName,
- NULL,
- "image subsystem 0x%X cannot be packed into 1 byte",
- (UINT32) OptionalHeader32.Subsystem
- );
- goto Finish;
- }
-
- TEImageHeader.Subsystem = (UINT8) OptionalHeader32.Subsystem;
- TEImageHeader.BaseOfCode = OptionalHeader32.BaseOfCode;
- TEImageHeader.ImageBase = (UINT64) (OptionalHeader32.ImageBase);
- if (OptionalHeader32.NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = OptionalHeader32.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = OptionalHeader32.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
- }
-
- if (OptionalHeader32.NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress = OptionalHeader32.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].Size = OptionalHeader32.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
- }
- } else if (OptionalHeader32.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
- //
- // Rewind and re-read the optional header
- //
- fseek (InFptr, SaveFilePosition, SEEK_SET);
- if (fread (&OptionalHeader64, sizeof (EFI_IMAGE_OPTIONAL_HEADER64), 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to re-read optional header from input file");
- goto Finish;
- }
-
- TEImageHeader.AddressOfEntryPoint = OptionalHeader64.AddressOfEntryPoint;
- //
- // - BytesStripped + sizeof (EFI_TE_IMAGE_HEADER);
- //
- // We're going to pack the subsystem into 1 byte. Make sure it fits
- //
- if (OptionalHeader64.Subsystem &~0xFF) {
- Error (
- NULL,
- 0,
- 0,
- InFileName,
- NULL,
- "image subsystem 0x%X cannot be packed into 1 byte",
- (UINT32) OptionalHeader64.Subsystem
- );
- goto Finish;
- }
-
- TEImageHeader.Subsystem = (UINT8) OptionalHeader64.Subsystem;
- TEImageHeader.BaseOfCode = OptionalHeader32.BaseOfCode;
- TEImageHeader.ImageBase = (UINT64) (OptionalHeader64.ImageBase);
- if (OptionalHeader64.NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = OptionalHeader64.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = OptionalHeader64.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
- }
-
- if (OptionalHeader64.NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress = OptionalHeader64.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].Size = OptionalHeader64.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
- }
- } else {
- Error (
- NULL,
- 0,
- 0,
- InFileName,
- "unsupported magic number 0x%X found in optional header",
- (UINT32) OptionalHeader32.Magic
- );
- goto Finish;
- }
- //
- // Fill in the remainder of our new image header
- //
- TEImageHeader.Signature = EFI_TE_IMAGE_HEADER_SIGNATURE;
- TEImageHeader.Machine = FileHeader.Machine;
- //
- // We're going to pack the number of sections into a single byte. Make sure it fits.
- //
- if (FileHeader.NumberOfSections &~0xFF) {
- Error (
- NULL,
- 0,
- 0,
- InFileName,
- NULL,
- "image's number of sections 0x%X cannot be packed into 1 byte",
- (UINT32) FileHeader.NumberOfSections
- );
- goto Finish;
- }
-
- TEImageHeader.NumberOfSections = (UINT8) FileHeader.NumberOfSections;
-
- //
- // Now open our output file
- //
- if ((OutFptr = fopen (OutFileName, "wb")) == NULL) {
- Error (NULL, 0, 0, OutFileName, "failed to open output file for writing");
- goto Finish;
- }
- //
- // Write the TE header
- //
- if (fwrite (&TEImageHeader, sizeof (EFI_TE_IMAGE_HEADER), 1, OutFptr) != 1) {
- Error (NULL, 0, 0, "failed to write image header to output file", NULL);
- goto Finish;
- }
- //
- // Position into the input file, read the part we're not stripping, and
- // write it out.
- //
- fseek (InFptr, BytesStripped, SEEK_SET);
- Buffer = (UINT8 *) malloc (FileSize - BytesStripped);
- if (Buffer == NULL) {
- Error (NULL, 0, 0, "application error", "failed to allocate memory");
- goto Finish;
- }
-
- if (fread (Buffer, FileSize - BytesStripped, 1, InFptr) != 1) {
- Error (NULL, 0, 0, InFileName, "failed to read remaining contents of input file");
- goto Finish;
- }
-
- if (fwrite (Buffer, FileSize - BytesStripped, 1, OutFptr) != 1) {
- Error (NULL, 0, 0, OutFileName, "failed to write all bytes to output file");
- goto Finish;
- }
-
- Status = STATUS_SUCCESS;
-
-Finish:
- if (InFptr != NULL) {
- fclose (InFptr);
- }
- //
- // Close the output file. If there was an error, delete the output file so
- // that a subsequent build will rebuild it.
- //
- if (OutFptr != NULL) {
- fclose (OutFptr);
- if (GetUtilityStatus () == STATUS_ERROR) {
- remove (OutFileName);
- }
- }
-
- //
- // Free up our buffer
- //
- if (Buffer != NULL) {
- free (Buffer);
- }
-
- return Status;
-}
-
-static
-STATUS
-CheckPE32File (
- INT8 *FileName,
- FILE *Fptr,
- UINT16 *MachineType,
- UINT16 *SubSystem
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FileName - GC_TODO: add argument description
- Fptr - GC_TODO: add argument description
- MachineType - GC_TODO: add argument description
- SubSystem - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- /*++
-
-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_FILE_HEADER FileHdr;
- EFI_IMAGE_OPTIONAL_HEADER OptionalHdr;
- UINT32 PESig;
- STATUS Status;
-
- Status = STATUS_ERROR;
- //
- // 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, 0, FileName, "failed to read the DOS stub from the input file");
- goto Finish;
- }
- //
- // Check the magic number (0x5A4D)
- //
- if (DosHeader.e_magic != EFI_IMAGE_DOS_SIGNATURE) {
- Error (NULL, 0, 0, FileName, "input file does not appear to be a PE32 image (magic number)");
- goto Finish;
- }
- //
- // Position into the file and check the PE signature
- //
- fseek (Fptr, (long) DosHeader.e_lfanew, SEEK_SET);
- if (fread (&PESig, sizeof (PESig), 1, Fptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to read PE signature bytes");
- goto Finish;
- }
- //
- // Check the PE signature in the header "PE\0\0"
- //
- if (PESig != EFI_IMAGE_NT_SIGNATURE) {
- Error (NULL, 0, 0, FileName, "file does not appear to be a PE32 image (signature)");
- goto Finish;
- }
- //
- // Read the file header
- //
- if (fread (&FileHdr, sizeof (FileHdr), 1, Fptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to read PE file header from input file");
- goto Finish;
- }
- //
- // Read the optional header so we can get the subsystem
- //
- if (fread (&OptionalHdr, sizeof (OptionalHdr), 1, Fptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to read COFF optional header from input file");
- goto Finish;
- }
-
- //
- // Check FileAlginment and SectionAlignment match or not
- // Because TeImage header doesn't record filealginment and sectionalignment info,
- // TeImage is used for PEIM and PeiCore XIP module.
- // So, check alignment match before generate TeImage to check.
- //
- if (OptionalHdr.SectionAlignment != OptionalHdr.FileAlignment) {
- Error (NULL, 0, 0, FileName, "Section-Alignment and File-Alignment does not match");
- goto Finish;
- }
-
- *SubSystem = OptionalHdr.Subsystem;
- if (mOptions.Verbose) {
- fprintf (stdout, " Got subsystem = 0x%X from image\n", (int) *SubSystem);
- }
- //
- // Good to go
- //
- Status = STATUS_SUCCESS;
-Finish:
- fseek (Fptr, 0, SEEK_SET);
- return Status;
-}
-
-static
-int
-ParseCommandLine (
- int Argc,
- char *Argv[]
- )
-/*++
-
-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
-
-Returns:
-
- STATUS_SUCCESS success
- non-zero otherwise
-
---*/
-// GC_TODO: ] - add argument and description to function comment
-{
- //
- // Clear out the options
- //
- memset ((char *) &mOptions, 0, sizeof (mOptions));
- //
- // Skip over the program name
- //
- Argc--;
- Argv++;
- //
- // If no arguments, assume they want usage info
- //
- if (Argc == 0) {
- Usage ();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
- (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- //
- // Process until no more arguments
- //
- while ((Argc > 0) && (Argv[0][0] == '-')) {
- if (stricmp (Argv[0], "-o") == 0) {
- //
- // Output filename specified with -o
- // Make sure there's another parameter
- //
- if (Argc > 1) {
- strcpy (mOptions.OutFileName, Argv[1]);
- } else {
- Error (NULL, 0, 0, Argv[0], "missing output file name with option");
- Usage ();
- return STATUS_ERROR;
- }
-
- Argv++;
- Argc--;
- } else if ((stricmp (Argv[0], "-h") == 0) || (strcmp (Argv[0], "-?") == 0)) {
- //
- // Help option
- //
- Usage ();
- return STATUS_ERROR;
- } else if (stricmp (Argv[0], "-v") == 0) {
- //
- // -v for verbose
- //
- mOptions.Verbose = 1;
- } else if (stricmp (Argv[0], "-dump") == 0) {
- //
- // -dump for dumping an image
- //
- mOptions.Dump = 1;
- } else {
- Error (NULL, 0, 0, Argv[0], "unrecognized option");
- Usage ();
- return STATUS_ERROR;
- }
- //
- // Next argument
- //
- Argv++;
- Argc--;
- }
- //
- // Better be one more arg for input file name
- //
- if (Argc == 0) {
- Error (NULL, 0, 0, "input file name required", NULL);
- Usage ();
- return STATUS_ERROR;
- }
-
- if (Argc != 1) {
- Error (NULL, 0, 0, Argv[1], "extra arguments on command line");
- return STATUS_ERROR;
- }
-
- strcpy (mOptions.InFileName, Argv[0]);
- return STATUS_SUCCESS;
-}
-
-static
-void
-Version(
- void
-)
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Utility to generate a TE image from an EFI PE32 image.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-static
-void
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Print usage information for this utility.
-
-Arguments:
-
- None.
-
-Returns:
-
- Nothing.
-
---*/
-{
- int Index;
- static const char *Msg[] = {
- "\nUsage: "UTILITY_NAME " {-v} {-dump} {-h|-?} {-o OutFileName} InFileName",
- " [-e|-b] [FileName(s)]",
- " where:",
- " -h,--help,-?,/? to display help messages",
- " -V,--version to display version information",
- " -v - for verbose output",
- " -dump - to dump the input file to a text file",
- " -o OutFileName - to write output to OutFileName rather than InFileName"DEFAULT_OUTPUT_EXTENSION,
- " InFileName - name of the input PE32 file",
- "",
- NULL
- };
-
- Version();
-
- for (Index = 0; Msg[Index] != NULL; Index++) {
- fprintf (stdout, "%s\n", Msg[Index]);
- }
-}
-
-static
-VOID
-DumpImage (
- INT8 *FileName
- )
-/*++
-
-Routine Description:
-
- Dump a specified image information
-
-Arguments:
-
- FileName - File name pointer to the image to dump
-
-Returns:
-
- Nothing.
-
---*/
-{
- FILE *InFptr;
- EFI_TE_IMAGE_HEADER TEImageHeader;
- INT8 *NamePtr;
-
- //
- // Open the input file
- //
- InFptr = NULL;
-
- if ((InFptr = fopen (FileName, "rb")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open input file for reading");
- return ;
- }
-
- if (fread (&TEImageHeader, sizeof (EFI_TE_IMAGE_HEADER), 1, InFptr) != 1) {
- Error (NULL, 0, 0, FileName, "failed to read image header from input file");
- goto Finish;
- }
-
- if (TEImageHeader.Signature != EFI_TE_IMAGE_HEADER_SIGNATURE) {
- Error (NULL, 0, 0, FileName, "Image does not appear to be a TE image (bad signature)");
- goto Finish;
- }
- //
- // Dump the header
- //
- fprintf (stdout, "Header (%d bytes):\n", sizeof (EFI_TE_IMAGE_HEADER));
- fprintf (stdout, " Signature: 0x%04X (TE)\n", (UINT32) TEImageHeader.Signature);
- NamePtr = GetMachineTypeStr (TEImageHeader.Machine);
- fprintf (stdout, " Machine: 0x%04X (%s)\n", (UINT32) TEImageHeader.Machine, NamePtr);
- NamePtr = GetSubsystemTypeStr (TEImageHeader.Subsystem);
- fprintf (stdout, " Subsystem: 0x%02X (%s)\n", (UINT32) TEImageHeader.Subsystem, NamePtr);
- fprintf (stdout, " Number of sections 0x%02X\n", (UINT32) TEImageHeader.NumberOfSections);
- fprintf (stdout, " Stripped size: 0x%04X\n", (UINT32) TEImageHeader.StrippedSize);
- fprintf (stdout, " Entry point: 0x%08X\n", TEImageHeader.AddressOfEntryPoint);
- fprintf (stdout, " Base of code: 0x%08X\n", TEImageHeader.BaseOfCode);
- fprintf (stdout, " Data directories:\n");
- fprintf (
- stdout,
- " %8X [%8X] RVA [size] of Base Relocation Directory\n",
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress,
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size
- );
- fprintf (
- stdout,
- " %8X [%8X] RVA [size] of Debug Directory\n",
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress,
- TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].Size
- );
-
-Finish:
- if (InFptr != NULL) {
- fclose (InFptr);
- }
-}
-
-static
-INT8 *
-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
-INT8 *
-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/Tools/CCode/Source/GenTEImage/build.xml b/Tools/CCode/Source/GenTEImage/build.xml
deleted file mode 100644
index 508035b14b..0000000000
--- a/Tools/CCode/Source/GenTEImage/build.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GenTEImage Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GenTEImage"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/GuidChk/CommonUtils.h b/Tools/CCode/Source/GuidChk/CommonUtils.h
deleted file mode 100644
index f7a331e5d7..0000000000
--- a/Tools/CCode/Source/GuidChk/CommonUtils.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- CommonUtils.h
-
-Abstract:
-
- Common utility defines and structure definitions.
-
---*/
-
-#ifndef _COMMON_UTILS_H_
-#define _COMMON_UTILS_H_
-
-//
-// Basic types
-//
-typedef unsigned char UINT8;
-typedef char INT8;
-typedef unsigned short UINT16;
-typedef unsigned int UINT32;
-
-typedef UINT8 BOOLEAN;
-typedef UINT32 STATUS;
-
-#define TRUE 1
-#define FALSE 0
-
-#define STATUS_SUCCESS 0
-#define STATUS_WARNING 1
-#define STATUS_ERROR 2
-
-//
-// Linked list of strings
-//
-typedef struct _STRING_LIST {
- struct _STRING_LIST *Next;
- char *Str;
-} STRING_LIST;
-
-int
-CreateGuidList (
- INT8 *OutFileName
- )
-;
-
-#endif // #ifndef _COMMON_UTILS_H_
diff --git a/Tools/CCode/Source/GuidChk/FileSearch.c b/Tools/CCode/Source/GuidChk/FileSearch.c
deleted file mode 100644
index 8b5b58fddf..0000000000
--- a/Tools/CCode/Source/GuidChk/FileSearch.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- FileSearch.c
-
-Abstract:
-
- Module used to support file searches on the system.
-
---*/
-
-#include <stdio.h>
-
-#include "CommonUtils.h"
-#include "FileSearch.h"
-#include "UtilsMsgs.h"
-
-//
-// Internal file search flag for sanity checks
-//
-#define FILE_SEARCH_STARTED 0x8000
-#define FILE_SEARCH_INITED 0x4000
-
-static
-BOOLEAN
-FileSearchMeetsCriteria (
- FILE_SEARCH_DATA *FSData
- );
-
-/*****************************************************************************/
-STATUS
-FileSearchInit (
- FILE_SEARCH_DATA *FSData
- )
-{
- memset ((char *) FSData, 0, sizeof (FILE_SEARCH_DATA));
- FSData->Handle = INVALID_HANDLE_VALUE;
- FSData->FileSearchFlags = FILE_SEARCH_INITED;
- FSData->FileName[0] = 0;
- return STATUS_SUCCESS;
-}
-
-STATUS
-FileSearchStart (
- FILE_SEARCH_DATA *FSData,
- char *FileMask,
- UINT32 SearchFlags
- )
-{
- BOOLEAN Done;
-
- //
- // Save their flags, and set a flag to indicate that they called this
- // start function so we can perform extended checking in the other
- // routines we have in this module.
- //
- FSData->FileSearchFlags |= (SearchFlags | FILE_SEARCH_STARTED);
- FSData->FileName[0] = 0;
-
- //
- // Begin the search
- //
- FSData->Handle = FindFirstFile (FileMask, &(FSData->FindData));
- if (FSData->Handle == INVALID_HANDLE_VALUE) {
- return STATUS_ERROR;
- }
- //
- // Keep looping through until we find a file meeting the caller's
- // criteria per the search flags
- //
- Done = FALSE;
- while (!Done) {
- //
- // If we're done (we found a match) copy the file name found and return
- //
- Done = FileSearchMeetsCriteria (FSData);
- if (Done) {
- return STATUS_SUCCESS;
- }
- //
- // Go on to next file
- //
- if (!FindNextFile (FSData->Handle, &(FSData->FindData))) {
- return STATUS_NOT_FOUND;
- }
- }
- //
- // Not reached
- //
- return STATUS_NOT_FOUND;
-}
-
-//
-// Find the next file meeting their criteria and return it.
-//
-STATUS
-FileSearchFindNext (
- FILE_SEARCH_DATA *FSData
- )
-{
- BOOLEAN Done;
-
- Done = FALSE;
- while (!Done) {
- if (!FindNextFile (FSData->Handle, &(FSData->FindData))) {
- return STATUS_NOT_FOUND;
- }
- //
- // See if it matches their criteria
- //
- Done = FileSearchMeetsCriteria (FSData);
- if (Done) {
- return STATUS_SUCCESS;
- }
- }
- //
- // Not reached
- //
- return STATUS_NOT_FOUND;
-}
-//
-// Perform any cleanup necessary to close down a search
-//
-STATUS
-FileSearchDestroy (
- FILE_SEARCH_DATA *FSData
- )
-{
- if (FSData->Handle != INVALID_HANDLE_VALUE) {
- FindClose (FSData->Handle);
- FSData->Handle = INVALID_HANDLE_VALUE;
- }
-
- FSData->FileName[0] = 0;
- FSData->FileSearchFlags = 0;
- return STATUS_SUCCESS;
-}
-
-static
-BOOLEAN
-FileSearchMeetsCriteria (
- FILE_SEARCH_DATA *FSData
- )
-{
- BOOLEAN Status;
- STRING_LIST *StrList;
- UINT32 ExtLen;
- UINT32 FileNameLen;
-
- Status = FALSE;
-
- //
- // First clear the flag indicating this is neither a file or a
- // directory.
- //
- FSData->FileFlags &= ~(FILE_SEARCH_DIR | FILE_SEARCH_FILE);
-
- //
- // We found a file. See if it matches the user's search criteria. First
- // check for this being a directory, and they want directories, and
- // it's not "." and it's not ".."
- //
- if ((FSData->FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
- (FSData->FileSearchFlags & FILE_SEARCH_DIR) &&
- (strcmp (FSData->FindData.cFileName, ".")) &&
- (strcmp (FSData->FindData.cFileName, ".."))
- ) {
- //
- // Assume we'll make it past this check
- //
- Status = TRUE;
- //
- // If they have a list of exclude directories, then check for those
- //
- StrList = FSData->ExcludeDirs;
- while (StrList != NULL) {
- if (stricmp (FSData->FindData.cFileName, StrList->Str) == 0) {
- Status = FALSE;
- break;
- }
-
- StrList = StrList->Next;
- }
- //
- // If we didn't fail due to excluded directories, then set the dir flag
- //
- if (Status) {
- FSData->FileFlags |= FILE_SEARCH_DIR;
- }
- //
- // Else check for a file, and they want files....
- //
- } else if (((FSData->FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) &&
- (FSData->FileSearchFlags & FILE_SEARCH_FILE)
- ) {
- //
- // See if it's in our list of excluded files
- //
- Status = TRUE;
- StrList = FSData->ExcludeFiles;
- while (StrList != NULL) {
- if (stricmp (FSData->FindData.cFileName, StrList->Str) == 0) {
- Status = FALSE;
- break;
- }
-
- StrList = StrList->Next;
- }
-
- if (Status) {
- //
- // See if it's in our list of excluded file extensions
- //
- FileNameLen = strlen (FSData->FindData.cFileName);
- StrList = FSData->ExcludeExtensions;
- while (StrList != NULL) {
- ExtLen = strlen (StrList->Str);
- if (stricmp (
- FSData->FindData.cFileName + FileNameLen - ExtLen,
- StrList->Str
- ) == 0) {
- Status = FALSE;
- break;
- }
-
- StrList = StrList->Next;
- }
- }
-
- if (Status) {
- FSData->FileFlags |= FILE_SEARCH_FILE;
- }
- }
- //
- // If it's a match, copy the filename into another field of the structure
- // for portability.
- //
- if (Status) {
- strcpy (FSData->FileName, FSData->FindData.cFileName);
- }
-
- return Status;
-}
-//
-// Exclude a list of subdirectories.
-//
-STATUS
-FileSearchExcludeDirs (
- FILE_SEARCH_DATA *FSData,
- STRING_LIST *StrList
- )
-{
- FSData->ExcludeDirs = StrList;
- return STATUS_SUCCESS;
-}
-
-STATUS
-FileSearchExcludeFiles (
- FILE_SEARCH_DATA *FSData,
- STRING_LIST *StrList
- )
-{
- FSData->ExcludeFiles = StrList;
- return STATUS_SUCCESS;
-}
-
-STATUS
-FileSearchExcludeExtensions (
- FILE_SEARCH_DATA *FSData,
- STRING_LIST *StrList
- )
-{
- FSData->ExcludeExtensions = StrList;
- return STATUS_SUCCESS;
-}
diff --git a/Tools/CCode/Source/GuidChk/FileSearch.h b/Tools/CCode/Source/GuidChk/FileSearch.h
deleted file mode 100644
index bc40265366..0000000000
--- a/Tools/CCode/Source/GuidChk/FileSearch.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- FileSearch.h
-
-Abstract:
-
- Header file to support file searching.
-
---*/
-
-#ifndef _FILE_SEARCH_H_
-#define _FILE_SEARCH_H_
-
-//
-// Since the file searching routines are OS dependent, put the
-// necessary include paths in this header file so that the non-OS-dependent
-// files don't need to include these windows-specific header files.
-//
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <direct.h>
-#include <windows.h>
-
-//
-// Return codes of some of the file search routines
-//
-#define STATUS_NOT_FOUND 0x1000
-
-//
-// Flags for what to search for. Also used in the FileFlags return field.
-//
-#define FILE_SEARCH_DIR 0x0001
-#define FILE_SEARCH_FILE 0x0002
-
-//
-// Here's our class definition
-//
-typedef struct {
- HANDLE Handle;
- WIN32_FIND_DATA FindData;
- UINT32 FileSearchFlags; // DIRS, FILES, etc
- UINT32 FileFlags;
- INT8 FileName[MAX_PATH]; // for portability
- STRING_LIST *ExcludeDirs;
- STRING_LIST *ExcludeFiles;
- STRING_LIST *ExcludeExtensions;
-} FILE_SEARCH_DATA;
-
-//
-// Here's our member functions
-//
-STATUS
-FileSearchInit (
- FILE_SEARCH_DATA *FSData
- )
-;
-
-STATUS
-FileSearchDestroy (
- FILE_SEARCH_DATA *FSData
- )
-;
-
-STATUS
-FileSearchStart (
- FILE_SEARCH_DATA *FSData,
- char *FileMask,
- UINT32 SearchFlags
- )
-;
-
-STATUS
-FileSearchFindNext (
- FILE_SEARCH_DATA *FSData
- )
-;
-
-STATUS
-FileSearchExcludeDirs (
- FILE_SEARCH_DATA *FSData,
- STRING_LIST *StrList
- )
-;
-STATUS
-FileSearchExcludeExtensions (
- FILE_SEARCH_DATA *FSData,
- STRING_LIST *StrList
- )
-;
-STATUS
-FileSearchExcludeFiles (
- FILE_SEARCH_DATA *FSData,
- STRING_LIST *StrList
- )
-;
-#endif
diff --git a/Tools/CCode/Source/GuidChk/GuidChk.c b/Tools/CCode/Source/GuidChk/GuidChk.c
deleted file mode 100644
index ab2d767b80..0000000000
--- a/Tools/CCode/Source/GuidChk/GuidChk.c
+++ /dev/null
@@ -1,2400 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2007, 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.
-
-Module Name:
-
- GuidChk.c
-
-Abstract:
-
- Parse files in a directory and subdirectories to find all guid definitions.
- Then check them against each other to make sure there are no duplicates.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include "CommonUtils.h"
-#include "FileSearch.h"
-#include "UtilsMsgs.h"
-
-#define MAX_LINE_LEN 180 // we concatenate two lines sometimes
-// Define a structure that correlates filename extensions to an enumerated
-// type.
-//
-
-#define UTILITY_NAME "GuidChk"
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 0
-
-typedef struct {
- INT8 *Extension;
- INT8 ExtensionCode;
-} FILE_TYPE_TABLE_ENTRY;
-
-#define FILE_EXTENSION_UNKNOWN 0
-#define FILE_EXTENSION_C 1
-#define FILE_EXTENSION_H 2
-#define FILE_EXTENSION_IA32_ASM 3
-#define FILE_EXTENSION_IA32_INC 4
-#define FILE_EXTENSION_IA64_ASM 5
-#define FILE_EXTENSION_IA64_INC 6
-#define FILE_EXTENSION_PKG 7
-#define FILE_EXTENSION_INF 8
-
-FILE_TYPE_TABLE_ENTRY FileTypeTable[] = {
- ".c",
- FILE_EXTENSION_C,
- ".h",
- FILE_EXTENSION_H,
- ".inc",
- FILE_EXTENSION_IA32_INC,
- ".asm",
- FILE_EXTENSION_IA32_ASM,
- ".s",
- FILE_EXTENSION_IA64_ASM,
- ".pkg",
- FILE_EXTENSION_PKG,
- ".inf",
- FILE_EXTENSION_INF,
- ".i",
- FILE_EXTENSION_IA64_INC,
- NULL,
- 0
-};
-
-typedef struct EFI_GUID {
- UINT32 Data1;
- UINT16 Data2;
- UINT16 Data3;
- UINT8 Data4[8];
-} EFI_GUID;
-
-typedef struct {
- INT8 Data[4];
- INT8 DataLen;
-} EFI_SIGNATURE;
-
-typedef struct _GUID_RECORD {
- struct _GUID_RECORD *Next;
- BOOLEAN Reported;
- INT8 *FileName;
- INT8 *SymName;
- EFI_GUID Guid;
-} GUID_RECORD;
-
-typedef struct _SIGNATURE_RECORD {
- struct _SIGNATURE_RECORD *Next;
- BOOLEAN Reported;
- INT8 *FileName;
- EFI_SIGNATURE Signature;
-} SIGNATURE_RECORD;
-
-//
-// Utility options
-//
-typedef struct {
- INT8 DatabaseOutputFileName[MAX_PATH]; // with -b option
- STRING_LIST *ExcludeDirs; // list of directory names not to process
- STRING_LIST *ExcludeSubDirs; // list of directory names to not process subdirectories (build)
- STRING_LIST *ExcludeFiles; // list of files to exclude (make.inf)
- STRING_LIST *ExcludeExtensions; // list of filename extensions to exclude (.inf, .pkg)
- BOOLEAN Verbose;
- BOOLEAN PrintFound;
- BOOLEAN CheckGuids;
- BOOLEAN CheckSignatures;
- BOOLEAN GuidXReference;
-} OPTIONS;
-
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- );
-
-static
-VOID
-Version (
- VOID
- );
-
-static
-VOID
-Usage (
- VOID
- );
-
-static
-STATUS
-ProcessDirectory (
- INT8 *Path,
- INT8 *DirectoryName
- );
-
-static
-STATUS
-ProcessFile (
- INT8 *DirectoryName,
- INT8 *FileName
- );
-
-static
-UINT32
-GetFileExtension (
- INT8 *FileName
- );
-
-static
-UINT32
-SkipWhiteSpace (
- INT8 *Str
- );
-
-static
-UINT32
-ValidSymbolName (
- INT8 *Name
- );
-
-static
-STATUS
-ProcessCFileGuids (
- INT8 *FileName
- );
-
-static
-STATUS
-AddSignature (
- INT8 *FileName,
- INT8 *StrDef,
- UINT32 SigSize
- );
-
-static
-STATUS
-ProcessCFileSigs (
- INT8 *FileName
- );
-
-static
-STATUS
-ProcessINFFileGuids (
- INT8 *FileName
- );
-
-static
-STATUS
-ProcessPkgFileGuids (
- INT8 *FileName
- );
-
-static
-STATUS
-ProcessIA32FileGuids (
- INT8 *FileName
- );
-
-static
-STATUS
-ProcessIA64FileGuids (
- INT8 *FileName
- );
-
-static
-BOOLEAN
-IsIA64GuidLine (
- INT8 *Line,
- UINT32 *GuidHigh,
- UINT32 *GuidLow,
- BOOLEAN *Low,
- INT8 *SymName
- );
-
-static
-STATUS
-AddGuid11 (
- INT8 *FileName,
- UINT32 *Data,
- INT8 *SymName
- );
-
-static
-STATUS
-AddPkgGuid (
- INT8 *FileName,
- UINT32 *Data,
- UINT64 *Data64
- );
-
-static
-STATUS
-AddGuid16 (
- INT8 *FileName,
- UINT32 *Data
- );
-
-static
-STATUS
-AddGuid64x2 (
- INT8 *FileName,
- UINT32 DataHH, // Upper 32-bits of upper 64 bits of guid
- UINT32 DataHL, // Lower 32-bits of upper 64 bits
- UINT32 DataLH,
- UINT32 DataLL
- );
-
-static
-VOID
-FreeGuids (
- VOID
- );
-
-static
-VOID
-FreeSigs (
- VOID
- );
-
-static
-STATUS
-CheckDuplicates (
- VOID
- );
-
-//
-// static
-// VOID
-// ReportGuid (
-// INT8 *FileName,
-// GUID_RECORD *FileRecord
-// );
-//
-static
-VOID
-FreeOptions (
- VOID
- );
-
-static
-BOOLEAN
-CheckGuidData (
- UINT32 *GuidData,
- UINT32 DataCount
- );
-
-/**************************** GLOBALS ****************************************/
-static GUID_RECORD *gGuidList = NULL;
-static SIGNATURE_RECORD *gSignatureList = NULL;
-static OPTIONS gOptions;
-
-/*****************************************************************************/
-int
-main (
- int Argc,
- char *Argv[]
- )
-{
- INT8 *Cwd;
- STATUS Status;
-
- SetUtilityName ("GuidChk");
- //
- // Get the current working directory and then process the command line
- // arguments.
- //
- Cwd = _getcwd (NULL, 0);
- Status = ProcessArgs (Argc, Argv);
- if (Status != STATUS_SUCCESS) {
- return Status;
- }
-
- if (gOptions.CheckGuids || gOptions.CheckSignatures) {
- Status = ProcessDirectory (Cwd, NULL);
- if (Status == STATUS_SUCCESS) {
- //
- // Check for duplicates
- //
- Status = CheckDuplicates ();
- }
- }
-
- if (gOptions.DatabaseOutputFileName[0] != 0) {
- CreateGuidList (gOptions.DatabaseOutputFileName);
- }
- //
- // Free up the memory
- //
- free (Cwd);
- FreeGuids ();
- FreeSigs ();
- FreeOptions ();
- return GetUtilityStatus ();
-}
-
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- )
-{
- STRING_LIST *StrList;
-
- memset ((char *) &gOptions, 0, sizeof (gOptions));
- //
- // skip over program name
- //
- Argc--;
- Argv++;
-
- if (Argc == 0) {
- Usage ();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
- (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- while (Argc > 0) {
- //
- // Look for options
- //
- if ((Argv[0][0] == '-') || (Argv[0][0] == '/')) {
- switch (Argv[0][1]) {
- //
- // Help option
- //
- case 'h':
- case 'H':
- case '?':
- Usage ();
- return STATUS_ERROR;
- break;
-
- //
- // Check guids option
- //
- case 'g':
- case 'G':
- gOptions.CheckGuids = TRUE;
- break;
-
- //
- // Check signatures option
- //
- case 's':
- case 'S':
- gOptions.CheckSignatures = TRUE;
- break;
-
- //
- // Print guids found option
- //
- case 'p':
- case 'P':
- gOptions.PrintFound = TRUE;
- break;
-
- //
- // Exclude files option
- //
- case 'f':
- case 'F':
- //
- // Check for another arg
- //
- if (Argc < 2) {
- Error (NULL, 0, 0, Argv[0], "missing argument with option");
- Usage ();
- return STATUS_ERROR;
- }
-
- StrList = malloc (sizeof (STRING_LIST));
- if (StrList == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- memset ((char *) StrList, 0, sizeof (STRING_LIST));
- StrList->Str = Argv[1];
- StrList->Next = gOptions.ExcludeFiles;
- gOptions.ExcludeFiles = StrList;
- Argc--;
- Argv++;
- break;
-
- //
- // Exclude directories option
- //
- case 'd':
- case 'D':
- //
- // Check for another arg
- //
- if (Argc < 2) {
- Error (NULL, 0, 0, Argv[0], "missing argument with option");
- Usage ();
- return STATUS_ERROR;
- }
-
- StrList = malloc (sizeof (STRING_LIST));
- if (StrList == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- memset ((char *) StrList, 0, sizeof (STRING_LIST));
- StrList->Str = Argv[1];
- StrList->Next = gOptions.ExcludeDirs;
- gOptions.ExcludeDirs = StrList;
- Argc--;
- Argv++;
- break;
-
- //
- // -u exclude all subdirectories of a given directory option
- //
- case 'u':
- case 'U':
- //
- // Check for another arg
- //
- if (Argc < 2) {
- Error (NULL, 0, 0, Argv[0], "missing argument with option");
- Usage ();
- return STATUS_ERROR;
- }
-
- StrList = malloc (sizeof (STRING_LIST));
- if (StrList == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- memset ((char *) StrList, 0, sizeof (STRING_LIST));
- StrList->Str = Argv[1];
- StrList->Next = gOptions.ExcludeSubDirs;
- gOptions.ExcludeSubDirs = StrList;
- Argc--;
- Argv++;
- break;
-
- //
- // -e exclude by filename extension option
- //
- case 'e':
- case 'E':
- //
- // Check for another arg
- //
- if (Argc < 2) {
- Error (NULL, 0, 0, Argv[0], "missing argument with option");
- Usage ();
- return STATUS_ERROR;
- }
-
- StrList = malloc (sizeof (STRING_LIST));
- if (StrList == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- memset ((char *) StrList, 0, sizeof (STRING_LIST));
- //
- // Let them put a * in front of the filename extension
- //
- StrList->Str = Argv[1];
- if (StrList->Str[0] == '*') {
- StrList->Str++;
- }
-
- StrList->Next = gOptions.ExcludeExtensions;
- gOptions.ExcludeExtensions = StrList;
- Argc--;
- Argv++;
- break;
-
- //
- // Print guid with matching symbol name for guid definitions found
- //
- case 'x':
- case 'X':
- gOptions.GuidXReference = 1;
- break;
-
- //
- // -b Print the internal database list to a file
- //
- case 'b':
- case 'B':
- //
- // Check for one more arg
- //
- if (Argc < 2) {
- Error (NULL, 0, 0, Argv[0], "must specify file name with option");
- Usage ();
- return STATUS_ERROR;
- }
-
- strcpy (gOptions.DatabaseOutputFileName, Argv[1]);
- Argc--;
- Argv++;
- break;
-
- default:
- Error (NULL, 0, 0, Argv[0], "invalid option");
- Usage ();
- return STATUS_ERROR;
- }
- } else {
- break;
- }
- //
- // Next arg
- //
- Argc--;
- Argv++;
- }
-
- if (Argc > 0) {
- Error (NULL, 0, 0, Argv[0], "invalid argument");
- Usage ();
- return STATUS_ERROR;
- }
- //
- // Have to check signatures, GUIDs, or dump the GUID database.
- //
- if ((!gOptions.CheckGuids) && (!gOptions.CheckSignatures) && (gOptions.DatabaseOutputFileName[0] == 0)) {
- Error (NULL, 0, 0, "nothing to do", "must specify -g, -s, and/or -b");
- Usage ();
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-void
-Version(
- void
-)
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Utility for checking guid duplication for files in a given directory.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-//
-// Print usage instructions
-//
-static
-VOID
-Usage (
- VOID
- )
-{
- int Index;
- char *Str[] = {
- "GuidChk - scan files for duplicate GUID or signature definitions",
- "",
- "Usage: GuidChk {options}\n",
- " Options: ",
- " -d dirname exclude searching of a directory",
- " -f filename exclude searching of a file",
- " -e extension exclude searching of files by extension",
- " -p print all GUIDS found",
- " -g check for duplicate guids",
- " -s check for duplicate signatures",
- " -x print guid+defined symbol name",
- " -b outfile write internal GUID+basename list to outfile",
- " -u dirname exclude searching all subdirectories of a directory",
- " -h,--help,-?,/? display help messages",
- " -V,--version display version information",
- " ",
- " Example: GuidChk -g -u build -d fv -f make.inf -e .pkg",
- "",
- NULL
- };
-
- Version();
-
- for (Index = 0; Str[Index] != NULL; Index++) {
- fprintf (stdout, "%s\n", Str[Index]);
- }
-}
-//
-// Process an entire directory by name
-//
-static
-STATUS
-ProcessDirectory (
- INT8 *Path,
- INT8 *DirectoryName
- )
-{
- FILE_SEARCH_DATA FSData;
- char *FileMask;
- BOOLEAN Done;
- UINT32 Len;
- BOOLEAN NoSubdirs;
- STRING_LIST *SLPtr;
-
- //
- // Root directory may be null
- //
- if (DirectoryName != NULL) {
- //
- // printf ("Processing directory: %s\n", DirectoryName);
- //
- }
- //
- // Initialize our file searching
- //
- FileSearchInit (&FSData);
-
- //
- // Exclude some directories, files, and extensions
- //
- FileSearchExcludeDirs (&FSData, gOptions.ExcludeDirs);
- FileSearchExcludeExtensions (&FSData, gOptions.ExcludeExtensions);
- FileSearchExcludeFiles (&FSData, gOptions.ExcludeFiles);
- //
- // See if this directory is in the list of directories that they
- // don't want to process subdirectories of
- //
- NoSubdirs = FALSE;
- if (DirectoryName != NULL) {
- for (SLPtr = gOptions.ExcludeSubDirs; SLPtr != NULL; SLPtr = SLPtr->Next) {
- if (stricmp (SLPtr->Str, DirectoryName) == 0) {
- //
- // printf ("not processing subdirectories of %s\n", DirectoryName);
- //
- NoSubdirs = TRUE;
- break;
- }
- }
- }
- //
- // Create a filemask of files to search for. We'll append "\*.*" on the
- // end, so allocate some extra bytes.
- //
- Len = strlen (Path) + 10;
- if (DirectoryName != NULL) {
- Len += strlen (DirectoryName);
- }
-
- FileMask = malloc (Len);
- if (FileMask == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
- //
- // Now put it all together
- //
- strcpy (FileMask, Path);
- if ((DirectoryName != NULL) && (strlen (DirectoryName) > 0)) {
- strcat (FileMask, "\\");
- strcat (FileMask, DirectoryName);
- }
-
- strcat (FileMask, "\\*.*");
-
- //
- // Start file searching for files and directories
- //
- FileSearchStart (&FSData, FileMask, FILE_SEARCH_FILE | FILE_SEARCH_DIR);
-
- //
- // Now hack the "\*.*" off the end of the filemask so we can use it to pass
- // the full directory path on recursive calls to process directories.
- //
- FileMask[strlen (FileMask) - 4] = 0;
-
- //
- // Loop until no more files
- //
- Done = FALSE;
- while (!Done) {
- //
- // printf ("Found %s...", FSData.FileName);
- //
- if (FSData.FileFlags & FILE_SEARCH_DIR) {
- //
- // printf ("directory\n");
- //
- if (!NoSubdirs) {
- ProcessDirectory (FileMask, FSData.FileName);
- }
- } else if (FSData.FileFlags & FILE_SEARCH_FILE) {
- //
- // printf ("file\n");
- //
- ProcessFile (FileMask, FSData.FileName);
- } else {
- //
- // printf ("unknown\n");
- //
- }
-
- if (FileSearchFindNext (&FSData) != STATUS_SUCCESS) {
- Done = TRUE;
- }
- }
- //
- // Free up allocated memory
- //
- free (FileMask);
-
- //
- // Free up our file searching
- //
- FileSearchDestroy (&FSData);
-
- return STATUS_SUCCESS;
-}
-//
-// Process a single file.
-//
-static
-STATUS
-ProcessFile (
- INT8 *DirectoryName,
- INT8 *FileName
- )
-{
- STATUS Status;
- UINT32 FileExtension;
- INT8 FullFileName[MAX_PATH];
-
- Status = STATUS_SUCCESS;
-
- sprintf (FullFileName, "%s\\%s", DirectoryName, FileName);
- //
- // printf ("Found file: %s\n", FullFileName);
- //
- FileExtension = GetFileExtension (FileName);
-
- //
- // Process these for GUID checks
- //
- if (gOptions.CheckGuids) {
- switch (FileExtension) {
- case FILE_EXTENSION_C:
- case FILE_EXTENSION_H:
- Status = ProcessCFileGuids (FullFileName);
- break;
-
- case FILE_EXTENSION_PKG:
- Status = ProcessPkgFileGuids (FullFileName);
- break;
-
- case FILE_EXTENSION_IA32_INC:
- case FILE_EXTENSION_IA32_ASM:
- Status = ProcessIA32FileGuids (FullFileName);
- break;
-
- case FILE_EXTENSION_INF:
- Status = ProcessINFFileGuids (FullFileName);
- break;
-
- case FILE_EXTENSION_IA64_INC:
- case FILE_EXTENSION_IA64_ASM:
- Status = ProcessIA64FileGuids (FullFileName);
- break;
-
- default:
- //
- // No errors anyway
- //
- Status = STATUS_SUCCESS;
- break;
- }
- }
-
- if (gOptions.CheckSignatures) {
- switch (FileExtension) {
- case FILE_EXTENSION_C:
- case FILE_EXTENSION_H:
- Status = ProcessCFileSigs (FullFileName);
- break;
-
- default:
- //
- // No errors anyway
- //
- Status = STATUS_SUCCESS;
- break;
- }
- }
-
- return Status;
-}
-//
-// Return a code indicating the file name extension.
-//
-static
-UINT32
-GetFileExtension (
- INT8 *FileName
- )
-{
- INT8 *Extension;
- int Index;
-
- //
- // Look back for a filename extension
- //
- for (Extension = FileName + strlen (FileName) - 1; Extension >= FileName; Extension--) {
- if (*Extension == '.') {
- for (Index = 0; FileTypeTable[Index].Extension != NULL; Index++) {
- if (stricmp (FileTypeTable[Index].Extension, Extension) == 0) {
- return FileTypeTable[Index].ExtensionCode;
- }
- }
- }
- }
-
- return FILE_TYPE_UNKNOWN;
-}
-//
-// Process a .pkg file.
-//
-// Look for FFS_FILEGUID=35b898ca-b6a9-49ce-8c72-904735cc49b7
-//
-static
-STATUS
-ProcessPkgFileGuids (
- INT8 *FileName
- )
-{
- FILE *Fptr;
- INT8 Line[MAX_LINE_LEN * 2];
- INT8 *Cptr;
- INT8 *Cptr2;
- UINT32 GuidScan[11];
- UINT64 Guid64;
-
- if ((Fptr = fopen (FileName, "r")) == NULL) {
- Error (NULL, 0, 0, FileName, "could not open input file for reading");
- return STATUS_ERROR;
- }
- //
- // Read lines from the file until done
- //
- while (fgets (Line, sizeof (Line), Fptr) != NULL) {
- Cptr = Line;
- Cptr += SkipWhiteSpace (Line);
- if (strncmp (Cptr, "FFS_FILEGUID", 12) == 0) {
- Cptr += 12;
- Cptr += SkipWhiteSpace (Cptr);
- if (*Cptr == '=') {
- Cptr++;
- Cptr += SkipWhiteSpace (Cptr + 1);
- //
- // Blank out dashes on the line.
- //
- for (Cptr2 = Cptr; *Cptr2; Cptr2++) {
- if (*Cptr2 == '-') {
- *Cptr2 = ' ';
- }
- }
-
- if (sscanf (
- Cptr,
- "%X %X %X %X %I64X",
- &GuidScan[0],
- &GuidScan[1],
- &GuidScan[2],
- &GuidScan[3],
- &Guid64
- ) == 5) {
- AddPkgGuid (FileName, GuidScan, &Guid64);
- } else {
- DebugMsg (NULL, 0, 0, FileName, "GUID scan failed");
- }
- }
- }
- }
-
- fclose (Fptr);
- return STATUS_SUCCESS;
-}
-//
-// Process an IA32 assembly file.
-//
-// Look for:
-// FIND_FD_GUID_VAL equ 01h, 01h, 01h, 01h, 01h, 01h, 01h, 01h, 01h, 01h, 01h, 01h, 01h, 01h, 01h, 01h
-// PEI_GUID_FileNameGuid_Gmch815 equ 081818181h, 08181h, 08181h, 081h, 081h, 081h, 081h, 081h, 081h, 081h, 081h
-//
-static
-STATUS
-ProcessIA32FileGuids (
- INT8 *FileName
- )
-{
- FILE *Fptr;
- INT8 Line[MAX_LINE_LEN];
- INT8 *Cptr;
- INT8 CSave;
- INT8 *CSavePtr;
- UINT32 Len;
- UINT32 GuidData[16];
- UINT32 Index;
-
- if ((Fptr = fopen (FileName, "r")) == NULL) {
- Error (NULL, 0, 0, FileName, "could not open input file for reading");
- return STATUS_ERROR;
- }
- //
- // Read lines from the file until done
- //
- while (fgets (Line, sizeof (Line), Fptr) != NULL) {
- Cptr = Line;
- Cptr += SkipWhiteSpace (Line);
- //
- // Look for xxxGUIDyyy equ 01h, 02h, 03h, ...
- //
- Len = ValidSymbolName (Cptr);
- if (Len) {
- //
- // Terminate the line after the symbol name, then look for "guid" in
- // the name.
- //
- CSavePtr = Cptr + Len;
- CSave = *CSavePtr;
- *CSavePtr = 0;
- while (*Cptr) {
- if (strnicmp (Cptr, "guid", 4) == 0) {
- break;
- }
-
- Cptr++;
- }
- //
- // If we found the string "guid", continue
- //
- if (*Cptr) {
- //
- // Restore the character on the line where we null-terminated the symbol
- //
- *CSavePtr = CSave;
- Cptr = CSavePtr;
- Len = SkipWhiteSpace (Cptr);
- //
- // Had to be some white space
- //
- if (Len) {
- Cptr += Len;
- //
- // now look for "equ"
- //
- if (strnicmp (Cptr, "equ", 3) == 0) {
- Cptr += 3;
- Cptr += SkipWhiteSpace (Cptr);
- //
- // Now scan all the data
- //
- for (Index = 0; Index < 16; Index++) {
- if (sscanf (Cptr, "%X", &GuidData[Index]) != 1) {
- break;
- }
- //
- // Skip to next
- //
- while (isxdigit (*Cptr)) {
- Cptr++;
- }
-
- if ((*Cptr != 'h') && (*Cptr != 'H')) {
- break;
- } else {
- Cptr++;
- while (*Cptr && (isspace (*Cptr) || (*Cptr == ','))) {
- Cptr++;
- }
- }
- }
- //
- // Now see which form we had
- //
- if (Index == 16) {
- AddGuid16 (FileName, GuidData);
- } else if (Index == 11) {
- AddGuid11 (FileName, GuidData, NULL);
- }
- }
- }
- }
- }
- }
-
- fclose (Fptr);
- return STATUS_SUCCESS;
-}
-//
-// Found and parsed an IA32 assembly code guid. Save the 16 bytes off in the list
-// of guids.
-//
-static
-STATUS
-AddGuid16 (
- INT8 *FileName,
- UINT32 *Data
- )
-{
- GUID_RECORD *NewRec;
- int Index;
-
- //
- // Sanity check the data
- //
- if (!CheckGuidData (Data, 16)) {
- return STATUS_ERROR;
- }
- //
- // Allocate memory for a new guid structure
- //
- NewRec = malloc (sizeof (GUID_RECORD));
- if (NewRec == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- memset ((char *) NewRec, 0, sizeof (GUID_RECORD));
- NewRec->FileName = malloc (strlen (FileName) + 1);
- if (NewRec->FileName == NULL) {
- free (NewRec);
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (NewRec->FileName, FileName);
- NewRec->Guid.Data1 = (UINT32) (Data[0] | (Data[1] << 8) | (Data[2] << 16) | (Data[3] << 24));
- NewRec->Guid.Data2 = (UINT16) (Data[4] | (Data[5] << 8));
- NewRec->Guid.Data3 = (UINT16) (Data[6] | (Data[7] << 8));
- for (Index = 0; Index < 8; Index++) {
- NewRec->Guid.Data4[Index] = (UINT8) Data[Index + 8];
- }
- //
- // Add it to the list
- //
- NewRec->Next = gGuidList;
- gGuidList = NewRec;
-
- //
- // Report it
- // ReportGuid (FileName, NewRec);
- //
- return STATUS_SUCCESS;
-}
-//
-// Add a GUID defined as GuidLow: 0x1122334455667788
-// GuidHi: 0x99AABBCCDDEEFF00
-//
-// These are equivalent:
-// { 0x11223344, 0x5566, 0x7788, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00 }
-// and:
-// Low: 00FFEEDDCCBBAA99
-// Hi: 7788556611223344
-//
-static
-STATUS
-AddGuid64x2 (
- INT8 *FileName,
- UINT32 DataHH, // Upper 32-bits of upper 64 bits of guid
- UINT32 DataHL, // Lower 32-bits of upper 64 bits
- UINT32 DataLH,
- UINT32 DataLL
- )
-{
- GUID_RECORD *NewRec;
- int Index;
-
- //
- // Allocate memory for a new guid structure
- //
- NewRec = malloc (sizeof (GUID_RECORD));
- if (NewRec == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- memset ((char *) NewRec, 0, sizeof (GUID_RECORD));
- NewRec->FileName = malloc (strlen (FileName) + 1);
- if (NewRec->FileName == NULL) {
- free (NewRec);
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (NewRec->FileName, FileName);
- NewRec->Guid.Data1 = DataHL;
- NewRec->Guid.Data2 = (UINT16) DataHH;
- NewRec->Guid.Data3 = (UINT16) (DataHH >> 16);
- for (Index = 0; Index < 4; Index++) {
- NewRec->Guid.Data4[Index] = (UINT8) DataLL;
- DataLL >>= 8;
- }
-
- for (Index = 0; Index < 4; Index++) {
- NewRec->Guid.Data4[Index + 4] = (UINT8) DataLH;
- DataLH >>= 8;
- }
- //
- // Add it to the list
- //
- NewRec->Next = gGuidList;
- gGuidList = NewRec;
-
- //
- // Report it
- // ReportGuid (FileName, NewRec);
- //
- return STATUS_SUCCESS;
-}
-//
-// Process INF files. Look for:
-// FILE_GUID = 240612B6-A063-11d4-9A3A-0090273FC14D
-//
-static
-STATUS
-ProcessINFFileGuids (
- INT8 *FileName
- )
-{
- FILE *Fptr;
- INT8 Line[MAX_LINE_LEN * 2];
- INT8 *Cptr;
- INT8 *Cptr2;
- UINT32 GuidScan[11];
- UINT64 Guid64;
-
- if ((Fptr = fopen (FileName, "r")) == NULL) {
- Error (NULL, 0, 0, FileName, "could not open input file for reading");
- return STATUS_ERROR;
- }
- //
- // Read lines from the file until done
- //
- while (fgets (Line, sizeof (Line), Fptr) != NULL) {
- Cptr = Line;
- Cptr += SkipWhiteSpace (Line);
- if (strncmp (Cptr, "FILE_GUID", 9) == 0) {
- Cptr += 9;
- Cptr += SkipWhiteSpace (Cptr);
- if (*Cptr == '=') {
- Cptr++;
- Cptr += SkipWhiteSpace (Cptr + 1);
- //
- // Blank out dashes on the line.
- //
- for (Cptr2 = Cptr; *Cptr2; Cptr2++) {
- if (*Cptr2 == '-') {
- *Cptr2 = ' ';
- }
- }
-
- if (sscanf (
- Cptr,
- "%X %X %X %X %I64X",
- &GuidScan[0],
- &GuidScan[1],
- &GuidScan[2],
- &GuidScan[3],
- &Guid64
- ) == 5) {
- AddPkgGuid (FileName, GuidScan, &Guid64);
- } else {
- DebugMsg (NULL, 0, 0, FileName, "GUID scan failed");
- }
- }
- }
- }
-
- fclose (Fptr);
- return STATUS_SUCCESS;
-}
-//
-// Parse ('g','m','a','p','a','b','c','d')
-//
-static
-STATUS
-AddSignature (
- INT8 *FileName,
- INT8 *StrDef,
- UINT32 SigSize
- )
-{
- SIGNATURE_RECORD *NewRec;
- INT8 *Cptr;
- UINT32 Index;
- BOOLEAN Fail;
-
- //
- // Allocate memory for the new record
- //
- Fail = FALSE;
- NewRec = malloc (sizeof (SIGNATURE_RECORD));
- if (NewRec == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
- //
- // Allocate memory to save the file name
- //
- NewRec->FileName = malloc (strlen (FileName) + 1);
- if (NewRec->FileName == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- free (NewRec);
- return STATUS_ERROR;
- }
- //
- // Fill in the fields
- //
- strcpy (NewRec->FileName, FileName);
- NewRec->Signature.DataLen = (UINT8) SigSize;
- //
- // Skip to open parenthesis
- //
- Cptr = StrDef;
- Cptr += SkipWhiteSpace (Cptr);
- if (*Cptr != '(') {
- Fail = TRUE;
- goto Done;
- }
-
- Cptr++;
- //
- // Skip to first ' and start processing
- //
- while (*Cptr && (*Cptr != '\'')) {
- Cptr++;
- }
-
- for (Index = 0; Index < SigSize; Index++) {
- if (*Cptr == '\'') {
- Cptr++;
- NewRec->Signature.Data[Index] = (INT8) *Cptr;
- //
- // Skip to closing quote
- //
- Cptr++;
- if (*Cptr != '\'') {
- Fail = TRUE;
- break;
- }
- //
- // Skip over closing quote, go to next one
- //
- Cptr++;
- while (*Cptr && (*Cptr != '\'')) {
- Cptr++;
- }
- } else {
- Fail = TRUE;
- DebugMsg (NULL, 0, 0, StrDef, "failed to parse signature");
- break;
- }
- }
-
-Done:
- if (Fail) {
- free (NewRec->FileName);
- free (NewRec);
- return STATUS_ERROR;
- }
-
- NewRec->Next = gSignatureList;
- gSignatureList = NewRec;
- return STATUS_SUCCESS;
-}
-//
-// Look for:
-// #define POOL_HEAD_SIGNATURE EFI_SIGNATURE_16('p','h')
-// #define GCD_MEMORY_MAP_SIGNATURE EFI_SIGNATURE_32('g','m','a','p')
-// #define GCD_MEMORY_MAP_SIGNATURE EFI_SIGNATURE_64('g','m','a','p','a','b','c','d')
-//
-static
-STATUS
-ProcessCFileSigs (
- INT8 *FileName
- )
-{
- FILE *Fptr;
- INT8 Line[MAX_LINE_LEN * 2];
- INT8 *Cptr;
- UINT32 Len;
- UINT32 LineLen;
-
- if ((Fptr = fopen (FileName, "r")) == NULL) {
- Error (NULL, 0, 0, FileName, "could not open input file for reading");
- return STATUS_ERROR;
- }
- //
- // Read lines from the file until done
- //
- while (fgets (Line, sizeof (Line), Fptr) != NULL) {
- Cptr = Line;
- Cptr += SkipWhiteSpace (Line);
- //
- // look for #define xxxGUIDxxx value
- //
- if (*Cptr == '#') {
- Cptr++;
- Cptr += SkipWhiteSpace (Cptr);
- //
- // Look for "define"
- //
- if (!strncmp (Cptr, "define", 6)) {
- Cptr += 6;
- //
- // Better be whitespace
- //
- Len = SkipWhiteSpace (Cptr);
- if (Len) {
- Cptr += Len;
- //
- // See if it's a valid symbol name
- //
- Len = ValidSymbolName (Cptr);
- if (Len) {
- //
- // It is a valid symbol name. See if there's a line continuation,
- // and if so, read one more line.
- // Skip over the symbol name and look for the string "EFI_SIGNATURE_xx"
- //
- LineLen = strlen (Line);
- if ((Line[LineLen - 1] == '\n') && (Line[LineLen - 2] == '\\')) {
- fgets (Line + LineLen - 2, sizeof (Line) - LineLen, Fptr);
- } else if (Line[LineLen - 1] == '\\') {
- fgets (Line + LineLen - 1, sizeof (Line) - LineLen, Fptr);
- }
-
- Cptr += Len;
- Cptr += SkipWhiteSpace (Cptr);
- if (strncmp (Cptr, "EFI_SIGNATURE_16", 16) == 0) {
- AddSignature (FileName, Cptr + 16, 2);
- } else if (strncmp (Cptr, "EFI_SIGNATURE_32", 16) == 0) {
- AddSignature (FileName, Cptr + 16, 4);
- } else if (strncmp (Cptr, "EFI_SIGNATURE_64", 16) == 0) {
- AddSignature (FileName, Cptr + 16, 8);
- }
- }
- }
- }
- }
- }
-
- fclose (Fptr);
- return STATUS_SUCCESS;
-}
-//
-// look for #define xxxGUIDyyy { 0x...}
-// xxx EFI_GUID GuidName = { 0x... };
-//
-static
-STATUS
-ProcessCFileGuids (
- INT8 *FileName
- )
-{
- FILE *Fptr;
- INT8 Line[MAX_LINE_LEN * 2];
- INT8 *Cptr;
- INT8 CSave;
- INT8 *CSavePtr;
- INT8 *TempCptr;
- INT8 *SymName;
- UINT32 Len;
- UINT32 LineLen;
- UINT32 GuidScan[11];
-
- if ((Fptr = fopen (FileName, "r")) == NULL) {
- Error (NULL, 0, 0, FileName, "could not open input file for reading");
- return STATUS_ERROR;
- }
- //
- // Read lines from the file until done
- //
- while (fgets (Line, sizeof (Line), Fptr) != NULL) {
- Cptr = Line;
- Cptr += SkipWhiteSpace (Line);
- //
- // look for #define xxxGUIDxxx value
- //
- if (*Cptr == '#') {
- Cptr++;
- Cptr += SkipWhiteSpace (Cptr);
- //
- // Look for "define"
- //
- if (!strncmp (Cptr, "define", 6)) {
- Cptr += 6;
- //
- // Better be whitespace
- //
- Len = SkipWhiteSpace (Cptr);
- if (Len) {
- Cptr += Len;
- //
- // See if it's a valid symbol name
- //
- Len = ValidSymbolName (Cptr);
- if (Len) {
- //
- // It is a valid symbol name. See if there's a line continuation,
- // and if so, read one more line.
- // Then truncate after the symbol name, look for the string "GUID",
- // and continue.
- //
- SymName = Cptr;
- LineLen = strlen (Line);
- if ((Line[LineLen - 1] == '\n') && (Line[LineLen - 2] == '\\')) {
- fgets (Line + LineLen - 2, sizeof (Line) - LineLen, Fptr);
- } else if (Line[LineLen - 1] == '\\') {
- fgets (Line + LineLen - 1, sizeof (Line) - LineLen, Fptr);
- }
-
- CSavePtr = Cptr + Len;
- CSave = *CSavePtr;
- *CSavePtr = 0;
- while (*Cptr) {
- if (strncmp (Cptr, "GUID", 4) == 0) {
- break;
- }
-
- Cptr++;
- }
- //
- // If we didn't run out of string, then we found the GUID string.
- // Now look for { 0x....... }
- //
- if (*Cptr) {
- Cptr = CSavePtr;
- *CSavePtr = CSave;
- Cptr += SkipWhiteSpace (Cptr);
- if (*Cptr == '{') {
- *Cptr = 0;
- Cptr++;
- //
- // 0x665E3FF6, 0x46CC, 0x11d4, 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }
- // If you have one suffixed with "L", then it doesn't work. So hack off 'L' characters
- // in the string.
- //
- for (TempCptr = Cptr; *TempCptr; TempCptr++) {
- if (*TempCptr == 'L') {
- if (*(TempCptr + 1) == ',') {
- *TempCptr = ',';
- *(TempCptr + 1) = ' ';
- }
- }
- }
-
- if (sscanf (
- Cptr,
- "%X, %X, %X, %X, %X, %X, %X, %X, %X, %X, %X",
- &GuidScan[0],
- &GuidScan[1],
- &GuidScan[2],
- &GuidScan[3],
- &GuidScan[4],
- &GuidScan[5],
- &GuidScan[6],
- &GuidScan[7],
- &GuidScan[8],
- &GuidScan[9],
- &GuidScan[10]
- ) == 11) {
- AddGuid11 (FileName, GuidScan, SymName);
- }
- }
- }
- }
- }
- }
- //
- // Else look for "static EFI_GUID xxxGUIDxxx = { 0x.... };
- //
- } else if ((CSavePtr = strstr (Line, "EFI_GUID")) != NULL) {
- //
- // Read the next line if line continuation
- //
- LineLen = strlen (Line);
- if ((Line[LineLen - 1] == '\n') && (Line[LineLen - 2] == '\\')) {
- fgets (Line + LineLen - 2, sizeof (Line) - LineLen, Fptr);
- } else if (Line[LineLen - 1] == '\\') {
- fgets (Line + LineLen - 1, sizeof (Line) - LineLen, Fptr);
- }
-
- Cptr = CSavePtr + 8;
- Cptr += SkipWhiteSpace (Cptr);
- //
- // Should be variable name next
- //
- Len = ValidSymbolName (Cptr);
- SymName = Cptr;
- Cptr += Len;
- Cptr += SkipWhiteSpace (Cptr);
- if (*Cptr == '=') {
- Cptr++;
- Cptr += SkipWhiteSpace (Cptr);
- //
- // Should be open-brace next to define guid
- //
- if (*Cptr == '{') {
- Cptr++;
- //
- // 0x665E3FF6, 0x46CC, 0x11d4, 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }
- //
- if (sscanf (
- Cptr,
- "%X, %X, %X, %X, %X, %X, %X, %X, %X, %X, %X",
- &GuidScan[0],
- &GuidScan[1],
- &GuidScan[2],
- &GuidScan[3],
- &GuidScan[4],
- &GuidScan[5],
- &GuidScan[6],
- &GuidScan[7],
- &GuidScan[8],
- &GuidScan[9],
- &GuidScan[10]
- ) == 11) {
- AddGuid11 (FileName, GuidScan, Cptr);
- //
- // printf ("Found guid: %s", Cptr);
- //
- }
- }
- }
- }
- }
-
- fclose (Fptr);
- return STATUS_SUCCESS;
-}
-//
-// Process Intel Itanium(TM) GUID definitions. Look for:
-// #define Cs870MemoryTestPEIMGuidL 0x9C2403386E1C8FAA
-// #define Cs870MemoryTestPEIMGuidH 0xE89E95C6180342f0
-// in either order.
-// This function assumes no blank lines between definitions.
-//
-static
-STATUS
-ProcessIA64FileGuids (
- INT8 *FileName
- )
-{
- FILE *Fptr;
- INT8 Line[MAX_LINE_LEN];
- UINT32 Guid1H;
- UINT32 Guid1L;
- UINT32 Guid2H;
- UINT32 Guid2L;
- INT8 SymName1[MAX_LINE_LEN];
- INT8 SymName2[MAX_LINE_LEN];
- BOOLEAN Done;
- BOOLEAN LowFirst;
- BOOLEAN FoundLow;
-
- if ((Fptr = fopen (FileName, "r")) == NULL) {
- Error (NULL, 0, 0, FileName, "could not open input file for reading");
- return STATUS_ERROR;
- }
-
- Done = FALSE;
- if (fgets (Line, sizeof (Line), Fptr) == NULL) {
- Done = 1;
- }
- //
- // Read lines from the file until done. Since the guid definition takes
- // two lines, we read lines in different places to recover gracefully
- // from mismatches. For example, if you thought you found the first half,
- // but the next line had a symbol mismatch, then you have to process the
- // line again in case it's the start of a new definition.
- //
- while (!Done) {
- //
- // Check current line for GUID definition. Assume low define first.
- //
- if (IsIA64GuidLine (Line, &Guid1H, &Guid1L, &FoundLow, SymName1)) {
- //
- // Might have to swap guids later. Save off if we found the LOW first
- //
- if (FoundLow) {
- LowFirst = TRUE;
- } else {
- LowFirst = FALSE;
- }
- //
- // Read the next line and try for the rest of the guid definition
- //
- if (fgets (Line, sizeof (Line), Fptr) == NULL) {
- Done = 1;
- } else {
- if (IsIA64GuidLine (Line, &Guid2H, &Guid2L, &FoundLow, SymName2)) {
- //
- // Found another. If the symbol names match, then save it off.
- //
- if (strcmp (SymName1, SymName2) == 0) {
- //
- // Yea, found one. Save it off.
- //
- if (LowFirst) {
- AddGuid64x2 (FileName, Guid2H, Guid2L, Guid1H, Guid1L);
- } else {
- AddGuid64x2 (FileName, Guid1H, Guid1L, Guid2H, Guid2L);
- }
- //
- // Read the next line for processing
- //
- if (fgets (Line, sizeof (Line), Fptr) == NULL) {
- Done = 1;
- }
- } else {
- //
- // Don't get another line so that we reprocess this line in case it
- // contains the start of a new definition.
- // fprintf (stdout, "Symbol name mismatch: %s: %s != %s\n",
- // FileName, SymName1, SymName2);
- //
- }
- } else {
- //
- // Second line was not a guid definition. Get the next line from the
- // file.
- //
- if (fgets (Line, sizeof (Line), Fptr) == NULL) {
- Done = 1;
- }
- }
- }
- } else {
- //
- // Not a guid define line. Next.
- //
- if (fgets (Line, sizeof (Line), Fptr) == NULL) {
- Done = 1;
- }
- }
- }
-
- fclose (Fptr);
- return STATUS_SUCCESS;
-}
-//
-// Given a line from an Itanium-based assembly file, check the line for a guid
-// defininition. One of either:
-// #define Cs870MemoryTestPEIMGuidL 0x9C2403386E1C8FAA
-// #define Cs870MemoryTestPEIMGuidH 0xE89E95C6180342f0
-// Return the defined value as two 32-bit values, and whether it's a high
-// or low guid.
-//
-static
-BOOLEAN
-IsIA64GuidLine (
- INT8 *Line,
- UINT32 *GuidHigh,
- UINT32 *GuidLow,
- BOOLEAN *FoundLow,
- INT8 *SymName
- )
-{
- INT8 *Cptr;
- INT8 CSave;
- INT8 *CSavePtr;
- INT8 *SymStart;
- UINT32 Len;
-
- Cptr = Line;
- Cptr += SkipWhiteSpace (Cptr);
- //
- // look for #define xxxGUID[L|H] 0xHexValue
- //
- if (*Cptr == '#') {
- Cptr++;
- Cptr += SkipWhiteSpace (Cptr);
- //
- // Look for "define"
- //
- if (!strncmp (Cptr, "define", 6)) {
- Cptr += 6;
- //
- // Better be whitespace
- //
- Len = SkipWhiteSpace (Cptr);
- if (Len) {
- Cptr += Len;
- //
- // See if it's a valid symbol name
- //
- Len = ValidSymbolName (Cptr);
- if (Len) {
- //
- // Save the start so we can copy it to their string if later checks are ok
- //
- SymStart = Cptr;
- //
- // It is a valid symbol name, look for the string GuidL or GuidH
- //
- CSavePtr = Cptr + Len;
- CSave = *CSavePtr;
- *CSavePtr = 0;
- while (*Cptr) {
- if (strncmp (Cptr, "GuidL", 5) == 0) {
- *FoundLow = 1;
- break;
- } else if (strncmp (Cptr, "GuidH", 5) == 0) {
- *FoundLow = 0;
- break;
- }
-
- Cptr++;
- }
- //
- // If we didn't run out of string, then we found the GUID string.
- // Restore the null character we inserted above and continue.
- // Now look for 0x.......
- //
- if (*Cptr) {
- //
- // Return symbol name less the "L" or "H"
- //
- strcpy (SymName, SymStart);
- SymName[strlen (SymName) - 1] = 0;
- Cptr = CSavePtr;
- *CSavePtr = CSave;
- Cptr += SkipWhiteSpace (Cptr);
- if ((*Cptr == '0') && (*(Cptr + 1) == 'x')) {
- //
- // skip over "0x"
- //
- Cptr += 2;
- //
- // 0x0123456789ABCDEF -- null terminate after 8 characters,
- // scan, replace the character and scan at that point.
- //
- CSave = *(Cptr + 8);
- *(Cptr + 8) = 0;
- if (sscanf (Cptr, "%X", GuidHigh) == 1) {
- *(Cptr + 8) = CSave;
- if (sscanf (Cptr + 8, "%X", GuidLow) == 1) {
- return TRUE;
- }
- }
- }
- }
- }
- }
- }
- }
-
- return FALSE;
-}
-//
-// Look at the characters in the string and determine if it's a valid
-// symbol name. Basically [a-zA-Z_][a-zA-Z_0-9]*
-//
-static
-UINT32
-ValidSymbolName (
- INT8 *Name
- )
-{
- int Len;
-
- Len = 0;
-
- //
- // Test first character
- //
- if (((*Name >= 'a') && (*Name <= 'z')) || ((*Name >= 'A') && (*Name <= 'Z')) || (*Name == '_')) {
- Name++;
- Len = 1;
- while (*Name) {
- if (((*Name >= 'a') && (*Name <= 'z')) ||
- ((*Name >= 'A') && (*Name <= 'Z')) ||
- ((*Name >= '0') && (*Name <= '9')) ||
- (*Name == '_')
- ) {
- Name++;
- Len++;
- } else {
- break;
- }
- }
- }
-
- return Len;
-}
-
-static
-UINT32
-SkipWhiteSpace (
- INT8 *Str
- )
-{
- UINT32 Len;
- Len = 0;
- while (isspace (*Str) && *Str) {
- Len++;
- Str++;
- }
-
- return Len;
-}
-//
-// found FFS_FILEGUID=35b898ca-b6a9-49ce-8c72-904735cc49b7
-//
-static
-STATUS
-AddPkgGuid (
- INT8 *FileName,
- UINT32 *Data,
- UINT64 *Data64
- )
-{
- GUID_RECORD *NewRec;
- int Index;
-
- //
- // Sanity check the data
- //
- if ((Data[1] | Data[2] | Data[3]) & 0xFFFF0000) {
- Error (NULL, 0, 0, "out of range value for GUID data word(s) [1] - [3]", NULL);
- return STATUS_ERROR;
- }
- //
- // More checks for Data64?
- // Allocate memory for a new one guid structure
- //
- NewRec = malloc (sizeof (GUID_RECORD));
- if (NewRec == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- memset ((char *) NewRec, 0, sizeof (GUID_RECORD));
- NewRec->FileName = malloc (strlen (FileName) + 1);
- if (NewRec->FileName == NULL) {
- free (NewRec);
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (NewRec->FileName, FileName);
- NewRec->Guid.Data1 = Data[0];
- NewRec->Guid.Data2 = (UINT16) Data[1];
- NewRec->Guid.Data3 = (UINT16) Data[2];
- NewRec->Guid.Data4[0] = (UINT8) Data[3];
- NewRec->Guid.Data4[1] = (UINT8) (Data[3] >> 8);
- for (Index = 2; Index < 8; Index++) {
- NewRec->Guid.Data4[Index] = (UINT8) *Data64;
- *Data64 >>= 8;
- }
- //
- // Add it to the list
- //
- NewRec->Next = gGuidList;
- gGuidList = NewRec;
-
- //
- // Report it
- // ReportGuid (FileName, NewRec);
- //
- return STATUS_SUCCESS;
-}
-//
-// Add a guid consisting of 11 fields to our list of guids
-//
-static
-STATUS
-AddGuid11 (
- INT8 *FileName,
- UINT32 *Data,
- INT8 *SymName
- )
-{
- GUID_RECORD *NewRec;
- int Index;
-
- //
- // Sanity check the data
- //
- if (!CheckGuidData (Data, 11)) {
- return STATUS_ERROR;
- }
- //
- // Allocate memory for a new one guid structure
- //
- NewRec = malloc (sizeof (GUID_RECORD));
- if (NewRec == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- memset ((char *) NewRec, 0, sizeof (GUID_RECORD));
- NewRec->FileName = malloc (strlen (FileName) + 1);
- if (NewRec->FileName == NULL) {
- free (NewRec);
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (NewRec->FileName, FileName);
- if (SymName != NULL) {
- NewRec->SymName = malloc (strlen (SymName) + 1);
- if (NewRec->SymName == NULL) {
- free (NewRec);
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
- }
-
- strcpy (NewRec->SymName, SymName);
-
- NewRec->Guid.Data1 = Data[0];
- NewRec->Guid.Data2 = (UINT16) Data[1];
- NewRec->Guid.Data3 = (UINT16) Data[2];
- for (Index = 0; Index < 8; Index++) {
- NewRec->Guid.Data4[Index] = (UINT8) Data[3 + Index];
- }
- //
- // Add it to the list
- //
- NewRec->Next = gGuidList;
- gGuidList = NewRec;
-
- //
- // Report it
- // ReportGuid (FileName, NewRec);
- //
- return STATUS_SUCCESS;
-}
-//
-// For debug purposes, print each guid found
-//
-// static
-// VOID
-// ReportGuid (
-// INT8 *FileName,
-// GUID_RECORD *NewGuid
-// )
-// {
-// //fprintf (stdout, "%s: 0x%08X\n", FileName, NewGuid->Guid.Data1);
-// }
-//
-// Free up memory we allocated to keep track of guids defined.
-//
-static
-VOID
-FreeGuids (
- VOID
- )
-{
- GUID_RECORD *NextRec;
- while (gGuidList != NULL) {
- NextRec = gGuidList->Next;
- if (gGuidList->FileName != NULL) {
- free (gGuidList->FileName);
- }
-
- if (gGuidList->SymName != NULL) {
- free (gGuidList->SymName);
- }
-
- free (gGuidList);
- gGuidList = NextRec;
- }
-}
-
-static
-VOID
-FreeSigs (
- VOID
- )
-{
- SIGNATURE_RECORD *NextRec;
- while (gSignatureList != NULL) {
- NextRec = gSignatureList->Next;
- if (gSignatureList->FileName != NULL) {
- free (gSignatureList->FileName);
- }
-
- free (gSignatureList);
- gSignatureList = NextRec;
- }
-}
-//
-// Scan through all guids defined and compare each for duplicates.
-//
-static
-STATUS
-CheckDuplicates (
- VOID
- )
-{
- GUID_RECORD *CurrentFile;
-
- GUID_RECORD *TempFile;
- SIGNATURE_RECORD *CurrentSig;
- SIGNATURE_RECORD *TempSig;
- STATUS Status;
- int Index;
- int DupCount;
- int Len;
- BOOLEAN Same;
- UINT32 GuidSum;
- INT8 *SymName;
-
- Status = STATUS_SUCCESS;
-
- //
- // If we're checking guids.....
- //
- if (gOptions.CheckGuids) {
- //
- // If -p option, print all guids found
- //
- if (gOptions.PrintFound) {
- CurrentFile = gGuidList;
- while (CurrentFile != NULL) {
- fprintf (
- stdout,
- "GUID: 0x%08X 0x%04X 0x%04X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X %s\n",
- (UINT32) CurrentFile->Guid.Data1,
- (UINT32) CurrentFile->Guid.Data2,
- (UINT32) CurrentFile->Guid.Data3,
- (UINT32) CurrentFile->Guid.Data4[0],
- (UINT32) CurrentFile->Guid.Data4[1],
- (UINT32) CurrentFile->Guid.Data4[2],
- (UINT32) CurrentFile->Guid.Data4[3],
- (UINT32) CurrentFile->Guid.Data4[4],
- (UINT32) CurrentFile->Guid.Data4[5],
- (UINT32) CurrentFile->Guid.Data4[6],
- (UINT32) CurrentFile->Guid.Data4[7],
- CurrentFile->FileName
- );
- CurrentFile = CurrentFile->Next;
- }
- }
-
- if (gOptions.GuidXReference) {
- CurrentFile = gGuidList;
- while (CurrentFile != NULL) {
- //
- // If no symbol name, print "unknown"
- //
- SymName = CurrentFile->SymName;
- if (SymName == NULL) {
- SymName = "unknown";
- }
-
- fprintf (
- stdout,
- "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X %s\n",
- (UINT32) CurrentFile->Guid.Data1,
- (UINT32) CurrentFile->Guid.Data2,
- (UINT32) CurrentFile->Guid.Data3,
- (UINT32) CurrentFile->Guid.Data4[0],
- (UINT32) CurrentFile->Guid.Data4[1],
- (UINT32) CurrentFile->Guid.Data4[2],
- (UINT32) CurrentFile->Guid.Data4[3],
- (UINT32) CurrentFile->Guid.Data4[4],
- (UINT32) CurrentFile->Guid.Data4[5],
- (UINT32) CurrentFile->Guid.Data4[6],
- (UINT32) CurrentFile->Guid.Data4[7],
- SymName
- );
- CurrentFile = CurrentFile->Next;
- }
- }
- //
- // Now go through all guids and report duplicates.
- //
- CurrentFile = gGuidList;
- while (CurrentFile != NULL) {
- DupCount = 0;
- TempFile = CurrentFile->Next;
- while (TempFile) {
- //
- // Compare the guids
- //
- if ((CurrentFile->Guid.Data1 == TempFile->Guid.Data1) &&
- (CurrentFile->Guid.Data2 == TempFile->Guid.Data2) &&
- (CurrentFile->Guid.Data3 == TempFile->Guid.Data3)
- ) {
- //
- // OR in all the guid bytes so we can ignore NULL-guid definitions.
- //
- GuidSum = CurrentFile->Guid.Data1 | CurrentFile->Guid.Data2 | CurrentFile->Guid.Data3;
- Same = TRUE;
- for (Index = 0; Index < 8; Index++) {
- GuidSum |= CurrentFile->Guid.Data4[Index];
- if (CurrentFile->Guid.Data4[Index] != TempFile->Guid.Data4[Index]) {
- Same = FALSE;
- break;
- }
- }
- //
- // If they're the same, and the guid was non-zero, print a message.
- //
- if (Same && GuidSum) {
- if (DupCount == 0) {
- Error (NULL, 0, 0, "duplicate GUIDS found", NULL);
- fprintf (stdout, " FILE1: %s\n", CurrentFile->FileName);
- }
-
- DupCount++;
- fprintf (stdout, " FILE%d: %s\n", DupCount + 1, TempFile->FileName);
- //
- // Flag it as reported so we don't report it again if there's three or more
- //
- TempFile->Reported = TRUE;
- }
- }
- //
- // Next one
- //
- TempFile = TempFile->Next;
- }
- //
- // Print the guid if we found duplicates
- //
- if (DupCount) {
- fprintf (
- stdout,
- " GUID: 0x%08X 0x%04X 0x%04X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
- (UINT32) CurrentFile->Guid.Data1,
- (UINT32) CurrentFile->Guid.Data2,
- (UINT32) CurrentFile->Guid.Data3,
- (UINT32) CurrentFile->Guid.Data4[0],
- (UINT32) CurrentFile->Guid.Data4[1],
- (UINT32) CurrentFile->Guid.Data4[2],
- (UINT32) CurrentFile->Guid.Data4[3],
- (UINT32) CurrentFile->Guid.Data4[4],
- (UINT32) CurrentFile->Guid.Data4[5],
- (UINT32) CurrentFile->Guid.Data4[6],
- (UINT32) CurrentFile->Guid.Data4[7]
- );
- //
- // return STATUS_ERROR;
- //
- }
- //
- // Find the next one that hasn't been reported
- //
- do {
- CurrentFile = CurrentFile->Next;
- } while ((CurrentFile != NULL) && (CurrentFile->Reported));
- }
- }
-
- if (gOptions.CheckSignatures) {
- //
- // Print ones found if specified
- //
- if (gOptions.PrintFound) {
- CurrentSig = gSignatureList;
- while (CurrentSig != NULL) {
- Len = CurrentSig->Signature.DataLen;
- for (Index = 0; Index < Len; Index++) {
- fprintf (stdout, "%c", CurrentSig->Signature.Data[Index]);
- }
-
- fprintf (stdout, " %s\n", CurrentSig->FileName);
- CurrentSig = CurrentSig->Next;
- }
- }
-
- CurrentSig = gSignatureList;
- while (CurrentSig != NULL) {
- DupCount = 0;
- TempSig = CurrentSig->Next;
- Len = CurrentSig->Signature.DataLen;
- while (TempSig) {
- //
- // Check for same length, then do string compare
- //
- if (Len == TempSig->Signature.DataLen) {
- if (strncmp (CurrentSig->Signature.Data, TempSig->Signature.Data, Len) == 0) {
- //
- // Print header message if first failure for this sig
- //
- if (DupCount == 0) {
- Error (NULL, 0, 0, "duplicate signatures found", NULL);
- fprintf (stdout, " FILE1: %s\n", CurrentSig->FileName);
- }
-
- DupCount++;
- fprintf (stdout, " FILE%d: %s\n", DupCount + 1, TempSig->FileName);
- TempSig->Reported = TRUE;
- }
- }
-
- TempSig = TempSig->Next;
- }
-
- if (DupCount) {
- fprintf (stdout, " SIG: ");
- for (Index = 0; Index < Len; Index++) {
- fprintf (stdout, "%c", CurrentSig->Signature.Data[Index]);
- }
-
- fprintf (stdout, "\n");
- }
- //
- // On to the next one that hasn't been reported
- //
- do {
- CurrentSig = CurrentSig->Next;
- } while ((CurrentSig != NULL) && (CurrentSig->Reported));
- }
- }
-
- return Status;
-}
-
-static
-VOID
-FreeOptions (
- VOID
- )
-/*++
-
-Routine Description:
- Free up any memory we allocated when processing command-line options.
-
-Arguments:
- None.
-
-Returns:
- NA
-
-Notes:
- We don't free up the ->Str fields because we did not allocate them.
- Instead, we just set the pointer to point to the actual parameter
- from the command line.
-
---*/
-{
- STRING_LIST *Ptr;
- while (gOptions.ExcludeDirs != NULL) {
- Ptr = gOptions.ExcludeDirs->Next;
- //
- // free (gOptions.ExcludeDirs->Str);
- //
- free (gOptions.ExcludeDirs);
- gOptions.ExcludeDirs = Ptr;
- }
-
- while (gOptions.ExcludeSubDirs != NULL) {
- Ptr = gOptions.ExcludeSubDirs->Next;
- //
- // free (gOptions.ExcludeSubDirs->Str);
- //
- free (gOptions.ExcludeSubDirs);
- gOptions.ExcludeSubDirs = Ptr;
- }
-
- while (gOptions.ExcludeExtensions != NULL) {
- Ptr = gOptions.ExcludeExtensions->Next;
- //
- // free (gOptions.ExcludeExtensions->Str);
- //
- free (gOptions.ExcludeExtensions);
- gOptions.ExcludeExtensions = Ptr;
- }
-
- while (gOptions.ExcludeFiles != NULL) {
- Ptr = gOptions.ExcludeFiles->Next;
- //
- // free (gOptions.ExcludeFiles->Str);
- //
- free (gOptions.ExcludeFiles);
- gOptions.ExcludeFiles = Ptr;
- }
-}
-//
-// Given an array of 32-bit data, validate the data for the given number of
-// guid data. For example, it might have been scanned as 16 bytes of data, or
-// 11 fields of data.
-//
-static
-BOOLEAN
-CheckGuidData (
- UINT32 *Data,
- UINT32 DataCount
- )
-{
- UINT32 Index;
-
- if (DataCount == 16) {
- for (Index = 0; Index < 16; Index++) {
- if (Data[Index] &~0xFF) {
- return FALSE;
- }
- }
-
- return TRUE;
- } else if (DataCount == 11) {
- //
- // Data[0] never out of range (32-bit)
- //
- if ((Data[1] | Data[2]) &~0xFFFF) {
- //
- // Error ("Out of range value for GUID data word(s) [1] and/or [2]");
- //
- return FALSE;
- }
-
- for (Index = 0; Index < 8; Index++) {
- if (Data[Index + 3] &~0xFF) {
- //
- // Error ("Out of range value for GUID data byte(s) [4] - [11]");
- //
- return FALSE;
- }
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/Tools/CCode/Source/GuidChk/GuidList.c b/Tools/CCode/Source/GuidChk/GuidList.c
deleted file mode 100644
index bb6a44d85e..0000000000
--- a/Tools/CCode/Source/GuidChk/GuidList.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- GuidList.c
-
-Abstract:
-
- Utility to create a GUID-to-name listing file that can
- be used by other utilities. Basic operation is to take the
- table of name+GUIDs that we have compiled into this utility,
- and create a text file that can be parsed by other utilities
- to do replacement of "name" with "GUID".
-
-Notes:
- To add a new GUID to this database:
- 1. Add a "#include EFI_GUID_DEFINITION(name)" statement below
- 2. Modify the mGuidList[] array below to add the new GUID name
-
- The only issue that may come up is that, if the source GUID file
- is not in the standard GUID directory, then this utility won't
- compile because the #include fails. In this case you'd need
- to define a new macro (if it's in a standard place) or modify
- this utility's makefile to add the path to your new .h file.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Guid/Apriori.h>
-#include <Guid/AcpiTableStorage.h>
-
-#include "EfiUtilityMsgs.h"
-
-
-#define GUID_XREF(varname, guid) { \
- #varname, #guid, guid \
- }
-
-#define NULL_GUID \
- { \
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 \
- }
-
-typedef struct {
- INT8 *VariableName;
- INT8 *DefineName;
- EFI_GUID Guid;
-} GUID_LIST;
-
-//
-// This is our table of all GUIDs we want to print out to create
-// a GUID-to-name cross reference.
-// Use the #defined name from the GUID definition's source .h file.
-//
-static GUID_LIST mGuidList[] = {
- GUID_XREF(gAprioriGuid, EFI_APRIORI_GUID),
- GUID_XREF(gEfiAcpiTableStorageGuid, EFI_ACPI_TABLE_STORAGE_GUID),
- // FIXME The next line was removed in the port to R9.
- // GUID_XREF(gEfiDefaultBmpLogoGuid, EFI_DEFAULT_BMP_LOGO_GUID),
- GUID_XREF(gEfiAcpiTableStorageGuid, EFI_ACPI_TABLE_STORAGE_GUID),
- //
- // Terminator
- //
- {
- NULL,
- NULL,
- NULL_GUID
- }
-};
-
-void
-PrintGuidText (
- FILE *OutFptr,
- INT8 *VariableName,
- INT8 *DefineName,
- EFI_GUID *Guid
- );
-
-int
-CreateGuidList (
- INT8 *OutFileName
- )
-/*++
-
-Routine Description:
- Print our GUID/name list to the specified output file.
-
-Arguments:
- OutFileName - name of the output file to write our results to.
-
-Returns:
- 0 if successful
- nonzero otherwise
-
---*/
-{
- FILE *OutFptr;
- int Index;
-
- //
- // Open output file for writing. If the name is NULL, then write to stdout
- //
- if (OutFileName != NULL) {
- OutFptr = fopen (OutFileName, "w");
- if (OutFptr == NULL) {
- Error (NULL, 0, 0, OutFileName, "failed to open output file for writing");
- return STATUS_ERROR;
- }
- } else {
- OutFptr = stdout;
- }
-
- for (Index = 0; mGuidList[Index].VariableName != NULL; Index++) {
- PrintGuidText (OutFptr, mGuidList[Index].VariableName, mGuidList[Index].DefineName, &mGuidList[Index].Guid);
- }
- //
- // Close the output file if they specified one.
- //
- if (OutFileName != NULL) {
- fclose (OutFptr);
- }
-
- return STATUS_SUCCESS;
-}
-
-void
-PrintGuidText (
- FILE *OutFptr,
- INT8 *VariableName,
- INT8 *DefineName,
- EFI_GUID *Guid
- )
-/*++
-
-Routine Description:
- Print a GUID/name combo in INF-style format
-
- guid-guid-guid-guid DEFINE_NAME gName
-
-Arguments:
- OutFptr - file pointer to which to write the output
- VariableName - the GUID variable's name
- DefineName - the name used in the #define
- Guid - pointer to the GUID value
-
-Returns:
- NA
-
---*/
-{
- if (OutFptr == NULL) {
- OutFptr = stdout;
- }
-
- fprintf (
- OutFptr,
- "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X %s %s\n",
- 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],
- DefineName,
- VariableName
- );
-}
diff --git a/Tools/CCode/Source/GuidChk/UtilsMsgs.c b/Tools/CCode/Source/GuidChk/UtilsMsgs.c
deleted file mode 100644
index 8aa343fc19..0000000000
--- a/Tools/CCode/Source/GuidChk/UtilsMsgs.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- UtilsMsgs.c
-
-Abstract:
-
- EFI tools utility functions to display warning, error, and informational
- messages.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
-
-#include <Common/UefiBaseTypes.h>
-
-#include "EfiUtilityMsgs.h"
-
-#define MAX_LINE_LEN 200
-
-//
-// Declare module globals for keeping track of the the utility's
-// name and other settings.
-//
-static STATUS mStatus = STATUS_SUCCESS;
-static INT8 mUtilityName[50] = { 0 };
-static INT8 *mSourceFileName = NULL;
-static UINT32 mSourceFileLineNum = 0;
-static UINT32 mErrorCount = 0;
-static UINT32 mWarningCount = 0;
-static UINT32 mDebugMsgMask = 0;
-
-static
-void
-PrintMessage (
- INT8 *Type,
- INT8 *FileName,
- UINT32 LineNumber,
- UINT32 MessageCode,
- INT8 *Text,
- INT8 *MsgFmt,
- va_list List
- );
-
-void
-Error (
- INT8 *FileName,
- UINT32 LineNumber,
- UINT32 MessageCode,
- INT8 *Text,
- INT8 *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
- utilty 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;
- mErrorCount++;
- va_start (List, MsgFmt);
- PrintMessage ("error", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
- va_end (List);
- //
- // Set status accordingly
- //
- if (mStatus < STATUS_ERROR) {
- mStatus = STATUS_ERROR;
- }
-}
-
-void
-ParserError (
- UINT32 MessageCode,
- INT8 *Text,
- INT8 *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;
- mErrorCount++;
- va_start (List, MsgFmt);
- PrintMessage ("error", mSourceFileName, mSourceFileLineNum, MessageCode, Text, MsgFmt, List);
- va_end (List);
- //
- // Set status accordingly
- //
- if (mStatus < STATUS_ERROR) {
- mStatus = STATUS_ERROR;
- }
-}
-
-void
-ParserWarning (
- UINT32 ErrorCode,
- INT8 *OffendingText,
- INT8 *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;
- mWarningCount++;
- va_start (List, MsgFmt);
- PrintMessage ("warning", mSourceFileName, mSourceFileLineNum, ErrorCode, OffendingText, MsgFmt, List);
- va_end (List);
- //
- // Set status accordingly
- //
- if (mStatus < STATUS_WARNING) {
- mStatus = STATUS_WARNING;
- }
-}
-
-void
-Warning (
- INT8 *FileName,
- UINT32 LineNumber,
- UINT32 MessageCode,
- INT8 *Text,
- INT8 *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;
- mWarningCount++;
- va_start (List, MsgFmt);
- PrintMessage ("warning", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
- va_end (List);
- //
- // Set status accordingly
- //
- if (mStatus < STATUS_WARNING) {
- mStatus = STATUS_WARNING;
- }
-}
-
-void
-DebugMsg (
- INT8 *FileName,
- UINT32 LineNumber,
- UINT32 MsgMask,
- INT8 *Text,
- INT8 *MsgFmt,
- ...
- )
-/*++
-
-Routine Description:
- Print a warning 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)
-
- MsgMask - an application-specific bitmask that, in combination with mDebugMsgMask,
- determines if the debug message gets printed.
-
- 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 mask is not applicable, then do nothing.
- //
- if ((MsgMask != 0) && ((mDebugMsgMask & MsgMask) == 0)) {
- return ;
- }
-
- va_start (List, MsgFmt);
- PrintMessage ("debug", FileName, LineNumber, 0, Text, MsgFmt, List);
- va_end (List);
-}
-
-static
-void
-PrintMessage (
- INT8 *Type,
- INT8 *FileName,
- UINT32 LineNumber,
- UINT32 MessageCode,
- INT8 *Text,
- INT8 *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 preceed 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 - Variable function parameter 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
-
---*/
-{
- INT8 Line[MAX_LINE_LEN];
- INT8 Line2[MAX_LINE_LEN];
- INT8 *Cptr;
- //
- // 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 if (mUtilityName[0] != 0) {
- Cptr = mUtilityName;
- } else {
- Cptr = "Unknown utility";
- }
-
- strcpy (Line, Cptr);
- if (LineNumber != 0) {
- sprintf (Line2, "(%d)", LineNumber);
- strcat (Line, Line2);
- }
- //
- // Have to print an error code or Visual Studio won't find the
- // message for you. It has to be decimal digits too.
- //
- sprintf (Line2, " : %s %c%04d", Type, toupper (Type[0]), MessageCode);
- strcat (Line, Line2);
- fprintf (stdout, "%s", Line);
- //
- // If offending text was provided, then print it
- //
- if (Text != NULL) {
- fprintf (stdout, ": %s ", Text);
- }
- //
- // Print formatted message if provided
- //
- if (MsgFmt != NULL) {
- vsprintf (Line2, MsgFmt, List);
- fprintf (stdout, ": %s", Line2);
- }
-
- fprintf (stdout, "\n");
-}
-
-void
-ParserSetPosition (
- INT8 *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 (
- INT8 *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 messags.
-
-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;
- return ;
- } else {
- strcpy (mUtilityName, UtilityName);
- }
- } 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;
-}
diff --git a/Tools/CCode/Source/GuidChk/UtilsMsgs.h b/Tools/CCode/Source/GuidChk/UtilsMsgs.h
deleted file mode 100644
index 5f6c7010b4..0000000000
--- a/Tools/CCode/Source/GuidChk/UtilsMsgs.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- UtilsMsgs.h
-
-Abstract:
-
- Prototypes for the EFI tools utility functions.
-
---*/
-
-#ifndef _UTILS_MESSAGES_H_
-#define _UTILS_MESSAGES_H_
-
-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 (
- INT8 *ProgramName
- )
-;
-
-void
-Error (
- INT8 *FileName,
- UINT32 LineNumber,
- UINT32 ErrorCode,
- INT8 *OffendingText,
- INT8 *MsgFmt,
- ...
- )
-;
-
-void
-Warning (
- INT8 *FileName,
- UINT32 LineNumber,
- UINT32 ErrorCode,
- INT8 *OffendingText,
- INT8 *MsgFmt,
- ...
- )
-;
-
-void
-DebugMsg (
- INT8 *FileName,
- UINT32 LineNumber,
- UINT32 MsgLevel,
- INT8 *OffendingText,
- INT8 *MsgFmt,
- ...
- )
-;
-
-void
-SetDebugMsgMask (
- UINT32 MsgMask
- )
-;
-
-void
-ParserSetPosition (
- INT8 *SourceFileName,
- UINT32 LineNum
- )
-;
-
-void
-ParserError (
- UINT32 ErrorCode,
- INT8 *OffendingText,
- INT8 *MsgFmt,
- ...
- )
-;
-
-void
-ParserWarning (
- UINT32 ErrorCode,
- INT8 *OffendingText,
- INT8 *MsgFmt,
- ...
- )
-;
-
-#endif
diff --git a/Tools/CCode/Source/GuidChk/build.xml b/Tools/CCode/Source/GuidChk/build.xml
deleted file mode 100644
index 80f8ef0024..0000000000
--- a/Tools/CCode/Source/GuidChk/build.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK GuidChk Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="GuidChk"/>
- <property name="FileSet" value="*.c *.h"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <if>
- <isfalse value="${gcc}"/>
- <then>
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </then>
- </if>
- </target>
-
- <target name="init">
- <if>
- <istrue value="${gcc}"/>
- <then>
- <echo message="The EDK Tool: ${ToolName} is not built for GCC!"/>
- </then>
- <else>
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </else>
- </if>
- </target>
-
- <target name="Tool" depends="init" unless="gcc">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
-
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/Include/Common/BaseTypes.h b/Tools/CCode/Source/Include/Common/BaseTypes.h
deleted file mode 100644
index b87e7141e6..0000000000
--- a/Tools/CCode/Source/Include/Common/BaseTypes.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/** @file
- Processor or Compiler specific defines for all supported processors.
-
- This file is stand alone self consistent set of definitions.
-
- Copyright (c) 2006, 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.
-
- Module Name: BaseTypes.h
-
-**/
-
-#ifndef __BASE_TYPES_H__
-#define __BASE_TYPES_H__
-
-//
-// Include processor specific binding
-//
-#include <ProcessorBind.h>
-#include <stdarg.h>
-
-#define MEMORY_FENCE() MemoryFence ()
-#define BREAKPOINT() CpuBreakpoint ()
-#define DEADLOOP() CpuDeadLoop ()
-
-typedef struct {
- UINT32 Data1;
- UINT16 Data2;
- UINT16 Data3;
- UINT8 Data4[8];
-} GUID;
-
-
-//
-// Modifiers to absract 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 envirnments use this construct, so #ifndef to prevent
-// mulitple 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
-// complier 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 nameing and
-// did not folow 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 argumnet 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
-
-///
-/// CONTAINING_RECORD - returns a pointer to the structure
-/// from one of it's elements.
-///
-#define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
-
-///
-/// ALIGN_POINTER - aligns a pointer to the lowest boundry
-///
-#define ALIGN_POINTER(p, s) ((VOID *) ((p) + (((s) - ((UINTN) (p))) & ((s) - 1))))
-
-///
-/// ALIGN_VARIABLE - aligns a variable up to the next natural boundry 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))
-
-//
-// EFI Error Codes common to all execution phases
-//
-
-typedef INTN RETURN_STATUS;
-
-///
-/// Set the upper bit to indicate EFI Error.
-///
-#define ENCODE_ERROR(a) (MAX_BIT | (a))
-
-#define ENCODE_WARNING(a) (a)
-#define RETURN_ERROR(a) ((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;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Common/Capsule.h b/Tools/CCode/Source/Include/Common/Capsule.h
deleted file mode 100644
index 0434fdf7f2..0000000000
--- a/Tools/CCode/Source/Include/Common/Capsule.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/** @file
- Defines for the EFI Capsule functionality.
-
- Copyright (c) 2006, 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.
-
- Module Name: Capsule.h
-
- @par Revision Reference:
- These definitions are from Capsule Spec Version 0.9.
-
-**/
-
-#ifndef _EFI_CAPSULE_H_
-#define _EFI_CAPSULE_H_
-
-//
-// Bits in the flags field of the capsule header
-//
-#define EFI_CAPSULE_HEADER_FLAG_SETUP 0x00000001 // supports setup changes
-
-
-#define CAPSULE_BLOCK_DESCRIPTOR_SIGNATURE EFI_SIGNATURE_32 ('C', 'B', 'D', 'S')
-
-//
-// An array of these describe the blocks that make up a capsule for
-// a capsule update.
-//
-typedef struct {
- UINT64 Length; // length of the data block
- EFI_PHYSICAL_ADDRESS Data; // physical address of the data block
- UINT32 Signature; // CBDS
- UINT32 CheckSum; // to sum this structure to 0
-} EFI_CAPSULE_BLOCK_DESCRIPTOR;
-
-typedef struct {
- EFI_GUID OemGuid;
- UINT32 HeaderSize;
- //
- // UINT8 OemHdrData[];
- //
-} EFI_CAPSULE_OEM_HEADER;
-
-typedef struct {
- EFI_GUID CapsuleGuid;
- UINT32 HeaderSize;
- UINT32 Flags;
- UINT32 CapsuleImageSize;
- UINT32 SequenceNumber;
- EFI_GUID InstanceId;
- UINT32 OffsetToSplitInformation;
- UINT32 OffsetToCapsuleBody;
- UINT32 OffsetToOemDefinedHeader;
- UINT32 OffsetToAuthorInformation;
- UINT32 OffsetToRevisionInformation;
- UINT32 OffsetToShortDescription;
- UINT32 OffsetToLongDescription;
- UINT32 OffsetToApplicableDevices;
-} EFI_CAPSULE_HEADER;
-
-#endif // #ifndef _EFI_CAPSULE_H_
diff --git a/Tools/CCode/Source/Include/Common/Dependency.h b/Tools/CCode/Source/Include/Common/Dependency.h
deleted file mode 100644
index 744027d2f3..0000000000
--- a/Tools/CCode/Source/Include/Common/Dependency.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
- This module contains data specific to dependency expressions
- and local function prototypes.
-
- Copyright (c) 2006, 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.
-
- Module Name: Dependency.h
-
-**/
-
-#ifndef __DEPENDENCY_H__
-#define __DEPENDENCY_H__
-
-/// EFI_DEP_BEFORE - If present, this must be the first and only opcode
-#define EFI_DEP_BEFORE 0x00
-
-/// EFI_DEP_AFTER - If present, this must be the first and only opcode
-#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
-
-/// EFI_DEP_SOR - If present, this must be the first opcode
-#define EFI_DEP_SOR 0x09
-
-///
-/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
-/// to save time. A EFI_DEP_PUSH is evauated one an
-/// replaced with EFI_DEP_REPLACE_TRUE
-///
-#define EFI_DEP_REPLACE_TRUE 0xff
-
-///
-/// Define the initial size of the dependency expression evaluation stack
-///
-#define DEPEX_STACK_SIZE_INCREMENT 0x1000
-
-#endif
diff --git a/Tools/CCode/Source/Include/Common/EfiImage.h b/Tools/CCode/Source/Include/Common/EfiImage.h
deleted file mode 100644
index 2f5c580e98..0000000000
--- a/Tools/CCode/Source/Include/Common/EfiImage.h
+++ /dev/null
@@ -1,716 +0,0 @@
-/** @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, 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.
-
- Module Name: EfiImage.h
-
-**/
-
-#ifndef __EFI_IMAGE_H__
-#define __EFI_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_IA64 0x0200
-#define IMAGE_FILE_MACHINE_EBC 0x0EBC
-#define IMAGE_FILE_MACHINE_X64 0x8664
-//
-// Support old names for backward compatible
-//
-#define EFI_IMAGE_MACHINE_IA32 IMAGE_FILE_MACHINE_I386
-#define EFI_IMAGE_MACHINE_IA64 IMAGE_FILE_MACHINE_IA64
-#define EFI_IMAGE_MACHINE_IPF IMAGE_FILE_MACHINE_IA64
-#define EFI_IMAGE_MACHINE_EBC IMAGE_FILE_MACHINE_EBC
-#define EFI_IMAGE_MACHINE_X64 IMAGE_FILE_MACHINE_X64
-
-#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_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)
-
-//
-// Processor specific definition of EFI_IMAGE_OPTIONAL_HEADER so the
-// type name EFI_IMAGE_OPTIONAL_HEADER is appropriate to the build. Same for
-// EFI_IMAGE_NT_HEADERS. These definitions MUST be used by ALL EFI code.
-//
-#if defined (MDE_CPU_IA32)
-
-typedef EFI_IMAGE_OPTIONAL_HEADER32 EFI_IMAGE_OPTIONAL_HEADER;
-typedef EFI_IMAGE_NT_HEADERS32 EFI_IMAGE_NT_HEADERS;
-
-#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
- (((Machine) == EFI_IMAGE_MACHINE_IA32) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
-
-#elif defined (MDE_CPU_IPF)
-
-typedef EFI_IMAGE_OPTIONAL_HEADER64 EFI_IMAGE_OPTIONAL_HEADER;
-typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
-
-#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
- (((Machine) == EFI_IMAGE_MACHINE_IPF) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
-
-#elif defined (MDE_CPU_X64)
-
-typedef EFI_IMAGE_OPTIONAL_HEADER64 EFI_IMAGE_OPTIONAL_HEADER;
-typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
-
-#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
- (((Machine) == EFI_IMAGE_MACHINE_X64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
-
-#elif defined (MDE_CPU_EBC)
-
-//
-// This is just to make sure you can cross compile with the EBC compiiler.
-// It does not make sense to have a PE loader coded in EBC. You need to
-// understand the basic
-//
-typedef EFI_IMAGE_OPTIONAL_HEADER64 EFI_IMAGE_OPTIONAL_HEADER;
-typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
-
-#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_EBC)
-
-#else
-#error Unknown Processor Type
-#endif
-
-
-#define EFI_IMAGE_FIRST_SECTION(ntheader) \
- ( \
- (EFI_IMAGE_SECTION_HEADER *) \
- ( \
- (UINT32) ntheader + \
- FIELD_OFFSET (EFI_IMAGE_NT_HEADERS, OptionalHeader) + \
- ((EFI_IMAGE_NT_HEADERS *) (ntheader))->FileHeader.SizeOfOptionalHeader \
- ) \
- )
-
-//
-// 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 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
-#define EFI_IMAGE_REL_I386_SECTION 012
-#define EFI_IMAGE_REL_I386_SECREL 013
-#define EFI_IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address
-
-///
-/// 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_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;
-
-//
-// .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;
-
-///
-/// 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
-
-#endif
diff --git a/Tools/CCode/Source/Include/Common/FirmwareFileSystem.h b/Tools/CCode/Source/Include/Common/FirmwareFileSystem.h
deleted file mode 100644
index 5678a95524..0000000000
--- a/Tools/CCode/Source/Include/Common/FirmwareFileSystem.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/** @file
- This file defines the data structures that comprise the FFS file system.
-
- Copyright (c) 2006, 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.
-
- Module Name: FirmwareFileSystem.h
-
- @par Revision Reference:
- These definitions are from Firmware File System Spec 0.9.
-
-**/
-
-#ifndef __EFI_FFS_FILE_SYSTEM_H__
-#define __EFI_FFS_FILE_SYSTEM_H__
-
-///
-/// FFS specific file types
-///
-#define EFI_FV_FILETYPE_FFS_PAD 0xF0
-
-//
-// FFS File Attributes
-//
-#define FFS_ATTRIB_TAIL_PRESENT 0x01
-#define FFS_ATTRIB_RECOVERY 0x02
-#define FFS_ATTRIB_HEADER_EXTENSION 0x04
-#define FFS_ATTRIB_DATA_ALIGNMENT 0x38
-#define FFS_ATTRIB_CHECKSUM 0x40
-
-///
-/// FFS_FIXED_CHECKSUM is the default checksum value used when the
-/// FFS_ATTRIB_CHECKSUM attribute bit is clear
-/// note this is NOT an architecturally defined value, but is in this file for
-/// implementation convenience
-///
-#define FFS_FIXED_CHECKSUM 0x5A
-
-//
-// File state definitions
-//
-#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 \
- )
-
-#define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \
- ( \
- (BOOLEAN) ( \
- (FvbAttributes & EFI_FVB_ERASE_POLARITY) ? (((~TestAttributes) & Bit) == Bit) : ((TestAttributes & Bit) == Bit) \
- ) \
- )
-
-typedef UINT16 EFI_FFS_FILE_TAIL;
-
-///
-/// FFS file integrity check structure
-///
-typedef union {
- struct {
- UINT8 Header;
- UINT8 File;
- } Checksum;
- UINT16 TailReference;
-} EFI_FFS_INTEGRITY_CHECK;
-
-//
-// FFS file header definition
-//
-typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
-typedef UINT8 EFI_FFS_FILE_STATE;
-
-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;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Common/FirmwareVolumeHeader.h b/Tools/CCode/Source/Include/Common/FirmwareVolumeHeader.h
deleted file mode 100644
index 038dce6f7f..0000000000
--- a/Tools/CCode/Source/Include/Common/FirmwareVolumeHeader.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/** @file
- Defines data structure that is the volume header found at the beginning of
- all firmware volumes that are either memory mapped, or have an
- associated FirmwareVolumeBlock protocol.
-
- Copyright (c) 2006, 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.
-
- Module Name: FirmwareVolumeHeader.h
-
- @par Revision Reference:
- These definitions are from Firmware Volume Block Spec 0.9.
-
-**/
-
-#ifndef __EFI_FIRMWARE_VOLUME_HEADER_H__
-#define __EFI_FIRMWARE_VOLUME_HEADER_H__
-
-//
-// Firmware Volume Block Attributes definition
-//
-typedef UINT32 EFI_FVB_ATTRIBUTES;
-
-//
-// Firmware Volume Block Attributes bit definitions
-//
-#define EFI_FVB_READ_DISABLED_CAP 0x00000001
-#define EFI_FVB_READ_ENABLED_CAP 0x00000002
-#define EFI_FVB_READ_STATUS 0x00000004
-
-#define EFI_FVB_WRITE_DISABLED_CAP 0x00000008
-#define EFI_FVB_WRITE_ENABLED_CAP 0x00000010
-#define EFI_FVB_WRITE_STATUS 0x00000020
-
-#define EFI_FVB_LOCK_CAP 0x00000040
-#define EFI_FVB_LOCK_STATUS 0x00000080
-
-#define EFI_FVB_STICKY_WRITE 0x00000200
-#define EFI_FVB_MEMORY_MAPPED 0x00000400
-#define EFI_FVB_ERASE_POLARITY 0x00000800
-
-#define EFI_FVB_ALIGNMENT_CAP 0x00008000
-#define EFI_FVB_ALIGNMENT_2 0x00010000
-#define EFI_FVB_ALIGNMENT_4 0x00020000
-#define EFI_FVB_ALIGNMENT_8 0x00040000
-#define EFI_FVB_ALIGNMENT_16 0x00080000
-#define EFI_FVB_ALIGNMENT_32 0x00100000
-#define EFI_FVB_ALIGNMENT_64 0x00200000
-#define EFI_FVB_ALIGNMENT_128 0x00400000
-#define EFI_FVB_ALIGNMENT_256 0x00800000
-#define EFI_FVB_ALIGNMENT_512 0x01000000
-#define EFI_FVB_ALIGNMENT_1K 0x02000000
-#define EFI_FVB_ALIGNMENT_2K 0x04000000
-#define EFI_FVB_ALIGNMENT_4K 0x08000000
-#define EFI_FVB_ALIGNMENT_8K 0x10000000
-#define EFI_FVB_ALIGNMENT_16K 0x20000000
-#define EFI_FVB_ALIGNMENT_32K 0x40000000
-#define EFI_FVB_ALIGNMENT_64K 0x80000000
-
-#define EFI_FVB_CAPABILITIES (EFI_FVB_READ_DISABLED_CAP | \
- EFI_FVB_READ_ENABLED_CAP | \
- EFI_FVB_WRITE_DISABLED_CAP | \
- EFI_FVB_WRITE_ENABLED_CAP | \
- EFI_FVB_LOCK_CAP \
- )
-
-#define EFI_FVB_STATUS (EFI_FVB_READ_STATUS | EFI_FVB_WRITE_STATUS | EFI_FVB_LOCK_STATUS)
-
-///
-/// Firmware Volume Header Revision definition
-///
-#define EFI_FVH_REVISION 0x01
-
-///
-/// Firmware Volume Header Signature definition
-///
-#define EFI_FVH_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', 'H')
-
-///
-/// Firmware Volume Header Block Map Entry definition
-///
-typedef struct {
- UINT32 NumBlocks;
- UINT32 BlockLength;
-} EFI_FV_BLOCK_MAP_ENTRY;
-
-///
-/// Firmware Volume Header definition
-///
-typedef struct {
- UINT8 ZeroVector[16];
- EFI_GUID FileSystemGuid;
- UINT64 FvLength;
- UINT32 Signature;
- EFI_FVB_ATTRIBUTES Attributes;
- UINT16 HeaderLength;
- UINT16 Checksum;
- UINT8 Reserved[3];
- UINT8 Revision;
- EFI_FV_BLOCK_MAP_ENTRY FvBlockMap[1];
-} EFI_FIRMWARE_VOLUME_HEADER;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Common/FirmwareVolumeImageFormat.h b/Tools/CCode/Source/Include/Common/FirmwareVolumeImageFormat.h
deleted file mode 100644
index 14fa41bf26..0000000000
--- a/Tools/CCode/Source/Include/Common/FirmwareVolumeImageFormat.h
+++ /dev/null
@@ -1,277 +0,0 @@
-/** @file
- This file defines the data structures that are architecturally defined for file
- images loaded via the FirmwareVolume protocol. The Firmware Volume specification
- is the basis for these definitions.
-
- Copyright (c) 2006, 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.
-
- Module Name: FimrwareVolumeImageFormat.h
-
- @par Revision Reference:
- These definitions are from Firmware Volume Spec 0.9.
-
-**/
-
-#ifndef __FIRMWARE_VOLUME_IMAGE_FORMAT_H__
-#define __FIRMWARE_VOLUME_IMAGE_FORMAT_H__
-
-//
-// pack all data structures since this is actually a binary format and we cannot
-// allow internal padding in the data structures because of some compilerism..
-//
-#pragma pack(1)
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// Architectural file types
-//
-typedef UINT8 EFI_FV_FILETYPE;
-
-#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
-//
-// File type 0x0A is reserved and should not be used
-//
-#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// Section types
-//
-typedef UINT8 EFI_SECTION_TYPE;
-
-//
-// ************************************************************
-// The section type EFI_SECTION_ALL is a psuedo type. It is
-// used as a wildcard 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_FIRST_LEAF_SECTION_TYPE 0x10
-
-#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_LAST_LEAF_SECTION_TYPE 0x1B
-#define EFI_SECTION_LAST_SECTION_TYPE 0x1B
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// Common section header
-//
-typedef struct {
- UINT8 Size[3];
- UINT8 Type;
-} EFI_COMMON_SECTION_HEADER;
-
-#define SECTION_SIZE(SectionHeaderPtr) \
- ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// Compression section
-//
-//
-// CompressionType values
-//
-#define EFI_NOT_COMPRESSED 0x00
-#define EFI_STANDARD_COMPRESSION 0x01
-#define EFI_CUSTOMIZED_COMPRESSION 0x02
-
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
- UINT32 UncompressedLength;
- UINT8 CompressionType;
-} EFI_COMPRESSION_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// GUID defined section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
- EFI_GUID SectionDefinitionGuid;
- UINT16 DataOffset;
- UINT16 Attributes;
-} EFI_GUID_DEFINED_SECTION;
-
-//
-// Bit values for Attributes
-//
-#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
-#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
-
-//
-// Bit values for AuthenticationStatus
-//
-#define EFI_AGGREGATE_AUTH_STATUS_PLATFORM_OVERRIDE 0x000001
-#define EFI_AGGREGATE_AUTH_STATUS_IMAGE_SIGNED 0x000002
-#define EFI_AGGREGATE_AUTH_STATUS_NOT_TESTED 0x000004
-#define EFI_AGGREGATE_AUTH_STATUS_TEST_FAILED 0x000008
-#define EFI_AGGREGATE_AUTH_STATUS_ALL 0x00000f
-
-#define EFI_LOCAL_AUTH_STATUS_PLATFORM_OVERRIDE 0x010000
-#define EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED 0x020000
-#define EFI_LOCAL_AUTH_STATUS_NOT_TESTED 0x040000
-#define EFI_LOCAL_AUTH_STATUS_TEST_FAILED 0x080000
-#define EFI_LOCAL_AUTH_STATUS_ALL 0x0f0000
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// PE32+ section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
-} EFI_PE32_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// PIC section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
-} EFI_PIC_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// PEIM header section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
-} EFI_PEIM_HEADER_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// DEPEX section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
-} EFI_DEPEX_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// Version section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
- UINT16 BuildNumber;
- INT16 VersionString[1];
-} EFI_VERSION_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// User interface section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
- INT16 FileNameString[1];
-} EFI_USER_INTERFACE_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// Code16 section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
-} EFI_CODE16_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// Firmware Volume Image section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
-} EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// Freeform subtype GUID section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
- EFI_GUID SubTypeGuid;
-} EFI_FREEFORM_SUBTYPE_GUID_SECTION;
-
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-// Raw section
-//
-typedef struct {
- EFI_COMMON_SECTION_HEADER CommonHeader;
-} EFI_RAW_SECTION;
-
-//
-// undo the pragma from the beginning...
-//
-#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_PEIM_HEADER_SECTION *PeimHeaderSection;
- EFI_DEPEX_SECTION *DependencySection;
- EFI_VERSION_SECTION *VersionSection;
- EFI_USER_INTERFACE_SECTION *UISection;
- EFI_CODE16_SECTION *Code16Section;
- EFI_FIRMWARE_VOLUME_IMAGE_SECTION *FVImageSection;
- EFI_FREEFORM_SUBTYPE_GUID_SECTION *FreeformSubtypeSection;
- EFI_RAW_SECTION *RawSection;
-} EFI_FILE_SECTION_POINTER;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Common/InternalFormRepresentation.h b/Tools/CCode/Source/Include/Common/InternalFormRepresentation.h
deleted file mode 100644
index bf3d824fbd..0000000000
--- a/Tools/CCode/Source/Include/Common/InternalFormRepresentation.h
+++ /dev/null
@@ -1,422 +0,0 @@
-/** @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, 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.
-
- Module Name: InternalFormRepresentation.h
-
- @par Revision Reference:
- These definitions are from Human Interface Infrastructure Spec Version 0.92.
-
-**/
-
-#ifndef __EFI_INTERNAL_FORM_REPRESENTATION_H__
-#define __EFI_INTERNAL_FORM_REPRESENTATION_H__
-
-//
-// The following types are currently defined:
-//
-typedef UINT32 RELOFST;
-typedef CHAR16 *EFI_STRING;
-
-//
-// IFR Op codes
-//
-#define EFI_IFR_FORM_OP 0x01
-#define EFI_IFR_SUBTITLE_OP 0x02
-#define EFI_IFR_TEXT_OP 0x03
-#define EFI_IFR_GRAPHIC_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 // ONEOF OPTION field
-#define EFI_IFR_SUPPRESS_IF_OP 0x0A
-#define EFI_IFR_END_FORM_OP 0x0B
-#define EFI_IFR_HIDDEN_OP 0x0C
-#define EFI_IFR_END_FORM_SET_OP 0x0D
-#define EFI_IFR_FORM_SET_OP 0x0E
-#define EFI_IFR_REF_OP 0x0F
-#define EFI_IFR_END_ONE_OF_OP 0x10
-#define EFI_IFR_END_OP EFI_IFR_END_ONE_OF_OP
-#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_LIST_OP 0x14
-#define EFI_IFR_AND_OP 0x15
-#define EFI_IFR_OR_OP 0x16
-#define EFI_IFR_NOT_OP 0x17
-#define EFI_IFR_END_IF_OP 0x18 // for endif of inconsistentif, suppressif, grayoutif
-#define EFI_IFR_GRAYOUT_IF_OP 0x19
-#define EFI_IFR_DATE_OP 0x1A
-#define EFI_IFR_TIME_OP 0x1B
-#define EFI_IFR_STRING_OP 0x1C
-#define EFI_IFR_LABEL_OP 0x1D
-#define EFI_IFR_SAVE_DEFAULTS_OP 0x1E
-#define EFI_IFR_RESTORE_DEFAULTS_OP 0x1F
-#define EFI_IFR_BANNER_OP 0x20
-#define EFI_IFR_INVENTORY_OP 0x21
-#define EFI_IFR_EQ_VAR_VAL_OP 0x22
-#define EFI_IFR_ORDERED_LIST_OP 0x23
-#define EFI_IFR_VARSTORE_OP 0x24
-#define EFI_IFR_VARSTORE_SELECT_OP 0x25
-#define EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26
-#define EFI_IFR_TRUE_OP 0x27
-#define EFI_IFR_FALSE_OP 0x28
-#define EFI_IFR_GT_OP 0x29
-#define EFI_IFR_GE_OP 0x2A
-#define EFI_IFR_OEM_DEFINED_OP 0x2B
-#define EFI_IFR_LAST_OPCODE EFI_IFR_OEM_DEFINED_OP
-#define EFI_IFR_OEM_OP 0xFE
-#define EFI_IFR_NV_ACCESS_COMMAND 0xFF
-
-//
-// Define values for the flags fields in some VFR opcodes. These are
-// bitmasks.
-//
-#define EFI_IFR_FLAG_DEFAULT 0x01
-#define EFI_IFR_FLAG_MANUFACTURING 0x02
-#define EFI_IFR_FLAG_INTERACTIVE 0x04
-#define EFI_IFR_FLAG_NV_ACCESS 0x08
-#define EFI_IFR_FLAG_RESET_REQUIRED 0x10
-#define EFI_IFR_FLAG_LATE_CHECK 0x20
-
-#define EFI_NON_DEVICE_CLASS 0x00 // Useful when you do not want something in the Device Manager
-#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
-
-#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
-#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
-#define EFI_FRONT_PAGE_SUBCLASS 0x02
-#define EFI_SINGLE_USE_SUBCLASS 0x03 // Used to display a single entity and then exit
-
-//
-// Used to flag dynamically created op-codes. This is meaningful to the IFR Library set
-// and the browser since we need to distinguish between compiled NV map data and created data.
-// We do not allow new entries to be created in the NV map dynamically however we still need
-// to display this information correctly. To dynamically create op-codes and assume that their
-// data will be saved, ensure that the NV starting location they refer to is pre-defined in the
-// NV map.
-//
-#define EFI_IFR_FLAG_CREATED 128
-
-#pragma pack(1)
-//
-// IFR Structure definitions
-//
-typedef struct {
- UINT8 OpCode;
- UINT8 Length;
-} EFI_IFR_OP_HEADER;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- EFI_GUID Guid;
- STRING_REF FormSetTitle;
- STRING_REF Help;
- EFI_PHYSICAL_ADDRESS CallbackHandle;
- UINT16 Class;
- UINT16 SubClass;
- UINT16 NvDataSize; // set once, size of the NV data as defined in the script
-} EFI_IFR_FORM_SET;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 FormId;
- STRING_REF FormTitle;
-} EFI_IFR_FORM;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 LabelId;
-} EFI_IFR_LABEL;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- STRING_REF SubTitle;
-} EFI_IFR_SUBTITLE;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- STRING_REF Help;
- STRING_REF Text;
- STRING_REF TextTwo;
- UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; // Value to be passed to caller to identify this particular op-code
-} EFI_IFR_TEXT;
-
-//
-// goto
-//
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 FormId;
- STRING_REF Prompt;
- STRING_REF Help; // The string Token for the context-help
- UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; // Value to be passed to caller to identify this particular op-code
-} EFI_IFR_REF;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_END_FORM;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_END_FORM_SET;
-
-//
-// Also notice that the IFR_ONE_OF and IFR_CHECK_BOX are identical in structure......code assumes this to be true, if this ever
-// changes we need to revisit the InitializeTagStructures code
-//
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
- UINT8 Width; // The Size of the Data being saved
- STRING_REF Prompt; // The String Token for the Prompt
- STRING_REF Help; // The string Token for the context-help
-} EFI_IFR_ONE_OF;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; // The offset in NV for storage of the data
- UINT8 MaxEntries; // The maximum number of options in the ordered list (=size of NVStore)
- STRING_REF Prompt; // The string token for the prompt
- STRING_REF Help; // The string token for the context-help
-} EFI_IFR_ORDERED_LIST;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
- UINT8 Width; // The Size of the Data being saved
- STRING_REF Prompt; // The String Token for the Prompt
- STRING_REF Help; // The string Token for the context-help
- UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely
- UINT16 Key; // Value to be passed to caller to identify this particular op-code
-} EFI_IFR_CHECKBOX, EFI_IFR_CHECK_BOX;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- STRING_REF Option; // The string token describing the option
- UINT16 Value; // The value associated with this option that is stored in the NVRAM if chosen
- UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely above
- UINT16 Key; // Value to be passed to caller to identify this particular op-code
-} EFI_IFR_ONE_OF_OPTION;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
- UINT8 Width; // The Size of the Data being saved
- STRING_REF Prompt; // The String Token for the Prompt
- STRING_REF Help; // The string Token for the context-help
- UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; // Value to be passed to caller to identify this particular op-code
- UINT16 Minimum;
- UINT16 Maximum;
- UINT16 Step; // If step is 0, then manual input is specified, otherwise, left/right arrow selection is called for
- UINT16 Default;
-} EFI_IFR_NUMERIC;
-
-//
-// There is an interesting twist with regards to Time and Date. This is one of the few items which can accept input from
-// a user, however may or may not need to use storage in the NVRAM space. The decided method for determining if NVRAM space
-// will be used (only for a TimeOp or DateOp) is: If .QuestionId == 0 && .Width == 0 (normally an impossibility) then use system
-// resources to store the data away and not NV resources. In other words, the setup engine will call gRT->SetTime, and gRT->SetDate
-// for the saving of data, and the values displayed will be from the gRT->GetXXXX series of calls.
-//
-typedef struct {
- EFI_IFR_NUMERIC Hour;
- EFI_IFR_NUMERIC Minute;
- EFI_IFR_NUMERIC Second;
-} EFI_IFR_TIME;
-
-typedef struct {
- EFI_IFR_NUMERIC Year;
- EFI_IFR_NUMERIC Month;
- EFI_IFR_NUMERIC Day;
-} EFI_IFR_DATE;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
- UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday
- STRING_REF Prompt; // The String Token for the Prompt
- STRING_REF Help; // The string Token for the context-help
- UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; // Value to be passed to caller to identify this particular op-code
- UINT8 MinSize; // Minimum allowable sized password
- UINT8 MaxSize; // Maximum allowable sized password
- UINT16 Encoding;
-} EFI_IFR_PASSWORD;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
- UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday
- STRING_REF Prompt; // The String Token for the Prompt
- STRING_REF Help; // The string Token for the context-help
- UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
- UINT16 Key; // Value to be passed to caller to identify this particular op-code
- UINT8 MinSize; // Minimum allowable sized password
- UINT8 MaxSize; // Maximum allowable sized password
-} EFI_IFR_STRING;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_END_ONE_OF;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 Value;
- UINT16 Key;
-} EFI_IFR_HIDDEN;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT8 Flags;
-} EFI_IFR_SUPPRESS;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT8 Flags;
-} EFI_IFR_GRAY_OUT;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- STRING_REF Popup;
- UINT8 Flags;
-} EFI_IFR_INCONSISTENT;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; // offset into variable storage
- UINT8 Width; // size of variable storage
- UINT16 Value; // value to compare against
-} EFI_IFR_EQ_ID_VAL;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId; // offset into variable storage
- UINT8 Width; // size of variable storage
- UINT16 ListLength;
- UINT16 ValueList[1];
-} EFI_IFR_EQ_ID_LIST;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 QuestionId1; // offset into variable storage for first value to compare
- UINT8 Width; // size of variable storage (must be same for both)
- UINT16 QuestionId2; // offset into variable storage for second value to compare
-} EFI_IFR_EQ_ID_ID;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 VariableId; // offset into variable storage
- UINT16 Value; // value to compare against
-} EFI_IFR_EQ_VAR_VAL;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_AND;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_OR;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_NOT;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_END_EXPR, EFI_IFR_END_IF;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 FormId;
- STRING_REF Prompt;
- STRING_REF Help;
- UINT8 Flags;
- UINT16 Key;
-} EFI_IFR_SAVE_DEFAULTS;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- STRING_REF Help;
- STRING_REF Text;
- STRING_REF TextTwo; // optional text
-} EFI_IFR_INVENTORY;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- EFI_GUID Guid; // GUID for the variable
- UINT16 VarId; // variable store ID, as referenced elsewhere in the form
- UINT16 Size; // size of the variable storage
-} EFI_IFR_VARSTORE;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 VarId; // variable store ID, as referenced elsewhere in the form
-} EFI_IFR_VARSTORE_SELECT;
-
-//
-// Used for the ideqid VFR statement where two variable stores may be referenced in the
-// same VFR statement.
-// A browser should treat this as an EFI_IFR_VARSTORE_SELECT statement and assume that all following
-// IFR opcodes use the VarId as defined here.
-//
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- UINT16 VarId; // variable store ID, as referenced elsewhere in the form
- UINT16 SecondaryVarId; // variable store ID, as referenced elsewhere in the form
-} EFI_IFR_VARSTORE_SELECT_PAIR;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_TRUE;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_FALSE;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_GT;
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
-} EFI_IFR_GE;
-
-//
-// Save defaults and restore defaults have same structure
-//
-#define EFI_IFR_RESTORE_DEFAULTS EFI_IFR_SAVE_DEFAULTS
-
-typedef struct {
- EFI_IFR_OP_HEADER Header;
- STRING_REF Title; // The string token for the banner title
- UINT16 LineNumber; // 1-based line number
- UINT8 Alignment; // left, center, or right-aligned
-} EFI_IFR_BANNER;
-
-#define EFI_IFR_BANNER_ALIGN_LEFT 0
-#define EFI_IFR_BANNER_ALIGN_CENTER 1
-#define EFI_IFR_BANNER_ALIGN_RIGHT 2
-#define EFI_IFR_BANNER_TIMEOUT 0xFF
-
-#pragma pack()
-
-#endif
diff --git a/Tools/CCode/Source/Include/Common/MultiPhase.h b/Tools/CCode/Source/Include/Common/MultiPhase.h
deleted file mode 100644
index 93867a5e8a..0000000000
--- a/Tools/CCode/Source/Include/Common/MultiPhase.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
- This includes some definitions that will be used in both PEI and DXE phases.
-
- Copyright (c) 2006, 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.
-
- Module Name: MultiPhase.h
-
-**/
-
-#ifndef __MULTI_PHASE_H__
-#define __MULTI_PHASE_H__
-
-//
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-//
-// Needed EFI defines for PEI
-//
-typedef UINT64 EFI_PHYSICAL_ADDRESS;
-
-typedef enum {
- EfiReservedMemoryType,
- EfiLoaderCode,
- EfiLoaderData,
- EfiBootServicesCode,
- EfiBootServicesData,
- EfiRuntimeServicesCode,
- EfiRuntimeServicesData,
- EfiConventionalMemory,
- EfiUnusableMemory,
- EfiACPIReclaimMemory,
- EfiACPIMemoryNVS,
- EfiMemoryMappedIO,
- EfiMemoryMappedIOPortSpace,
- EfiPalCode,
- EfiMaxMemoryType
-} EFI_MEMORY_TYPE;
-
-typedef UINT32 EFI_STATUS_CODE_TYPE;
-typedef UINT32 EFI_STATUS_CODE_VALUE;
-
-typedef struct {
- UINT16 HeaderSize;
- UINT16 Size;
- EFI_GUID Type;
-} EFI_STATUS_CODE_DATA;
-
-typedef struct {
- UINT64 Signature;
- UINT32 Revision;
- UINT32 HeaderSize;
- UINT32 CRC32;
- UINT32 Reserved;
-} EFI_TABLE_HEADER;
-
-#define EFI_PAGE_SIZE 4096
-
-
-typedef VOID *EFI_HANDLE;
-typedef UINT16 EFI_HII_HANDLE;
-typedef UINT16 STRING_REF;
-typedef struct {
- INT16 Value;
- INT16 Exponent;
-} EFI_EXP_BASE10_DATA;
-
-//
-// Define macros to build data structure signatures from characters.
-//
-#define EFI_SIGNATURE_16(A, B) ((A) | (B << 8))
-#define EFI_SIGNATURE_32(A, B, C, D) (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))
-#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \
- (EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))
-
-
-#include <Protocol/DevicePath.h>
-
-#endif
diff --git a/Tools/CCode/Source/Include/Common/UefiBaseTypes.h b/Tools/CCode/Source/Include/Common/UefiBaseTypes.h
deleted file mode 100644
index 4954c10bf2..0000000000
--- a/Tools/CCode/Source/Include/Common/UefiBaseTypes.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/** @file
- This file makes the BaseTypes.h backward compatible with the ones used in the
- past for EFI and Tiano development. It's mostly just prepending an EFI_ on the
- definitions.
-
- Copyright (c) 2006, 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.
-
- Module Name: UefiBaseTypes.h
-
-**/
-
-#ifndef __UEFI_BASE_TYPES_H__
-#define __UEFI_BASE_TYPES_H__
-
-#include <Common/BaseTypes.h>
-
-typedef UINT64 EFI_LBA;
-
-#define EFIERR(_a) ENCODE_ERROR(_a)
-
-#define EFI_MAX_BIT MAX_BIT
-#define EFI_MAX_ADDRESS MAX_ADDRESS
-#define EFI_BREAKPOINT() CpuBreakpoint ()
-#define EFI_DEADLOOP() CpuDeadLoop ()
-#define EFI_ERROR(A) RETURN_ERROR(A)
-
-typedef GUID EFI_GUID;
-typedef RETURN_STATUS 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
-
-//
-// 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_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)
-
-#endif
diff --git a/Tools/CCode/Source/Include/Common/Variable.h b/Tools/CCode/Source/Include/Common/Variable.h
deleted file mode 100644
index bc0d6408d7..0000000000
--- a/Tools/CCode/Source/Include/Common/Variable.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*++
-
-Copyright (c) 2006, 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.
-
-Module Name:
-
- EfiVariable.h
-
-Abstract:
-
- Header file for EFI Variable Services
-
---*/
-
-#ifndef _EFI_VARIABLE_H_
-#define _EFI_VARIABLE_H_
-
-#define VARIABLE_STORE_SIGNATURE EFI_SIGNATURE_32 ('$', 'V', 'S', 'S')
-
-#define MAX_VARIABLE_SIZE 1024
-
-#define VARIABLE_DATA 0x55AA
-
-//
-// Variable Store Header flags
-//
-#define VARIABLE_STORE_FORMATTED 0x5a
-#define VARIABLE_STORE_HEALTHY 0xfe
-
-//
-// Variable Store Status
-//
-typedef enum {
- EfiRaw,
- EfiValid,
- EfiInvalid,
- EfiUnknown
-} VARIABLE_STORE_STATUS;
-
-//
-// Variable State flags
-//
-#define VAR_IN_DELETED_TRANSITION 0xfe // Variable is in obsolete transistion
-#define VAR_DELETED 0xfd // Variable is obsolete
-#define VAR_ADDED 0x7f // Variable has been completely added
-#define IS_VARIABLE_STATE(_c, _Mask) (BOOLEAN) (((~_c) & (~_Mask)) != 0)
-
-#pragma pack(1)
-
-typedef struct {
- UINT32 Signature;
- UINT32 Size;
- UINT8 Format;
- UINT8 State;
- UINT16 Reserved;
- UINT32 Reserved1;
-} VARIABLE_STORE_HEADER;
-
-typedef struct {
- UINT16 StartId;
- UINT8 State;
- UINT8 Reserved;
- UINT32 Attributes;
- UINTN NameSize;
- UINTN DataSize;
- EFI_GUID VendorGuid;
-} VARIABLE_HEADER;
-
-#pragma pack()
-
-#endif // _EFI_VARIABLE_H_
diff --git a/Tools/CCode/Source/Include/Common/WorkingBlockHeader.h b/Tools/CCode/Source/Include/Common/WorkingBlockHeader.h
deleted file mode 100644
index 235b740e83..0000000000
--- a/Tools/CCode/Source/Include/Common/WorkingBlockHeader.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*++
-
-Copyright (c) 2006, 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.
-
-Module Name:
-
- EfiWorkingBlockHeader.h
-
-Abstract:
-
- 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.
-
---*/
-
-#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;
- UINT32 WorkingBlockValid : 1;
- UINT32 WorkingBlockInvalid : 1;
-#define WORKING_BLOCK_VALID 0x1
-#define WORKING_BLOCK_INVALID 0x2
- UINT32 Reserved : 6;
- UINT8 Reserved3[3];
- UINTN WriteQueueSize;
- //
- // UINT8 WriteQueue[WriteQueueSize];
- //
-} EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Guid/AcpiTableStorage.h b/Tools/CCode/Source/Include/Guid/AcpiTableStorage.h
deleted file mode 100644
index 80b1154828..0000000000
--- a/Tools/CCode/Source/Include/Guid/AcpiTableStorage.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- The ACPI table storage file is fully FFS compliant.
- The file is a number of sections of type EFI_SECTION_RAW.
- This GUID is used to identify the file as an ACPI table storage file.
-
- Copyright (c) 2006, 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.
-
- Module Name: AcpiTableStorage.h
-
- @par Revision Reference:
- GUID defined in ACPI Table Storage Spec Version 0.9.
-
-**/
-
-#ifndef _ACPI_TABLE_STORAGE_H_
-#define _ACPI_TABLE_STORAGE_H_
-
-#define EFI_ACPI_TABLE_STORAGE_GUID \
- { 0x7e374e25, 0x8e01, 0x4fee, {0x87, 0xf2, 0x39, 0xc, 0x23, 0xc6, 0x6, 0xcd } }
-
-extern EFI_GUID gEfiAcpiTableStorageGuid;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Guid/Apriori.h b/Tools/CCode/Source/Include/Guid/Apriori.h
deleted file mode 100644
index ba92560d7e..0000000000
--- a/Tools/CCode/Source/Include/Guid/Apriori.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/** @file
- GUID used as an FV filename for A Priori file. The A Priori file contains a
- list of FV filenames that the DXE dispatcher will schedule reguardless of
- the dependency grammer.
-
- Copyright (c) 2006, 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.
-
- Module Name: Apriori.h
-
- @par Revision Reference:
- GUID defined in DXE CIS spec version 0.91B
-
-**/
-
-#ifndef __APRIORI_GUID_H__
-#define __APRIORI_GUID_H__
-
-#define EFI_APRIORI_GUID \
- { \
- 0xfc510ee7, 0xffdc, 0x11d4, {0xbd, 0x41, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
- }
-
-extern EFI_GUID gAprioriGuid;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Guid/Capsule.h b/Tools/CCode/Source/Include/Guid/Capsule.h
deleted file mode 100644
index 7864b924de..0000000000
--- a/Tools/CCode/Source/Include/Guid/Capsule.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/** @file
- GUIDs used for EFI Capsule
-
- Copyright (c) 2006, 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.
-
- Module Name: Capsule.h
-
- @par Revision Reference:
- GUIDs defined in Capsule Spec Version 0.9
-
-**/
-
-#ifndef __CAPSULE_GUID_H__
-#define __CAPSULE_GUID_H__
-
-//
-// This is the GUID of the capsule header of the image on disk.
-//
-#define EFI_CAPSULE_GUID \
- { \
- 0x3B6686BD, 0x0D76, 0x4030, {0xB7, 0x0E, 0xB5, 0x51, 0x9E, 0x2F, 0xC5, 0xA0 } \
- }
-
-//
-// This is the GUID of the configuration results file created by the capsule
-// application.
-//
-#define EFI_CONFIG_FILE_NAME_GUID \
- { \
- 0x98B8D59B, 0xE8BA, 0x48EE, {0x98, 0xDD, 0xC2, 0x95, 0x39, 0x2F, 0x1E, 0xDB } \
- }
-
-extern EFI_GUID gEfiCapsuleGuid;
-extern EFI_GUID gEfiConfigFileNameGuid;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Guid/FirmwareFileSystem.h b/Tools/CCode/Source/Include/Guid/FirmwareFileSystem.h
deleted file mode 100644
index 06bfa7d583..0000000000
--- a/Tools/CCode/Source/Include/Guid/FirmwareFileSystem.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
- Guid used to define the Firmware File System. See the Framework Firmware
- File System Specification for more details.
-
- Copyright (c) 2006, 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.
-
- Module Name: FirmwareFileSystem.h
-
- @par Revision Reference:
- Guids defined in Firmware File System Spec 0.9
-
-**/
-
-#ifndef __FIRMWARE_FILE_SYSTEM_GUID_H__
-#define __FIRMWARE_FILE_SYSTEM_GUID_H__
-
-//
-// GUIDs defined by the FFS specification.
-//
-#define EFI_FIRMWARE_FILE_SYSTEM_GUID \
- { \
- 0x7A9354D9, 0x0468, 0x444a, {0x81, 0xCE, 0x0B, 0xF6, 0x17, 0xD8, 0x90, 0xDF } \
- }
-
-#define EFI_FFS_VOLUME_TOP_FILE_GUID \
- { \
- 0x1BA0062E, 0xC779, 0x4582, {0x85, 0x66, 0x33, 0x6A, 0xE8, 0xF7, 0x8F, 0x9 } \
- }
-
-extern EFI_GUID gEfiFirmwareFileSystemGuid;
-extern EFI_GUID gEfiFirmwareVolumeTopFileGuid;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Ia32/ProcessorBind.h b/Tools/CCode/Source/Include/Ia32/ProcessorBind.h
deleted file mode 100644
index 587d8a69ab..0000000000
--- a/Tools/CCode/Source/Include/Ia32/ProcessorBind.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/** @file
- Processor or Compiler specific defines and types for x64.
-
- Copyright (c) 2006, 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.
-
- Module Name: ProcessorBind.h
-
-**/
-
-#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 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 complier dependent interger 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
-
-//
-// Maximum legal IA-32 address
-//
-#define MAX_ADDRESS 0xFFFFFFFF
-
-//
-// 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 thier member functions with EFIAPI.
-//
-#if _MSC_EXTENSIONS
- //
- // Microsoft* compiler requires _EFIAPI useage, __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/Tools/CCode/Source/Include/IndustryStandard/Acpi.h b/Tools/CCode/Source/Include/IndustryStandard/Acpi.h
deleted file mode 100644
index fc8c49843d..0000000000
--- a/Tools/CCode/Source/Include/IndustryStandard/Acpi.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/** @file
- This file contains some basic ACPI definitions that are consumed by drivers
- that do not care about ACPI versions.
-
- Copyright (c) 2006, 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.
-
- Module Name: Acpi.h
-
-**/
-
-#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/Tools/CCode/Source/Include/IndustryStandard/Acpi1_0.h b/Tools/CCode/Source/Include/IndustryStandard/Acpi1_0.h
deleted file mode 100644
index 6480e2ecdf..0000000000
--- a/Tools/CCode/Source/Include/IndustryStandard/Acpi1_0.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved.
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-
-Module Name:
-
- Acpi1_0.h
-
-Abstract:
-
- ACPI 1.0b definitions from the ACPI Specification, revision 1.0b
-
---*/
-
-#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)
-
-//
-// 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/Tools/CCode/Source/Include/IndustryStandard/Acpi2_0.h b/Tools/CCode/Source/Include/IndustryStandard/Acpi2_0.h
deleted file mode 100644
index 03c46c6f0d..0000000000
--- a/Tools/CCode/Source/Include/IndustryStandard/Acpi2_0.h
+++ /dev/null
@@ -1,533 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved.
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-
-Module Name:
-
- Acpi2_0.h
-
-Abstract:
-
- ACPI 2.0 definitions from the ACPI Specification, revision 2.0
-
---*/
-
-#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 Concole 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/Tools/CCode/Source/Include/IndustryStandard/Acpi3_0.h b/Tools/CCode/Source/Include/IndustryStandard/Acpi3_0.h
deleted file mode 100644
index af51e4d3fa..0000000000
--- a/Tools/CCode/Source/Include/IndustryStandard/Acpi3_0.h
+++ /dev/null
@@ -1,681 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved.
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-
-Module Name:
-
- Acpi3_0.h
-
-Abstract:
-
- ACPI 3.0 definitions from the ACPI Specification Revision 3.0 September 2, 2004
-
---*/
-
-#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 Concole 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/Tools/CCode/Source/Include/IndustryStandard/EfiPci.h b/Tools/CCode/Source/Include/IndustryStandard/EfiPci.h
deleted file mode 100644
index 7c5d4eb849..0000000000
--- a/Tools/CCode/Source/Include/IndustryStandard/EfiPci.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
- Support for EFI PCI specification.
-
- Copyright (c) 2006, 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.
-
- Module Name: EfiPci.h
-
-**/
-
-#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/Tools/CCode/Source/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h b/Tools/CCode/Source/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
deleted file mode 100644
index 175aa6ea86..0000000000
--- a/Tools/CCode/Source/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-
-Module Name:
-
- MemoryMappedConfigurationSpaceAccessTable.h
-
-Abstract:
-
- 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.
-
---*/
-
-#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/Tools/CCode/Source/Include/IndustryStandard/pci22.h b/Tools/CCode/Source/Include/IndustryStandard/pci22.h
deleted file mode 100644
index f150fbc1b0..0000000000
--- a/Tools/CCode/Source/Include/IndustryStandard/pci22.h
+++ /dev/null
@@ -1,543 +0,0 @@
-/** @file
- Support for PCI 2.2 standard.
-
- Copyright (c) 2006, 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.
-
- Module Name: pci22.h
-
-**/
-
-#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; // Cardus 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 bye none-prefectable 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 EFI_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/Tools/CCode/Source/Include/IndustryStandard/pci23.h b/Tools/CCode/Source/Include/IndustryStandard/pci23.h
deleted file mode 100644
index cb0cde0725..0000000000
--- a/Tools/CCode/Source/Include/IndustryStandard/pci23.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file
- Support for PCI 2.3 standard.
-
- Copyright (c) 2006, 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.
-
- Module Name: pci23.h
-
-**/
-
-#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/Tools/CCode/Source/Include/IndustryStandard/pci30.h b/Tools/CCode/Source/Include/IndustryStandard/pci30.h
deleted file mode 100644
index 0272ee5399..0000000000
--- a/Tools/CCode/Source/Include/IndustryStandard/pci30.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
- Support for PCI 3.0 standard.
-
- Copyright (c) 2006, 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.
-
- Module Name: pci30.h
-
-**/
-
-#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/Tools/CCode/Source/Include/Library/PeCoffLib.h b/Tools/CCode/Source/Include/Library/PeCoffLib.h
deleted file mode 100644
index 08e8195a8a..0000000000
--- a/Tools/CCode/Source/Include/Library/PeCoffLib.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/** @file
- Memory Only PE COFF loader
-
- Copyright (c) 2006, 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.
-
- Module Name: PeCoffLib.h
-
-**/
-
-#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
-
-
-//
-// 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
- )
-;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Library/PrintLib.h b/Tools/CCode/Source/Include/Library/PrintLib.h
deleted file mode 100644
index 9c65459a59..0000000000
--- a/Tools/CCode/Source/Include/Library/PrintLib.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/** @file
- Library that provides print services
-
- Copyright (c) 2006, 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.
-
- Module Name: PrintLib.h
-
-**/
-
-#ifndef __PRINT_LIB_H__
-#define __PRINT_LIB_H__
-
-//
-// Print primitives
-//
-#define LEFT_JUSTIFY 0x01
-#define COMMA_TYPE 0x08
-#define PREFIX_ZERO 0x20
-
-/**
- Produces a Null-terminated Unicode string in an output buffer based on
- a Null-terminated Unicode format string and a VA_LIST argument list
-
- Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on the
- contents of the format string.
- The length of the produced output buffer is returned.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize is not 0 and FormatString is NULL, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
-
- @param StartOfBuffer APointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
- @param Marker VA_LIST marker for the variable argument list.
-
- @return return Length of the produced output buffer.
-
-**/
-UINTN
-EFIAPI
-UnicodeVSPrint (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- IN VA_LIST Marker
- );
-
-/**
- Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
- Unicode format string and variable argument list.
-
- Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the format string.
- The length of the produced output buffer is returned.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize is not 0 and FormatString is NULL, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
-
- @param StartOfBuffer APointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
-
- @return Length of the produced output buffer.
-
-**/
-UINTN
-EFIAPI
-UnicodeSPrint (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- ...
- );
-
-/**
- Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
- ASCII format string and a VA_LIST argument list
-
- Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on the
- contents of the format string.
- The length of the produced output buffer is returned.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize is not 0 and FormatString is NULL, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
-
- @param StartOfBuffer APointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
- @param Marker VA_LIST marker for the variable argument list.
-
- @return Length of the produced output buffer.
-
-**/
-UINTN
-EFIAPI
-UnicodeVSPrintAsciiFormat (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- IN VA_LIST Marker
- );
-
-/**
- Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
- ASCII format string and variable argument list.
-
- Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the
- format string.
- The length of the produced output buffer is returned.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize is not 0 and FormatString is NULL, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().
-
- @param StartOfBuffer APointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
-
- @return Length of the produced output buffer.
-
-**/
-UINTN
-EFIAPI
-UnicodeSPrintAsciiFormat (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- ...
- );
-
-/**
- Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- ASCII format string and a VA_LIST argument list.
-
- Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on
- the contents of the format string.
- The length of the produced output buffer is returned.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize is not 0 and FormatString is NULL, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
-
- @param StartOfBuffer APointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
- @param Marker VA_LIST marker for the variable argument list.
-
- @return Length of the produced output buffer.
-
-**/
-UINTN
-EFIAPI
-AsciiVSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- IN VA_LIST Marker
- );
-
-/**
- Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- ASCII format string and variable argument list.
-
- Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the
- format string.
- The length of the produced output buffer is returned.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize is not 0 and FormatString is NULL, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
-
- @param StartOfBuffer APointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
-
- @return Length of the produced output buffer.
-
-**/
-UINTN
-EFIAPI
-AsciiSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- ...
- );
-
-/**
- Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- ASCII format string and a VA_LIST argument list.
-
- Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on
- the contents of the format string.
- The length of the produced output buffer is returned.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize is not 0 and FormatString is NULL, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
-
- @param StartOfBuffer APointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
- @param Marker VA_LIST marker for the variable argument list.
-
- @return Length of the produced output buffer.
-
-**/
-UINTN
-EFIAPI
-AsciiVSPrintUnicodeFormat (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- IN VA_LIST Marker
- );
-
-/**
- Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- ASCII format string and variable argument list.
-
- Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
- and BufferSize.
- The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the
- format string.
- The length of the produced output buffer is returned.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
-
- If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize is not 0 and FormatString is NULL, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().
-
- @param StartOfBuffer APointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
-
- @return Length of the produced output buffer.
-
-**/
-UINTN
-EFIAPI
-AsciiSPrintUnicodeFormat (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- ...
- );
-
-/**
- Converts a decimal value to a Null-terminated Unicode string.
-
- Converts the decimal number specified by Value to a Null-terminated Unicode
- string specified by Buffer containing at most Width characters.
- If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
- The total number of characters placed in Buffer is returned.
- If the conversion contains more than Width characters, then only the first
- Width characters are returned, and the total number of characters
- required to perform the conversion is returned.
- Additional conversion parameters are specified in Flags.
- The Flags bit LEFT_JUSTIFY is always ignored.
- All conversions are left justified in Buffer.
- If Width is 0, PREFIX_ZERO is ignored in Flags.
- If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
- are inserted every 3rd digit starting from the right.
- If Value is < 0, then the fist character in Buffer is a '-'.
- If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
- then Buffer is padded with '0' characters so the combination of the optional '-'
- sign character, '0' characters, digit characters for Value, and the Null-terminator
- add up to Width characters.
-
- If Buffer is NULL, then ASSERT().
- If unsupported bits are set in Flags, then ASSERT().
- If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
-
- @param Buffer Pointer to the output buffer for the produced Null-terminated
- Unicode string.
- @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
- @param Value The 64-bit signed value to convert to a string.
- @param Width The maximum number of Unicode characters to place in Buffer.
-
- @return Total number of characters required to perform the conversion.
-
-**/
-UINTN
-EFIAPI
-UnicodeValueToString (
- IN OUT CHAR16 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- );
-
-/**
- Converts a decimal value to a Null-terminated ASCII string.
-
- Converts the decimal number specified by Value to a Null-terminated ASCII string
- specified by Buffer containing at most Width characters.
- If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
- The total number of characters placed in Buffer is returned.
- If the conversion contains more than Width characters, then only the first Width
- characters are returned, and the total number of characters required to perform
- the conversion is returned.
- Additional conversion parameters are specified in Flags.
- The Flags bit LEFT_JUSTIFY is always ignored.
- All conversions are left justified in Buffer.
- If Width is 0, PREFIX_ZERO is ignored in Flags.
- If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
- are inserted every 3rd digit starting from the right.
- If Value is < 0, then the fist character in Buffer is a '-'.
- If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then Buffer
- is padded with '0' characters so the combination of the optional '-'
- sign character, '0' characters, digit characters for Value, and the
- Null-terminator add up to Width characters.
-
- If Buffer is NULL, then ASSERT().
- If unsupported bits are set in Flags, then ASSERT().
- If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
-
- @param Buffer Pointer to the output buffer for the produced Null-terminated
- ASCII string.
- @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
- @param Value The 64-bit signed value to convert to a string.
- @param Width The maximum number of ASCII characters to place in Buffer.
-
- @return Total number of characters required to perform the conversion.
-
-**/
-UINTN
-EFIAPI
-AsciiValueToString (
- IN OUT CHAR8 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- );
-
-#endif
diff --git a/Tools/CCode/Source/Include/Protocol/DevicePath.h b/Tools/CCode/Source/Include/Protocol/DevicePath.h
deleted file mode 100644
index d01999904f..0000000000
--- a/Tools/CCode/Source/Include/Protocol/DevicePath.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/** @file
- The device path protocol as defined in EFI 1.0.
-
- The device path represents a programatic path to a device. It's the view
- from a software point of view. It also must persist from boot to boot, so
- it can not contain things like PCI bus numbers that change from boot to boot.
-
- Copyright (c) 2006, 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.
-
- Module Name: DevicePath.h
-
-**/
-
-#ifndef __EFI_DEVICE_PATH_PROTOCOL_H__
-#define __EFI_DEVICE_PATH_PROTOCOL_H__
-
-//
-// Device Path protocol
-//
-#define EFI_DEVICE_PATH_PROTOCOL_GUID \
- { \
- 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
- }
-
-#pragma pack(1)
-
-typedef struct {
- UINT8 Type;
- UINT8 SubType;
- UINT8 Length[2];
-} EFI_DEVICE_PATH_PROTOCOL;
-
-#pragma pack()
-
-#define EFI_DP_TYPE_MASK 0x7F
-#define EFI_DP_TYPE_UNPACKED 0x80
-#define END_DEVICE_PATH_TYPE 0x7f
-
-#define EFI_END_ENTIRE_DEVICE_PATH 0xff
-#define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
-#define EFI_END_INSTANCE_DEVICE_PATH 0x01
-#define END_ENTIRE_DEVICE_PATH_SUBTYPE EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE
-#define END_INSTANCE_DEVICE_PATH_SUBTYPE EFI_END_INSTANCE_DEVICE_PATH
-
-#define EFI_END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))
-#define END_DEVICE_PATH_LENGTH EFI_END_DEVICE_PATH_LENGTH
-
-#define DP_IS_END_TYPE(a)
-#define DP_IS_END_SUBTYPE(a) (((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)
-#define DevicePathSubType(a) ((a)->SubType)
-#define IsDevicePathUnpacked(a) ((a)->Type & EFI_DP_TYPE_UNPACKED)
-
-#define EfiDevicePathNodeLength(a) (((a)->Length[0]) | ((a)->Length[1] << 8))
-#define DevicePathNodeLength(a) (EfiDevicePathNodeLength(a))
-#define EfiNextDevicePathNode(a) ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a)))
-#define NextDevicePathNode(a) (EfiNextDevicePathNode(a))
-
-#define EfiDevicePathType(a) (((a)->Type) & EFI_DP_TYPE_MASK)
-#define DevicePathType(a) (EfiDevicePathType(a))
-#define EfiIsDevicePathEndType(a) (EfiDevicePathType (a) == END_DEVICE_PATH_TYPE)
-#define IsDevicePathEndType(a) (EfiIsDevicePathEndType(a))
-
-
-#define EfiIsDevicePathEndSubType(a) ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)
-#define IsDevicePathEndSubType(a) (EfiIsDevicePathEndSubType(a))
-#define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH)
-
-#define EfiIsDevicePathEnd(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a))
-#define IsDevicePathEnd(a) (EfiIsDevicePathEnd(a))
-#define EfiIsDevicePathEndInstance(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a))
-
-
-#define SetDevicePathNodeLength(a,l) { \
- (a)->Length[0] = (UINT8) (l); \
- (a)->Length[1] = (UINT8) ((l) >> 8); \
- }
-
-#define SetDevicePathEndNode(a) { \
- (a)->Type = END_DEVICE_PATH_TYPE; \
- (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
- (a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL); \
- (a)->Length[1] = 0; \
- }
-
-extern EFI_GUID gEfiDevicePathProtocolGuid;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Protocol/GuidedSectionExtraction.h b/Tools/CCode/Source/Include/Protocol/GuidedSectionExtraction.h
deleted file mode 100644
index d98c56a7bc..0000000000
--- a/Tools/CCode/Source/Include/Protocol/GuidedSectionExtraction.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/** @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.
-
- Copyright (c) 2006, 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.
-
- Module Name: GuidedSectionExtraction.h
-
- @par Revision Reference:
- This protocol is defined in Firmware Volume Specification.
- Version 0.9
-
-**/
-
-#ifndef __GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
-#define __GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
-
-
-//
-// 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 } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL;
-
-//
-// Protocol member functions
-//
-/**
- Processes the input section and returns the data contained therein along
- with the authentication status.
-
- @param This Indicates the EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
- @param InputSection Buffer containing the input GUIDed section to be processed.
- @param OutputBuffer *OutputBuffer is allocated from boot services pool memory
- and contains the new section stream.
- @param OutputSize A pointer to a caller-allocated UINTN in which the size
- of *OutputBuffer allocation is stored.
- @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
- indicates the authentication status of the output buffer.
-
- @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 EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,
- IN VOID *InputSection,
- OUT VOID **OutputBuffer,
- OUT UINTN *OutputSize,
- OUT UINT32 *AuthenticationStatus
- );
-
-//
-// Protocol definition
-//
-/**
- @par Protocol Description:
- If a GUID-defined section is encountered when doing section extraction,
- the section extraction driver calls the appropriate instance of the GUIDed
- Section Extraction Protocol to extract the section stream contained therein.
-
- @param ExtractSection
- Takes the GUIDed section as input and produces the section stream data.
-
-**/
-struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL {
- EFI_EXTRACT_GUIDED_SECTION ExtractSection;
-};
-
-//
-// may add other GUID here
-//
-extern EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid;
-
-#endif
diff --git a/Tools/CCode/Source/Include/Protocol/Hii.h b/Tools/CCode/Source/Include/Protocol/Hii.h
deleted file mode 100644
index d1c3c252d6..0000000000
--- a/Tools/CCode/Source/Include/Protocol/Hii.h
+++ /dev/null
@@ -1,1024 +0,0 @@
-/** @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.
-
- Copyright (c) 2006, 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.
-
- Module Name: Hii.h
-
- @par Revision Reference:
- This protocol is defined in HII spec 0.92.
-
-**/
-
-#ifndef __HII_H__
-#define __HII_H__
-
-
-#define EFI_HII_PROTOCOL_GUID \
- { \
- 0xea816d2c, 0xcee5, 0x4f02, {0x99, 0xb5, 0xd3, 0x90, 0x5c, 0xbb, 0xd0, 0x77 } \
- }
-
-// 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:
-//
-typedef UINT16 EFI_FORM_ID;
-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_UGA_PIXEL Foreground,
- IN EFI_UGA_PIXEL Background,
- IN UINTN Count,
- IN UINTN Width,
- IN UINTN Height,
- IN OUT EFI_UGA_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/Tools/CCode/Source/Include/Protocol/UgaDraw.h b/Tools/CCode/Source/Include/Protocol/UgaDraw.h
deleted file mode 100644
index 5586bdfffb..0000000000
--- a/Tools/CCode/Source/Include/Protocol/UgaDraw.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/** @file
- UGA Draw protocol from the EFI 1.1 specification.
-
- Abstraction of a very simple graphics device.
-
- Copyright (c) 2006, 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.
-
- Module Name: UgaDraw.h
-
-**/
-
-#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 - Hight 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 occured writting 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/Tools/CCode/Source/Include/X64/ProcessorBind.h b/Tools/CCode/Source/Include/X64/ProcessorBind.h
deleted file mode 100644
index 8cbf4915f3..0000000000
--- a/Tools/CCode/Source/Include/X64/ProcessorBind.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/** @file
- Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
-
- Copyright (c) 2006, 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.
-
- Module Name: ProcessorBind.h
-
-**/
-
-#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
-//
-#pragma pack()
-
-
-#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 complier dependent interger 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 0x8000000000000000
-#define MAX_2_BITS 0xC000000000000000
-
-//
-// Maximum legal Itanium-based address
-//
-#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
-
-//
-// 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 thier member functions with EFIAPI.
-//
-#if _MSC_EXTENSIONS
- ///
- /// Define the standard calling convention reguardless of optimization level.
- /// __cdecl is Microsoft* specific C extension.
- ///
- #define EFIAPI __cdecl
-#elif __GNUC__
- ///
- /// Define the standard calling convention reguardless 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/Tools/CCode/Source/MakeDeps/MakeDeps.c b/Tools/CCode/Source/MakeDeps/MakeDeps.c
deleted file mode 100755
index 9eb0425a26..0000000000
--- a/Tools/CCode/Source/MakeDeps/MakeDeps.c
+++ /dev/null
@@ -1,1338 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 20077, 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.
-
-Module Name:
-
- MakeDeps.c
-
-Abstract:
-
- Recursively scan source files to find include files and emit them to
- create dependency lists.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include <Common/UefiBaseTypes.h>
-
-#include "EfiUtilityMsgs.h"
-#include "CommonLib.h"
-
-//
-// Structure to maintain a linked list of strings
-//
-typedef struct _STRING_LIST {
- struct _STRING_LIST *Next;
- char *Str;
-} STRING_LIST;
-
-#define UTILITY_NAME "MakeDeps"
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 0
-
-#define MAX_LINE_LEN 2048
-#define MAX_PATH 2048
-#define START_NEST_DEPTH 1
-#define MAX_NEST_DEPTH 1000 // just in case we get in an endless loop.
-//
-// Define the relative paths used by the special #include macros
-//
-#define PROTOCOL_DIR_PATH "Protocol/"
-#define GUID_DIR_PATH "Guid/"
-#define ARCH_PROTOCOL_DIR_PATH "ArchProtocol/"
-#define PPI_PROTOCOL_DIR_PATH "Ppi/"
-
-//
-// Use this structure to keep track of all the special #include forms
-//
-typedef struct {
- INT8 *IncludeMacroName;
- INT8 *PathName;
-} INCLUDE_MACRO_CONVERSION;
-
-//
-// This data is used to convert #include macros like:
-// #include EFI_PROTOCOL_DEFINITION(xxx)
-// into
-// #include Protocol/xxx/xxx.h
-//
-static const INCLUDE_MACRO_CONVERSION mMacroConversion[] = {
- "EFI_PROTOCOL_DEFINITION",
- PROTOCOL_DIR_PATH,
- "EFI_GUID_DEFINITION",
- GUID_DIR_PATH,
- "EFI_ARCH_PROTOCOL_DEFINITION",
- ARCH_PROTOCOL_DIR_PATH,
- "EFI_PROTOCOL_PRODUCER",
- PROTOCOL_DIR_PATH,
- "EFI_PROTOCOL_CONSUMER",
- PROTOCOL_DIR_PATH,
- "EFI_PROTOCOL_DEPENDENCY",
- PROTOCOL_DIR_PATH,
- "EFI_ARCH_PROTOCOL_PRODUCER",
- ARCH_PROTOCOL_DIR_PATH,
- "EFI_ARCH_PROTOCOL_CONSUMER",
- ARCH_PROTOCOL_DIR_PATH,
- "EFI_ARCH_PROTOCOL_DEPENDENCY",
- ARCH_PROTOCOL_DIR_PATH,
- "EFI_PPI_DEFINITION",
- PPI_PROTOCOL_DIR_PATH,
- "EFI_PPI_PRODUCER",
- PPI_PROTOCOL_DIR_PATH,
- "EFI_PPI_CONSUMER",
- PPI_PROTOCOL_DIR_PATH,
- "EFI_PPI_DEPENDENCY",
- PPI_PROTOCOL_DIR_PATH,
- NULL,
- NULL
-};
-
-typedef struct _SYMBOL {
- struct _SYMBOL *Next;
- INT8 *Name;
- INT8 *Value;
-} SYMBOL;
-
-//
-// Here's all our globals. We need a linked list of include paths, a linked
-// list of source files, a linked list of subdirectories (appended to each
-// include path when searching), and flags to keep track of command-line options.
-//
-static struct {
- STRING_LIST *IncludePaths; // all include paths to search
- STRING_LIST *SourceFiles; // all source files to parse
- STRING_LIST *SubDirs; // appended to each include path when searching
- SYMBOL *SymbolTable; // for replacement strings
- FILE *OutFptr; // output dependencies to this file
- BOOLEAN Verbose; // for more detailed output
- BOOLEAN IgnoreNotFound; // no warnings if files not found
- BOOLEAN QuietMode; // -q - don't print missing file warnings
- BOOLEAN NoSystem; // don't process #include <system> files
- BOOLEAN NeverFail; // always return success
- BOOLEAN NoDupes; // to not list duplicate dependency files (for timing purposes)
- BOOLEAN UseSumDeps; // use summary dependency files if found
- INT8 TargetFileName[MAX_PATH]; // target object filename
- INT8 SumDepsPath[MAX_PATH]; // path to summary files
- INT8 *OutFileName; // -o option
-} mGlobals;
-
-static
-STATUS
-ProcessFile (
- INT8 *TargetFileName,
- INT8 *FileName,
- UINT32 NestDepth,
- STRING_LIST *ProcessedFiles
- );
-
-static
-FILE *
-FindFile (
- INT8 *FileName,
- UINT32 FileNameLen
- );
-
-static
-void
-PrintDependency (
- INT8 *Target,
- INT8 *DependentFile
- );
-
-static
-void
-ReplaceSymbols (
- INT8 *Str,
- UINT32 StrSize
- );
-
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- );
-
-static
-void
-Version (
- VOID
- );
-
-static
-void
-Usage (
- VOID
- );
-
-static
-void
-FreeLists (
- VOID
- );
-
-int
-main (
- int Argc,
- char *Argv[]
- )
-/*++
-
-Routine Description:
-
- Call the routine to parse the command-line options, then process each file
- to build dependencies.
-
-Arguments:
-
- Argc - Standard C main() argc.
- Argv - Standard C main() argv.
-
-Returns:
-
- 0 if successful
- nonzero otherwise
-
---*/
-{
- STRING_LIST *File;
- STRING_LIST ProcessedFiles;
- STRING_LIST *TempList;
- STATUS Status;
- INT8 *Cptr;
- INT8 TargetFileName[MAX_PATH];
-
- SetUtilityName (UTILITY_NAME);
- //
- // Process the command-line arguments
- //
- Status = ProcessArgs (Argc, Argv);
- if (Status != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
- //
- // Go through the list of source files and process each.
- //
- memset (&ProcessedFiles, 0, sizeof (STRING_LIST));
- File = mGlobals.SourceFiles;
- while (File != NULL) {
- //
- // Clear out our list of processed files
- //
- TempList = ProcessedFiles.Next;
- while (ProcessedFiles.Next != NULL) {
- TempList = ProcessedFiles.Next->Next;
- free (ProcessedFiles.Next->Str);
- free (ProcessedFiles.Next);
- ProcessedFiles.Next = TempList;
- }
- //
- // Replace filename extension with ".obj" if they did not
- // specifically specify the target file
- //
- if (mGlobals.TargetFileName[0] == 0) {
- strcpy (TargetFileName, File->Str);
- //
- // Find the .extension
- //
- for (Cptr = TargetFileName + strlen (TargetFileName) - 1;
- (*Cptr != '\\' && *Cptr != '/') && (Cptr > TargetFileName) && (*Cptr != '.');
- Cptr--
- )
- ;
- if (Cptr == TargetFileName) {
- Error (NULL, 0, 0, File->Str, "could not locate extension in filename");
- goto Finish;
- }
- //
- // Tack on the ".obj"
- //
- strcpy (Cptr, ".obj");
- } else {
- //
- // Copy the target filename they specified
- //
- strcpy (TargetFileName, mGlobals.TargetFileName);
- }
-
- Status = ProcessFile (TargetFileName, File->Str, START_NEST_DEPTH, &ProcessedFiles);
- if (Status != STATUS_SUCCESS) {
- goto Finish;
- }
-
- File = File->Next;
- }
-
-Finish:
- //
- // Free up memory
- //
- FreeLists ();
- //
- // Free up our processed files list
- //
- TempList = ProcessedFiles.Next;
- while (ProcessedFiles.Next != NULL) {
- TempList = ProcessedFiles.Next->Next;
- free (ProcessedFiles.Next->Str);
- free (ProcessedFiles.Next);
- ProcessedFiles.Next = TempList;
- }
- //
- // Close our output file
- //
- if ((mGlobals.OutFptr != stdout) && (mGlobals.OutFptr != NULL)) {
- fprintf(mGlobals.OutFptr, "\t\n"); // file ending flag
- fclose (mGlobals.OutFptr);
- }
-
- if (mGlobals.NeverFail) {
- return STATUS_SUCCESS;
- }
- //
- // If any errors, then delete our output so that it will get created
- // again on a rebuild.
- //
- if ((GetUtilityStatus () == STATUS_ERROR) && (mGlobals.OutFileName != NULL)) {
- remove (mGlobals.OutFileName);
- }
-
- return GetUtilityStatus ();
-}
-
-static
-STATUS
-ProcessFile (
- INT8 *TargetFileName,
- INT8 *FileName,
- UINT32 NestDepth,
- STRING_LIST *ProcessedFiles
- )
-/*++
-
-Routine Description:
-
- Given a source file name, open the file and parse all #include lines.
-
-Arguments:
-
- TargetFileName - name of the usually .obj target
- FileName - name of the file to process
- NestDepth - how deep we're nested in includes
- ProcessedFiles - list of processed files.
-
-Returns:
-
- standard status.
-
---*/
-{
- FILE *Fptr;
- INT8 Line[MAX_LINE_LEN];
- INT8 *Cptr;
- INT8 *EndPtr;
- INT8 *SaveCptr;
- INT8 EndChar;
- INT8 FileNameCopy[MAX_PATH];
- INT8 MacroIncludeFileName[MAX_LINE_LEN];
- INT8 SumDepsFile[MAX_PATH];
- STATUS Status;
- UINT32 Index;
- UINT32 LineNum;
- STRING_LIST *ListPtr;
-
- Status = STATUS_SUCCESS;
- Fptr = NULL;
- //
- // Print the file being processed. Indent so you can tell the include nesting
- // depth.
- //
- if (mGlobals.Verbose) {
- fprintf (stdout, "%*cProcessing file '%s'\n", NestDepth * 2, ' ', FileName);
- }
- //
- // If we're using summary dependency files, and a matching .dep file is
- // found for this file, then just emit the summary dependency file as
- // a dependency and return.
- //
- if (mGlobals.UseSumDeps) {
- strcpy (SumDepsFile, mGlobals.SumDepsPath);
- strcat (SumDepsFile, FileName);
- for (Cptr = SumDepsFile + strlen (SumDepsFile) - 1;
- (*Cptr != '\\' && *Cptr != '/') && (Cptr > SumDepsFile) && (*Cptr != '.');
- Cptr--
- )
- ;
- if (*Cptr == '.') {
- strcpy (Cptr, ".dep");
- } else {
- strcat (SumDepsFile, ".dep");
- }
- //
- // See if the summary dep file exists. Could use _stat() function, but
- // it's less portable.
- //
- if ((Fptr = fopen (SumDepsFile, "r")) != NULL) {
- PrintDependency (TargetFileName, SumDepsFile);
- return STATUS_SUCCESS;
- }
- }
- //
- // If we're not doing duplicates, and we've already seen this filename,
- // then return
- //
- if (mGlobals.NoDupes) {
- for (ListPtr = ProcessedFiles->Next; ListPtr != NULL; ListPtr = ListPtr->Next) {
- if (stricmp (FileName, ListPtr->Str) == 0) {
- break;
- }
- }
- //
- // If we found a match, we're done. If we didn't, create a new element
- // and add it to the list.
- //
- if (ListPtr != NULL) {
- //
- // Print a message if verbose mode
- //
- if (mGlobals.Verbose) {
- DebugMsg (NULL, 0, 0, FileName, "duplicate include -- not processed again");
- }
-
- return STATUS_SUCCESS;
- }
-
- ListPtr = malloc (sizeof (STRING_LIST));
- ListPtr->Str = malloc (strlen (FileName) + 1);
- strcpy (ListPtr->Str, FileName);
- ListPtr->Next = ProcessedFiles->Next;
- ProcessedFiles->Next = ListPtr;
- }
-
- //
- // Make sure we didn't exceed our maximum nesting depth
- //
- if (NestDepth > MAX_NEST_DEPTH) {
- Error (NULL, 0, 0, FileName, "max nesting depth exceeded on file");
- goto Finish;
- }
- //
- // Make a local copy of the filename. Then we can manipulate it
- // if we have to.
- //
- strcpy (FileNameCopy, FileName);
- //
- // Try to open the file locally
- //
- if ((Fptr = fopen (FileNameCopy, "r")) == NULL) {
- //
- // Try to find it among the paths.
- //
- Fptr = FindFile (FileNameCopy, sizeof (FileNameCopy));
- if (Fptr == NULL) {
- //
- // If this is not the top-level file, and the command-line argument
- // said to ignore missing files, then return ok
- //
- if (NestDepth != START_NEST_DEPTH) {
- if (mGlobals.IgnoreNotFound) {
- if (!mGlobals.QuietMode) {
- DebugMsg (NULL, 0, 0, FileNameCopy, "could not find file");
- }
-
- return STATUS_SUCCESS;
- } else {
- Error (NULL, 0, 0, FileNameCopy, "could not find file");
- return STATUS_ERROR;
- }
- } else {
- //
- // Top-level (first) file. Emit an error.
- //
- Error (NULL, 0, 0, FileNameCopy, "could not find file");
- return STATUS_ERROR;
- }
- }
- }
- //
- // Print the dependency, with string substitution
- //
- PrintDependency (TargetFileName, FileNameCopy);
-
- //
- // Now read in lines and find all #include lines. Allow them to indent, and
- // to put spaces between the # and include.
- //
- LineNum = 0;
- while ((fgets (Line, sizeof (Line), Fptr) != NULL) && (Status == STATUS_SUCCESS)) {
- LineNum++;
- Cptr = Line;
- //
- // Skip preceeding spaces on the line
- //
- while (*Cptr && (isspace (*Cptr))) {
- Cptr++;
- }
- //
- // Check for # character
- //
- if (*Cptr == '#') {
- Cptr++;
- //
- // Check for "include"
- //
- while (*Cptr && (isspace (*Cptr))) {
- Cptr++;
- }
-
- if (strncmp (Cptr, "include", 7) == 0) {
- //
- // Skip over "include" and move on to filename as "file" or <file>
- //
- Cptr += 7;
- while (*Cptr && (isspace (*Cptr))) {
- Cptr++;
- }
-
- if (*Cptr == '<') {
- EndChar = '>';
- } else if (*Cptr == '"') {
- EndChar = '"';
- } else {
- //
- // Handle special #include MACRO_NAME(file)
- // Set EndChar to null so we fall through on processing below.
- //
- EndChar = 0;
- //
- // Look for all the special include macros and convert accordingly.
- //
- for (Index = 0; mMacroConversion[Index].IncludeMacroName != NULL; Index++) {
- //
- // Save the start of the string in case some macros are substrings
- // of others.
- //
- SaveCptr = Cptr;
- if (strncmp (
- Cptr,
- mMacroConversion[Index].IncludeMacroName,
- strlen (mMacroConversion[Index].IncludeMacroName)
- ) == 0) {
- //
- // Skip over the macro name
- //
- Cptr += strlen (mMacroConversion[Index].IncludeMacroName);
- //
- // Skip over open parenthesis, blank spaces, then find closing
- // parenthesis or blank space
- //
- while (*Cptr && (isspace (*Cptr))) {
- Cptr++;
- }
-
- if (*Cptr == '(') {
- Cptr++;
- while (*Cptr && (isspace (*Cptr))) {
- Cptr++;
- }
-
- EndPtr = Cptr;
- while (*EndPtr && !isspace (*EndPtr) && (*EndPtr != ')')) {
- EndPtr++;
- }
-
- *EndPtr = 0;
- //
- // Create the path
- //
- strcpy (MacroIncludeFileName, mMacroConversion[Index].PathName);
- strcat (MacroIncludeFileName, Cptr);
- strcat (MacroIncludeFileName, "/");
- strcat (MacroIncludeFileName, Cptr);
- strcat (MacroIncludeFileName, ".h");
- //
- // Process immediately, then break out of the outside FOR loop.
- //
- Status = ProcessFile (TargetFileName, MacroIncludeFileName, NestDepth + 1, ProcessedFiles);
- break;
- }
- }
- //
- // Restore the start
- //
- Cptr = SaveCptr;
- }
- //
- // Don't recognize the include line? Ignore it. We assume that the
- // file compiles anyway.
- //
- if (mMacroConversion[Index].IncludeMacroName == NULL) {
- //
- // Warning (FileNameCopy, LineNum, 0, "could not parse line", NULL);
- // Status = STATUS_WARNING;
- //
- }
- }
- //
- // Process "normal" includes. If the endchar is 0, then the
- // file has already been processed. Otherwise look for the
- // endchar > or ", and process the include file.
- //
- if (EndChar != 0) {
- Cptr++;
- EndPtr = Cptr;
- while (*EndPtr && (*EndPtr != EndChar)) {
- EndPtr++;
- }
-
- if (*EndPtr == EndChar) {
- //
- // If we're processing it, do it
- //
- if ((EndChar != '>') || (!mGlobals.NoSystem)) {
- //
- // Null terminate the filename and try to process it.
- //
- *EndPtr = 0;
- Status = ProcessFile (TargetFileName, Cptr, NestDepth + 1, ProcessedFiles);
- }
- } else {
- Warning (FileNameCopy, LineNum, 0, "malformed include", "missing closing %c", EndChar);
- Status = STATUS_WARNING;
- goto Finish;
- }
- }
- }
- }
- }
-
-Finish:
- //
- // Close open files and return status
- //
- if (Fptr != NULL) {
- fclose (Fptr);
- }
-
- return Status;
-}
-
-static
-void
-PrintDependency (
- INT8 *TargetFileName,
- INT8 *DependentFile
- )
-/*++
-
-Routine Description:
-
- Given a target (.obj) file name, and a dependent file name, do any string
- substitutions (per the command line options) on the file names, then
- print the dependency line of form:
-
- TargetFileName : DependentFile
-
-Arguments:
-
- TargetFileName - build target file name
- DependentFile - file on which TargetFileName depends
-
-Returns:
-
- None
-
---*/
-{
- INT8 Str[MAX_PATH];
-
- //
- // Go through the symbols and do replacements
- //
- strcpy (Str, DependentFile);
- ReplaceSymbols (Str, sizeof (Str));
- fprintf (mGlobals.OutFptr, "%s\n", Str);
-}
-
-static
-void
-ReplaceSymbols (
- INT8 *Str,
- UINT32 StrSize
- )
-{
- SYMBOL *Sym;
- INT8 StrCopy[MAX_LINE_LEN];
- INT8 *From;
- INT8 *To;
- BOOLEAN Replaced;
-
- //
- // Go through the entire string to look for replacement strings at
- // every position.
- //
- From = Str;
- To = StrCopy;
- while (*From) {
- //
- // Copy the character
- //
- *To = *From;
- Replaced = FALSE;
- //
- // Go through each symbol and try to find a string substitution
- //
- Sym = mGlobals.SymbolTable;
- while (Sym != NULL) {
- if (strnicmp (From, Sym->Value, strlen (Sym->Value)) == 0) {
- //
- // Replace the string, then advance the pointers past the
- // replaced strings
- //
- strcpy (To, Sym->Name);
- To += strlen (Sym->Name);
- From += strlen (Sym->Value);
- Replaced = TRUE;
- //
- // Break from the while()
- //
- break;
- } else {
- Sym = Sym->Next;
- }
- }
-
- if (!Replaced) {
- From++;
- To++;
- }
- }
- //
- // Null terminate, and return it
- //
- *To = 0;
- if (strlen (StrCopy) < StrSize) {
- strcpy (Str, StrCopy);
- }
-}
-//
-// Given a filename, try to find it along the include paths.
-//
-static
-FILE *
-FindFile (
- INT8 *FileName,
- UINT32 FileNameLen
- )
-{
- FILE *Fptr;
- STRING_LIST *List;
- STRING_LIST *SubDir;
- INT8 FullFileName[MAX_PATH * 2];
-
- //
- // Traverse the list of paths and try to find the file
- //
- List = mGlobals.IncludePaths;
- while (List != NULL) {
- //
- // Put the path and filename together
- //
- if (strlen (List->Str) + strlen (FileName) + 1 > sizeof (FullFileName)) {
- Error (
- __FILE__,
- __LINE__,
- 0,
- "application error",
- "cannot concatenate '%s' + '%s'",
- List->Str,
- FileName
- );
- return NULL;
- }
- //
- // Append the filename to this include path and try to open the file.
- //
- strcpy (FullFileName, List->Str);
- strcat (FullFileName, FileName);
- if ((Fptr = fopen (FullFileName, "r")) != NULL) {
- //
- // Return the file name
- //
- if (FileNameLen <= strlen (FullFileName)) {
- Error (__FILE__, __LINE__, 0, "application error", "internal path name of insufficient length");
- //
- // fprintf (stdout, "File length > %d: %s\n", FileNameLen, FullFileName);
- //
- return NULL;
- }
-
- strcpy (FileName, FullFileName);
- return Fptr;
- }
- //
- // Didn't find it there. Now try this directory with every subdirectory
- // the user specified on the command line
- //
- for (SubDir = mGlobals.SubDirs; SubDir != NULL; SubDir = SubDir->Next) {
- strcpy (FullFileName, List->Str);
- strcat (FullFileName, SubDir->Str);
- strcat (FullFileName, FileName);
- if ((Fptr = fopen (FullFileName, "r")) != NULL) {
- //
- // Return the file name
- //
- if (FileNameLen <= strlen (FullFileName)) {
- Error (__FILE__, __LINE__, 0, "application error", "internal path name of insufficient length");
- return NULL;
- }
-
- strcpy (FileName, FullFileName);
- return Fptr;
- }
- }
-
- List = List->Next;
- }
- //
- // Not found
- //
- return NULL;
-}
-//
-// Process the command-line arguments
-//
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- )
-{
- STRING_LIST *NewList;
- STRING_LIST *LastIncludePath;
- STRING_LIST *LastSourceFile;
- SYMBOL *Symbol;
- int Index;
- //
- // Clear our globals
- //
- memset ((char *) &mGlobals, 0, sizeof (mGlobals));
- mGlobals.NoDupes = TRUE;
- //
- // Skip program name
- //
- Argc--;
- Argv++;
-
- if (Argc == 0) {
- Usage ();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
- (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- //
- // Initialize locals
- //
- LastIncludePath = NULL;
- LastSourceFile = NULL;
- //
- // Process until no more args
- //
- while (Argc) {
- //
- // -i path add include search path
- //
- if (stricmp (Argv[0], "-i") == 0) {
- //
- // check for one more arg
- //
- if (Argc > 1) {
- //
- // Allocate memory for a new list element, fill it in, and
- // add it to our list of include paths. Always make sure it
- // has a "\" on the end of it.
- //
- NewList = malloc (sizeof (STRING_LIST));
- if (NewList == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- NewList->Next = NULL;
- NewList->Str = malloc (strlen (Argv[1]) + 2);
- if (NewList->Str == NULL) {
- free (NewList);
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (NewList->Str, Argv[1]);
- if (NewList->Str[strlen (NewList->Str) - 1] != '\\' && NewList->Str[strlen (NewList->Str) - 1] != '/') {
- strcat (NewList->Str, "/");
- }
- //
- // Add it to the end of the our list of include paths
- //
- if (mGlobals.IncludePaths == NULL) {
- mGlobals.IncludePaths = NewList;
- } else {
- LastIncludePath->Next = NewList;
- }
-
- LastIncludePath = NewList;
- //
- // fprintf (stdout, "Added path: %s\n", NewList->Str);
- //
- } else {
- Error (NULL, 0, 0, Argv[0], "option requires an include path");
- Usage ();
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-f") == 0) {
- //
- // Check for one more arg
- //
- if (Argc > 1) {
- //
- // Allocate memory for a new list element, fill it in, and
- // add it to our list of source files.
- //
- NewList = malloc (sizeof (STRING_LIST));
- if (NewList == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- NewList->Next = NULL;
- //
- // Allocate space to replace ".c" with ".obj", plus null termination
- //
- NewList->Str = malloc (strlen (Argv[1]) + 5);
- if (NewList->Str == NULL) {
- free (NewList);
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (NewList->Str, Argv[1]);
- if (mGlobals.SourceFiles == NULL) {
- mGlobals.SourceFiles = NewList;
- } else {
- LastSourceFile->Next = NewList;
- }
-
- LastSourceFile = NewList;
- } else {
- Error (NULL, 0, 0, Argv[0], "option requires a file name");
- Usage ();
- return STATUS_ERROR;
- }
- //
- // The C compiler first looks for #include files in the directory where
- // the source file came from. Add the file's source directory to the
- // list of include paths.
- //
- NewList = malloc (sizeof (STRING_LIST));
- if (NewList == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- NewList->Next = NULL;
- NewList->Str = malloc (strlen (Argv[1]) + 3);
- if (NewList->Str == NULL) {
- free (NewList);
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (NewList->Str, Argv[1]);
- //
- // Back up in the source file name to the last backslash and terminate after it.
- //
- for (Index = strlen (NewList->Str) - 1; (Index > 0) && (NewList->Str[Index] != '\\' && NewList->Str[Index] != '/'); Index--)
- ;
- if (Index < 0) {
- strcpy (NewList->Str, "./");
- } else {
- NewList->Str[Index + 1] = 0;
- }
- //
- // Add it to the end of the our list of include paths
- //
- if (mGlobals.IncludePaths == NULL) {
- mGlobals.IncludePaths = NewList;
- } else {
- LastIncludePath->Next = NewList;
- }
-
- if (mGlobals.Verbose) {
- fprintf (stdout, "Adding include path: %s\n", NewList->Str);
- }
-
- LastIncludePath = NewList;
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-s") == 0) {
- //
- // -s subdir add subdirectory subdir to list of subdirecties to scan.
- // Check for one more arg first.
- //
- if (Argc > 1) {
- //
- // Allocate memory for a new list element, fill it in, and
- // add it to our list of subdirectory include paths. Always
- // make sure it has a "\" on the end of it.
- //
- NewList = malloc (sizeof (STRING_LIST));
- if (NewList == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- NewList->Str = malloc (strlen (Argv[1]) + 2);
- if (NewList->Str == NULL) {
- free (NewList);
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (NewList->Str, Argv[1]);
- if (NewList->Str[strlen (NewList->Str) - 1] != '\\' && NewList->Str[strlen (NewList->Str) - 1] != '/') {
- strcat (NewList->Str, "/");
- }
-
- NewList->Next = mGlobals.SubDirs;
- mGlobals.SubDirs = NewList;
- } else {
- Error (NULL, 0, 0, Argv[0], "option requires a subdirectory name");
- Usage ();
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-sub") == 0) {
- //
- // -sub symname symvalue to do string substitution in the output
- //
- if (Argc > 2) {
- //
- // Allocate memory for the symbol object
- //
- Symbol = malloc (sizeof (SYMBOL));
- if (Symbol == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
- //
- // Allocate memory for the symbol name and value, then save copies
- //
- Symbol->Name = malloc (strlen (Argv[1]) + 1);
- if (Symbol->Name == NULL) {
- free (Symbol);
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (Symbol->Name, Argv[1]);
- Symbol->Value = malloc (strlen (Argv[2]) + 1);
- if (Symbol->Value == NULL) {
- free (Symbol->Name);
- free (Symbol);
- Error (__FILE__, __LINE__, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (Symbol->Value, Argv[2]);
- //
- // Add it to the list
- //
- Symbol->Next = mGlobals.SymbolTable;
- mGlobals.SymbolTable = Symbol;
- } else {
- Error (NULL, 0, 0, Argv[0], "option requires a symbol name and value");
- Usage ();
- return STATUS_ERROR;
- }
- //
- // Skip over args
- //
- Argc -= 2;
- Argv += 2;
- } else if (stricmp (Argv[0], "-nosystem") == 0) {
- mGlobals.NoSystem = TRUE;
- } else if (stricmp (Argv[0], "-nodupes") == 0) {
- mGlobals.NoDupes = TRUE;
- } else if (stricmp (Argv[0], "-nodups") == 0) {
- mGlobals.NoDupes = TRUE;
- } else if (stricmp (Argv[0], "-target") == 0) {
- //
- // -target TargetFileName - Target object file (only one allowed right
- // now) is TargetFileName rather than SourceFile.obj
- //
- if (Argc > 1) {
- strcpy (mGlobals.TargetFileName, Argv[1]);
- } else {
- Error (NULL, 0, 0, Argv[0], "option requires a target file name");
- Usage ();
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-usesumdeps") == 0) {
- //
- // -usesumdeps Path - if we find an included file xxx.h, and file
- // Path/xxx.dep exists, list Path/xxx.dep as a dependency rather than
- // xxx.h and don't parse xxx.h. This allows you to create a dependency
- // file for a commonly included file, and have its dependency file updated
- // only if its included files are updated. Then anyone else including this
- // common include file can simply have a dependency on that file's .dep file
- // rather than on all the files included by it. Confusing enough?
- //
- mGlobals.UseSumDeps = 1;
- if (Argc > 1) {
- strcpy (mGlobals.SumDepsPath, Argv[1]);
- //
- // Add slash on end if not there
- //
- if (mGlobals.SumDepsPath[strlen (mGlobals.SumDepsPath) - 1] != '\\' && mGlobals.SumDepsPath[strlen (mGlobals.SumDepsPath) - 1] != '/') {
- strcat (mGlobals.SumDepsPath, "/");
- }
- } else {
- Error (NULL, 0, 0, Argv[0], "option requires path to summary dependency files");
- Usage ();
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
-
- } else if (stricmp (Argv[0], "-o") == 0) {
- //
- // -o OutputFileName - specify an output filename for dependency list
- // check for one more arg
- //
- if (Argc > 1) {
- //
- // Try to open the file
- //
- if ((mGlobals.OutFptr = fopen (Argv[1], "w")) == NULL) {
- Error (NULL, 0, 0, Argv[1], "could not open file for writing");
- return STATUS_ERROR;
- }
-
- mGlobals.OutFileName = Argv[1];
- } else {
- Error (NULL, 0, 0, Argv[0], "option requires output file name");
- Usage ();
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-v") == 0) {
- mGlobals.Verbose = TRUE;
- } else if (stricmp (Argv[0], "-neverfail") == 0) {
- mGlobals.NeverFail = TRUE;
- } else if (stricmp (Argv[0], "-q") == 0) {
- mGlobals.QuietMode = TRUE;
- } else if (stricmp (Argv[0], "-ignorenotfound") == 0) {
- mGlobals.IgnoreNotFound = TRUE;
- } else if ((stricmp (Argv[0], "-h") == 0) || (strcmp (Argv[0], "-?") == 0)) {
- Usage ();
- return STATUS_ERROR;
- } else {
- Error (NULL, 0, 0, Argv[0], "unrecognized option");
- Usage ();
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- }
- //
- // Had to specify at least one source file
- //
- if (mGlobals.SourceFiles == NULL) {
- Error (NULL, 0, 0, "must specify one source file name", NULL);
- Usage ();
- return STATUS_ERROR;
- }
- //
- // Assume output to stdout if not specified
- //
- if (mGlobals.OutFptr == NULL) {
- mGlobals.OutFptr = stdout;
- }
-
- return STATUS_SUCCESS;
-}
-//
-// Free the global string lists we allocated memory for
-//
-static
-void
-FreeLists (
- VOID
- )
-{
- STRING_LIST *Temp;
- SYMBOL *NextSym;
-
- //
- // printf ("Free lists.....");
- //
- // Traverse the include paths, freeing each
- // printf ("freeing include paths\n");
- //
- while (mGlobals.IncludePaths != NULL) {
- Temp = mGlobals.IncludePaths->Next;
- //
- // printf ("Freeing include path string '%s' at 0x%X\n",
- // mGlobals.IncludePaths->Str, (int)(mGlobals.IncludePaths->Str));
- //
- free (mGlobals.IncludePaths->Str);
- //
- // printf ("Freeing include path object at 0x%X\n", (int)(mGlobals.IncludePaths));
- //
- free (mGlobals.IncludePaths);
- mGlobals.IncludePaths = Temp;
- }
- //
- // Traverse the source files, freeing each
- //
- while (mGlobals.SourceFiles != NULL) {
- Temp = mGlobals.SourceFiles->Next;
- free (mGlobals.SourceFiles->Str);
- free (mGlobals.SourceFiles);
- mGlobals.SourceFiles = Temp;
- }
- //
- // Traverse the subdirectory list, freeing each
- //
- while (mGlobals.SubDirs != NULL) {
- Temp = mGlobals.SubDirs->Next;
- free (mGlobals.SubDirs->Str);
- free (mGlobals.SubDirs);
- mGlobals.SubDirs = Temp;
- }
- //
- // Free the symbol table
- //
- while (mGlobals.SymbolTable != NULL) {
- NextSym = mGlobals.SymbolTable->Next;
- free (mGlobals.SymbolTable->Name);
- free (mGlobals.SymbolTable->Value);
- mGlobals.SymbolTable = NextSym;
- }
- //
- // printf ("done\n");
- //
-}
-
-static
-void
-Version(
- void
-)
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Utility for generating file dependency lists for files in a given directory.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-static
-void
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Print usage information for this utility.
-
-Arguments:
-
- None.
-
-Returns:
-
- Nothing.
-
---*/
-{
- int Index;
- static const char *Str[] = {
- UTILITY_NAME " -- make dependencies",
- " Usage: MakeDeps [options]",
- " Options include:",
- " -h,--help,-?,/? display help messages",
- " -V,--version display version information",
- " -f SourceFile add SourceFile to list of files to scan",
- " -i IncludePath add IncludePath to list of search paths",
- " -o OutputFile write output dependencies to OutputFile",
- " -s SubDir for each IncludePath, also search IncludePath\\SubDir",
- " -v for verbose output",
- " -ignorenotfound don't warn for files not found",
- " -target Target for single SourceFile, target is Target, not SourceFile.obj",
- " -q quiet mode to not report files not found if ignored",
- " -sub sym str replace all occurrances of 'str' with 'sym' in the output",
- " -nosystem not process system <include> files",
- " -neverfail always return a success return code",
- //
- // " -nodupes keep track of include files, don't rescan duplicates",
- //
- " -usesumdeps path use summary dependency files in 'path' directory.",
- "",
- NULL
- };
-
- Version();
-
- for (Index = 0; Str[Index] != NULL; Index++) {
- fprintf (stdout, "%s\n", Str[Index]);
- }
-}
diff --git a/Tools/CCode/Source/MakeDeps/build.xml b/Tools/CCode/Source/MakeDeps/build.xml
deleted file mode 100755
index 6c532a126f..0000000000
--- a/Tools/CCode/Source/MakeDeps/build.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK MakeDeps Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="MakeDeps"/>
- <property name="FileSet" value="*.c *.h"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/ModifyInf/ModifyInf.c b/Tools/CCode/Source/ModifyInf/ModifyInf.c
deleted file mode 100755
index 7115c00903..0000000000
--- a/Tools/CCode/Source/ModifyInf/ModifyInf.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-
-Module Name:
-
- ModifyInf.c
-
-Abstract:
-
- It is a simple tool to modify some fields in a FV inf file
- and output a new FV inf file.
-
---*/
-
-#include "stdio.h"
-#include "string.h"
-
-#define UTILITY_NAME "ModifyInf"
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 1
-
-//
-// Read a line into buffer including '\r\n'
-//
-int
-ReadLine (
- char *LineBuffer,
- FILE *fp
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- LineBuffer - GC_TODO: add argument description
- fp - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- int CharC;
- char *Line;
-
- Line = LineBuffer;
-
- while ((CharC = fgetc (fp)) != EOF) {
- *Line++ = (char) CharC;
- if (CharC == 0x0a) {
- break;
- }
- }
-
- *Line = 0;
-
- if (CharC == EOF) {
- return 0;
- } else {
- return 1;
- }
-
-}
-//
-// Write a line into output file
-//
-int
-WriteLine (
- char *Line,
- FILE *fp
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- Line - GC_TODO: add argument description
- fp - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- fwrite (Line, strlen (Line), 1, fp);
- return 0;
-}
-//
-// Apply patterns to a line
-// Currently there are 2 patterns to support
-// '==' replace a field value with a new value
-// '+=' append a string at the end of original line
-// '-' prevent the line from applying any patterns
-// it has the highest priority
-//
-int
-ApplyPattern (
- char *Line,
- char *argv[],
- int argc
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- Line - GC_TODO: add argument description
- ] - GC_TODO: add argument description
- argc - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- static char Section[256];
- char PatternBuffer[256];
- char *Pattern;
- char *Pattern1;
- char *Pattern2;
- int PatternNum;
- char *Ptr;
-
- Pattern = PatternBuffer;
-
- PatternNum = argc;
-
- //
- // For section field
- // record current scope section into static buffer
- //
- Ptr = Line;
- if (*Ptr == '[') {
- while (*Ptr != ']') {
- if (!(*Ptr++)) {
- return -1;
- }
- }
-
- strcpy (Section, Line);
- Section[Ptr - Line + 1] = 0;
- }
- //
- // Apply each pattern on the line
- //
- while (PatternNum-- > 3) {
-
- strcpy (Pattern, argv[PatternNum]);
-
- //
- // For pattern '-'
- // keep it unmodified by other patterns
- //
- if (*Pattern == '-') {
- if (strstr (Line, Pattern + 1)) {
- return 0;
- } else {
- continue;
- }
- }
- //
- // For other patterns
- // get its section at first if it has
- //
- if (*Pattern == '[') {
- if (strncmp (Section, Pattern, strlen (Section))) {
- //
- // This pattern can't be appied for current section
- //
- continue;
- }
- //
- // Strip the section field
- //
- while (*Pattern != ']') {
- if (!(*Pattern++)) {
- return -1;
- }
- }
-
- Pattern++;
- }
- //
- // Apply patterns
- //
- Pattern1 = strstr (Pattern, "==");
- Pattern2 = strstr (Pattern, "+=");
- if (Pattern1) {
- //
- // For pattern '=='
- // replace the field value with a new string
- //
- if (!strncmp (Line, Pattern, Pattern1 - Pattern)) {
- Pattern1 += 2;
- Ptr = strstr (Line, "=");
- if (!Ptr) {
- return -1;
- }
-
- while (*(++Ptr) == ' ')
- ;
- *Ptr = 0;
- strcat (Line, Pattern1);
- strcat (Line, "\r\n");
- }
- } else if (Pattern2) {
- //
- // For pattern '+='
- // append a string at end of the original string
- //
- if (!strncmp (Line, Pattern, Pattern2 - Pattern)) {
- Pattern2 += 2;
- Ptr = Line;
- while (*Ptr != 0x0D && *Ptr != 0x0A) {
- Ptr++;
- }
-
- *Ptr = 0;
- strcat (Line, Pattern2);
- strcat (Line, "\r\n");
- }
- }
- }
-
- return 0;
-}
-
-void
-Version(
- void
- )
-/*++
-
-Routine Description:
-
- Print out version information for Strip.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -EDK Modify fields in FV inf files.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 2005-2006 Intel Corporation. All rights reserved.\n");
-}
-
-void
-Usage(
- void
- )
-/*++
-
-Routine Description:
-
- Print out usage information for Strip.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- Version();
- printf ("\nUsage: %s InputFile OutputFile Pattern_String [Pattern_String ¡­]\n\
- Where: \n\
- Pattern_String is of the format (note that the section name must be \n\
- enclosed within square brackets):\n\
- [section]FieldKey<op>Value [(FieldKey<op>Value) ¡­] \n\
- The operator, <op>, must be one of the following: \n\
- '==' replace a field value with a new value \n\
- '+=' append a string at the end of original line \n\
- '-' prevent the line from applying any patterns \n\
- Example: \n\
- ModifyInf BuildRootFvFvMain.inf BuildRootFvFvMainEXP.inf \\ \n\
- [files]EFI_FILE_NAME+=.Org EFI_NUM_BLOCKS==0x20 \\ \n\
- [options]EFI_FILENAME==FcMainCompact.fv -DpsdSignature.dxe \n", UTILITY_NAME);
-}
-
-
-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
-
---*/
-{
- char LineBuffer[256];
- FILE *fpin;
- FILE *fpout;
-
- if (argc == 1) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return 0;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return 0;
- }
-
- if (argc < 3) {
- Usage();
- return -1;
- }
-
- fpin = fopen (argv[1], "rb");
- if (!fpin) {
- printf ("Can't open input file!\r\n");
- return -1;
- }
-
- fpout = fopen (argv[2], "wb");
- if (!fpout) {
- fclose (fpin);
- printf ("Can't create output file!\r\n");
- return -1;
- }
-
- while (ReadLine (LineBuffer, fpin)) {
- ApplyPattern (LineBuffer, argv, argc);
- WriteLine (LineBuffer, fpout);
- }
-
- fclose (fpin);
- fclose (fpout);
-
- return 0;
-}
diff --git a/Tools/CCode/Source/ModifyInf/build.xml b/Tools/CCode/Source/ModifyInf/build.xml
deleted file mode 100644
index f536a989ac..0000000000
--- a/Tools/CCode/Source/ModifyInf/build.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK ModifyInf Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="ModifyInf"/>
- <property name="FileSet" value="ModifyInf.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
-
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/Pccts/CHANGES_FROM_131.txt b/Tools/CCode/Source/Pccts/CHANGES_FROM_131.txt
deleted file mode 100644
index 500d84f2e8..0000000000
--- a/Tools/CCode/Source/Pccts/CHANGES_FROM_131.txt
+++ /dev/null
@@ -1,522 +0,0 @@
-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/Tools/CCode/Source/Pccts/CHANGES_FROM_133.txt b/Tools/CCode/Source/Pccts/CHANGES_FROM_133.txt
deleted file mode 100644
index 2128c4ff25..0000000000
--- a/Tools/CCode/Source/Pccts/CHANGES_FROM_133.txt
+++ /dev/null
@@ -1,2448 +0,0 @@
-=======================================================================
-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 unnnecesary 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 annying messages from program
- that checked for unitialized variables.
-
- This has caused significant annoyance for C++ users that had
- classes with virtual functions or non-trivial contructors 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 taks 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 significanly 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 defintion 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 circunstances 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 varible
- 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/Tools/CCode/Source/Pccts/CHANGES_FROM_133_BEFORE_MR13.txt b/Tools/CCode/Source/Pccts/CHANGES_FROM_133_BEFORE_MR13.txt
deleted file mode 100644
index bba5ecdd64..0000000000
--- a/Tools/CCode/Source/Pccts/CHANGES_FROM_133_BEFORE_MR13.txt
+++ /dev/null
@@ -1,3666 +0,0 @@
-
- ------------------------------------------------------------
- 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 additiion 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 initialzed 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 arbirtrary 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:
-
- uppperCaseVowel : <<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 previosly 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 messge.
-
- 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 vanila.
-
-#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 demonstates 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 refrence 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 inconsistentcy 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 defintion 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 invocaton to after rule's init action.
-
-#55. (Fixed in 1.33MR7) Unitialized 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 exection 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 aggresive 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/Tools/CCode/Source/Pccts/CHANGES_SUMMARY.txt b/Tools/CCode/Source/Pccts/CHANGES_SUMMARY.txt
deleted file mode 100644
index 91defae169..0000000000
--- a/Tools/CCode/Source/Pccts/CHANGES_SUMMARY.txt
+++ /dev/null
@@ -1,2049 +0,0 @@
-======================================================================
-
- 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 initialzed 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:
-
- uppperCaseVowel : <<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 inconsistentcy 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 exection 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/Tools/CCode/Source/Pccts/KNOWN_PROBLEMS.txt b/Tools/CCode/Source/Pccts/KNOWN_PROBLEMS.txt
deleted file mode 100644
index 5a9b22e1bd..0000000000
--- a/Tools/CCode/Source/Pccts/KNOWN_PROBLEMS.txt
+++ /dev/null
@@ -1,241 +0,0 @@
-
- =======================================================
- 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 grammer, 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 defintion 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/Tools/CCode/Source/Pccts/MPW_Read_Me b/Tools/CCode/Source/Pccts/MPW_Read_Me
deleted file mode 100644
index 70a9d1bcad..0000000000
--- a/Tools/CCode/Source/Pccts/MPW_Read_Me
+++ /dev/null
@@ -1,21 +0,0 @@
-
-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/Tools/CCode/Source/Pccts/NOTES.bcc b/Tools/CCode/Source/Pccts/NOTES.bcc
deleted file mode 100644
index 1ac05b17c5..0000000000
--- a/Tools/CCode/Source/Pccts/NOTES.bcc
+++ /dev/null
@@ -1,184 +0,0 @@
-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/Tools/CCode/Source/Pccts/NOTES.msvc b/Tools/CCode/Source/Pccts/NOTES.msvc
deleted file mode 100644
index 86f8ed66e0..0000000000
--- a/Tools/CCode/Source/Pccts/NOTES.msvc
+++ /dev/null
@@ -1,189 +0,0 @@
-
- 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/Tools/CCode/Source/Pccts/README b/Tools/CCode/Source/Pccts/README
deleted file mode 100644
index d089b638b4..0000000000
--- a/Tools/CCode/Source/Pccts/README
+++ /dev/null
@@ -1,159 +0,0 @@
-
- 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/Tools/CCode/Source/Pccts/RIGHTS b/Tools/CCode/Source/Pccts/RIGHTS
deleted file mode 100644
index 9db175ff40..0000000000
--- a/Tools/CCode/Source/Pccts/RIGHTS
+++ /dev/null
@@ -1,26 +0,0 @@
-
-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/Tools/CCode/Source/Pccts/antlr/AntlrMS.mak b/Tools/CCode/Source/Pccts/antlr/AntlrMS.mak
deleted file mode 100644
index 7342d99b09..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/AntlrMS.mak
+++ /dev/null
@@ -1,233 +0,0 @@
-# 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 $(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/Tools/CCode/Source/Pccts/antlr/AntlrPPC.mak b/Tools/CCode/Source/Pccts/antlr/AntlrPPC.mak
deleted file mode 100644
index 9ede60d64c..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/AntlrPPC.mak
+++ /dev/null
@@ -1,101 +0,0 @@
-# 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/Tools/CCode/Source/Pccts/antlr/README b/Tools/CCode/Source/Pccts/antlr/README
deleted file mode 100644
index d7fc95916e..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/README
+++ /dev/null
@@ -1,19 +0,0 @@
- 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/Tools/CCode/Source/Pccts/antlr/antlr.1 b/Tools/CCode/Source/Pccts/antlr/antlr.1
deleted file mode 100644
index acfa85b066..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/antlr.1
+++ /dev/null
@@ -1,209 +0,0 @@
-.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/Tools/CCode/Source/Pccts/antlr/antlr.c b/Tools/CCode/Source/Pccts/antlr/antlr.c
deleted file mode 100644
index 8aaef794e1..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/antlr.c
+++ /dev/null
@@ -1,3564 +0,0 @@
-/*
- * 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
-
-
-#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 statment 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 statment 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 */, { 0; /* 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/Tools/CCode/Source/Pccts/antlr/antlr.g b/Tools/CCode/Source/Pccts/antlr/antlr.g
deleted file mode 100644
index e6eda6010c..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/antlr.g
+++ /dev/null
@@ -1,2586 +0,0 @@
-/*
- * 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
-
-
-#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 statment 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 statment 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/Tools/CCode/Source/Pccts/antlr/antlr.r b/Tools/CCode/Source/Pccts/antlr/antlr.r
deleted file mode 100644
index e3de38759f..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/antlr.r
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- 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 refrence 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/Tools/CCode/Source/Pccts/antlr/antlr1.txt b/Tools/CCode/Source/Pccts/antlr/antlr1.txt
deleted file mode 100644
index 4a7d22e7f2..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/antlr1.txt
+++ /dev/null
@@ -1,264 +0,0 @@
-
-
-
-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/Tools/CCode/Source/Pccts/antlr/bits.c b/Tools/CCode/Source/Pccts/antlr/bits.c
deleted file mode 100644
index ddd9bd6053..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/bits.c
+++ /dev/null
@@ -1,1025 +0,0 @@
-/* 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[%d] = {",
- name,
- suffix,
- NumWords(TokenNum-1)*sizeof(unsigned));
- }
- else {
- fprintf(ErrFile, "SetWordType zzerr%d[%d] = {",
- 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[%d];\n", name, suffix,
- NumWords(TokenNum-1)*sizeof(unsigned));
- fprintf(Parser_c, "SetWordType %s::%s%s[%d] = {",
- CurrentClassName,
- name,
- suffix,
- NumWords(TokenNum-1)*sizeof(unsigned));
- }
- else {
- fprintf(Parser_c, "SetWordType %s::err%d[%d] = {",
- CurrentClassName,
- esetnum,
- NumWords(TokenNum-1)*sizeof(unsigned));
- fprintf(Parser_h, "\tstatic SetWordType err%d[%d];\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,%d)\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 %d\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/Tools/CCode/Source/Pccts/antlr/build.c b/Tools/CCode/Source/Pccts/antlr/build.c
deleted file mode 100644
index 4eb3b02af1..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/build.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/build.xml b/Tools/CCode/Source/Pccts/antlr/build.xml
deleted file mode 100644
index 7ea7458f7b..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/build.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK antlr Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="antlr"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <target name="init">
- <condition property="CheckDepends">
- <uptodate targetfile="${WORKSPACE}/Tools/bin/antlr.exe">
- <srcfiles dir="." includes="*.c *.h *.g"/>
- </uptodate>
- </condition>
- <if>
- <equals arg1="${CheckDepends}" arg2="true"/>
- <then>
- <echo message="Executable, antlr.exe, is up to date."/>
- </then>
- <else>
- <echo message="Building the EDK Pccts Tool: ${ToolName}"/>
- </else>
- </if>
- </target>
-
- <target name="GenTool" depends="init" unless="CheckDepends">
- <if>
- <equals arg1="${ToolChain}" arg2="msvc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/antlr" executable="nmake" failonerror="TRUE">
- <arg line="/NOLOGO"/>
- <arg line="-f AntlrMS.mak"/>
- </exec>
- </then>
- <elseif>
- <istrue value="${cygwin}"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/antlr" executable="make" failonerror="TRUE">
- <arg line="-f makefile.cygwin"/>
- </exec>
- </then>
- </elseif>
- <elseif>
- <istrue value="${gcc}"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/antlr" executable="make" failonerror="TRUE">
- <arg line="-s"/>
- <arg line="-f makefile BIN_DIR=${BIN_DIR}"/>
- </exec>
- </then>
- </elseif>
- </if>
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <if>
- <equals arg1="${ToolChain}" arg2="msvc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/antlr" executable="nmake" failonerror="TRUE">
- <arg line="/C"/>
- <arg line="/NOLOGO"/>
- <arg line="-f AntlrMS.mak clean"/>
- </exec>
- </then>
- <elseif>
- <istrue value="${cygwin}"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/antlr" executable="make" failonerror="TRUE">
- <arg line="-f makefile.cygwin clean"/>
- </exec>
- </then>
- </elseif>
- <elseif>
- <istrue value="${gcc}"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/antlr" executable="make" failonerror="TRUE">
- <arg line="-s"/>
- <arg line="-f makefile clean"/>
- </exec>
- </then>
- </elseif>
- </if>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <if>
- <equals arg1="${ToolChain}" arg2="msvc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/antlr" executable="nmake" failonerror="FALSE">
- <arg line="/C"/>
- <arg line="/NOLOGO"/>
- <arg line="/f AntlrMS.mak clean"/>
- </exec>
- </then>
- <elseif>
- <istrue value="${cygwin}"/>
- <then>
- <echo message="Building antlr with cygwin gcc"/>
- <exec dir="${PACKAGE_DIR}/Pccts/antlr" executable="make" failonerror="FALSE">
- <arg line="-s"/>
- <arg line="-f makefile.cygwin clean"/>
- </exec>
- </then>
- </elseif>
- <elseif>
- <istrue value="${gcc}"/>
- <then>
- <echo message="Building antlr with gcc"/>
- <exec dir="${PACKAGE_DIR}/Pccts/antlr" executable="make" failonerror="FALSE">
- <arg line="-s"/>
- <arg line="-f makefile clean"/>
- </exec>
- </then>
- </elseif>
- </if>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/Pccts/antlr/dumpcycles.c b/Tools/CCode/Source/Pccts/antlr/dumpcycles.c
deleted file mode 100644
index 8156159f71..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/dumpcycles.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#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/Tools/CCode/Source/Pccts/antlr/dumpnode.c b/Tools/CCode/Source/Pccts/antlr/dumpnode.c
deleted file mode 100644
index 2a34c6fcd5..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/dumpnode.c
+++ /dev/null
@@ -1,423 +0,0 @@
-#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/Tools/CCode/Source/Pccts/antlr/egman.c b/Tools/CCode/Source/Pccts/antlr/egman.c
deleted file mode 100644
index c8a633fc06..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/egman.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * 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;
- };
- };
-
- /* ocurs 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/Tools/CCode/Source/Pccts/antlr/err.c b/Tools/CCode/Source/Pccts/antlr/err.c
deleted file mode 100644
index ca239398cf..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/err.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/fcache.c b/Tools/CCode/Source/Pccts/antlr/fcache.c
deleted file mode 100644
index ff7dcdfdd5..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/fcache.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/fset.c b/Tools/CCode/Source/Pccts/antlr/fset.c
deleted file mode 100644
index e1a76ec620..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/fset.c
+++ /dev/null
@@ -1,1555 +0,0 @@
-/*
- * 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 it's 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 threshhold; /* 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 */ threshhold = LONG_MAX / n;
-/* MR10 */ if (set_deg_value <= threshhold) {
-/* 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/Tools/CCode/Source/Pccts/antlr/fset2.c b/Tools/CCode/Source/Pccts/antlr/fset2.c
deleted file mode 100644
index 7f686a53d5..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/fset2.c
+++ /dev/null
@@ -1,2250 +0,0 @@
-/*
- * 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 it's 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,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/Tools/CCode/Source/Pccts/antlr/gen.c b/Tools/CCode/Source/Pccts/antlr/gen.c
deleted file mode 100644
index 368a96b9ac..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/gen.c
+++ /dev/null
@@ -1,4797 +0,0 @@
-/*
- * 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 "expcect 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 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 */
- "0; /* 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 */
- "0; /* 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
- initiailized 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 paramters. */
-
- 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 */ _gen(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 %d\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 %d\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 wasnt'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/Tools/CCode/Source/Pccts/antlr/generic.h b/Tools/CCode/Source/Pccts/antlr/generic.h
deleted file mode 100644
index 8d736d5200..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/generic.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * 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 superceded 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/Tools/CCode/Source/Pccts/antlr/globals.c b/Tools/CCode/Source/Pccts/antlr/globals.c
deleted file mode 100644
index 59d00320a0..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/globals.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/hash.c b/Tools/CCode/Source/Pccts/antlr/hash.c
deleted file mode 100644
index 68fe8fd227..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/hash.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/hash.h b/Tools/CCode/Source/Pccts/antlr/hash.h
deleted file mode 100644
index 3969c40b4a..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/hash.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/lex.c b/Tools/CCode/Source/Pccts/antlr/lex.c
deleted file mode 100644
index 8c524fe465..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/lex.c
+++ /dev/null
@@ -1,878 +0,0 @@
-/*
- * 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 expressiones */
-/* 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 initalComma 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::*contstraint)()
- 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,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,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,strBetween(pDataType, pSymbol, pSeparator));
- fprintf(f," ");
- fprintf(f,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/Tools/CCode/Source/Pccts/antlr/main.c b/Tools/CCode/Source/Pccts/antlr/main.c
deleted file mode 100644
index 051ee4ec5d..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/main.c
+++ /dev/null
@@ -1,1747 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/makefile b/Tools/CCode/Source/Pccts/antlr/makefile
deleted file mode 100644
index 2aa6cdfc34..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/makefile
+++ /dev/null
@@ -1,218 +0,0 @@
-#
-# 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)
-#
-CC=gcc
-COPT=-O
-ANTLR=${BIN_DIR}/antlr
-DLG=${BIN_DIR}/dlg
-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 $(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/Tools/CCode/Source/Pccts/antlr/makefile.cygwin b/Tools/CCode/Source/Pccts/antlr/makefile.cygwin
deleted file mode 100644
index 956de0be07..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/makefile.cygwin
+++ /dev/null
@@ -1,219 +0,0 @@
-#
-# 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/Tools/CCode/Source/Pccts/antlr/makefile1 b/Tools/CCode/Source/Pccts/antlr/makefile1
deleted file mode 100644
index dffc709478..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/makefile1
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# 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/Tools/CCode/Source/Pccts/antlr/misc.c b/Tools/CCode/Source/Pccts/antlr/misc.c
deleted file mode 100644
index 3f58da34c5..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/misc.c
+++ /dev/null
@@ -1,1864 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/mode.h b/Tools/CCode/Source/Pccts/antlr/mode.h
deleted file mode 100644
index c08bf31ac7..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/mode.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#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/Tools/CCode/Source/Pccts/antlr/mrhoist.c b/Tools/CCode/Source/Pccts/antlr/mrhoist.c
deleted file mode 100644
index 110bf5996f..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/mrhoist.c
+++ /dev/null
@@ -1,3030 +0,0 @@
-/*
- * 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 expresssions 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/Tools/CCode/Source/Pccts/antlr/parser.dlg b/Tools/CCode/Source/Pccts/antlr/parser.dlg
deleted file mode 100644
index 8c43dff300..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/parser.dlg
+++ /dev/null
@@ -1,1387 +0,0 @@
-<<
-/* 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/Tools/CCode/Source/Pccts/antlr/pred.c b/Tools/CCode/Source/Pccts/antlr/pred.c
deleted file mode 100644
index eb11c4d950..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/pred.c
+++ /dev/null
@@ -1,821 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/proto.h b/Tools/CCode/Source/Pccts/antlr/proto.h
deleted file mode 100644
index 53035e720e..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/proto.h
+++ /dev/null
@@ -1,852 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/scan.c b/Tools/CCode/Source/Pccts/antlr/scan.c
deleted file mode 100644
index 9b4bde08e6..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/scan.c
+++ /dev/null
@@ -1,5735 +0,0 @@
-
-/* 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/Tools/CCode/Source/Pccts/antlr/stdpccts.h b/Tools/CCode/Source/Pccts/antlr/stdpccts.h
deleted file mode 100644
index ccdc21c3c9..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/stdpccts.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#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/Tools/CCode/Source/Pccts/antlr/syn.h b/Tools/CCode/Source/Pccts/antlr/syn.h
deleted file mode 100644
index a23d196d77..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/syn.h
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/antlr/tokens.h b/Tools/CCode/Source/Pccts/antlr/tokens.h
deleted file mode 100644
index 91a53a8471..0000000000
--- a/Tools/CCode/Source/Pccts/antlr/tokens.h
+++ /dev/null
@@ -1,246 +0,0 @@
-#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/Tools/CCode/Source/Pccts/build.xml b/Tools/CCode/Source/Pccts/build.xml
deleted file mode 100644
index 58a82f4c36..0000000000
--- a/Tools/CCode/Source/Pccts/build.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK Pccts Tool
- Copyright (c) 2006, Intel Corporation
- <property name="ToolName" value="Pccts"/>
--->
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <target name="init">
- <echo message="Building the EDK Pccts Tools"/>
- </target>
-
- <target name="GenTool" depends="init, Pccts">
- <echo message="The EDK Pccts Tools build has completed!"/>
- </target>
-
- <target name="Pccts" depends="init">
- <subant target="" inheritall="true">
- <fileset dir="${PACKAGE_DIR}/Pccts/antlr" includes="build.xml"/>
- </subant>
- <subant target="" inheritall="true">
- <fileset dir="${PACKAGE_DIR}/Pccts/dlg" includes="build.xml"/>
- </subant>
- </target>
-
- <target name="clean">
- <ant dir="${PACKAGE_DIR}/Pccts/antlr" target="clean" inheritAll="true"/>
- <ant dir="${PACKAGE_DIR}/Pccts/dlg" target="clean" inheritAll="true"/>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executables from the package: Pccts"/>
- <ant dir="${PACKAGE_DIR}/Pccts/antlr" target="cleanall" inheritAll="true"/>
- <ant dir="${PACKAGE_DIR}/Pccts/dlg" target="cleanall" inheritAll="true"/>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/Pccts/dlg/DlgMS.mak b/Tools/CCode/Source/Pccts/dlg/DlgMS.mak
deleted file mode 100644
index 086af956c8..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/DlgMS.mak
+++ /dev/null
@@ -1,121 +0,0 @@
-# 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 $(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/Tools/CCode/Source/Pccts/dlg/DlgPPC.mak b/Tools/CCode/Source/Pccts/dlg/DlgPPC.mak
deleted file mode 100644
index 55b643ad88..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/DlgPPC.mak
+++ /dev/null
@@ -1,84 +0,0 @@
-# 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/Tools/CCode/Source/Pccts/dlg/automata.c b/Tools/CCode/Source/Pccts/dlg/automata.c
deleted file mode 100644
index d6d5d7809d..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/automata.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/* 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 inital 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 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 maynot 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/Tools/CCode/Source/Pccts/dlg/build.xml b/Tools/CCode/Source/Pccts/dlg/build.xml
deleted file mode 100644
index da5dbd0f59..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/build.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK Pccts Tool: dlg
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="dlg"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="PACKAGE_DIR" value="${WORKSPACE}/Tools"/>
-
- <target name="init">
- <condition property="CheckDepends">
- <uptodate targetfile="${WORKSPACE}/Tools/bin/dlg.exe">
- <srcfiles dir="." includes="*.c *.h *.g"/>
- </uptodate>
- </condition>
- <if>
- <equals arg1="${CheckDepends}" arg2="true"/>
- <then>
- <echo message="Executable, dlg.exe, is up to date."/>
- </then>
- <else>
- <echo message="Building the EDK Pccts Tool: ${ToolName}"/>
- </else>
- </if>
- </target>
-
- <target name="GenTool" depends="init" unless="CheckDepends">
- <if>
- <equals arg1="${ToolChain}" arg2="msvc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="nmake" failonerror="TRUE">
- <arg line="/NOLOGO"/>
- <arg line="-f DlgMS.mak"/>
- </exec>
- </then>
- <elseif>
- <istrue value="${cygwin}"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="TRUE">
- <arg line="-f makefile.cygwin"/>
- </exec>
- </then>
- </elseif>
- <elseif>
- <equals arg1="${ToolChain}" arg2="gcc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="TRUE">
- <arg line="-s"/>
- <arg line="-f makefile BIN_DIR=${BIN_DIR}"/>
- </exec>
- </then>
- </elseif>
- </if>
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <if>
- <equals arg1="${ToolChain}" arg2="msvc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="nmake" failonerror="TRUE">
- <arg line="/C"/>
- <arg line="/NOLOGO"/>
- <arg line="-f DlgMS.mak clean"/>
- </exec>
- </then>
- <elseif>
- <istrue value="${cygwin}"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="TRUE">
- <arg line="-f makefile.cygwin clean"/>
- </exec>
- </then>
- </elseif>
- <elseif>
- <equals arg1="${ToolChain}" arg2="gcc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="TRUE">
- <arg line="-s"/>
- <arg line="-f makefile clean"/>
- </exec>
- </then>
- </elseif>
- </if>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <if>
- <equals arg1="${ToolChain}" arg2="msvc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="nmake" failonerror="FALSE">
- <arg line="/C"/>
- <arg line="/NOLOGO"/>
- <arg line="-f DlgMS.mak clean"/>
- </exec>
- </then>
- <elseif>
- <equals arg1="${ToolChain}" arg2="gcc"/>
- <then>
- <exec dir="${PACKAGE_DIR}/Pccts/dlg" executable="make" failonerror="FALSE">
- <arg line="-s"/>
- <arg line="-f makefile clean"/>
- </exec>
- </then>
- </elseif>
- </if>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/Pccts/dlg/dlg.1 b/Tools/CCode/Source/Pccts/dlg/dlg.1
deleted file mode 100644
index f68e3ae8a7..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/dlg.1
+++ /dev/null
@@ -1,79 +0,0 @@
-.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/Tools/CCode/Source/Pccts/dlg/dlg.h b/Tools/CCode/Source/Pccts/dlg/dlg.h
deleted file mode 100644
index 9f387c0a1c..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/dlg.h
+++ /dev/null
@@ -1,250 +0,0 @@
-/* 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 occured */
-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 transistion 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/Tools/CCode/Source/Pccts/dlg/dlg.r b/Tools/CCode/Source/Pccts/dlg/dlg.r
deleted file mode 100644
index c5311fa1b8..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/dlg.r
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- 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 genera"
- "tes a scanner using C++ classes rather t"
- "han 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 f"
- "or 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 ho"
- "ld 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 f"
- "or 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 n"
- "ot compress its tables.",
- /* [2] */
- {134, 265, 149, 345}, "Level 1", "-C1", NotSet, "When this option is selected, DLG will r"
- "emove all unused characters from the tra"
- "nsition-from table.",
- /* [3] */
- {134, 360, 149, 450}, "Level 2", "-C2", NotSet, "When this option is selected, DLG will p"
- "erform 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 au"
- "tomaton 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 g"
- "enerate as interactive a scanner as poss"
- "ible."
- },
- /* [15] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {165, 310, 180, 460},
- "Ambiguity Warnings",
- "-Wambiguity",
- "When this control is checked, DLG warns "
- "if more than one regular expression coul"
- "d match the same character sequence."
- },
- /* [16] */
- 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
- },
- /* [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 genera"
- "tes ANSI C compatible code."
- }
- }
- }
-};
-
diff --git a/Tools/CCode/Source/Pccts/dlg/dlg1.txt b/Tools/CCode/Source/Pccts/dlg/dlg1.txt
deleted file mode 100644
index 06b320de2a..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/dlg1.txt
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
-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/Tools/CCode/Source/Pccts/dlg/dlg_a.c b/Tools/CCode/Source/Pccts/dlg/dlg_a.c
deleted file mode 100644
index 0b8982cf2a..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/dlg_a.c
+++ /dev/null
@@ -1,1414 +0,0 @@
-
-/* 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/Tools/CCode/Source/Pccts/dlg/dlg_p.c b/Tools/CCode/Source/Pccts/dlg/dlg_p.c
deleted file mode 100644
index e726ae3983..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/dlg_p.c
+++ /dev/null
@@ -1,959 +0,0 @@
-/*
- * 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
-
-int action_no = 0; /* keep track of actions outputed */
-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 inital 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/Tools/CCode/Source/Pccts/dlg/dlg_p.g b/Tools/CCode/Source/Pccts/dlg/dlg_p.g
deleted file mode 100644
index 58ca110693..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/dlg_p.g
+++ /dev/null
@@ -1,614 +0,0 @@
-/* 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
-
-int action_no = 0; /* keep track of actions outputed */
-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 inital 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/Tools/CCode/Source/Pccts/dlg/err.c b/Tools/CCode/Source/Pccts/dlg/err.c
deleted file mode 100644
index c3eaeae6d1..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/err.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/dlg/main.c b/Tools/CCode/Source/Pccts/dlg/main.c
deleted file mode 100644
index 35bd827f8c..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/main.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/dlg/makefile b/Tools/CCode/Source/Pccts/dlg/makefile
deleted file mode 100644
index d5cceb8be5..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/makefile
+++ /dev/null
@@ -1,156 +0,0 @@
-#
-# 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
-#
-CC=cc
-COPT=-O
-ANTLR=${BIN_DIR}/antlr
-DLG=${BIN_DIR}/dlg
-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 $(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/Tools/CCode/Source/Pccts/dlg/makefile.cygwin b/Tools/CCode/Source/Pccts/dlg/makefile.cygwin
deleted file mode 100644
index bbba820d13..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/makefile.cygwin
+++ /dev/null
@@ -1,157 +0,0 @@
-#
-# 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/Tools/CCode/Source/Pccts/dlg/makefile1 b/Tools/CCode/Source/Pccts/dlg/makefile1
deleted file mode 100644
index 4d00f7966e..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/makefile1
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# 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/Tools/CCode/Source/Pccts/dlg/mode.h b/Tools/CCode/Source/Pccts/dlg/mode.h
deleted file mode 100644
index 3f3279e52a..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/mode.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#define START 0
-#define ACT 1
-#define ACTION_COMMENTS 2
-#define ACTION_CPP_COMMENTS 3
diff --git a/Tools/CCode/Source/Pccts/dlg/output.c b/Tools/CCode/Source/Pccts/dlg/output.c
deleted file mode 100644
index 2e56a6d8c1..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/output.c
+++ /dev/null
@@ -1,850 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/dlg/parser.dlg b/Tools/CCode/Source/Pccts/dlg/parser.dlg
deleted file mode 100644
index df9a637f9e..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/parser.dlg
+++ /dev/null
@@ -1,398 +0,0 @@
-<<
-/* 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/Tools/CCode/Source/Pccts/dlg/relabel.c b/Tools/CCode/Source/Pccts/dlg/relabel.c
deleted file mode 100644
index 0b8bc163d1..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/relabel.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* 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 partion 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/Tools/CCode/Source/Pccts/dlg/stdpccts.h b/Tools/CCode/Source/Pccts/dlg/stdpccts.h
deleted file mode 100644
index 06ec67e44d..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/stdpccts.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#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/Tools/CCode/Source/Pccts/dlg/support.c b/Tools/CCode/Source/Pccts/dlg/support.c
deleted file mode 100644
index 84fe99d69c..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/support.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/dlg/tokens.h b/Tools/CCode/Source/Pccts/dlg/tokens.h
deleted file mode 100644
index 73e502b7e1..0000000000
--- a/Tools/CCode/Source/Pccts/dlg/tokens.h
+++ /dev/null
@@ -1,133 +0,0 @@
-#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/Tools/CCode/Source/Pccts/h/AParser.cpp b/Tools/CCode/Source/Pccts/h/AParser.cpp
deleted file mode 100644
index 720fe75af1..0000000000
--- a/Tools/CCode/Source/Pccts/h/AParser.cpp
+++ /dev/null
@@ -1,871 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/AParser.h b/Tools/CCode/Source/Pccts/h/AParser.h
deleted file mode 100644
index fe405f4167..0000000000
--- a/Tools/CCode/Source/Pccts/h/AParser.h
+++ /dev/null
@@ -1,376 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/ASTBase.cpp b/Tools/CCode/Source/Pccts/h/ASTBase.cpp
deleted file mode 100644
index a94f080c86..0000000000
--- a/Tools/CCode/Source/Pccts/h/ASTBase.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/ASTBase.h b/Tools/CCode/Source/Pccts/h/ASTBase.h
deleted file mode 100644
index 912f4b8482..0000000000
--- a/Tools/CCode/Source/Pccts/h/ASTBase.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/ATokPtr.h b/Tools/CCode/Source/Pccts/h/ATokPtr.h
deleted file mode 100644
index 75b4c86cbf..0000000000
--- a/Tools/CCode/Source/Pccts/h/ATokPtr.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* 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)
- void operator = (const ANTLRTokenPtr & lhs); // MR1
- void 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/Tools/CCode/Source/Pccts/h/ATokPtrImpl.h b/Tools/CCode/Source/Pccts/h/ATokPtrImpl.h
deleted file mode 100644
index 9c07cf52a9..0000000000
--- a/Tools/CCode/Source/Pccts/h/ATokPtrImpl.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 weall as some other member functions
-//
-void ANTLRTokenPtr::operator = (const ANTLRTokenPtr & lhs) // MR1
-{
- lhs.ref(); // protect against "xp = xp"; ie same underlying object
- deref();
- ptr_ = lhs.ptr_;
-}
-
-void ANTLRTokenPtr::operator = (ANTLRAbstractToken *addr)
-{
- if (addr != NULL) {
- addr->ref();
- }
- deref();
- ptr_ = addr;
-}
diff --git a/Tools/CCode/Source/Pccts/h/AToken.h b/Tools/CCode/Source/Pccts/h/AToken.h
deleted file mode 100644
index 6167c21ef5..0000000000
--- a/Tools/CCode/Source/Pccts/h/AToken.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/ATokenBuffer.cpp b/Tools/CCode/Source/Pccts/h/ATokenBuffer.cpp
deleted file mode 100644
index 9a2f2fc88b..0000000000
--- a/Tools/CCode/Source/Pccts/h/ATokenBuffer.cpp
+++ /dev/null
@@ -1,374 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/ATokenBuffer.h b/Tools/CCode/Source/Pccts/h/ATokenBuffer.h
deleted file mode 100644
index 1c008fd59e..0000000000
--- a/Tools/CCode/Source/Pccts/h/ATokenBuffer.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/ATokenStream.h b/Tools/CCode/Source/Pccts/h/ATokenStream.h
deleted file mode 100644
index 3dfea6ebff..0000000000
--- a/Tools/CCode/Source/Pccts/h/ATokenStream.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/BufFileInput.cpp b/Tools/CCode/Source/Pccts/h/BufFileInput.cpp
deleted file mode 100644
index 99d08a42a4..0000000000
--- a/Tools/CCode/Source/Pccts/h/BufFileInput.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-// 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/Tools/CCode/Source/Pccts/h/BufFileInput.h b/Tools/CCode/Source/Pccts/h/BufFileInput.h
deleted file mode 100644
index ea54c0ee26..0000000000
--- a/Tools/CCode/Source/Pccts/h/BufFileInput.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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/Tools/CCode/Source/Pccts/h/DLG_stream_input.h b/Tools/CCode/Source/Pccts/h/DLG_stream_input.h
deleted file mode 100644
index d2147f5217..0000000000
--- a/Tools/CCode/Source/Pccts/h/DLG_stream_input.h
+++ /dev/null
@@ -1,98 +0,0 @@
-
-/************************************************************/
-/* */
-/* 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 responsability 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 unwaranted...
-// 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 hiting 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/Tools/CCode/Source/Pccts/h/DLexer.h b/Tools/CCode/Source/Pccts/h/DLexer.h
deleted file mode 100644
index 37cac24f14..0000000000
--- a/Tools/CCode/Source/Pccts/h/DLexer.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* 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
- */
-
-#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;
- 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/Tools/CCode/Source/Pccts/h/DLexerBase.cpp b/Tools/CCode/Source/Pccts/h/DLexerBase.cpp
deleted file mode 100644
index b218afc038..0000000000
--- a/Tools/CCode/Source/Pccts/h/DLexerBase.cpp
+++ /dev/null
@@ -1,302 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/DLexerBase.h b/Tools/CCode/Source/Pccts/h/DLexerBase.h
deleted file mode 100644
index db6cc1890c..0000000000
--- a/Tools/CCode/Source/Pccts/h/DLexerBase.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/* 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;
-};
-
-/* 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 {
-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/Tools/CCode/Source/Pccts/h/PBlackBox.h b/Tools/CCode/Source/Pccts/h/PBlackBox.h
deleted file mode 100644
index d25b8d6939..0000000000
--- a/Tools/CCode/Source/Pccts/h/PBlackBox.h
+++ /dev/null
@@ -1,134 +0,0 @@
-#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/Tools/CCode/Source/Pccts/h/PCCTSAST.cpp b/Tools/CCode/Source/Pccts/h/PCCTSAST.cpp
deleted file mode 100644
index a8249cdac0..0000000000
--- a/Tools/CCode/Source/Pccts/h/PCCTSAST.cpp
+++ /dev/null
@@ -1,684 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/h/PCCTSAST.h b/Tools/CCode/Source/Pccts/h/PCCTSAST.h
deleted file mode 100644
index 3485da7d1b..0000000000
--- a/Tools/CCode/Source/Pccts/h/PCCTSAST.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/SList.h b/Tools/CCode/Source/Pccts/h/SList.h
deleted file mode 100644
index 5b8bf97427..0000000000
--- a/Tools/CCode/Source/Pccts/h/SList.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#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/Tools/CCode/Source/Pccts/h/antlr.h b/Tools/CCode/Source/Pccts/h/antlr.h
deleted file mode 100644
index 80664535d3..0000000000
--- a/Tools/CCode/Source/Pccts/h/antlr.h
+++ /dev/null
@@ -1,807 +0,0 @@
-/* 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 veriables 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/Tools/CCode/Source/Pccts/h/ast.c b/Tools/CCode/Source/Pccts/h/ast.c
deleted file mode 100644
index 9326ae16ae..0000000000
--- a/Tools/CCode/Source/Pccts/h/ast.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/ast.h b/Tools/CCode/Source/Pccts/h/ast.h
deleted file mode 100644
index 5ff84bd76c..0000000000
--- a/Tools/CCode/Source/Pccts/h/ast.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/charbuf.h b/Tools/CCode/Source/Pccts/h/charbuf.h
deleted file mode 100644
index 5f01c8ba35..0000000000
--- a/Tools/CCode/Source/Pccts/h/charbuf.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/charptr.c b/Tools/CCode/Source/Pccts/h/charptr.c
deleted file mode 100644
index d3f80e60ba..0000000000
--- a/Tools/CCode/Source/Pccts/h/charptr.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/h/charptr.h b/Tools/CCode/Source/Pccts/h/charptr.h
deleted file mode 100644
index e73da681a4..0000000000
--- a/Tools/CCode/Source/Pccts/h/charptr.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * 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/Tools/CCode/Source/Pccts/h/config.h b/Tools/CCode/Source/Pccts/h/config.h
deleted file mode 100644
index 8aa50ad618..0000000000
--- a/Tools/CCode/Source/Pccts/h/config.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "pcctscfg.h"
diff --git a/Tools/CCode/Source/Pccts/h/dlgauto.h b/Tools/CCode/Source/Pccts/h/dlgauto.h
deleted file mode 100644
index db94cefaca..0000000000
--- a/Tools/CCode/Source/Pccts/h/dlgauto.h
+++ /dev/null
@@ -1,504 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/dlgdef.h b/Tools/CCode/Source/Pccts/h/dlgdef.h
deleted file mode 100644
index 733d2568e3..0000000000
--- a/Tools/CCode/Source/Pccts/h/dlgdef.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/err.h b/Tools/CCode/Source/Pccts/h/err.h
deleted file mode 100644
index b2b196bd75..0000000000
--- a/Tools/CCode/Source/Pccts/h/err.h
+++ /dev/null
@@ -1,1170 +0,0 @@
-/*
- * 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 it's 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/Tools/CCode/Source/Pccts/h/int.h b/Tools/CCode/Source/Pccts/h/int.h
deleted file mode 100644
index cdcaa92426..0000000000
--- a/Tools/CCode/Source/Pccts/h/int.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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/Tools/CCode/Source/Pccts/h/pccts_assert.h b/Tools/CCode/Source/Pccts/h/pccts_assert.h
deleted file mode 100644
index ff0dfb5126..0000000000
--- a/Tools/CCode/Source/Pccts/h/pccts_assert.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __PCCTS_ASSERT_H__
-#define __PCCTS_ASSERT_H__
-
-#ifdef PCCTS_USE_NAMESPACE_STD
-#include <cassert>
-#else
-#include <assert.h>
-#endif
-
-#endif
diff --git a/Tools/CCode/Source/Pccts/h/pccts_iostream.h b/Tools/CCode/Source/Pccts/h/pccts_iostream.h
deleted file mode 100644
index 972b32cbd1..0000000000
--- a/Tools/CCode/Source/Pccts/h/pccts_iostream.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __PCCTS_IOSTREAM_H__
-#define __PCCTS_IOSTREAM_H__
-
-#ifdef PCCTS_USE_NAMESPACE_STD
-#include <iostream>
-#else
-#include <iostream.h>
-#endif
-
-#endif
diff --git a/Tools/CCode/Source/Pccts/h/pccts_istream.h b/Tools/CCode/Source/Pccts/h/pccts_istream.h
deleted file mode 100644
index e25cb8c483..0000000000
--- a/Tools/CCode/Source/Pccts/h/pccts_istream.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __PCCTS_ISTREAM_H__
-#define __PCCTS_ISTREAM_H__
-
-#ifdef PCCTS_USE_NAMESPACE_STD
-#include <istream>
-#else
-#include <istream.h>
-#endif
-
-#endif
diff --git a/Tools/CCode/Source/Pccts/h/pccts_setjmp.h b/Tools/CCode/Source/Pccts/h/pccts_setjmp.h
deleted file mode 100644
index 9ea185ca73..0000000000
--- a/Tools/CCode/Source/Pccts/h/pccts_setjmp.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __PCCTS_SETJMP_H__
-#define __PCCTS_SETJMP_H__
-
-#ifdef PCCTS_USE_NAMESPACE_STD
-#include <csetjmp>
-#else
-#include <setjmp.h>
-#endif
-
-#endif
diff --git a/Tools/CCode/Source/Pccts/h/pccts_stdarg.h b/Tools/CCode/Source/Pccts/h/pccts_stdarg.h
deleted file mode 100644
index e957430c32..0000000000
--- a/Tools/CCode/Source/Pccts/h/pccts_stdarg.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __PCCTS_STDARG_H__
-#define __PCCTS_STDARG_H__
-
-#ifdef PCCTS_USE_NAMESPACE_STD
-#include <cstdarg>
-#else
-#include <stdarg.h>
-#endif
-
-#endif
diff --git a/Tools/CCode/Source/Pccts/h/pccts_stdio.h b/Tools/CCode/Source/Pccts/h/pccts_stdio.h
deleted file mode 100644
index ac34d1086d..0000000000
--- a/Tools/CCode/Source/Pccts/h/pccts_stdio.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __PCCTS_STDIO_H__
-#define __PCCTS_STDIO_H__
-
-#ifdef PCCTS_USE_NAMESPACE_STD
-#include <cstdio>
-#else
-#include <stdio.h>
-#endif
-
-#endif
diff --git a/Tools/CCode/Source/Pccts/h/pccts_stdlib.h b/Tools/CCode/Source/Pccts/h/pccts_stdlib.h
deleted file mode 100644
index f0b344e8dc..0000000000
--- a/Tools/CCode/Source/Pccts/h/pccts_stdlib.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __PCCTS_STDLIB_H__
-#define __PCCTS_STDLIB_H__
-
-#ifdef PCCTS_USE_NAMESPACE_STD
-#include <cstdlib>
-#else
-#include <stdlib.h>
-#endif
-
-#endif
diff --git a/Tools/CCode/Source/Pccts/h/pccts_string.h b/Tools/CCode/Source/Pccts/h/pccts_string.h
deleted file mode 100644
index 458a08a94b..0000000000
--- a/Tools/CCode/Source/Pccts/h/pccts_string.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __PCCTS_STRING_H__
-#define __PCCTS_STRING_H__
-
-#ifdef PCCTS_USE_NAMESPACE_STD
-#include <cstring>
-#else
-#include <string.h>
-#endif
-
-#endif
diff --git a/Tools/CCode/Source/Pccts/h/pcctscfg.h b/Tools/CCode/Source/Pccts/h/pcctscfg.h
deleted file mode 100644
index 0c3c5ba6fd..0000000000
--- a/Tools/CCode/Source/Pccts/h/pcctscfg.h
+++ /dev/null
@@ -1,359 +0,0 @@
-#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/Tools/CCode/Source/Pccts/h/pcnames.bat b/Tools/CCode/Source/Pccts/h/pcnames.bat
deleted file mode 100644
index 8784aee9ab..0000000000
--- a/Tools/CCode/Source/Pccts/h/pcnames.bat
+++ /dev/null
@@ -1,11 +0,0 @@
-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/Tools/CCode/Source/Pccts/h/slist.cpp b/Tools/CCode/Source/Pccts/h/slist.cpp
deleted file mode 100644
index faf2fe4967..0000000000
--- a/Tools/CCode/Source/Pccts/h/slist.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/history.ps b/Tools/CCode/Source/Pccts/history.ps
deleted file mode 100644
index e2600d5129..0000000000
--- a/Tools/CCode/Source/Pccts/history.ps
+++ /dev/null
@@ -1,473 +0,0 @@
-%!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/Tools/CCode/Source/Pccts/history.txt b/Tools/CCode/Source/Pccts/history.txt
deleted file mode 100644
index 89ad8408c9..0000000000
--- a/Tools/CCode/Source/Pccts/history.txt
+++ /dev/null
@@ -1,186 +0,0 @@
-
-
-
- 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/Tools/CCode/Source/Pccts/makefile b/Tools/CCode/Source/Pccts/makefile
deleted file mode 100644
index f9b2dd2b9b..0000000000
--- a/Tools/CCode/Source/Pccts/makefile
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# 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/Tools/CCode/Source/Pccts/support/genmk/genmk.c b/Tools/CCode/Source/Pccts/support/genmk/genmk.c
deleted file mode 100644
index 4952a30b38..0000000000
--- a/Tools/CCode/Source/Pccts/support/genmk/genmk.c
+++ /dev/null
@@ -1,1063 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/support/genmk/genmk_old.c b/Tools/CCode/Source/Pccts/support/genmk/genmk_old.c
deleted file mode 100644
index 2cf9fad727..0000000000
--- a/Tools/CCode/Source/Pccts/support/genmk/genmk_old.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/support/genmk/makefile b/Tools/CCode/Source/Pccts/support/genmk/makefile
deleted file mode 100644
index a003c2f321..0000000000
--- a/Tools/CCode/Source/Pccts/support/genmk/makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-##
-## 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/Tools/CCode/Source/Pccts/support/rexpr/makefile b/Tools/CCode/Source/Pccts/support/rexpr/makefile
deleted file mode 100644
index 44caef1aa5..0000000000
--- a/Tools/CCode/Source/Pccts/support/rexpr/makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-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/Tools/CCode/Source/Pccts/support/rexpr/rexpr.c b/Tools/CCode/Source/Pccts/support/rexpr/rexpr.c
deleted file mode 100644
index 805bf65533..0000000000
--- a/Tools/CCode/Source/Pccts/support/rexpr/rexpr.c
+++ /dev/null
@@ -1,586 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/support/rexpr/rexpr.h b/Tools/CCode/Source/Pccts/support/rexpr/rexpr.h
deleted file mode 100644
index e67a9652fb..0000000000
--- a/Tools/CCode/Source/Pccts/support/rexpr/rexpr.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#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/Tools/CCode/Source/Pccts/support/rexpr/test.c b/Tools/CCode/Source/Pccts/support/rexpr/test.c
deleted file mode 100644
index 2619539e4b..0000000000
--- a/Tools/CCode/Source/Pccts/support/rexpr/test.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#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/Tools/CCode/Source/Pccts/support/set/set.c b/Tools/CCode/Source/Pccts/support/set/set.c
deleted file mode 100644
index eb6fba7393..0000000000
--- a/Tools/CCode/Source/Pccts/support/set/set.c
+++ /dev/null
@@ -1,816 +0,0 @@
-/* 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, 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/Tools/CCode/Source/Pccts/support/set/set.h b/Tools/CCode/Source/Pccts/support/set/set.h
deleted file mode 100644
index 5d68152df4..0000000000
--- a/Tools/CCode/Source/Pccts/support/set/set.h
+++ /dev/null
@@ -1,121 +0,0 @@
-#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/Tools/CCode/Source/Pccts/support/sym/sym.c b/Tools/CCode/Source/Pccts/support/sym/sym.c
deleted file mode 100644
index eccce059bb..0000000000
--- a/Tools/CCode/Source/Pccts/support/sym/sym.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * 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/Tools/CCode/Source/Pccts/support/sym/template.h b/Tools/CCode/Source/Pccts/support/sym/template.h
deleted file mode 100644
index ee6e665e34..0000000000
--- a/Tools/CCode/Source/Pccts/support/sym/template.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 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/Tools/CCode/Source/PeCoffLoader/BasePeCoff.c b/Tools/CCode/Source/PeCoffLoader/BasePeCoff.c
deleted file mode 100644
index 06d4b83af7..0000000000
--- a/Tools/CCode/Source/PeCoffLoader/BasePeCoff.c
+++ /dev/null
@@ -1,1060 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2005, 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.
-
-Module Name:
-
- PeCoffLoader.c
-
-Abstract:
-
- Tiano PE/COFF loader
-
-Revision History
-
---*/
-
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h>
-#include <Library/PeCoffLib.h>
-
-STATIC
-RETURN_STATUS
-PeCoffLoaderGetPeHeader (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- OUT EFI_IMAGE_NT_HEADERS *PeHdr,
- OUT EFI_TE_IMAGE_HEADER *TeHdr
- );
-
-STATIC
-RETURN_STATUS
-PeCoffLoaderCheckImageType (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- IN EFI_IMAGE_NT_HEADERS *PeHdr,
- IN EFI_TE_IMAGE_HEADER *TeHdr
- );
-
-STATIC
-VOID *
-PeCoffLoaderImageAddress (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- IN UINTN Address
- );
-
-
-STATIC
-RETURN_STATUS
-PeCoffLoaderGetPeHeader (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- OUT EFI_IMAGE_NT_HEADERS *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;
- }
- //
- // Read the PE/COFF Header
- //
- Size = sizeof (EFI_IMAGE_NT_HEADERS);
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- ImageContext->PeCoffHeaderOffset,
- &Size,
- PeHdr
- );
- if (RETURN_ERROR (Status)) {
- ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
- return Status;
- }
- //
- // Check the PE/COFF Header Signature. If not, then try to read a TE header
- //
- if (PeHdr->Signature != EFI_IMAGE_NT_SIGNATURE) {
- Size = sizeof (EFI_TE_IMAGE_HEADER);
- Status = ImageContext->ImageRead (
- ImageContext->Handle,
- 0,
- &Size,
- TeHdr
- );
- 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_NT_HEADERS *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)
- // and the machine type for the Virtual Machine.
- //
- if (ImageContext->IsTeImage == FALSE) {
- ImageContext->Machine = PeHdr->FileHeader.Machine;
- } else {
- ImageContext->Machine = TeHdr->Machine;
- }
-
- if (!(EFI_IMAGE_MACHINE_TYPE_SUPPORTED (ImageContext->Machine))) {
- ImageContext->ImageError = IMAGE_ERROR_INVALID_MACHINE_TYPE;
- return RETURN_UNSUPPORTED;
- }
-
- //
- // See if the image type is supported. We support EFI Applications,
- // EFI Boot Service Drivers, and EFI Runtime Drivers.
- //
- if (ImageContext->IsTeImage == FALSE) {
- ImageContext->ImageType = PeHdr->OptionalHeader.Subsystem;
- } else {
- ImageContext->ImageType = (UINT16) (TeHdr->Subsystem);
- }
-
-
- 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_NT_HEADERS 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;
-
- 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;
- }
- //
- // Retrieve the base address of the image
- //
- if (!(ImageContext->IsTeImage)) {
- ImageContext->ImageAddress = PeHdr.OptionalHeader.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.FileHeader.Characteristics & EFI_IMAGE_FILE_RELOCS_STRIPPED) != 0)) {
- ImageContext->RelocationsStripped = TRUE;
- } else {
- ImageContext->RelocationsStripped = FALSE;
- }
-
- if (!(ImageContext->IsTeImage)) {
- ImageContext->ImageSize = (UINT64) PeHdr.OptionalHeader.SizeOfImage;
- ImageContext->SectionAlignment = PeHdr.OptionalHeader.SectionAlignment;
- ImageContext->SizeOfHeaders = PeHdr.OptionalHeader.SizeOfHeaders;
-
- //
- // Modify ImageSize to contain .PDB file name if required and initialize
- // PdbRVA field...
- //
- if (PeHdr.OptionalHeader.NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
- DebugDirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(PeHdr.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
-
- DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
-
- //
- // 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.FileHeader.SizeOfOptionalHeader
- );
-
- for (Index = 0; Index < PeHdr.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,
- &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 mulitple 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 (CHAR8 *) ((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_NT_HEADERS *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;
- CHAR8 *FixupData;
- PHYSICAL_ADDRESS BaseAddress;
-
- 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;
- }
-
- //
- // If the destination address is not 0, use that rather than the
- // image address as the relocation target.
- //
- if (ImageContext->DestinationAddress) {
- BaseAddress = ImageContext->DestinationAddress;
- } else {
- BaseAddress = ImageContext->ImageAddress;
- }
-
- if (!(ImageContext->IsTeImage)) {
- PeHdr = (EFI_IMAGE_NT_HEADERS *)((UINTN)ImageContext->ImageAddress +
- ImageContext->PeCoffHeaderOffset);
- Adjust = (UINT64) BaseAddress - PeHdr->OptionalHeader.ImageBase;
- PeHdr->OptionalHeader.ImageBase = (UINTN) BaseAddress;
-
- //
- // 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 (PeHdr->OptionalHeader.NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
- RelocDir = &PeHdr->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
- RelocBase = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
- RelocBaseEnd = PeCoffLoaderImageAddress (
- ImageContext,
- RelocDir->VirtualAddress + RelocDir->Size - 1
- );
- } 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);
-
- //
- // 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);
- } 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_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:
- Status = PeCoffLoaderRelocateImageEx (Reloc, Fixup, &FixupData, Adjust);
- 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_NT_HEADERS *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;
-
- PeHdr = NULL;
- TeHdr = 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_NT_HEADERS *)
- ((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
-
- FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
- (UINTN)ImageContext->ImageAddress +
- ImageContext->PeCoffHeaderOffset +
- sizeof(UINT32) +
- sizeof(EFI_IMAGE_FILE_HEADER) +
- PeHdr->FileHeader.SizeOfOptionalHeader
- );
- NumberOfSections = (UINTN) (PeHdr->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 (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;
- }
- //
- // 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;
- }
-
- //
- // 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->OptionalHeader.AddressOfEntryPoint
- );
- } else {
- ImageContext->EntryPoint = (PHYSICAL_ADDRESS) (
- (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->OptionalHeader.NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)
- &PeHdr->OptionalHeader.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;
-
- default:
- break;
- }
- }
- }
- }
-
- return Status;
-}
diff --git a/Tools/CCode/Source/PeCoffLoader/Common/EfiImage.h b/Tools/CCode/Source/PeCoffLoader/Common/EfiImage.h
deleted file mode 100644
index 9528e6bff5..0000000000
--- a/Tools/CCode/Source/PeCoffLoader/Common/EfiImage.h
+++ /dev/null
@@ -1,701 +0,0 @@
-/** @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, 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.
-
- Module Name: EfiImage.h
-
-**/
-
-#ifndef __EFI_IMAGE_H__
-#define __EFI_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_IA64 0x0200
-#define IMAGE_FILE_MACHINE_EBC 0x0EBC
-#define IMAGE_FILE_MACHINE_X64 0x8664
-//
-// Support old names for backward compatible
-//
-#define EFI_IMAGE_MACHINE_IA32 IMAGE_FILE_MACHINE_I386
-#define EFI_IMAGE_MACHINE_IA64 IMAGE_FILE_MACHINE_IA64
-#define EFI_IMAGE_MACHINE_IPF IMAGE_FILE_MACHINE_IA64
-#define EFI_IMAGE_MACHINE_EBC IMAGE_FILE_MACHINE_EBC
-#define EFI_IMAGE_MACHINE_X64 IMAGE_FILE_MACHINE_X64
-
-#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_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)
-
-//
-// Processor specific definition of EFI_IMAGE_OPTIONAL_HEADER so the
-// type name EFI_IMAGE_OPTIONAL_HEADER is appropriate to the build. Same for
-// EFI_IMAGE_NT_HEADERS. These definitions MUST be used by ALL EFI code.
-//
-#if defined (MDE_CPU_IA32) && !defined (BUILDING_TOOLS) || \
- defined (BUILDING_TOOLS) && defined (TOOL_BUILD_IA32_TARGET)
-
-// typedef EFI_IMAGE_OPTIONAL_HEADER32 EFI_IMAGE_OPTIONAL_HEADER;
-typedef EFI_IMAGE_NT_HEADERS32 EFI_IMAGE_NT_HEADERS;
-
-#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
- (((Machine) == EFI_IMAGE_MACHINE_IA32) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
-
-#elif defined (MDE_CPU_IPF) && !defined (BUILDING_TOOLS) || \
- defined (BUILDING_TOOLS) && defined (TOOL_BUILD_IPF_TARGET)
-
-typedef EFI_IMAGE_OPTIONAL_HEADER64 EFI_IMAGE_OPTIONAL_HEADER;
-typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
-
-#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
- (((Machine) == EFI_IMAGE_MACHINE_IPF) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
-
-#elif defined (MDE_CPU_X64) && !defined (BUILDING_TOOLS) || \
- defined (BUILDING_TOOLS) && defined (TOOL_BUILD_X64_TARGET)
-
-typedef EFI_IMAGE_OPTIONAL_HEADER64 EFI_IMAGE_OPTIONAL_HEADER;
-typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
-
-#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
- (((Machine) == EFI_IMAGE_MACHINE_X64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
-
-#elif defined (MDE_CPU_EBC)
-
-//
-// This is just to make sure you can cross compile with the EBC compiiler.
-// It does not make sense to have a PE loader coded in EBC. You need to
-// understand the basic
-//
-typedef EFI_IMAGE_OPTIONAL_HEADER64 EFI_IMAGE_OPTIONAL_HEADER;
-typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
-
-#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_EBC)
-
-#else
-#error Unknown Processor Type
-#endif
-
-
-#define EFI_IMAGE_FIRST_SECTION(ntheader) \
- ( \
- (EFI_IMAGE_SECTION_HEADER *) \
- ( \
- (UINT32) ntheader + \
- FIELD_OFFSET (EFI_IMAGE_NT_HEADERS, OptionalHeader) + \
- ((EFI_IMAGE_NT_HEADERS *) (ntheader))->FileHeader.SizeOfOptionalHeader \
- ) \
- )
-
-//
-// 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 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
-#define EFI_IMAGE_REL_I386_SECTION 012
-#define EFI_IMAGE_REL_I386_SECREL 013
-#define EFI_IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address
-
-///
-/// 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_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;
-
-///
-/// 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
-
-#endif
diff --git a/Tools/CCode/Source/PeCoffLoader/Ia32/PeCoffLoaderEx.c b/Tools/CCode/Source/PeCoffLoader/Ia32/PeCoffLoaderEx.c
deleted file mode 100644
index f58e8d0364..0000000000
--- a/Tools/CCode/Source/PeCoffLoader/Ia32/PeCoffLoaderEx.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- PeCoffLoaderEx.c
-
-Abstract:
-
- IA-32 Specific relocation fixups
-
-Revision History
-
---*/
-
-#include <Common/UefiBaseTypes.h>
-
-RETURN_STATUS
-PeCoffLoaderRelocateImageEx (
- 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;
-}
diff --git a/Tools/CCode/Source/PeCoffLoader/Ipf/PeCoffLoaderEx.c b/Tools/CCode/Source/PeCoffLoader/Ipf/PeCoffLoaderEx.c
deleted file mode 100644
index 3f3989908d..0000000000
--- a/Tools/CCode/Source/PeCoffLoader/Ipf/PeCoffLoaderEx.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- PeCoffLoaderEx.c
-
-Abstract:
-
- Fixes Intel Itanium(TM) specific relocation types
-
-
-Revision History
-
---*/
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h>
-#include <Library/PeCoffLib.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
-
-RETURN_STATUS
-PeCoffLoaderRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
- )
-/*++
-
-Routine Description:
-
- Performs an Itanium-based 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
-
---*/
-{
- UINT64 *F64;
- UINT64 FixupVal;
-
- switch ((*Reloc) >> 12) {
-
- 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_IA64_IMM64:
-
- //
- // Align it to bundle address before fixing up the
- // 64-bit immediate value of the movl instruction.
- //
-
- Fixup = (CHAR8 *)((UINTN) Fixup & (UINTN) ~(15));
- FixupVal = (UINT64)0;
-
- //
- // Extract the lower 32 bits of IMM64 from bundle
- //
- EXT_IMM64(FixupVal,
- (UINT32 *)Fixup + IMM64_IMM7B_INST_WORD_X,
- IMM64_IMM7B_SIZE_X,
- IMM64_IMM7B_INST_WORD_POS_X,
- IMM64_IMM7B_VAL_POS_X
- );
-
- EXT_IMM64(FixupVal,
- (UINT32 *)Fixup + IMM64_IMM9D_INST_WORD_X,
- IMM64_IMM9D_SIZE_X,
- IMM64_IMM9D_INST_WORD_POS_X,
- IMM64_IMM9D_VAL_POS_X
- );
-
- EXT_IMM64(FixupVal,
- (UINT32 *)Fixup + IMM64_IMM5C_INST_WORD_X,
- IMM64_IMM5C_SIZE_X,
- IMM64_IMM5C_INST_WORD_POS_X,
- IMM64_IMM5C_VAL_POS_X
- );
-
- EXT_IMM64(FixupVal,
- (UINT32 *)Fixup + IMM64_IC_INST_WORD_X,
- IMM64_IC_SIZE_X,
- IMM64_IC_INST_WORD_POS_X,
- IMM64_IC_VAL_POS_X
- );
-
- EXT_IMM64(FixupVal,
- (UINT32 *)Fixup + IMM64_IMM41a_INST_WORD_X,
- IMM64_IMM41a_SIZE_X,
- IMM64_IMM41a_INST_WORD_POS_X,
- IMM64_IMM41a_VAL_POS_X
- );
-
- //
- // Update 64-bit address
- //
- FixupVal += Adjust;
-
- //
- // Insert IMM64 into bundle
- //
- INS_IMM64(FixupVal,
- ((UINT32 *)Fixup + IMM64_IMM7B_INST_WORD_X),
- IMM64_IMM7B_SIZE_X,
- IMM64_IMM7B_INST_WORD_POS_X,
- IMM64_IMM7B_VAL_POS_X
- );
-
- INS_IMM64(FixupVal,
- ((UINT32 *)Fixup + IMM64_IMM9D_INST_WORD_X),
- IMM64_IMM9D_SIZE_X,
- IMM64_IMM9D_INST_WORD_POS_X,
- IMM64_IMM9D_VAL_POS_X
- );
-
- INS_IMM64(FixupVal,
- ((UINT32 *)Fixup + IMM64_IMM5C_INST_WORD_X),
- IMM64_IMM5C_SIZE_X,
- IMM64_IMM5C_INST_WORD_POS_X,
- IMM64_IMM5C_VAL_POS_X
- );
-
- INS_IMM64(FixupVal,
- ((UINT32 *)Fixup + IMM64_IC_INST_WORD_X),
- IMM64_IC_SIZE_X,
- IMM64_IC_INST_WORD_POS_X,
- IMM64_IC_VAL_POS_X
- );
-
- INS_IMM64(FixupVal,
- ((UINT32 *)Fixup + IMM64_IMM41a_INST_WORD_X),
- IMM64_IMM41a_SIZE_X,
- IMM64_IMM41a_INST_WORD_POS_X,
- IMM64_IMM41a_VAL_POS_X
- );
-
- INS_IMM64(FixupVal,
- ((UINT32 *)Fixup + IMM64_IMM41b_INST_WORD_X),
- IMM64_IMM41b_SIZE_X,
- IMM64_IMM41b_INST_WORD_POS_X,
- IMM64_IMM41b_VAL_POS_X
- );
-
- INS_IMM64(FixupVal,
- ((UINT32 *)Fixup + IMM64_IMM41c_INST_WORD_X),
- IMM64_IMM41c_SIZE_X,
- IMM64_IMM41c_INST_WORD_POS_X,
- IMM64_IMM41c_VAL_POS_X
- );
-
- INS_IMM64(FixupVal,
- ((UINT32 *)Fixup + IMM64_SIGN_INST_WORD_X),
- IMM64_SIGN_SIZE_X,
- IMM64_SIGN_INST_WORD_POS_X,
- IMM64_SIGN_VAL_POS_X
- );
-
- F64 = (UINT64 *) Fixup;
- if (*FixupData != NULL) {
- *FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
- *(UINT64 *)(*FixupData) = *F64;
- *FixupData = *FixupData + sizeof(UINT64);
- }
- break;
-
- default:
- return RETURN_UNSUPPORTED;
- }
-
- return RETURN_SUCCESS;
-}
diff --git a/Tools/CCode/Source/PeCoffLoader/X64/PeCoffLoaderEx.c b/Tools/CCode/Source/PeCoffLoader/X64/PeCoffLoaderEx.c
deleted file mode 100644
index 30db3e35c5..0000000000
--- a/Tools/CCode/Source/PeCoffLoader/X64/PeCoffLoaderEx.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/**@file
- x64 Specific relocation fixups.
-
-Copyright (c) 2005 - 2006 Intel Corporation. <BR>
-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.
-
-**/
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h>
-#include <Library/PeCoffLib.h>
-
-/**
- Performs an x64 specific relocation fixup
-
- @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
-
- @retval RETURN_SUCCESS Success to perform relocation
- @retval RETURN_UNSUPPORTED Unsupported.
-**/
-RETURN_STATUS
-PeCoffLoaderRelocateImageEx (
- IN UINT16 *Reloc,
- IN OUT CHAR8 *Fixup,
- IN OUT CHAR8 **FixupData,
- IN UINT64 Adjust
- )
-{
- UINT64 *F64;
-
- switch ((*Reloc) >> 12) {
-
- 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;
-
- default:
- return RETURN_UNSUPPORTED;
- }
-
- return RETURN_SUCCESS;
-}
diff --git a/Tools/CCode/Source/PeCoffLoader/build.xml b/Tools/CCode/Source/PeCoffLoader/build.xml
deleted file mode 100644
index c6137bdfad..0000000000
--- a/Tools/CCode/Source/PeCoffLoader/build.xml
+++ /dev/null
@@ -1,153 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK PeCoffLoader
- Copyright (c) 2006, Intel Corporation
--->
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LibName" value="PeCoffLoader"/>
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR_IA32" value="${PACKAGE_DIR}/${LibName}/tmp/Ia32"/>
- <property name="BUILD_DIR_X64" value="${PACKAGE_DIR}/${LibName}/tmp/X64"/>
- <property name="BUILD_DIR_IPF" value="${PACKAGE_DIR}/${LibName}/tmp/Ipf"/>
-
- <target name="GenTool" depends="init, PeCoffLoaderLib">
- <echo message="The EDK Library: ${LibName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Library: ${LibName}"/>
- <mkdir dir="${BUILD_DIR_IA32}"/>
- <mkdir dir="${BUILD_DIR_X64}"/>
- <mkdir dir="${BUILD_DIR_IPF}"/>
-
- <condition property="syslibdirs" value="">
- <os family="mac"/>
- </condition>
-
- <condition property="syslibs" value="">
- <os family="mac"/>
- </condition>
-
- <condition property="syslibdirs" value="${env.CYGWIN_HOME}/lib/e2fsprogs">
- <os family="windows"/>
- </condition>
-
- <condition property="syslibs" value="uuid">
- <os family="windows"/>
- </condition>
-
- <condition property="syslibdirs" value="/usr/lib">
- <os name="Linux"/>
- </condition>
-
- <condition property="syslibs" value="uuid">
- <os name="Linux"/>
- </condition>
-
- </target>
-
- <target name="PeCoffLoaderLib" depends="init, PeCoffLoader_Ia32, PeCoffLoader_Ipf, PeCoffLoader_X64"/>
-
- <target name="PeCoffLoader_Ia32" >
- <cc name="${ToolChain}" objdir="${BUILD_DIR_IA32}"
- outfile="${LIB_DIR}/${LibName}_Ia32"
- outtype="static"
- debug="true"
- optimize="speed">
-
- <defineset>
- <define name="BUILDING_TOOLS"/>
- <define name="TOOL_BUILD_IA32_TARGET"/>
- </defineset>
-
- <fileset dir="${basedir}/${LibName}"
- includes="BasePeCoff.c Ia32/PeCoffLoaderEx.c" />
-
- <includepath path="${PACKAGE_DIR}/${LibName}"/>
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- </cc>
- </target>
-
- <target name="PeCoffLoader_Ipf" >
- <cc name="${ToolChain}" objdir="${BUILD_DIR_IPF}"
- outfile="${LIB_DIR}/${LibName}_Ipf"
- outtype="static"
- debug="true"
- optimize="speed">
-
- <defineset>
- <define name="BUILDING_TOOLS"/>
- <define name="TOOL_BUILD_IPF_TARGET"/>
- </defineset>
-
- <fileset dir="${basedir}/${LibName}"
- includes="BasePeCoff.c Ipf/PeCoffLoaderEx.c" />
-
- <includepath path="${PACKAGE_DIR}/${LibName}"/>
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- </cc>
- </target>
-
- <target name="PeCoffLoader_X64" >
- <cc name="${ToolChain}" objdir="${BUILD_DIR_X64}"
- outfile="${LIB_DIR}/${LibName}_X64"
- outtype="static"
- debug="true"
- optimize="speed">
-
- <defineset>
- <define name="BUILDING_TOOLS"/>
- <define name="TOOL_BUILD_X64_TARGET"/>
- </defineset>
-
- <fileset dir="${basedir}/${LibName}"
- includes="BasePeCoff.c X64/PeCoffLoaderEx.c" />
-
- <includepath path="${PACKAGE_DIR}/${LibName}"/>
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- </cc>
- </target>
-
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR_IA32}" includes="*.obj"/>
- <fileset dir="${BUILD_DIR_X64}" includes="*.obj"/>
- <fileset dir="${BUILD_DIR_IPF}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${LibName}${ext_exe}"/>
- <delete dir="${PACKAGE_DIR}/${LibName}/tmp">
- </delete>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR_IA32}"/>
- <fileset dir="${BUILD_DIR_X64}"/>
- <fileset dir="${BUILD_DIR_IPF}"/>
- <fileset file="${LIB_DIR}/${LibName}_Ia32${ext_static}"/>
- <fileset file="${BIN_DIR}/${LibName}_X64${ext_static}"/>
- <fileset file="${BIN_DIR}/${LibName}_IPF${ext_static}"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c
deleted file mode 100644
index 459d8db11e..0000000000
--- a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c
+++ /dev/null
@@ -1,1010 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-
-Module Name:
-
- PeiRebaseExe.c
-
-Abstract:
-
- This contains all code necessary to build the PeiRebase.exe utility.
- This utility relies heavily on the PeiRebase DLL. Definitions for both
- can be found in the PEI Rebase Utility Specification, review draft.
-
---*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-#include <Common/FirmwareFileSystem.h>
-#include <Library/PeCoffLib.h>
-
-#include "CommonLib.h"
-#include "ParseInf.h"
-#include "FvLib.h"
-#include "EfiUtilityMsgs.h"
-#include "PeiRebaseExe.h"
-
-EFI_STATUS
-ReadHeader (
- IN FILE *InputFile,
- OUT UINT32 *FvSize,
- OUT BOOLEAN *ErasePolarity
- );
-
-int
-main (
- int argc,
- char **argv
- )
-/*++
-
-Routine Description:
-
- This utility relocates PEI XIP PE32s in a FV.
-
-Arguments:
-
- argc - Number of command line arguments
- argv[]:
- BaseAddress The base address to use for rebasing the FV. The correct
- format is a hex number preceded by 0x.
- InputFileName The name of the input FV file.
- OutputFileName The name of the output FV file.
-
- Arguments come in pair in any order.
- -I InputFileName
- -O OutputFileName
- -B BaseAddress
-
-Returns:
-
- 0 No error conditions detected.
- 1 One or more of the input parameters is invalid.
- 2 A resource required by the utility was unavailable.
- Most commonly this will be memory allocation or file creation.
- 3 PeiRebase.dll could not be loaded.
- 4 Error executing the PEI rebase.
-
---*/
-{
- UINT8 Index;
- CHAR8 InputFileName[_MAX_PATH];
- CHAR8 *OutputFileName;
- EFI_PHYSICAL_ADDRESS XipBase, BsBase, RtBase;
- UINT32 BaseTypes;
- EFI_STATUS Status;
- FILE *InputFile;
- FILE *OutputFile;
- FILE *LogFile;
- UINT64 FvOffset;
- UINT32 FileCount;
- int BytesRead;
- EFI_FIRMWARE_VOLUME_HEADER *FvImage;
- UINT32 FvSize;
- EFI_FFS_FILE_HEADER *CurrentFile;
- BOOLEAN ErasePolarity;
- MEMORY_FILE InfMemoryFile;
- CHAR8 StringBuffer[0x100];
-
- ErasePolarity = FALSE;
- //
- // Set utility name for error/warning reporting purposes.
- //
- SetUtilityName (UTILITY_NAME);
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- //
- // Verify the correct number of arguments
- //
- if (argc < MAX_ARGS) {
- Usage ();
- return STATUS_ERROR;
- }
-
- //
- // Initialize variables
- //
- InputFileName[0] = '\0';
- OutputFileName = NULL;
- XipBase = BsBase = RtBase = 0;
- BaseTypes = 0;
- FvOffset = 0;
- FileCount = 0;
- ErasePolarity = FALSE;
- InputFile = NULL;
- OutputFile = NULL;
- LogFile = NULL;
- FvImage = NULL;
-
- //
- // Parse the command line arguments
- //
- for (Index = 1; Index < argc; Index += 2) {
- //
- // Make sure argument pair begin with - or /
- //
- if (argv[Index][0] != '-' && argv[Index][0] != '/') {
- Usage ();
- Error (NULL, 0, 0, argv[Index], "unrecognized option");
- return STATUS_ERROR;
- }
- //
- // Make sure argument specifier is only one letter
- //
- if (argv[Index][2] != 0) {
- Usage ();
- Error (NULL, 0, 0, argv[Index], "unrecognized option");
- return STATUS_ERROR;
- }
- //
- // Determine argument to read
- //
- switch (argv[Index][1]) {
- case 'I':
- case 'i':
- if (strlen (InputFileName) == 0) {
- strcpy (InputFileName, argv[Index + 1]);
- } else {
- Usage ();
- Error (NULL, 0, 0, argv[Index + 1], "only one -i InputFileName may be specified");
- return STATUS_ERROR;
- }
- break;
-
- case 'O':
- case 'o':
- if (OutputFileName == NULL) {
- OutputFileName = argv[Index + 1];
- } else {
- Usage ();
- Error (NULL, 0, 0, argv[Index + 1], "only one -o OutputFileName may be specified");
- return STATUS_ERROR;
- }
- break;
-
- case 'F':
- case 'f':
- //
- // Load INF file into memory & initialize MEMORY_FILE structure
- //
- Status = GetFileImage (argv[Index + 1], &InfMemoryFile.FileImage, (UINT32*)&InfMemoryFile.Eof);
- InfMemoryFile.Eof = InfMemoryFile.FileImage + (UINT32)(UINTN)InfMemoryFile.Eof;
- InfMemoryFile.CurrentFilePointer = InfMemoryFile.FileImage;
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, argv[Index + 1], "Error opening FvInfFile");
- return STATUS_ERROR;
- }
-
- //
- // Read BaseAddress from fv.inf file
- //
- FindToken (&InfMemoryFile, "[options]", "EFI_BASE_ADDRESS", 0, StringBuffer);
-
- //
- // Free INF file image
- //
- free (InfMemoryFile.FileImage);
-
- //
- // Point argv[Index + 1] to StringBuffer so that it could be processed as "-b"
- //
- argv[Index + 1] = StringBuffer;
-
- case 'B':
- case 'b':
- if (BaseTypes & 1) {
- Usage ();
- Error (NULL, 0, 0, argv[Index + 1], "XipBaseAddress may be specified only once by either -b or -f");
- return STATUS_ERROR;
- }
-
- Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &XipBase);
- if (EFI_ERROR (Status)) {
- Usage ();
- Error (NULL, 0, 0, argv[Index + 1], "invalid hex digit given for XIP base address");
- return STATUS_ERROR;
- }
-
- BaseTypes |= 1;
- break;
-
- case 'D':
- case 'd':
- if (BaseTypes & 2) {
- Usage ();
- Error (NULL, 0, 0, argv[Index + 1], "-d BsBaseAddress may be specified only once");
- return STATUS_ERROR;
- }
-
- Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &BsBase);
- if (EFI_ERROR (Status)) {
- Usage ();
- Error (NULL, 0, 0, argv[Index + 1], "invalid hex digit given for BS_DRIVER base address");
- return STATUS_ERROR;
- }
-
- BaseTypes |= 2;
- break;
-
- case 'R':
- case 'r':
- if (BaseTypes & 4) {
- Usage ();
- Error (NULL, 0, 0, argv[Index + 1], "-r RtBaseAddress may be specified only once");
- return STATUS_ERROR;
- }
-
- Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &RtBase);
- if (EFI_ERROR (Status)) {
- Usage ();
- Error (NULL, 0, 0, argv[Index + 1], "invalid hex digit given for RT_DRIVER base address");
- return STATUS_ERROR;
- }
-
- BaseTypes |= 4;
- break;
-
- default:
- Usage ();
- Error (NULL, 0, 0, argv[Index], "unrecognized argument");
- return STATUS_ERROR;
- break;
- }
- }
-
- //
- // Open the file containing the FV
- //
- InputFile = fopen (InputFileName, "rb");
- if (InputFile == NULL) {
- Error (NULL, 0, 0, InputFileName, "could not open input file for reading");
- return STATUS_ERROR;
- }
-
- //
- // Open the log file
- //
- strcat (InputFileName, ".log");
- LogFile = fopen (InputFileName, "w");
- if (LogFile == NULL) {
- Error (NULL, 0, 0, InputFileName, "could not append to log file");
- }
-
- //
- // Determine size of FV
- //
- Status = ReadHeader (InputFile, &FvSize, &ErasePolarity);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "could not parse the FV header", NULL);
- goto Finish;
- }
- //
- // Allocate a buffer for the FV image
- //
- FvImage = malloc (FvSize);
- if (FvImage == NULL) {
- Error (NULL, 0, 0, "application error", "memory allocation failed");
- goto Finish;
- }
- //
- // Read the entire FV to the buffer
- //
- BytesRead = fread (FvImage, 1, FvSize, InputFile);
- fclose (InputFile);
- InputFile = NULL;
- if ((unsigned int) BytesRead != FvSize) {
- Error (NULL, 0, 0, InputFileName, "failed to read from file");
- goto Finish;
- }
- //
- // Prepare to walk the FV image
- //
- InitializeFvLib (FvImage, FvSize);
- //
- // Get the first file
- //
- Status = GetNextFile (NULL, &CurrentFile);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "cannot find the first file in the FV image", NULL);
- goto Finish;
- }
- //
- // Check if each file should be rebased
- //
- while (CurrentFile != NULL) {
- //
- // Rebase this file
- //
- FfsRebase (
- CurrentFile,
- BaseTypes,
- XipBase + (UINTN)CurrentFile - (UINTN)FvImage,
- &BsBase,
- &RtBase,
- LogFile
- );
-
- if (EFI_ERROR (Status)) {
- switch (Status) {
-
- case EFI_INVALID_PARAMETER:
- Error (NULL, 0, 0, "invalid parameter passed to FfsRebase", NULL);
- break;
-
- case EFI_ABORTED:
- Error (NULL, 0, 0, "error detected while rebasing -- aborted", NULL);
- break;
-
- case EFI_OUT_OF_RESOURCES:
- Error (NULL, 0, 0, "FfsRebase could not allocate required resources", NULL);
- break;
-
- case EFI_NOT_FOUND:
- Error (NULL, 0, 0, "FfsRebase could not locate a PE32 section", NULL);
- break;
-
- default:
- Error (NULL, 0, 0, "FfsRebase returned unknown status", "status=0x%08X", Status);
- break;
- }
-
- goto Finish;
- }
- //
- // Get the next file
- //
- Status = GetNextFile (CurrentFile, &CurrentFile);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "cannot find the next file in the FV image", NULL);
- goto Finish;
- }
- }
- //
- // Open the output file
- //
- OutputFile = fopen (OutputFileName, "wb");
- if (OutputFile == NULL) {
- Error (NULL, 0, 0, OutputFileName, "failed to open output file");
- goto Finish;
- }
-
- if (fwrite (FvImage, 1, FvSize, OutputFile) != FvSize) {
- Error (NULL, 0, 0, "failed to write to output file", 0);
- goto Finish;
- }
-
-Finish:
- if (InputFile != NULL) {
- fclose (InputFile);
- }
- //
- // If we created an output file, and there was an error, remove it so
- // subsequent builds will rebuild it.
- //
- if (OutputFile != NULL) {
- if (GetUtilityStatus () == STATUS_ERROR) {
- remove (OutputFileName);
- }
-
- fclose (OutputFile);
- }
-
- if (LogFile != NULL) {
- fclose (LogFile);
- }
-
- if (FvImage != NULL) {
- free (FvImage);
- }
-
- return GetUtilityStatus ();
-}
-
-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;
-
- BytesRead = 0;
- Size = 0;
- //
- // Check input parameters
- //
- if ((InputFile == NULL) || (FvSize == NULL) || (ErasePolarity == NULL)) {
- Error (NULL, 0, 0, "ReadHeader()", "invalid input parameter");
- return EFI_INVALID_PARAMETER;
- }
- //
- // Read the header
- //
- fread (&VolumeHeader, sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile);
- BytesRead = sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY);
- Signature[0] = VolumeHeader.Signature;
- Signature[1] = 0;
-
- //
- // Get erase polarity
- //
- if (VolumeHeader.Attributes & EFI_FVB_ERASE_POLARITY) {
- *ErasePolarity = TRUE;
- }
-
- do {
- fread (&BlockMap, sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile);
- BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
-
- if (BlockMap.NumBlocks != 0) {
- Size += BlockMap.NumBlocks * BlockMap.BlockLength;
- }
-
- } while (!(BlockMap.NumBlocks == 0 && BlockMap.BlockLength == 0));
-
- if (VolumeHeader.FvLength != Size) {
- Error (NULL, 0, 0, "volume size not consistant with block maps", NULL);
- return EFI_ABORTED;
- }
-
- *FvSize = Size;
-
- rewind (InputFile);
-
- return EFI_SUCCESS;
-}
-
-VOID
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -PEI Rebase Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-VOID
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the utility usage syntax to STDOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- Version();
-
- printf (
- "Usage: %s -I InputFileName -O OutputFileName -B BaseAddress [-F InputFvInfName]\n",
- UTILITY_NAME
- );
- printf (" [-D BootDriverBaseAddress] [-R RuntimeDriverBaseAddress]\n");
- printf (" Where:\n");
- printf (" InputFileName is the name of the EFI FV file to rebase.\n");
- printf (" OutputFileName is the desired output file name.\n");
- printf (" BaseAddress is the rebase address for all drivers run in Flash.\n");
- printf (" InputFvInfName is the Fv.inf file that contains this FV base address to rebase against.\n");
- printf (" BootDriverBaseAddress is the rebase address for all boot drivers in this fv image.\n");
- printf (" RuntimeDriverBaseAddress is the rebase address for all runtime drivers in this fv image.\n");
- printf (" Argument pair may be in any order.\n\n");
-}
-
-EFI_STATUS
-FfsRebase (
- IN OUT EFI_FFS_FILE_HEADER *FfsFile,
- IN UINT32 Flags,
- IN OUT EFI_PHYSICAL_ADDRESS XipBase,
- IN OUT EFI_PHYSICAL_ADDRESS *BsBase,
- IN OUT EFI_PHYSICAL_ADDRESS *RtBase,
- OUT FILE *LogFile
- )
-/*++
-
-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:
-
- FfsFile A pointer to Ffs file image.
- BaseAddress The base address to use for rebasing the file image.
-
-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;
- EFI_PHYSICAL_ADDRESS NewPe32BaseAddress;
- UINTN Index;
- EFI_FILE_SECTION_POINTER CurrentPe32Section;
- EFI_FFS_FILE_STATE SavedState;
- EFI_IMAGE_NT_HEADERS32 *PeHdr;
- EFI_TE_IMAGE_HEADER *TEImageHeader;
- UINT8 FileGuidString[80];
- UINT32 TailSize;
- EFI_FFS_FILE_TAIL TailValue;
- EFI_PHYSICAL_ADDRESS *BaseToUpdate;
- EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
-
-
- //
- // Verify input parameters
- //
- if (FfsFile == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Convert the GUID to a string so we can at least report which file
- // if we find an error.
- //
- PrintGuidToBuffer (&FfsFile->Name, FileGuidString, sizeof (FileGuidString), TRUE);
- if (FfsFile->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailSize = sizeof (EFI_FFS_FILE_TAIL);
- } else {
- TailSize = 0;
- }
- //
- // Do some cursory checks on the FFS file contents
- //
- Status = VerifyFfsFile (FfsFile);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "file does not appear to be a valid FFS file, cannot be rebased", FileGuidString);
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // 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;
- default:
- return EFI_SUCCESS;
- }
-
- //
- // Rebase each PE32 section
- //
- Status = EFI_SUCCESS;
- for (Index = 1;; Index++) {
- Status = GetSectionByType (FfsFile, EFI_SECTION_PE32, Index, &CurrentPe32Section);
- if (EFI_ERROR (Status)) {
- break;
- }
-
- //
- // Initialize context
- //
- memset (&ImageContext, 0, sizeof (ImageContext));
- ImageContext.Handle = (VOID *) ((UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION));
- ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;
- Status = PeCoffLoaderGetImageInfo (&ImageContext);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "GetImageInfo() call failed on rebase", FileGuidString);
- return Status;
- }
-
- //
- // Don't Load PeImage, only to relocate current image.
- //
- ImageContext.ImageAddress = (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION);
-
- //
- // Check if section-alignment and file-alignment match or not
- //
- PeHdr = (EFI_IMAGE_NT_HEADERS *)((UINTN)ImageContext.ImageAddress + ImageContext.PeCoffHeaderOffset);
- if (PeHdr->OptionalHeader.SectionAlignment != PeHdr->OptionalHeader.FileAlignment) {
- //
- // Nor XIP module can be ignored.
- //
- if ((Flags & 1) == 0) {
- continue;
- }
- Error (NULL, 0, 0, "Section-Alignment and File-Alignment does not match", FileGuidString);
- return EFI_ABORTED;
- }
-
- //
- // Update CodeView and PdbPointer in ImageContext
- //
- DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)(UINTN)(
- ImageContext.ImageAddress +
- ImageContext.DebugDirectoryEntryRva
- );
- ImageContext.CodeView = (VOID *)(UINTN)(
- ImageContext.ImageAddress +
- DebugEntry->RVA
- );
- 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;
-
- default:
- break;
- }
-
- //
- // 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:
- if ((Flags & 1) == 0) {
- //
- // We aren't relocating XIP code, so skip it.
- //
- return EFI_SUCCESS;
- }
-
- NewPe32BaseAddress =
- XipBase + (UINTN)ImageContext.ImageAddress - (UINTN)FfsFile;
- BaseToUpdate = &XipBase;
- break;
-
- case EFI_FV_FILETYPE_DRIVER:
- PeHdr = (EFI_IMAGE_NT_HEADERS32*)(ImageContext.ImageAddress + ImageContext.PeCoffHeaderOffset);
- switch (PeHdr->OptionalHeader.Subsystem) {
- case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
- if ((Flags & 4) == 0) {
- //
- // RT drivers aren't supposed to be relocated
- //
- continue;
- }
-
- NewPe32BaseAddress = *RtBase;
- BaseToUpdate = RtBase;
- break;
-
- default:
- //
- // We treat all other subsystems the same as BS_DRIVER
- //
- if ((Flags & 2) == 0) {
- //
- // Skip all BS_DRIVER's
- //
- continue;
- }
-
- NewPe32BaseAddress = *BsBase;
- BaseToUpdate = BsBase;
- break;
- }
- break;
-
- case EFI_FV_FILETYPE_DXE_CORE:
- if ((Flags & 2) == 0) {
- //
- // Skip DXE core
- //
- return EFI_SUCCESS;
- }
-
- NewPe32BaseAddress = *BsBase;
- BaseToUpdate = BsBase;
- break;
-
- default:
- //
- // Not supported file type
- //
- return EFI_SUCCESS;
- }
-
- ImageContext.DestinationAddress = NewPe32BaseAddress;
- Status = PeCoffLoaderRelocateImage (&ImageContext);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "RelocateImage() call failed on rebase", FileGuidString);
- return Status;
- }
-
- //
- // Update BASE address
- //
- fprintf (
- LogFile,
- "%s %016I64X\n",
- FileGuidString,
- ImageContext.DestinationAddress
- );
- *BaseToUpdate += EFI_SIZE_TO_PAGES (ImageContext.ImageSize) * EFI_PAGE_SIZE;
-
- //
- // Now update file checksum
- //
- if (FfsFile->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailSize = sizeof (EFI_FFS_FILE_TAIL);
- } else {
- TailSize = 0;
- }
-
- if (FfsFile->Attributes & FFS_ATTRIB_CHECKSUM) {
- SavedState = FfsFile->State;
- FfsFile->IntegrityCheck.Checksum.File = 0;
- FfsFile->State = 0;
- if (FfsFile->Attributes & FFS_ATTRIB_CHECKSUM) {
- FfsFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (
- (UINT8 *) FfsFile,
- GetLength (FfsFile->Size) - TailSize
- );
- } else {
- FfsFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
- }
-
- FfsFile->State = SavedState;
- }
- //
- // Update tail if present
- //
- if (FfsFile->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailValue = (EFI_FFS_FILE_TAIL) (~(FfsFile->IntegrityCheck.TailReference));
- *(EFI_FFS_FILE_TAIL *) (((UINTN) FfsFile + GetLength (FfsFile->Size) - sizeof (EFI_FFS_FILE_TAIL))) = TailValue;
- }
- }
-
- if ((Flags & 1) == 0 || (
- 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
- )) {
- //
- // Only XIP code may have a TE section
- //
- return EFI_SUCCESS;
- }
-
- //
- // Now process TE sections
- //
- for (Index = 1;; Index++) {
- Status = GetSectionByType (FfsFile, EFI_SECTION_TE, Index, &CurrentPe32Section);
- if (EFI_ERROR (Status)) {
- break;
- }
-
- //
- // 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 + sizeof (EFI_COMMON_SECTION_HEADER));
-
- //
- // 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, 0, "GetImageInfo() call failed on rebase of TE image", FileGuidString);
- return Status;
- }
- //
- // Don't reload TeImage
- //
- ImageContext.ImageAddress = (UINTN) TEImageHeader;
-
- //
- // Update CodeView and PdbPointer in ImageContext
- //
- DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)(UINTN)(
- ImageContext.ImageAddress +
- ImageContext.DebugDirectoryEntryRva +
- sizeof(EFI_TE_IMAGE_HEADER) -
- TEImageHeader->StrippedSize
- );
-
- ImageContext.CodeView = (VOID *)(UINTN)(
- ImageContext.ImageAddress +
- DebugEntry->RVA +
- sizeof(EFI_TE_IMAGE_HEADER) -
- TEImageHeader->StrippedSize
- );
-
- 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;
-
- default:
- break;
- }
-
- //
- // Reloacate TeImage
- //
- ImageContext.DestinationAddress = XipBase + (UINTN) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) \
- - TEImageHeader->StrippedSize - (UINTN) FfsFile;
- Status = PeCoffLoaderRelocateImage (&ImageContext);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "RelocateImage() call failed on rebase of TE image", FileGuidString);
- return Status;
- }
-
- if (FfsFile->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailSize = sizeof (EFI_FFS_FILE_TAIL);
- } else {
- TailSize = 0;
- }
- //
- // Now update file checksum
- //
- if (FfsFile->Attributes & FFS_ATTRIB_CHECKSUM) {
- SavedState = FfsFile->State;
- FfsFile->IntegrityCheck.Checksum.File = 0;
- FfsFile->State = 0;
- if (FfsFile->Attributes & FFS_ATTRIB_CHECKSUM) {
- FfsFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (
- (UINT8 *) FfsFile,
- GetLength (FfsFile->Size) - TailSize
- );
- } else {
- FfsFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
- }
-
- FfsFile->State = SavedState;
- }
- //
- // Update tail if present
- //
- if (FfsFile->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- TailValue = (EFI_FFS_FILE_TAIL) (~(FfsFile->IntegrityCheck.TailReference));
- *(EFI_FFS_FILE_TAIL *) (((UINTN) FfsFile + GetLength (FfsFile->Size) - sizeof (EFI_FFS_FILE_TAIL))) = TailValue;
- }
-
- fprintf (
- LogFile,
- "%s %016I64X\n",
- FileGuidString,
- ImageContext.DestinationAddress
- );
- }
-
- 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;
-}
diff --git a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.h b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.h
deleted file mode 100644
index 1c5b6929c3..0000000000
--- a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-
-Module Name:
-
- PeiRebaseExe.h
-
-Abstract:
-
- Definitions for the PeiRebase exe utility.
-
---*/
-
-#ifndef _EFI_PEIM_FIXUP_EXE_H
-#define _EFI_PEIM_FIXUP_EXE_H
-
-#include <Common/FirmwareVolumeImageFormat.h>
-#include <Common/FirmwareFileSystem.h>
-#include <Common/FirmwareVolumeHeader.h>
-#include <Common/MultiPhase.h>
-
-//
-// Utility Name
-//
-#define UTILITY_NAME "PeiRebase"
-
-//
-// Utility version information
-//
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-#define UTILITY_DATE __DATE__
-
-//
-// The maximum number of arguments accepted from the command line.
-//
-#define MAX_ARGS 7
-
-//
-// The file copy buffer size
-//
-#define FILE_COPY_BUFFER_SIZE 512
-
-//
-// The function that displays general utility information
-//
-VOID
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-//
-// The function that displays the utility usage message.
-//
-VOID
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-//
-// Internal function declarations
-//
-EFI_STATUS
-FfsRebaseImageRead (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINT32 *ReadSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FileHandle - GC_TODO: add argument description
- FileOffset - GC_TODO: add argument description
- ReadSize - GC_TODO: add argument description
- Buffer - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-FfsRebase (
- IN OUT EFI_FFS_FILE_HEADER *FfsFile,
- IN UINT32 Flags,
- IN OUT EFI_PHYSICAL_ADDRESS XipBase,
- IN OUT EFI_PHYSICAL_ADDRESS *BsBase,
- IN OUT EFI_PHYSICAL_ADDRESS *RtBase,
- OUT FILE *LogFile
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FfsFile - GC_TODO: add argument description
- BaseAddress - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/Tools/CCode/Source/PeiRebase/build.xml b/Tools/CCode/Source/PeiRebase/build.xml
deleted file mode 100644
index 7c719b775b..0000000000
--- a/Tools/CCode/Source/PeiRebase/build.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK PeiRebase Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="PeiRebase"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed"/>
- </target>
-
- <target name="Tool" depends="init, PeiRebase_Ia32, PeiRebase_Ipf, PeiRebase_X64"/>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="PeiRebase_Ia32" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}_Ia32"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools PeCoffLoader_Ia32"/>
- </cc>
- </target>
-
- <target name="PeiRebase_Ipf" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}_Ipf"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools PeCoffLoader_Ipf"/>
- </cc>
- </target>
-
- <target name="PeiRebase_X64" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}_X64"
- outtype="executable"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}" />
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools PeCoffLoader_X64"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}_*${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ia32${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ipf${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_X64${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ia32.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}_Ipf.pdb"/>
- <fileset file="${BIN_DIR}/${ToolName}_X64.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/SecApResetVectorFixup/SecApResetVectorFixup.c b/Tools/CCode/Source/SecApResetVectorFixup/SecApResetVectorFixup.c
deleted file mode 100644
index f34e2d1a63..0000000000
--- a/Tools/CCode/Source/SecApResetVectorFixup/SecApResetVectorFixup.c
+++ /dev/null
@@ -1,531 +0,0 @@
-/*++
-
-Copyright (c) 2004-2007 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.
-
-
-Module Name:
-
- SecApResetVectorFixup.c
-
-Abstract:
-
- This utility is part of build process for IA32 Fvrecovery.fv whose total size
- is larger than 128kB so that we cannot use GenFvImage utility to put Ap reset
- vector at the zero vector of Fv header.
-
- PEI FV after using the tool
-
- -------------------------
- |zzz |
- | |
- | |
- | FFS |
- | |
- | |
- | |
- |---------------------- |
- | PAD |
- | |
- |.......................| ---
- | | |
- |xxx | | 128K
- |---------------------- | |
- | VTF (SEC) | |
- ------------------------- ---
-
- 1. zzz --> Zero vector, which is beyond the 128K limited address space
- 2. xxx --> AP reset vector at 4K alignment below 128K and it is in the PAD
- file area.
- 3. After the build process ,the PAD guid is changed to a new GUID to avoid
- the PAD definition confusing. If there is some problem, try to disable
- UpdatePadFileGuid
-
-
-
---*/
-
-#include "SecApResetVectorFixup.h"
-
-
-EFI_GUID DefaultFvPadFileNameGuid = { 0x78f54d4, 0xcc22, 0x4048, 0x9e, 0x94, 0x87, 0x9c, 0x21, 0x4d, 0x56, 0x2f };
-EFI_GUID NewFvPadFileNameGuid = { 0x145372bc, 0x66b9, 0x476d, 0x81, 0xbc, 0x21, 0x27, 0xc3, 0x76, 0xbb, 0x66 };
-
-//
-// jmp 0xf000:0xffd0 (0xFFFFFFD0)
-//
-UINT8 ApResetVector[5] = {0xEA, 0xD0, 0xFF, 0x00, 0xF0};
-
-VOID
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Tiano IA32 SEC Ap Reset Vector Fixup Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-VOID
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the utility usage syntax to STDOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- Version();
-
- printf ("\nUsage: %s InputFvrecoveryFile OutputFvrecoveryFile\n", UTILITY_NAME);
- printf (" Where:\n");
- printf (" InputFvrecoveryFile - Name of the IA32 input Fvrecovery.fv file.\n");
- printf (" OutputFvrecoveryFile - Name of the IA32 output Fvrecovery.fv file.\n");
-}
-
-
-VOID
-UpdatePadFileGuid (
- IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader,
- IN EFI_FFS_FILE_HEADER *FileHeader,
- IN UINT32 FileLength,
- IN OUT EFI_GUID *Guid
- )
-/*++
-
-Routine Description:
-
- Update the Pad File Guid to change it to other guid and update
- the checksum
-
-Arguments:
- FvHeader - EFI_FIRMWARE_VOLUME_HEADER
- FileHeader - The FFS PAD file header.
- FileLength - The FFS PAD file length.
- Guid - The Guid to compare and if it is PAD Guid, update it to new Guid
-Returns:
- VOID
---*/
-
-{
- if ((CompareGuid (Guid, (EFI_GUID *)&DefaultFvPadFileNameGuid)) == 0) {
- //
- // Set new Pad file guid
- //
- memcpy (Guid, &NewFvPadFileNameGuid, sizeof (EFI_GUID));
-
-
-
- FileHeader->Type = EFI_FV_FILETYPE_FFS_PAD;
- FileHeader->Attributes = 0;
- //
- // Fill in checksums and state, must be zero during checksum calculation.
- //
- FileHeader->IntegrityCheck.Checksum.Header = 0;
- FileHeader->IntegrityCheck.Checksum.File = 0;
- FileHeader->State = 0;
- FileHeader->IntegrityCheck.Checksum.Header = CalculateChecksum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
- if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
- FileHeader->IntegrityCheck.Checksum.File = CalculateChecksum8 ((UINT8 *) FileHeader, FileLength);
- } else {
- FileHeader->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
- }
-
- FileHeader->State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
-
- if (FvHeader->Attributes & EFI_FVB_ERASE_POLARITY) {
- FileHeader->State = (UINT8)~(FileHeader->State);
- }
- }
-
-}
-
-VOID
-SetHeaderChecksum (
- IN EFI_FFS_FILE_HEADER *FfsHeader
- )
-/*++
-
- Routine Description:
- Caculate the checksum for the FFS header.
-
- Parameters:
- FfsHeader - FFS File Header which needs to caculate the checksum
-
- Return:
- N/A
-
---*/
-{
- EFI_FFS_FILE_STATE State;
- UINT8 HeaderChecksum;
- UINT8 FileChecksum;
-
- //
- // The state and the File checksum are not included
- //
- State = FfsHeader->State;
- FfsHeader->State = 0;
-
- FileChecksum = FfsHeader->IntegrityCheck.Checksum.File;
- FfsHeader->IntegrityCheck.Checksum.File = 0;
-
- FfsHeader->IntegrityCheck.Checksum.Header = 0;
-
- HeaderChecksum = CalculateChecksum8 ((UINT8 *)FfsHeader,sizeof (EFI_FFS_FILE_HEADER));
-
- FfsHeader->IntegrityCheck.Checksum.Header = (UINT8) (~(0x100-HeaderChecksum) + 1);
-
- FfsHeader->State = State;
- FfsHeader->IntegrityCheck.Checksum.File = FileChecksum;
-
- return ;
-}
-
-VOID
-SetFileChecksum (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN UINTN ActualFileSize
- )
-/*++
-
- Routine Description:
- Caculate the checksum for the FFS File, usually it is caculated before
- the file tail is set.
-
- Parameters:
- FfsHeader - FFS File Header which needs to caculate the checksum
- ActualFileSize - The whole Ffs File Length, including the FFS Tail
- if exists, but at this time, it is 0.
- Return:
- N/A
-
---*/
-{
- EFI_FFS_FILE_STATE State;
- UINT8 FileChecksum;
- UINTN ActualSize;
-
- if (FfsHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
- //
- // The file state is not included
- //
- State = FfsHeader->State;
- FfsHeader->State = 0;
-
- FfsHeader->IntegrityCheck.Checksum.File = 0;
-
- if (FfsHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- ActualSize = ActualFileSize - 2;
- } else {
- ActualSize = ActualFileSize;
- }
- //
- // File checksum does not including the file tail
- //
- FileChecksum = CalculateChecksum8 ((UINT8 *)FfsHeader,sizeof (EFI_FFS_FILE_HEADER));
-
- FfsHeader->IntegrityCheck.Checksum.File = (UINT8) (~(0x100-FileChecksum) + 1);
-
- FfsHeader->State = State;
-
- } else {
-
- FfsHeader->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
-
- }
-
- return ;
-}
-
-VOID
-SetFileTail (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN UINTN ActualFileSize
- )
-/*++
-
- Routine Description:
- Set the file tail if needed
-
- Parameters:
- FfsHeader - FFS File Header which needs to caculate the checksum
- ActualFileSize - The whole Ffs File Length, including the FFS Tail
- if exists.
- Return:
- N/A
-
---*/
-{
- UINT8 TailLow;
- UINT8 TailHigh;
- UINT16 Tail;
-
- if (FfsHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- //
- // Insert tail here, since tail may not aligned on an even
- // address, we need to do byte operation here.
- //
- Tail = (UINT16)~FfsHeader->IntegrityCheck.TailReference;
- TailLow = (UINT8) Tail;
- TailHigh = (UINT8) (Tail >> 8);
- *((UINT8 *) FfsHeader + ActualFileSize - 2) = TailLow;
- *((UINT8 *) FfsHeader + ActualFileSize - 1) = TailHigh;
- }
-
- return ;
-}
-
-STATUS
-main (
- IN INTN argc,
- IN 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.
-
---*/
-{
- FILE *FpIn;
- FILE *FpOut;
- UINT32 FvrecoveryFileSize;
- UINT8 *FileBuffer;
- UINT8 *FileBufferRaw;
- UINT64 FvLength;
- UINT32 Offset;
- UINT32 FileLength;
- UINT32 FileOccupiedSize;
- EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
- EFI_FFS_FILE_HEADER *FileHeader;
- EFI_GUID *TempGuid;
- UINT8 *FixPoint;
- UINT32 TempResult;
- UINT32 Index;
- UINT32 IpiVector;
- STATUS Status;
-
- TempGuid = NULL;
- SetUtilityName (UTILITY_NAME);
-
- if (argc == 1) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- //
- // Verify the correct number of arguments
- //
- if (argc != MAX_ARGS) {
- Error (NULL, 0, 0, "invalid number of input parameters specified", NULL);
- Usage ();
- return STATUS_ERROR;
- }
- //
- // Open the Input Fvrecovery.fv file
- //
- if ((FpIn = fopen (argv[1], "rb")) == NULL) {
- Error (NULL, 0, 0, "Unable to open file", argv[1]);
- return STATUS_ERROR;
- }
- //
- // Get the Input Fvrecovery.fv file size
- //
- fseek (FpIn, 0, SEEK_END);
- FvrecoveryFileSize = ftell (FpIn);
- //
- // Read the contents of input file to memory buffer
- //
- FileBuffer = NULL;
- FileBufferRaw = NULL;
- FileBufferRaw = (UINT8 *) malloc (FvrecoveryFileSize + 0x10000);
- if (NULL == FileBufferRaw) {
- Error (NULL, 0, 0, "No sufficient memory to allocate!", NULL);
- fclose (FpIn);
- return STATUS_ERROR;
- }
- TempResult = 0x10000 - ((UINT32)FileBufferRaw & 0x0FFFF);
- FileBuffer = (UINT8 *)((UINT32)FileBufferRaw + TempResult);
- fseek (FpIn, 0, SEEK_SET);
- TempResult = fread (FileBuffer, 1, FvrecoveryFileSize, FpIn);
- if (TempResult != FvrecoveryFileSize) {
- Error (NULL, 0, 0, "Read input file error!", NULL);
- free ((VOID *)FileBufferRaw);
- fclose (FpIn);
- return STATUS_ERROR;
- }
-
- //
- // Prepare to walk the FV image
- //
- InitializeFvLib (FileBuffer, FvrecoveryFileSize);
-
- //
- // Close the input Fvrecovery.fv file
- //
- fclose (FpIn);
-
- //
- // Find the pad FFS file
- //
- FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)FileBuffer;
- FvLength = FvHeader->FvLength;
- FileHeader = (EFI_FFS_FILE_HEADER *)(FileBuffer + FvHeader->HeaderLength);
- FileLength = (*(UINT32 *)(FileHeader->Size)) & 0x00FFFFFF;
- FileOccupiedSize = GETOCCUPIEDSIZE(FileLength, 8);
- Offset = (UINT32)FileHeader - (UINT32)FileBuffer;
-
- while (Offset < FvLength) {
- TempGuid = (EFI_GUID *)&(FileHeader->Name);
- FileLength = (*(UINT32 *)(FileHeader->Size)) & 0x00FFFFFF;
- FileOccupiedSize = GETOCCUPIEDSIZE(FileLength, 8);
- if ((CompareGuid (TempGuid, (EFI_GUID *)&DefaultFvPadFileNameGuid)) == 0) {
- break;
- }
- FileHeader = (EFI_FFS_FILE_HEADER *)((UINT32)FileHeader + FileOccupiedSize);
- Offset = (UINT32)FileHeader - (UINT32)FileBuffer;
- }
-
- if (Offset >= FvLength) {
- Error (NULL, 0, 0, "No pad file found!", NULL);
- free ((VOID *)FileBufferRaw);
- return STATUS_ERROR;
- }
- //
- // 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
- //
- FixPoint = (UINT8 *)(FileHeader + sizeof(EFI_FFS_FILE_HEADER));
- TempResult = 0x1000 - ((UINT32)FixPoint & 0x0FFF);
- FixPoint +=TempResult;
- if (((UINT32)FixPoint - (UINT32)FileHeader + 5) > FileOccupiedSize) {
- Error (NULL, 0, 0, "No appropriate space in pad file to add Ap reset vector!", NULL);
- free ((VOID *)FileBufferRaw);
- return STATUS_ERROR;
- }
- while (((UINT32)FixPoint - (UINT32)FileHeader + 5) <= FileOccupiedSize) {
- FixPoint += 0x1000;
- }
- FixPoint -= 0x1000;
- if ((UINT32)FvHeader + FvLength - (UINT32)FixPoint > 0x20000) {
- Error (NULL, 0, 0, "The position to place Ap reset vector is not in E and F segment!", NULL);
- free ((VOID *)FileBufferRaw);
- return STATUS_ERROR;
- }
-
- //
- // Fix up Ap reset vector and calculate the IPI vector
- //
- for (Index = 0; Index < 5; Index++) {
- FixPoint[Index] = ApResetVector[Index];
- }
- TempResult = 0x0FFFFFFFF - ((UINT32)FvHeader + (UINT32)FvLength - 1 - (UINT32)FixPoint);
- TempResult >>= 12;
- IpiVector = TempResult & 0x0FF;
-
- //
- // Update Pad file and checksum
- //
- UpdatePadFileGuid (FvHeader, FileHeader, FileLength, TempGuid);
-
- //
- // Get FileHeader of SEC Ffs
- //
- Status = GetFileByType (EFI_FV_FILETYPE_SECURITY_CORE, 1, &FileHeader);
-
- //
- // Write IPI Vector at Offset FvrecoveryFileSize - 8
- //
- *(UINT32 *)((UINTN)(FileBuffer + FvrecoveryFileSize - 8)) = IpiVector;
-
- if (Status == STATUS_SUCCESS) {
- FileLength = (*(UINT32 *)(FileHeader->Size)) & 0x00FFFFFF;
- //
- // Update the Checksum of SEC ffs
- //
- SetHeaderChecksum (FileHeader);
- SetFileChecksum (FileHeader, FileLength);
- SetFileTail (FileHeader, FileLength);
- } else {
- Error (NULL, 0, 0, "Do not get SEC FFS File Header!", NULL);
- }
- //
- // Open the output Fvrecovery.fv file
- //
- if ((FpOut = fopen (argv[2], "w+b")) == NULL) {
- Error (NULL, 0, 0, "Unable to open file", argv[2]);
- free ((VOID *)FileBufferRaw);
- return STATUS_ERROR;
- }
- //
- // Write the output Fvrecovery.fv file
- //
- if ((fwrite (FileBuffer, 1, FvrecoveryFileSize, FpOut)) != FvrecoveryFileSize) {
- Error (NULL, 0, 0, "Write output file error!", NULL);
- free ((VOID *)FileBufferRaw);
- return STATUS_ERROR;
- }
-
- //
- // Close the output Fvrecovery.fv file
- //
- fclose (FpOut);
- free ((VOID *)FileBufferRaw);
- return STATUS_SUCCESS;
-}
-
diff --git a/Tools/CCode/Source/SecApResetVectorFixup/SecApResetVectorFixup.h b/Tools/CCode/Source/SecApResetVectorFixup/SecApResetVectorFixup.h
deleted file mode 100644
index 6d234e3a18..0000000000
--- a/Tools/CCode/Source/SecApResetVectorFixup/SecApResetVectorFixup.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-
-Module Name:
-
- SecApResetVectorFixup.h
-
-Abstract:
-
- Definitions for the SecApResetVectorFixup utility.
-
---*/
-
-#ifndef _SEC_AP_RESET_VECTOR_FIXUP_H
-#define _SEC_AP_RESET_VECTOR_FIXUP_H
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-#include <Common/FirmwareFileSystem.h>
-#include <Common/FirmwareVolumeHeader.h>
-
-#include "EfiUtilityMsgs.c"
-#include "CommonLib.h"
-
-
-//
-// Utility Name
-//
-#define UTILITY_NAME "SecApResetVectorFixup"
-
-//
-// Utility version information
-//
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-#define UTILITY_DATE __DATE__
-
-//
-// The maximum number of arguments accepted from the command line.
-//
-#define MAX_ARGS 3
-#define BUF_SIZE (8 * 1024)
-
-#define GETOCCUPIEDSIZE(ActualSize, Alignment) \
- (ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
-
-
-VOID
-PrintUtilityInfo (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-PrintUsage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the utility usage syntax to STDOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-
-#endif
diff --git a/Tools/CCode/Source/SecApResetVectorFixup/build.xml b/Tools/CCode/Source/SecApResetVectorFixup/build.xml
deleted file mode 100644
index 5148d9dcf9..0000000000
--- a/Tools/CCode/Source/SecApResetVectorFixup/build.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK SecApResetVectorFixup Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="SecApResetVectorFixup"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/SecFixup/SecFixup.c b/Tools/CCode/Source/SecFixup/SecFixup.c
deleted file mode 100644
index 5a36cdff5e..0000000000
--- a/Tools/CCode/Source/SecFixup/SecFixup.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-
-Module Name:
-
- SecFixup.c
-
-Abstract:
-
- This utility is part of build process for IA32 SEC FFS file.
-
- It fixup the reset vector data. The reset vector data binary file
- will be wrapped as a RAW section and be located immediately after
- the PE/TE section.
-
- The SEC EXE file can be either PE or TE file.
-
---*/
-
-#include <stdio.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/EfiImage.h>
-#include <Common/FirmwareVolumeImageFormat.h>
-
-#include "EfiUtilityMsgs.c"
-#include "SecFixup.h"
-
-VOID
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Tiano IA32 SEC Fixup Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-VOID
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the utility usage syntax to STDOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- Version();
-
- printf ("\nUsage: %s SecExeFile ResetVectorDataFile OutputFile\n", UTILITY_NAME);
- printf (" Where:\n");
- printf (" SecExeFile - Name of the IA32 SEC EXE file.\n");
- printf (" ResetVectorDataFile - Name of the reset vector data binary file.\n");
- printf (" OutputFileName - Name of the output file.\n");
-}
-
-STATUS
-main (
- IN INTN argc,
- IN 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.
-
---*/
-{
- FILE *FpIn;
-
- FILE *FpOut;
- UINT32 AddressOfEntryPoint;
- INT32 DestRel;
- STATUS Status;
- UINT32 SecFileSize;
-
- SetUtilityName (UTILITY_NAME);
-
- if (argc == 1) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- //
- // Verify the correct number of arguments
- //
- if (argc != MAX_ARGS) {
- Error (NULL, 0, 0, "invalid number of input parameters specified", NULL);
- Usage ();
- return STATUS_ERROR;
- }
- //
- // Open the SEC exe file
- //
- if ((FpIn = fopen (argv[1], "rb")) == NULL) {
- Error (NULL, 0, 0, "Unable to open file", argv[1]);
- return STATUS_ERROR;
- }
- //
- // Get the entry point of the EXE file
- //
- Status = GetEntryPoint (FpIn, &AddressOfEntryPoint);
- if (Status != STATUS_SUCCESS) {
- fclose (FpIn);
- return STATUS_ERROR;
- }
- //
- // Get the SEC file size
- //
- fseek (FpIn, 0, SEEK_END);
- SecFileSize = ftell (FpIn);
-
- //
- // Close the SEC file
- //
- fclose (FpIn);
-
- //
- // Open the reset vector data file
- //
- if ((FpIn = fopen (argv[2], "rb")) == NULL) {
- Error (NULL, 0, 0, "Unable to open file", argv[2]);
- return STATUS_ERROR;
- }
- //
- // Open the output file
- //
- if ((FpOut = fopen (argv[3], "w+b")) == NULL) {
- Error (NULL, 0, 0, "Unable to open file", argv[3]);
- fclose (FpIn);
- return STATUS_ERROR;
- }
- //
- // Copy the input file to the output file
- //
- if (CopyFile (FpIn, FpOut) != STATUS_SUCCESS) {
- fclose (FpIn);
- fclose (FpOut);
- return STATUS_ERROR;
- }
- //
- // Close the reset vector data file
- //
- fclose (FpIn);
-
- //
- // Fix the destination relative in the jmp instruction
- // in the reset vector data structure
- //
- fseek (FpOut, -DEST_REL_OFFSET, SEEK_END);
- DestRel = AddressOfEntryPoint - (SecFileSize + sizeof (EFI_COMMON_SECTION_HEADER) + (UINT32) (ftell (FpOut)) + 2);
- if (DestRel <= -65536) {
- Error (NULL, 0, 0, "The SEC EXE file size is too big", NULL);
- fclose (FpOut);
- return STATUS_ERROR;
- }
-
- if (fwrite (&DestRel, sizeof (UINT16), 1, FpOut) != 1) {
- Error (NULL, 0, 0, "Failed to write to the output file", NULL);
- fclose (FpOut);
- return STATUS_ERROR;
- }
- //
- // Close the output file
- //
- fclose (FpOut);
-
- return STATUS_SUCCESS;
-}
-
-STATUS
-GetEntryPoint (
- IN FILE *ExeFile,
- OUT UINT32 *EntryPoint
- )
-/*++
-
-Routine Description:
-
- Get the address of the entry point of a PE/TE file.
-
-Arguments:
-
- PeFile - File pointer to the specified PE/TE file.
- EntryPoint - Buffer for the address of the entry point to be returned.
-
-Returns:
- STATUS_SUCCESS - Function completed successfully.
- STATUS_ERROR - Error occured.
-
---*/
-// GC_TODO: ExeFile - add argument and description to function comment
-{
- EFI_IMAGE_DOS_HEADER DosHeader;
- EFI_IMAGE_NT_HEADERS32 NtHeader;
- EFI_TE_IMAGE_HEADER TeHeader;
-
- //
- // Check if it is a TE file
- //
- fseek (ExeFile, 0, SEEK_SET);
- //
- // Attempt to read the TE header
- //
- if (fread (&TeHeader, sizeof (TeHeader), 1, ExeFile) == 1) {
- if (TeHeader.Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
- if (TeHeader.Machine != EFI_IMAGE_MACHINE_IA32) {
- Error (NULL, 0, 0, "The SEC file is PE but is not PE32 for IA32", NULL);
- return STATUS_ERROR;
- }
-
- *EntryPoint = TeHeader.AddressOfEntryPoint + sizeof (EFI_TE_IMAGE_HEADER) - TeHeader.StrippedSize;
- return STATUS_SUCCESS;
- }
- }
- //
- // Check if it is a PE file
- //
- fseek (ExeFile, 0, SEEK_SET);
- //
- // Attempt to read the DOS header
- //
- if (fread (&DosHeader, sizeof (DosHeader), 1, ExeFile) != 1) {
- goto InvalidFile;
- }
- //
- // Check the magic number
- //
- if (DosHeader.e_magic != EFI_IMAGE_DOS_SIGNATURE) {
- goto InvalidFile;
- }
- //
- // Position into the file and read the NT PE header
- //
- fseek (ExeFile, (long) DosHeader.e_lfanew, SEEK_SET);
- if (fread (&NtHeader, sizeof (NtHeader), 1, ExeFile) != 1) {
- goto InvalidFile;
- }
- //
- // Check the PE signature in the header
- //
- if (NtHeader.Signature != EFI_IMAGE_NT_SIGNATURE) {
- goto InvalidFile;
- }
- //
- // Make sure the PE file is PE32 for IA32
- //
- if (NtHeader.FileHeader.Machine != EFI_IMAGE_MACHINE_IA32 ||
- NtHeader.OptionalHeader.Magic != EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
- ) {
- Error (NULL, 0, 0, "The SEC file is PE but is not PE32 for IA32", NULL);
- return STATUS_ERROR;
- }
- //
- // Get the entry point from the optional header
- //
- *EntryPoint = NtHeader.OptionalHeader.AddressOfEntryPoint;
- return STATUS_SUCCESS;
-
-InvalidFile:
- Error (NULL, 0, 0, "The SEC file is neither PE nor TE file", NULL);
- return STATUS_ERROR;
-}
-
-STATUS
-CopyFile (
- FILE *FpIn,
- FILE *FpOut
- )
-/*++
-
-Routine Description:
-
- Copy file.
-
-Arguments:
-
- FpIn - File pointer to the source file.
- FpOut - File pointer to the destination file.
-
-Returns:
- STATUS_SUCCESS - Function completed successfully.
- STATUS_ERROR - Error occured.
-
---*/
-{
- INTN FileSize;
-
- INTN Offset;
-
- INTN Length;
- UINT8 Buffer[BUF_SIZE];
-
- fseek (FpIn, 0, SEEK_END);
- FileSize = ftell (FpIn);
-
- fseek (FpIn, 0, SEEK_SET);
- fseek (FpOut, 0, SEEK_SET);
-
- Offset = 0;
- while (Offset < FileSize) {
- Length = sizeof (Buffer);
- if (FileSize - Offset < Length) {
- Length = FileSize - Offset;
- }
-
- if (fread (Buffer, Length, 1, FpIn) != 1 || fwrite (Buffer, Length, 1, FpOut) != 1) {
- Error (NULL, 0, 0, "Copy file error", NULL);
- return STATUS_ERROR;
- }
-
- Offset += Length;
- }
-
- return STATUS_SUCCESS;
-}
diff --git a/Tools/CCode/Source/SecFixup/SecFixup.h b/Tools/CCode/Source/SecFixup/SecFixup.h
deleted file mode 100644
index 9d26656c5f..0000000000
--- a/Tools/CCode/Source/SecFixup/SecFixup.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*++
-
-Copyright (c) 1999-2006 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.
-
-
-Module Name:
-
- SecFixup.h
-
-Abstract:
-
- Definitions for the SecFixup utility.
-
---*/
-
-#ifndef _SEC_FIXUP_H
-#define _SEC_FIXUP_H
-
-//
-// Utility Name
-//
-#define UTILITY_NAME "SecFixup"
-
-//
-// Utility version information
-//
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-#define UTILITY_DATE __DATE__
-
-//
-// The maximum number of arguments accepted from the command line.
-//
-#define MAX_ARGS 4
-
-#define DEST_REL_OFFSET 13
-#define BUF_SIZE (8 * 1024)
-
-//
-// The function that displays general utility information
-//
-VOID
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-//
-// The function that displays the utility usage message.
-//
-VOID
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-//
-// The function that gets the entry point of a PE/TE file.
-//
-STATUS
-GetEntryPoint (
- IN FILE *ExeFile,
- OUT UINT32 *EntryPoint
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- ExeFile - GC_TODO: add argument description
- EntryPoint - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-//
-// The function that copies a file.
-//
-STATUS
-CopyFile (
- FILE *FpIn,
- FILE *FpOut
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
- FpIn - GC_TODO: add argument description
- FpOut - GC_TODO: add argument description
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/Tools/CCode/Source/SecFixup/build.xml b/Tools/CCode/Source/SecFixup/build.xml
deleted file mode 100644
index 2abb1daae2..0000000000
--- a/Tools/CCode/Source/SecFixup/build.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK SecFixup Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="SecFixup"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/SetStamp/SetStamp.c b/Tools/CCode/Source/SetStamp/SetStamp.c
deleted file mode 100644
index 51f5155ab8..0000000000
--- a/Tools/CCode/Source/SetStamp/SetStamp.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2007, 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.
-
-Module Name:
- SetStamp.c
-
-Abstract:
- Set Date/Time Stamp of Portable Executable (PE) format file
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-
-#define LINE_MAXLEN 80
-
-//
-// Utility Name
-//
-#define UTILITY_NAME "SetStamp"
-
-//
-// Utility version information
-//
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-
-void
-Version (
- void
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Utility to set Date/Time Stamp for Portable Executable (PE) format file.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-void
-Usage (
- void
- )
-/*++
-Routine Description:
- print usage of setstamp command
-
-Arguments:
- void
-
-Returns:
- None
---*/
-{
- Version();
-
- //
- // print usage of command
- //
- printf ("\nUsage: SetStamp <PE-File> <TIME-File>\n");
-}
-
-int
-GetDateTime (
- FILE *fp,
- time_t *ltime
- )
-/*++
-Routine Description:
- Read the date and time from TIME file. If the date/time string is
-"NOW NOW", write the current date and time to TIME file and set it to
-ltime. Else, set the date and time of TIME file to ltime.
-
-Arguments:
- fp - The pointer of TIME file
- ltime - Date and time
-
-Returns:
- = 0 - Success
- = -1 - Failed
---*/
-{
- char buffer[LINE_MAXLEN];
- struct tm stime;
- struct tm *now;
-
- if (fgets (buffer, LINE_MAXLEN, fp) == NULL) {
- printf ("Error: Cannot read TIME file.\n");
- return -1;
- }
- //
- // compare the value with "NOW NOW", write TIME file if equal
- //
- if (strncmp (buffer, "NOW NOW", 7) == 0) {
- //
- // get system current time and date
- //
- time (ltime);
-
- now = localtime (ltime);
- if (now == NULL) {
- printf ("Error: Cannot get local time.\n");
- return -1;
- }
-
- if (strftime (buffer, LINE_MAXLEN, "%Y-%m-%d %H:%M:%S", now) == 0) {
- printf ("Error: Cannot format time string.\n");
- return -1;
- }
- //
- // write TIME file
- //
- if (fseek (fp, 0, SEEK_SET) != 0) {
- printf ("Error: Cannot move location of TIME file.\n");
- return -1;
- }
-
- if (fputs (buffer, fp) == EOF) {
- printf ("Error: Cannot write time string to TIME file.\n");
- return -1;
- }
- //
- // ltime has been set as current time and date, return
- //
- return 0;
- }
- //
- // get the date and time from buffer
- //
- if (6 != sscanf (
- buffer,
- "%d-%d-%d %d:%d:%d",
- &stime.tm_year,
- &stime.tm_mon,
- &stime.tm_mday,
- &stime.tm_hour,
- &stime.tm_min,
- &stime.tm_sec
- )) {
- printf ("Error: Invaild date or time!\n");
- return -1;
- }
- //
- // in struct, Month (0 - 11; Jan = 0). So decrease 1 from it
- //
- 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 <= 38) {
- stime.tm_year += 100;
- }
- //
- // convert 1970 -> 70, 2000 -> 100, ...
- //
- else if (stime.tm_year >= 1970) {
- stime.tm_year -= 1900;
- }
- //
- // convert the date and time to time_t format
- //
- *ltime = mktime (&stime);
- if (*ltime == (time_t) - 1) {
- printf ("Error: Invalid date or time!\n");
- return -1;
- }
-
- return 0;
-}
-
-int
-ReadFromFile (
- FILE *fp,
- long offset,
- void *buffer,
- int size
- )
-/*++
-Routine Description:
- read data from a specified location of file
-
-Arguments:
- fp - file pointer
- offset - number of bytes from beginning of file
- buffer - buffer used to store data
- size - size of buffer
-
-Returns:
- = 0 - Success
- = -1 - Failed
---*/
-{
- //
- // set file pointer to the specified location of file
- //
- if (fseek (fp, offset, SEEK_SET) != 0) {
- printf ("Error: Cannot move the current location of the file.\n");
- return -1;
- }
- //
- // read data from the file
- //
- if (fread (buffer, size, 1, fp) != 1) {
- printf ("Error: Cannot read data from the file.\n");
- return -1;
- }
-
- return 0;
-}
-
-int
-WriteToFile (
- FILE *fp,
- long offset,
- void *buffer,
- int size
- )
-/*++
-Routine Description:
- write data to a specified location of file
-
-Arguments:
- fp - file pointer
- offset - number of bytes from beginning of file
- buffer - buffer used to store data
- size - size of buffer
-
-Returns:
- = 0 - Success
- = -1 - Failed
---*/
-{
- //
- // set file pointer to the specified location of file
- //
- if (fseek (fp, offset, SEEK_SET) != 0) {
- printf ("Error: Cannot move the current location of the file.\n");
- return -1;
- }
- //
- // write data to the file
- //
- if (fwrite (buffer, size, 1, fp) != 1) {
- perror ("Error: Cannot write data to the file.\n");
- return -1;
- }
-
- return 0;
-}
-
-int
-SetStamp (
- FILE *fp,
- time_t ltime
- )
-/*++
-Routine Description:
- set Date/Time Stamp of the file
-
-Arguments:
- fp - file pointer
- ltime - time and date
-
-Returns:
- = 0 - Success
- = -1 - Failed
---*/
-{
- unsigned char header[4];
- unsigned long offset;
- unsigned long NumberOfRvaAndSizes;
- unsigned int nvalue;
- unsigned long lvalue;
-
- //
- // read the header of file
- //
- if (ReadFromFile (fp, 0, header, 2) != 0) {
- return -1;
- }
- //
- // "MZ" -- the header of image file (PE)
- //
- if (strncmp ((char *) header, "MZ", 2) != 0) {
- printf ("Error: Invalid Image file.\n");
- return -1;
- }
- //
- // At location 0x3C, the stub has the file offset to the
- // PE signature.
- //
- if (ReadFromFile (fp, 0x3C, &offset, 4) != 0) {
- return -1;
- }
- //
- // read the header of optional
- //
- if (ReadFromFile (fp, offset, header, 4) != 0) {
- return -1;
- }
- //
- // "PE\0\0" -- the signature of optional header
- //
- if (strncmp ((char *) header, "PE\0\0", 4) != 0) {
- printf ("Error: Invalid PE format file.\n");
- return -1;
- }
- //
- // Add 8 to skip PE signature (4-byte), Machine (2-byte) and
- // NumberOfSection (2-byte)
- //
- offset += 8;
-
- if (WriteToFile (fp, offset, &ltime, 4) != 0) {
- return -1;
- }
- //
- // Add 16 to skip COFF file header, and get to optional header.
- //
- offset += 16;
-
- //
- // Check the magic field, 0x10B for PE32 and 0x20B for PE32+
- //
- if (ReadFromFile (fp, offset, &nvalue, 2) != 0) {
- return -1;
- }
- //
- // If this is PE32 image file, offset of NumberOfRvaAndSizes is 92.
- // Else it is 108.
- //
- switch (nvalue & 0xFFFF) {
- case 0x10B:
- offset += 92;
- break;
-
- case 0x20B:
- offset += 108;
- break;
-
- default:
- printf ("Error: Sorry! The Magic value is unknown.\n");
- return -1;
- }
- //
- // get the value of NumberOfRvaAndSizes
- //
- if (ReadFromFile (fp, offset, &NumberOfRvaAndSizes, 4) != 0) {
- return -1;
- }
- //
- // Date/time stamp exists in Export Table, Import Table, Resource Table,
- // Debug Table and Delay Import Table. And in Import Table and Delay Import
- // Table, it will be set when bound. So here only set the date/time stamp
- // of Export Table, Resource Table and Debug Table.
- //
- //
- // change date/time stamp of Export Table, the offset of Export Table
- // is 4 + 0 * 8 = 4. And the offset of stamp is 4.
- //
- if (NumberOfRvaAndSizes >= 1) {
- if (ReadFromFile (fp, offset + 4, &lvalue, 4) != 0) {
- return -1;
- }
-
- if (lvalue != 0) {
- if (WriteToFile (fp, lvalue + 4, &ltime, 4) != 0) {
- return -1;
- }
- }
- }
- //
- // change date/time stamp of Resource Table, the offset of Resource Table
- // is 4 + 2 * 8 = 20. And the offset of stamp is 4.
- //
- if (NumberOfRvaAndSizes >= 3) {
- if (ReadFromFile (fp, offset + 20, &lvalue, 4) != 0) {
- return -1;
- }
-
- if (lvalue != 0) {
- if (WriteToFile (fp, lvalue + 4, &ltime, 4) != 0) {
- return -1;
- }
- }
- }
- //
- // change date/time stamp of Debug Table, offset of Debug Table
- // is 4 + 6 * 8 = 52. And the offset of stamp is 4.
- //
- if (NumberOfRvaAndSizes >= 7) {
- if (ReadFromFile (fp, offset + 52, &lvalue, 4) != 0) {
- return -1;
- }
-
- if (lvalue != 0) {
- if (WriteToFile (fp, lvalue + 4, &ltime, 4) != 0) {
- return -1;
- }
- }
- //
- // change the date/time stamp of Debug Data
- //
- if (ReadFromFile (fp, lvalue + 24, &lvalue, 4) != 0) {
- return -1;
- }
- //
- // get the signature of debug data
- //
- if (ReadFromFile (fp, lvalue, header, 2) != 0) {
- return -1;
- }
- //
- // "NB" - the signature of Debug Data
- // Need Review: (From Spec. is "NB05", From .dll is "NB10")
- //
- if (strncmp ((char *) header, "NB", 2) == 0) {
- if (WriteToFile (fp, lvalue + 8, &ltime, 4) != 0) {
- return -1;
- }
- }
- }
-
- return 0;
-}
-
-int
-main (
- int argc,
- char *argv[]
- )
-{
- FILE *fp;
- time_t ltime;
-
- if (argc == 1) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return -1;
- }
- //
- // check the number of parameters
- //
- if (argc != 3) {
- Usage ();
- return -1;
- }
- //
- // open the TIME file, if not exists, return
- //
- fp = fopen (argv[2], "r+");
- if (fp == NULL) {
- return 0;
- }
- //
- // get time and date from file
- //
- if (GetDateTime (fp, &ltime) != 0) {
- fclose (fp);
- return -1;
- }
- //
- // close the TIME file
- //
- fclose (fp);
-
- //
- // open the PE file
- //
- fp = fopen (argv[1], "r+b");
- if (fp == NULL) {
- printf ("Error: Cannot open the PE file!\n");
- return -1;
- }
- //
- // set time and date stamp to the PE file
- //
- if (SetStamp (fp, ltime) != 0) {
- fclose (fp);
- return -1;
- }
-
- printf ("Set Date/Time Stamp to %s", ctime (&ltime));
-
- //
- // close the PE file
- //
- fclose (fp);
-
- return 0;
-}
diff --git a/Tools/CCode/Source/SetStamp/build.xml b/Tools/CCode/Source/SetStamp/build.xml
deleted file mode 100644
index ff8d6ed932..0000000000
--- a/Tools/CCode/Source/SetStamp/build.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK SetStamp Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="SetStamp"/>
- <property name="FileSet" value="SetStamp.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
-
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/SplitFile/SplitFile.c b/Tools/CCode/Source/SplitFile/SplitFile.c
deleted file mode 100644
index 68a0739a5f..0000000000
--- a/Tools/CCode/Source/SplitFile/SplitFile.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
-
-Copyright (c) 1999-2006 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.
-
-*/
-
-// GC_TODO: fix comment to start with /*++
-#include "stdio.h"
-#include "string.h"
-#include "stdlib.h"
-
-//
-// Utility Name
-//
-#define UTILITY_NAME "SplitFile"
-
-//
-// Utility version information
-//
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-
-void
-Version (
- void
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-void
-Usage (
- void
- )
-/*++
-
-Routine Description:
-
- GC_TODO: Add function description
-
-Arguments:
-
-
-Returns:
-
- GC_TODO: add return values
-
---*/
-{
- Version();
- printf ("\nUsage: \n\
- SplitFile Filename Offset\n\
- where:\n\
- Filename: Input file to split\n\
- Offset: offset at which to split file\n\
- The output files will be named <Filename>1 and <Filename>2 with \n\
- <Filename> being given as the input file name.\n");
-}
-
-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 *In;
-
- FILE *Out1;
-
- FILE *Out2;
- char OutName1[512];
- char OutName2[512];
- unsigned long Index;
- unsigned long splitpoint;
- char CharC;
-
- if (argc == 1) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return -1;
- }
-
- if (argc != 3) {
- Usage ();
- return -1;
- }
-
- In = fopen (argv[1], "rb");
- if (In == NULL) {
- printf ("Unable to open file \"%s\"\n", argv[1]);
- return -1;
- }
-
- strncpy (OutName1, argv[1], 510);
- strncpy (OutName2, argv[1], 510);
- strcat (OutName1, "1");
- strcat (OutName2, "2");
-
- Out1 = fopen (OutName1, "wb");
- if (Out1 == NULL) {
- printf ("Unable to open file \"%s\"\n", OutName1);
- return -1;
- }
-
- Out2 = fopen (OutName2, "wb");
- if (Out2 == NULL) {
- printf ("Unable to open file \"%s\"\n", OutName2);
- return -1;
- }
-
- splitpoint = atoi (argv[2]);
-
- for (Index = 0; Index < splitpoint; Index++) {
- CharC = (char) fgetc (In);
- if (feof (In)) {
- break;
- }
-
- fputc (CharC, Out1);
- }
-
- for (;;) {
- CharC = (char) fgetc (In);
- if (feof (In)) {
- break;
- }
-
- fputc (CharC, Out2);
- }
-
- fclose (In);
- fclose (Out1);
- fclose (Out2);
-
- return 0;
-}
diff --git a/Tools/CCode/Source/SplitFile/build.xml b/Tools/CCode/Source/SplitFile/build.xml
deleted file mode 100644
index 71e307b112..0000000000
--- a/Tools/CCode/Source/SplitFile/build.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK SplitFile Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="SplitFile"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/StrGather/StrGather.c b/Tools/CCode/Source/StrGather/StrGather.c
deleted file mode 100644
index b9d4a493af..0000000000
--- a/Tools/CCode/Source/StrGather/StrGather.c
+++ /dev/null
@@ -1,2584 +0,0 @@
-/*++
-
-Copyright (c) 2004-2007, 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.
-
-Module Name:
-
- StrGather.c
-
-Abstract:
-
- Parse a strings file and create or add to a string database file.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include <Common/UefiBaseTypes.h>
-
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.h"
-#include "StrGather.h"
-#include "StringDB.h"
-
-#ifndef MAX_PATH
-#define MAX_PATH 255
-#endif
-#define MAX_NEST_DEPTH 20 // just in case we get in an endless loop.
-#define MAX_STRING_IDENTIFIER_NAME 100 // number of wchars
-#define MAX_LINE_LEN 200
-#define STRING_TOKEN "STRING_TOKEN"
-#define DEFAULT_BASE_NAME "BaseName"
-//
-// Operational modes for this utility
-//
-#define MODE_UNKNOWN 0
-#define MODE_PARSE 1
-#define MODE_SCAN 2
-#define MODE_DUMP 3
-//
-// Different file separater for Linux and Windows
-//
-#ifdef __GNUC__
-#define FILE_SEP_CHAR '/'
-#define FILE_SEP_STRING "/"
-#else
-#define FILE_SEP_CHAR '\\'
-#define FILE_SEP_STRING "\\"
-#endif
-
-//
-// We keep a linked list of these for the source files we process
-//
-typedef struct _SOURCE_FILE {
- FILE *Fptr;
- WCHAR *FileBuffer;
- WCHAR *FileBufferPtr;
- UINT32 FileSize;
- CHAR8 FileName[MAX_PATH];
- UINT32 LineNum;
- BOOLEAN EndOfFile;
- BOOLEAN SkipToHash;
- struct _SOURCE_FILE *Previous;
- struct _SOURCE_FILE *Next;
- WCHAR ControlCharacter;
-} SOURCE_FILE;
-
-#define DEFAULT_CONTROL_CHARACTER UNICODE_SLASH
-
-//
-// Here's all our globals. We need a linked list of include paths, a linked
-// list of source files, a linked list of subdirectories (appended to each
-// include path when searching), and a couple other fields.
-//
-static struct {
- SOURCE_FILE SourceFiles;
- TEXT_STRING_LIST *IncludePaths; // all include paths to search
- TEXT_STRING_LIST *LastIncludePath;
- TEXT_STRING_LIST *ScanFileName;
- TEXT_STRING_LIST *LastScanFileName;
- TEXT_STRING_LIST *SkipExt; // if -skipext .uni
- TEXT_STRING_LIST *LastSkipExt;
- TEXT_STRING_LIST *IndirectionFileName;
- TEXT_STRING_LIST *LastIndirectionFileName;
- TEXT_STRING_LIST *DatabaseFileName;
- TEXT_STRING_LIST *LastDatabaseFileName;
- WCHAR_STRING_LIST *Language;
- WCHAR_STRING_LIST *LastLanguage;
- WCHAR_MATCHING_STRING_LIST *IndirectionList; // from indirection file(s)
- WCHAR_MATCHING_STRING_LIST *LastIndirectionList;
- BOOLEAN Verbose; // for more detailed output
- BOOLEAN VerboseDatabaseWrite; // for more detailed output when writing database
- BOOLEAN VerboseDatabaseRead; // for more detailed output when reading database
- BOOLEAN NewDatabase; // to start from scratch
- BOOLEAN IgnoreNotFound; // when scanning
- BOOLEAN VerboseScan;
- BOOLEAN UnquotedStrings; // -uqs option
- CHAR8 OutputDatabaseFileName[MAX_PATH];
- CHAR8 StringHFileName[MAX_PATH];
- CHAR8 StringCFileName[MAX_PATH]; // output .C filename
- CHAR8 DumpUFileName[MAX_PATH]; // output unicode dump file name
- CHAR8 HiiExportPackFileName[MAX_PATH]; // HII export pack file name
- CHAR8 BaseName[MAX_PATH]; // base filename of the strings file
- UINT32 Mode;
-} mGlobals;
-
-static
-BOOLEAN
-IsValidIdentifierChar (
- CHAR8 Char,
- BOOLEAN FirstChar
- );
-
-static
-void
-RewindFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-BOOLEAN
-SkipTo (
- SOURCE_FILE *SourceFile,
- WCHAR WChar,
- BOOLEAN StopAfterNewline
- );
-
-static
-UINT32
-SkipWhiteSpace (
- SOURCE_FILE *SourceFile
- );
-
-static
-BOOLEAN
-IsWhiteSpace (
- SOURCE_FILE *SourceFile
- );
-
-static
-BOOLEAN
-EndOfFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-void
-PreprocessFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-UINT32
-GetStringIdentifierName (
- IN SOURCE_FILE *SourceFile,
- IN OUT WCHAR *StringIdentifierName,
- IN UINT32 StringIdentifierNameLen
- );
-
-static
-UINT32
-GetLanguageIdentifierName (
- IN SOURCE_FILE *SourceFile,
- IN OUT WCHAR *LanguageIdentifierName,
- IN UINT32 LanguageIdentifierNameLen,
- IN BOOLEAN Optional
- );
-
-static
-WCHAR *
-GetPrintableLanguageName (
- IN SOURCE_FILE *SourceFile
- );
-
-static
-STATUS
-AddCommandLineLanguage (
- IN CHAR8 *Language
- );
-
-static
-WCHAR *
-GetQuotedString (
- SOURCE_FILE *SourceFile,
- BOOLEAN Optional
- );
-
-static
-STATUS
-ProcessIncludeFile (
- SOURCE_FILE *SourceFile,
- SOURCE_FILE *ParentSourceFile
- );
-
-static
-STATUS
-ParseFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-FILE *
-FindFile (
- IN CHAR8 *FileName,
- OUT CHAR8 *FoundFileName,
- IN UINT32 FoundFileNameLen
- );
-
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- );
-
-static
-STATUS
-ProcessFile (
- SOURCE_FILE *SourceFile
- );
-
-static
-UINT32
-wstrcmp (
- WCHAR *Buffer,
- WCHAR *Str
- );
-
-static
-void
-Version (
- VOID
- );
-
-static
-void
-Usage (
- VOID
- );
-
-static
-void
-FreeLists (
- VOID
- );
-
-static
-void
-ProcessTokenString (
- SOURCE_FILE *SourceFile
- );
-
-static
-void
-ProcessTokenInclude (
- SOURCE_FILE *SourceFile
- );
-
-static
-void
-ProcessTokenScope (
- SOURCE_FILE *SourceFile
- );
-
-static
-void
-ProcessTokenLanguage (
- SOURCE_FILE *SourceFile
- );
-
-static
-void
-ProcessTokenLangDef (
- SOURCE_FILE *SourceFile
- );
-
-static
-STATUS
-ScanFiles (
- TEXT_STRING_LIST *ScanFiles
- );
-
-static
-STATUS
-ParseIndirectionFiles (
- TEXT_STRING_LIST *Files
- );
-
-STATUS
-StringDBCreateHiiExportPack (
- CHAR8 *OutputFileName
- );
-
-int
-main (
- int Argc,
- char *Argv[]
- )
-/*++
-
-Routine Description:
-
- Call the routine to parse the command-line options, then process the file.
-
-Arguments:
-
- Argc - Standard C main() argc and argv.
- Argv - Standard C main() argc and argv.
-
-Returns:
-
- 0 if successful
- nonzero otherwise
-
---*/
-{
- STATUS Status;
-
- SetUtilityName (UTILITY_NAME);
- //
- // Process the command-line arguments
- //
- Status = ProcessArgs (Argc, Argv);
- if (Status != STATUS_SUCCESS) {
- return Status;
- }
- //
- // Initialize the database manager
- //
- StringDBConstructor ();
- //
- // We always try to read in an existing database file. It may not
- // exist, which is ok usually.
- //
- if (mGlobals.NewDatabase == 0) {
- //
- // Read all databases specified.
- //
- for (mGlobals.LastDatabaseFileName = mGlobals.DatabaseFileName;
- mGlobals.LastDatabaseFileName != NULL;
- mGlobals.LastDatabaseFileName = mGlobals.LastDatabaseFileName->Next
- ) {
- Status = StringDBReadDatabase (mGlobals.LastDatabaseFileName->Str, TRUE, mGlobals.VerboseDatabaseRead);
- if (Status != STATUS_SUCCESS) {
- return Status;
- }
- }
- }
- //
- // Read indirection file(s) if specified
- //
- if (ParseIndirectionFiles (mGlobals.IndirectionFileName) != STATUS_SUCCESS) {
- goto Finish;
- }
- //
- // If scanning source files, do that now
- //
- if (mGlobals.Mode == MODE_SCAN) {
- ScanFiles (mGlobals.ScanFileName);
- } else if (mGlobals.Mode == MODE_PARSE) {
- //
- // Parsing a unicode strings file
- //
- mGlobals.SourceFiles.ControlCharacter = DEFAULT_CONTROL_CHARACTER;
- Status = ProcessIncludeFile (&mGlobals.SourceFiles, NULL);
- if (Status != STATUS_SUCCESS) {
- goto Finish;
- }
- }
- //
- // Create the string defines header file if there have been no errors.
- //
- ParserSetPosition (NULL, 0);
- if ((mGlobals.StringHFileName[0] != 0) && (GetUtilityStatus () < STATUS_ERROR)) {
- Status = StringDBDumpStringDefines (mGlobals.StringHFileName, mGlobals.BaseName);
- if (Status != EFI_SUCCESS) {
- goto Finish;
- }
- }
- //
- // Dump the strings to a .c file if there have still been no errors.
- //
- if ((mGlobals.StringCFileName[0] != 0) && (GetUtilityStatus () < STATUS_ERROR)) {
- Status = StringDBDumpCStrings (
- mGlobals.StringCFileName,
- mGlobals.BaseName,
- mGlobals.Language,
- mGlobals.IndirectionList
- );
- if (Status != EFI_SUCCESS) {
- goto Finish;
- }
- }
- //
- // Dump the database if requested
- //
- if ((mGlobals.DumpUFileName[0] != 0) && (GetUtilityStatus () < STATUS_ERROR)) {
- StringDBDumpDatabase (NULL, mGlobals.DumpUFileName, FALSE);
- }
- //
- // Dump the string data as HII binary string pack if requested
- //
- if ((mGlobals.HiiExportPackFileName[0] != 0) && (GetUtilityStatus () < STATUS_ERROR)) {
- StringDBCreateHiiExportPack (mGlobals.HiiExportPackFileName);
- }
- //
- // Always update the database if no errors and not in dump mode. If they specified -od
- // for an output database file name, then use that name. Otherwise use the name of
- // the first database file specified with -db
- //
- if ((mGlobals.Mode != MODE_DUMP) && (GetUtilityStatus () < STATUS_ERROR)) {
- if (mGlobals.OutputDatabaseFileName[0]) {
- Status = StringDBWriteDatabase (mGlobals.OutputDatabaseFileName, mGlobals.VerboseDatabaseWrite);
- } else {
- Status = StringDBWriteDatabase (mGlobals.DatabaseFileName->Str, mGlobals.VerboseDatabaseWrite);
- }
-
- if (Status != EFI_SUCCESS) {
- goto Finish;
- }
- }
-
-Finish:
- //
- // Free up memory
- //
- FreeLists ();
- StringDBDestructor ();
- return GetUtilityStatus ();
-}
-
-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 UINT32 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.Verbose) {
- fprintf (stdout, "%*cProcessing file '%s'\n", NestDepth * 2, ' ', SourceFile->FileName);
- }
-
- //
- // Make sure we didn't exceed our maximum nesting depth
- //
- if (NestDepth > MAX_NEST_DEPTH) {
- Error (NULL, 0, 0, SourceFile->FileName, "max nesting depth (%d) exceeded", 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 (FoundFileName, "rb")) == NULL) {
- //
- // Try to find it among the paths if it has a parent (that is, it is included
- // by someone else).
- //
- if (ParentSourceFile == NULL) {
- Error (NULL, 0, 0, SourceFile->FileName, "file not found");
- return STATUS_ERROR;
- }
-
- SourceFile->Fptr = FindFile (SourceFile->FileName, FoundFileName, sizeof (FoundFileName));
- if (SourceFile->Fptr == NULL) {
- Error (ParentSourceFile->FileName, ParentSourceFile->LineNum, 0, SourceFile->FileName, "include file not found");
- return STATUS_ERROR;
- }
- }
- //
- // Process the file found
- //
- ProcessFile (SourceFile);
-Finish:
- //
- // Close open files and return status
- //
- if (SourceFile->Fptr != NULL) {
- fclose (SourceFile->Fptr);
- }
-
- return Status;
-}
-
-static
-STATUS
-ProcessFile (
- SOURCE_FILE *SourceFile
- )
-{
- //
- // Get the file size, and then read the entire thing into memory.
- // Allocate space for a terminator character.
- //
- fseek (SourceFile->Fptr, 0, SEEK_END);
- SourceFile->FileSize = ftell (SourceFile->Fptr);
- fseek (SourceFile->Fptr, 0, SEEK_SET);
- SourceFile->FileBuffer = (WCHAR *) malloc (SourceFile->FileSize + sizeof (WCHAR));
- if (SourceFile->FileBuffer == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- fread ((VOID *) SourceFile->FileBuffer, SourceFile->FileSize, 1, SourceFile->Fptr);
- SourceFile->FileBuffer[(SourceFile->FileSize / sizeof (WCHAR))] = UNICODE_NULL;
- //
- // Pre-process the file to replace comments with spaces
- //
- PreprocessFile (SourceFile);
- //
- // Parse the file
- //
- ParseFile (SourceFile);
- free (SourceFile->FileBuffer);
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-ParseFile (
- SOURCE_FILE *SourceFile
- )
-{
- BOOLEAN InComment;
- UINT32 Len;
-
- //
- // First character of a unicode file is special. Make sure
- //
- if (SourceFile->FileBufferPtr[0] != UNICODE_FILE_START) {
- Error (SourceFile->FileName, 1, 0, SourceFile->FileName, "file does not appear to be a unicode file");
- return STATUS_ERROR;
- }
-
- SourceFile->FileBufferPtr++;
- InComment = FALSE;
- //
- // Print the first line if in verbose mode
- //
- if (mGlobals.Verbose) {
- printf ("%d: %S\n", SourceFile->LineNum, SourceFile->FileBufferPtr);
- }
- //
- // Since the syntax is relatively straightforward, just switch on the next char
- //
- while (!EndOfFile (SourceFile)) {
- //
- // Check for whitespace
- //
- if (SourceFile->FileBufferPtr[0] == UNICODE_SPACE) {
- SourceFile->FileBufferPtr++;
- } else if (SourceFile->FileBufferPtr[0] == UNICODE_TAB) {
- SourceFile->FileBufferPtr++;
- } else if (SourceFile->FileBufferPtr[0] == UNICODE_CR) {
- SourceFile->FileBufferPtr++;
- } else if (SourceFile->FileBufferPtr[0] == UNICODE_LF) {
- SourceFile->FileBufferPtr++;
- SourceFile->LineNum++;
- if (mGlobals.Verbose) {
- printf ("%d: %S\n", SourceFile->LineNum, SourceFile->FileBufferPtr);
- }
-
- InComment = FALSE;
- } else if (SourceFile->FileBufferPtr[0] == 0) {
- SourceFile->FileBufferPtr++;
- } else if (InComment) {
- SourceFile->FileBufferPtr++;
- } else if ((SourceFile->FileBufferPtr[0] == UNICODE_SLASH) && (SourceFile->FileBufferPtr[1] == UNICODE_SLASH)) {
- SourceFile->FileBufferPtr += 2;
- InComment = TRUE;
- } else if (SourceFile->SkipToHash && (SourceFile->FileBufferPtr[0] != SourceFile->ControlCharacter)) {
- SourceFile->FileBufferPtr++;
- } else {
- SourceFile->SkipToHash = FALSE;
- if ((SourceFile->FileBufferPtr[0] == SourceFile->ControlCharacter) &&
- ((Len = wstrcmp (SourceFile->FileBufferPtr + 1, L"include")) > 0)
- ) {
- SourceFile->FileBufferPtr += Len + 1;
- ProcessTokenInclude (SourceFile);
- } else if ((SourceFile->FileBufferPtr[0] == SourceFile->ControlCharacter) &&
- (Len = wstrcmp (SourceFile->FileBufferPtr + 1, L"scope")) > 0
- ) {
- SourceFile->FileBufferPtr += Len + 1;
- ProcessTokenScope (SourceFile);
- } else if ((SourceFile->FileBufferPtr[0] == SourceFile->ControlCharacter) &&
- (Len = wstrcmp (SourceFile->FileBufferPtr + 1, L"language")) > 0
- ) {
- SourceFile->FileBufferPtr += Len + 1;
- ProcessTokenLanguage (SourceFile);
- } else if ((SourceFile->FileBufferPtr[0] == SourceFile->ControlCharacter) &&
- (Len = wstrcmp (SourceFile->FileBufferPtr + 1, L"langdef")) > 0
- ) {
- SourceFile->FileBufferPtr += Len + 1;
- ProcessTokenLangDef (SourceFile);
- } else if ((SourceFile->FileBufferPtr[0] == SourceFile->ControlCharacter) &&
- (Len = wstrcmp (SourceFile->FileBufferPtr + 1, L"string")) > 0
- ) {
- SourceFile->FileBufferPtr += Len + 1;
- ProcessTokenString (SourceFile);
- } else if ((SourceFile->FileBufferPtr[0] == SourceFile->ControlCharacter) &&
- (Len = wstrcmp (SourceFile->FileBufferPtr + 1, L"EFI_BREAKPOINT()")) > 0
- ) {
- SourceFile->FileBufferPtr += Len;
- //
- // BUGBUG: Caling EFI_BREAKOINT() is breaking the link. What is the proper action for this tool
- // in this condition?
- //
-// EFI_BREAKPOINT ();
- } else if ((SourceFile->FileBufferPtr[0] == SourceFile->ControlCharacter) &&
- (SourceFile->FileBufferPtr[1] == UNICODE_EQUAL_SIGN)
- ) {
- SourceFile->ControlCharacter = SourceFile->FileBufferPtr[2];
- SourceFile->FileBufferPtr += 3;
- } else {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "unrecognized token", "%S", SourceFile->FileBufferPtr);
- //
- // Treat rest of line as a comment.
- //
- InComment = TRUE;
- }
- }
- }
-
- 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 from the file to the screen.
-
-Arguments:
- SourceFile - structure that we use to keep track of an input file.
-
-Returns:
- Nothing.
-
---*/
-{
- BOOLEAN InComment;
-
- RewindFile (SourceFile);
- InComment = FALSE;
- while (!EndOfFile (SourceFile)) {
- //
- // If a line-feed, then no longer in a comment
- //
- if (SourceFile->FileBufferPtr[0] == UNICODE_LF) {
- SourceFile->FileBufferPtr++;
- SourceFile->LineNum++;
- InComment = 0;
- } else if (SourceFile->FileBufferPtr[0] == UNICODE_CR) {
- //
- // Replace all carriage returns with a NULL so we can print stuff
- //
- SourceFile->FileBufferPtr[0] = 0;
- SourceFile->FileBufferPtr++;
- } else if (InComment) {
- SourceFile->FileBufferPtr[0] = UNICODE_SPACE;
- SourceFile->FileBufferPtr++;
- } else if ((SourceFile->FileBufferPtr[0] == UNICODE_SLASH) && (SourceFile->FileBufferPtr[1] == UNICODE_SLASH)) {
- SourceFile->FileBufferPtr += 2;
- 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);
-}
-
-static
-WCHAR *
-GetPrintableLanguageName (
- IN SOURCE_FILE *SourceFile
- )
-{
- WCHAR *String;
- WCHAR *Start;
- WCHAR *Ptr;
- UINT32 Len;
-
- SkipWhiteSpace (SourceFile);
- if (SourceFile->FileBufferPtr[0] != UNICODE_DOUBLE_QUOTE) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- "expected quoted printable language name",
- "%S",
- SourceFile->FileBufferPtr
- );
- SourceFile->SkipToHash = TRUE;
- return NULL;
- }
-
- Len = 0;
- SourceFile->FileBufferPtr++;
- Start = Ptr = SourceFile->FileBufferPtr;
- while (!EndOfFile (SourceFile)) {
- if (SourceFile->FileBufferPtr[0] == UNICODE_CR) {
- Warning (SourceFile->FileName, SourceFile->LineNum, 0, "carriage return found in quoted string", "%S", Start);
- break;
- } else if (SourceFile->FileBufferPtr[0] == UNICODE_DOUBLE_QUOTE) {
- break;
- }
-
- SourceFile->FileBufferPtr++;
- Len++;
- }
-
- if (SourceFile->FileBufferPtr[0] != UNICODE_DOUBLE_QUOTE) {
- Warning (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- "missing closing quote on printable language name string",
- "%S",
- Start
- );
- } else {
- SourceFile->FileBufferPtr++;
- }
- //
- // Now allocate memory for the string and save it off
- //
- String = (WCHAR *) malloc ((Len + 1) * sizeof (WCHAR));
- if (String == NULL) {
- Error (NULL, 0, 0, "memory allocation failed", 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;
- //
- // Now format the string to convert \wide and \narrow controls
- //
- StringDBFormatString (String);
- return String;
-}
-
-static
-WCHAR *
-GetQuotedString (
- SOURCE_FILE *SourceFile,
- BOOLEAN Optional
- )
-{
- WCHAR *String;
- WCHAR *Start;
- WCHAR *Ptr;
- UINT32 Len;
- BOOLEAN PreviousBackslash;
-
- if (SourceFile->FileBufferPtr[0] != UNICODE_DOUBLE_QUOTE) {
- if (!Optional) {
- 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] == UNICODE_DOUBLE_QUOTE) && (!PreviousBackslash)) {
- break;
- } else if (SourceFile->FileBufferPtr[0] == UNICODE_CR) {
- Warning (SourceFile->FileName, SourceFile->LineNum, 0, "carriage return found in quoted string", "%S", Start);
- PreviousBackslash = FALSE;
- } else if (SourceFile->FileBufferPtr[0] == UNICODE_BACKSLASH) {
- PreviousBackslash = TRUE;
- } else {
- PreviousBackslash = FALSE;
- }
-
- SourceFile->FileBufferPtr++;
- Len++;
- }
-
- if (SourceFile->FileBufferPtr[0] != UNICODE_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 = (WCHAR *) malloc ((Len + 1) * sizeof (WCHAR));
- if (String == NULL) {
- Error (NULL, 0, 0, "memory allocation failed", 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;
-}
-//
-// Parse:
-// #string STR_ID_NAME
-//
-// All we can do is call the string database to add the string identifier. Unfortunately
-// he'll have to keep track of the last identifier we added.
-//
-static
-void
-ProcessTokenString (
- SOURCE_FILE *SourceFile
- )
-{
- WCHAR StringIdentifier[MAX_STRING_IDENTIFIER_NAME];
- UINT16 StringId;
- //
- // Extract the string identifier name and add it to the database.
- //
- if (GetStringIdentifierName (SourceFile, StringIdentifier, sizeof (StringIdentifier)) > 0) {
- StringId = STRING_ID_INVALID;
- StringDBAddStringIdentifier (StringIdentifier, &StringId, 0);
- } else {
- //
- // Error recovery -- skip to the next #
- //
- SourceFile->SkipToHash = TRUE;
- }
-}
-
-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 (WCHAR)) {
- SourceFile->EndOfFile = TRUE;
- return TRUE;
- }
-
- if (SourceFile->EndOfFile) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-static
-UINT32
-GetStringIdentifierName (
- IN SOURCE_FILE *SourceFile,
- IN OUT WCHAR *StringIdentifierName,
- IN UINT32 StringIdentifierNameLen
- )
-{
- UINT32 Len;
- WCHAR *From;
- WCHAR *Start;
-
- //
- // Skip whitespace
- //
- SkipWhiteSpace (SourceFile);
- if (SourceFile->EndOfFile) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "end-of-file encountered", "expected string identifier");
- return 0;
- }
- //
- // Verify first character of name is [A-Za-z]
- //
- Len = 0;
- StringIdentifierNameLen /= 2;
- From = SourceFile->FileBufferPtr;
- Start = SourceFile->FileBufferPtr;
- if (((SourceFile->FileBufferPtr[0] >= UNICODE_A) && (SourceFile->FileBufferPtr[0] <= UNICODE_Z)) ||
- ((SourceFile->FileBufferPtr[0] >= UNICODE_z) && (SourceFile->FileBufferPtr[0] <= UNICODE_z))
- ) {
- //
- // Do nothing
- //
- } else {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "invalid character in string identifier name", "%S", Start);
- return 0;
- }
-
- while (!EndOfFile (SourceFile)) {
- if (((SourceFile->FileBufferPtr[0] >= UNICODE_A) && (SourceFile->FileBufferPtr[0] <= UNICODE_Z)) ||
- ((SourceFile->FileBufferPtr[0] >= UNICODE_z) && (SourceFile->FileBufferPtr[0] <= UNICODE_z)) ||
- ((SourceFile->FileBufferPtr[0] >= UNICODE_0) && (SourceFile->FileBufferPtr[0] <= UNICODE_9)) ||
- (SourceFile->FileBufferPtr[0] == UNICODE_UNDERSCORE)
- ) {
- Len++;
- if (Len >= StringIdentifierNameLen) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "string identifier name too long", "%S", Start);
- return 0;
- }
-
- *StringIdentifierName = SourceFile->FileBufferPtr[0];
- StringIdentifierName++;
- SourceFile->FileBufferPtr++;
- } else if (SkipWhiteSpace (SourceFile) == 0) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "invalid string identifier name", "%S", Start);
- return 0;
- } else {
- break;
- }
- }
- //
- // Terminate the copy of the string.
- //
- *StringIdentifierName = 0;
- return Len;
-}
-
-static
-UINT32
-GetLanguageIdentifierName (
- IN SOURCE_FILE *SourceFile,
- IN OUT WCHAR *LanguageIdentifierName,
- IN UINT32 LanguageIdentifierNameLen,
- IN BOOLEAN Optional
- )
-{
- UINT32 Len;
- WCHAR *From;
- WCHAR *Start;
- //
- // Skip whitespace
- //
- SkipWhiteSpace (SourceFile);
- if (SourceFile->EndOfFile) {
- if (!Optional) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- "end-of-file encountered",
- "expected language identifier"
- );
- }
-
- return 0;
- }
- //
- // This function is called to optionally get a language identifier name in:
- // #string STR_ID eng "the string"
- // If it's optional, and we find a double-quote, then return now.
- //
- if (Optional) {
- if (*SourceFile->FileBufferPtr == UNICODE_DOUBLE_QUOTE) {
- return 0;
- }
- }
-
- Len = 0;
- LanguageIdentifierNameLen /= 2;
- //
- // Internal error if we weren't given at least 4 WCHAR's to work with.
- //
- if (LanguageIdentifierNameLen < LANGUAGE_IDENTIFIER_NAME_LEN + 1) {
- Error (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- "app error -- language identifier name length is invalid",
- NULL
- );
- }
-
- From = SourceFile->FileBufferPtr;
- Start = SourceFile->FileBufferPtr;
- while (!EndOfFile (SourceFile)) {
- if (((SourceFile->FileBufferPtr[0] >= UNICODE_a) && (SourceFile->FileBufferPtr[0] <= UNICODE_z))) {
- Len++;
- if (Len > LANGUAGE_IDENTIFIER_NAME_LEN) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "language identifier name too long", "%S", Start);
- return 0;
- }
-
- *LanguageIdentifierName = SourceFile->FileBufferPtr[0];
- SourceFile->FileBufferPtr++;
- LanguageIdentifierName++;
- } else if (!IsWhiteSpace (SourceFile)) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "invalid language identifier name", "%S", Start);
- return 0;
- } else {
- break;
- }
- }
- //
- // Terminate the copy of the string.
- //
- *LanguageIdentifierName = 0;
- return Len;
-}
-
-static
-void
-ProcessTokenInclude (
- SOURCE_FILE *SourceFile
- )
-{
- CHAR8 IncludeFileName[MAX_PATH];
- CHAR8 *To;
- UINT32 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] != UNICODE_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] == UNICODE_CR) || (SourceFile->FileBufferPtr[0] == UNICODE_LF)) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "end-of-line found in quoted include file name", NULL);
- goto FailDone;
- }
-
- if (SourceFile->FileBufferPtr[0] == UNICODE_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 = UNICODE_TO_ASCII (SourceFile->FileBufferPtr[0]);
- To++;
- }
-
- SourceFile->FileBufferPtr++;
- }
-
- if (!ReportedError) {
- *To = 0;
- memset ((char *) &IncludedSourceFile, 0, sizeof (SOURCE_FILE));
- strcpy (IncludedSourceFile.FileName, IncludeFileName);
- IncludedSourceFile.ControlCharacter = DEFAULT_CONTROL_CHARACTER;
- ProcessIncludeFile (&IncludedSourceFile, SourceFile);
- //
- // printf ("including file '%s'\n", IncludeFileName);
- //
- }
-
- return ;
-FailDone:
- //
- // Error recovery -- skip to next #
- //
- SourceFile->SkipToHash = TRUE;
-}
-
-static
-void
-ProcessTokenScope (
- SOURCE_FILE *SourceFile
- )
-{
- WCHAR StringIdentifier[MAX_STRING_IDENTIFIER_NAME];
- //
- // Extract the scope name
- //
- if (GetStringIdentifierName (SourceFile, StringIdentifier, sizeof (StringIdentifier)) > 0) {
- StringDBSetScope (StringIdentifier);
- }
-}
-//
-// Parse: #langdef eng "English"
-// #langdef chn "\wideChinese"
-//
-static
-void
-ProcessTokenLangDef (
- SOURCE_FILE *SourceFile
- )
-{
- WCHAR LanguageIdentifier[MAX_STRING_IDENTIFIER_NAME];
- UINT32 Len;
- WCHAR *PrintableName;
- //
- // Extract the 3-character language identifier
- //
- Len = GetLanguageIdentifierName (SourceFile, LanguageIdentifier, sizeof (LanguageIdentifier), FALSE);
- if (Len != LANGUAGE_IDENTIFIER_NAME_LEN) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "invalid or missing language identifier", NULL);
- } else {
- //
- // Extract the printable name
- //
- PrintableName = GetPrintableLanguageName (SourceFile);
- if (PrintableName != NULL) {
- ParserSetPosition (SourceFile->FileName, SourceFile->LineNum);
- StringDBAddLanguage (LanguageIdentifier, PrintableName);
- free (PrintableName);
- return ;
- }
- }
- //
- // Error recovery -- skip to next #
- //
- SourceFile->SkipToHash = TRUE;
-}
-
-static
-BOOLEAN
-ApparentQuotedString (
- SOURCE_FILE *SourceFile
- )
-{
- WCHAR *Ptr;
- //
- // See if the first and last nonblank characters on the line are double quotes
- //
- for (Ptr = SourceFile->FileBufferPtr; *Ptr && (*Ptr == UNICODE_SPACE); Ptr++)
- ;
- if (*Ptr != UNICODE_DOUBLE_QUOTE) {
- return FALSE;
- }
-
- while (*Ptr) {
- Ptr++;
- }
-
- Ptr--;
- for (; *Ptr && (*Ptr == UNICODE_SPACE); Ptr--)
- ;
- if (*Ptr != UNICODE_DOUBLE_QUOTE) {
- return FALSE;
- }
-
- return TRUE;
-}
-//
-// Parse:
-// #language eng "some string " "more string"
-//
-static
-void
-ProcessTokenLanguage (
- SOURCE_FILE *SourceFile
- )
-{
- WCHAR *String;
- WCHAR *SecondString;
- WCHAR *TempString;
- WCHAR *From;
- WCHAR *To;
- WCHAR Language[LANGUAGE_IDENTIFIER_NAME_LEN + 1];
- UINT32 Len;
- BOOLEAN PreviousNewline;
- //
- // Get the language identifier
- //
- Language[0] = 0;
- Len = GetLanguageIdentifierName (SourceFile, Language, sizeof (Language), TRUE);
- if (Len != LANGUAGE_IDENTIFIER_NAME_LEN) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "invalid or missing language identifier", "%S", Language);
- SourceFile->SkipToHash = TRUE;
- return ;
- }
- //
- // Extract the string value. It's either a quoted string that starts on the current line, or
- // an unquoted string that starts on the following line and continues until the next control
- // character in column 1.
- // Look ahead to find a quote or a newline
- //
- if (SkipTo (SourceFile, UNICODE_DOUBLE_QUOTE, TRUE)) {
- String = GetQuotedString (SourceFile, FALSE);
- if (String != NULL) {
- //
- // Set the position in the file of where we are parsing for error
- // reporting purposes. Then start looking ahead for additional
- // quoted strings, and concatenate them until we get a failure
- // back from the string parser.
- //
- Len = StrLen (String) + 1;
- ParserSetPosition (SourceFile->FileName, SourceFile->LineNum);
- do {
- SkipWhiteSpace (SourceFile);
- SecondString = GetQuotedString (SourceFile, TRUE);
- if (SecondString != NULL) {
- Len += StrLen (SecondString);
- TempString = (WCHAR *) malloc (Len * sizeof (WCHAR));
- if (TempString == NULL) {
- Error (NULL, 0, 0, "application error", "failed to allocate memory");
- return ;
- }
-
- StrCpy (TempString, String);
- StrCat (TempString, SecondString);
- free (String);
- free (SecondString);
- String = TempString;
- }
- } while (SecondString != NULL);
- StringDBAddString (Language, NULL, NULL, String, TRUE, 0);
- free (String);
- } else {
- //
- // Error was reported at lower level. Error recovery mode.
- //
- SourceFile->SkipToHash = TRUE;
- }
- } else {
- if (!mGlobals.UnquotedStrings) {
- //
- // They're using unquoted strings. If the next non-blank character is a double quote, and the
- // last non-blank character on the line is a double quote, then more than likely they're using
- // quotes, so they need to put the quoted string on the end of the previous line
- //
- if (ApparentQuotedString (SourceFile)) {
- Warning (
- SourceFile->FileName,
- SourceFile->LineNum,
- 0,
- "unexpected quoted string on line",
- "specify -uqs option if necessary"
- );
- }
- }
- //
- // Found end-of-line (hopefully). Skip over it and start taking in characters
- // until we find a control character at the start of a line.
- //
- Len = 0;
- From = SourceFile->FileBufferPtr;
- PreviousNewline = FALSE;
- while (!EndOfFile (SourceFile)) {
- if (SourceFile->FileBufferPtr[0] == UNICODE_LF) {
- PreviousNewline = TRUE;
- SourceFile->LineNum++;
- } else {
- Len++;
- if (PreviousNewline && (SourceFile->FileBufferPtr[0] == SourceFile->ControlCharacter)) {
- break;
- }
-
- PreviousNewline = FALSE;
- }
-
- SourceFile->FileBufferPtr++;
- }
-
- if ((Len == 0) && EndOfFile (SourceFile)) {
- Error (SourceFile->FileName, SourceFile->LineNum, 0, "unexpected end of file", NULL);
- SourceFile->SkipToHash = TRUE;
- return ;
- }
- //
- // Now allocate a buffer, copy the characters, and add the string.
- //
- String = (WCHAR *) malloc ((Len + 1) * sizeof (WCHAR));
- if (String == NULL) {
- Error (NULL, 0, 0, "application error", "failed to allocate memory");
- return ;
- }
-
- To = String;
- while (From < SourceFile->FileBufferPtr) {
- switch (*From) {
- case UNICODE_LF:
- case 0:
- break;
-
- default:
- *To = *From;
- To++;
- break;
- }
-
- From++;
- }
-
- //
- // String[Len] = 0;
- //
- *To = 0;
- StringDBAddString (Language, NULL, NULL, String, TRUE, 0);
- }
-}
-
-static
-BOOLEAN
-IsWhiteSpace (
- SOURCE_FILE *SourceFile
- )
-{
- switch (SourceFile->FileBufferPtr[0]) {
- case UNICODE_NULL:
- case UNICODE_CR:
- case UNICODE_SPACE:
- case UNICODE_TAB:
- case UNICODE_LF:
- return TRUE;
-
- default:
- return FALSE;
- }
-}
-
-static
-UINT32
-SkipWhiteSpace (
- SOURCE_FILE *SourceFile
- )
-{
- UINT32 Count;
-
- Count = 0;
- while (!EndOfFile (SourceFile)) {
- Count++;
- switch (*SourceFile->FileBufferPtr) {
- case UNICODE_NULL:
- case UNICODE_CR:
- case UNICODE_SPACE:
- case UNICODE_TAB:
- SourceFile->FileBufferPtr++;
- break;
-
- case UNICODE_LF:
- SourceFile->FileBufferPtr++;
- SourceFile->LineNum++;
- if (mGlobals.Verbose) {
- printf ("%d: %S\n", SourceFile->LineNum, SourceFile->FileBufferPtr);
- }
- 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
-UINT32
-wstrcmp (
- WCHAR *Buffer,
- WCHAR *Str
- )
-{
- UINT32 Len;
-
- Len = 0;
- while (*Str == *Buffer) {
- Buffer++;
- Str++;
- Len++;
- }
-
- if (*Str) {
- return 0;
- }
-
- return Len;
-}
-//
-// Given a filename, try to find it along the include paths.
-//
-static
-FILE *
-FindFile (
- IN CHAR8 *FileName,
- OUT CHAR8 *FoundFileName,
- IN UINT32 FoundFileNameLen
- )
-{
- FILE *Fptr;
- TEXT_STRING_LIST *List;
-
- //
- // Traverse the list of paths and try to find the file
- //
- List = mGlobals.IncludePaths;
- while (List != NULL) {
- //
- // Put the path and filename together
- //
- if (strlen (List->Str) + strlen (FileName) + 1 > FoundFileNameLen) {
- Error (UTILITY_NAME, 0, 0, NULL, "internal error - cannot concatenate path+filename");
- return NULL;
- }
- //
- // Append the filename to this include path and try to open the file.
- //
- strcpy (FoundFileName, List->Str);
- strcat (FoundFileName, FileName);
- if ((Fptr = fopen (FoundFileName, "rb")) != NULL) {
- //
- // Return the file pointer
- //
- return Fptr;
- }
-
- List = List->Next;
- }
- //
- // Not found
- //
- FoundFileName[0] = 0;
- return NULL;
-}
-//
-// Process the command-line arguments
-//
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- )
-{
- TEXT_STRING_LIST *NewList;
- //
- // Clear our globals
- //
- memset ((char *) &mGlobals, 0, sizeof (mGlobals));
- strcpy (mGlobals.BaseName, DEFAULT_BASE_NAME);
- //
- // Skip program name
- //
- Argc--;
- Argv++;
-
- if (Argc == 0) {
- Usage ();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
- (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
- Usage();
- return STATUS_ERROR;
- }
-
- if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
- Version();
- return STATUS_ERROR;
- }
-
- mGlobals.Mode = MODE_UNKNOWN;
- //
- // Process until no more -args.
- //
- while ((Argc > 0) && (Argv[0][0] == '-')) {
- //
- // -parse option
- //
- if (stricmp (Argv[0], "-parse") == 0) {
- if (mGlobals.Mode != MODE_UNKNOWN) {
- Error (NULL, 0, 0, "only one of -parse/-scan/-dump allowed", NULL);
- return STATUS_ERROR;
- }
-
- mGlobals.Mode = MODE_PARSE;
- //
- // -scan option
- //
- } else if (stricmp (Argv[0], "-scan") == 0) {
- if (mGlobals.Mode != MODE_UNKNOWN) {
- Error (NULL, 0, 0, "only one of -parse/-scan/-dump allowed", NULL);
- return STATUS_ERROR;
- }
-
- mGlobals.Mode = MODE_SCAN;
- //
- // -vscan verbose scanning option
- //
- } else if (stricmp (Argv[0], "-vscan") == 0) {
- mGlobals.VerboseScan = TRUE;
- //
- // -dump option
- //
- } else if (stricmp (Argv[0], "-dump") == 0) {
- if (mGlobals.Mode != MODE_UNKNOWN) {
- Error (NULL, 0, 0, "only one of -parse/-scan/-dump allowed", NULL);
- return STATUS_ERROR;
- }
-
- mGlobals.Mode = MODE_DUMP;
- } else if (stricmp (Argv[0], "-uqs") == 0) {
- mGlobals.UnquotedStrings = TRUE;
- //
- // -i path add include search path when parsing
- //
- } else if (stricmp (Argv[0], "-i") == 0) {
- //
- // check for one more arg
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing include path");
- return STATUS_ERROR;
- }
- //
- // Allocate memory for a new list element, fill it in, and
- // add it to our list of include paths. Always make sure it
- // has a "\" on the end of it.
- //
- NewList = malloc (sizeof (TEXT_STRING_LIST));
- if (NewList == NULL) {
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
-
- memset ((char *) NewList, 0, sizeof (TEXT_STRING_LIST));
- NewList->Str = malloc (strlen (Argv[1]) + 2);
- if (NewList->Str == NULL) {
- free (NewList);
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
-
- strcpy (NewList->Str, Argv[1]);
- if (NewList->Str[strlen (NewList->Str) - 1] != FILE_SEP_CHAR) {
- strcat (NewList->Str, FILE_SEP_STRING);
- }
- //
- // Add it to our linked list
- //
- if (mGlobals.IncludePaths == NULL) {
- mGlobals.IncludePaths = NewList;
- } else {
- mGlobals.LastIncludePath->Next = NewList;
- }
-
- mGlobals.LastIncludePath = NewList;
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-if") == 0) {
- //
- // Indirection file -- check for one more arg
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing indirection file name");
- return STATUS_ERROR;
- }
- //
- // Allocate memory for a new list element, fill it in, and
- // add it to our list of include paths. Always make sure it
- // has a "\" on the end of it.
- //
- NewList = malloc (sizeof (TEXT_STRING_LIST));
- if (NewList == NULL) {
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
-
- memset ((char *) NewList, 0, sizeof (TEXT_STRING_LIST));
- NewList->Str = malloc (strlen (Argv[1]) + 1);
- if (NewList->Str == NULL) {
- free (NewList);
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
-
- strcpy (NewList->Str, Argv[1]);
- //
- // Add it to our linked list
- //
- if (mGlobals.IndirectionFileName == NULL) {
- mGlobals.IndirectionFileName = NewList;
- } else {
- mGlobals.LastIndirectionFileName->Next = NewList;
- }
-
- mGlobals.LastIndirectionFileName = NewList;
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-db") == 0) {
- //
- // -db option to specify a database file.
- // Check for one more arg (the database file name)
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing database file name");
- return STATUS_ERROR;
- }
-
- NewList = malloc (sizeof (TEXT_STRING_LIST));
- if (NewList == NULL) {
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
-
- memset ((char *) NewList, 0, sizeof (TEXT_STRING_LIST));
- NewList->Str = malloc (strlen (Argv[1]) + 1);
- if (NewList->Str == NULL) {
- free (NewList);
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
-
- strcpy (NewList->Str, Argv[1]);
- //
- // Add it to our linked list
- //
- if (mGlobals.DatabaseFileName == NULL) {
- mGlobals.DatabaseFileName = NewList;
- } else {
- mGlobals.LastDatabaseFileName->Next = NewList;
- }
-
- mGlobals.LastDatabaseFileName = NewList;
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-ou") == 0) {
- //
- // -ou option to specify an output unicode file to
- // which we can dump our database.
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing database dump output file name");
- return STATUS_ERROR;
- }
-
- if (mGlobals.DumpUFileName[0] == 0) {
- strcpy (mGlobals.DumpUFileName, Argv[1]);
- } else {
- Error (UTILITY_NAME, 0, 0, Argv[1], "-ou option already specified with '%s'", mGlobals.DumpUFileName);
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-hpk") == 0) {
- //
- // -hpk option to create an HII export pack of the input database file
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing raw string data dump output file name");
- return STATUS_ERROR;
- }
-
- if (mGlobals.HiiExportPackFileName[0] == 0) {
- strcpy (mGlobals.HiiExportPackFileName, Argv[1]);
- } else {
- Error (UTILITY_NAME, 0, 0, Argv[1], "-or option already specified with '%s'", mGlobals.HiiExportPackFileName);
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- } else if ((stricmp (Argv[0], "-?") == 0) || (stricmp (Argv[0], "-h") == 0)) {
- Usage ();
- return STATUS_ERROR;
- } else if (stricmp (Argv[0], "-v") == 0) {
- mGlobals.Verbose = 1;
- } else if (stricmp (Argv[0], "-vdbw") == 0) {
- mGlobals.VerboseDatabaseWrite = 1;
- } else if (stricmp (Argv[0], "-vdbr") == 0) {
- mGlobals.VerboseDatabaseRead = 1;
- } else if (stricmp (Argv[0], "-newdb") == 0) {
- mGlobals.NewDatabase = 1;
- } else if (stricmp (Argv[0], "-ignorenotfound") == 0) {
- mGlobals.IgnoreNotFound = 1;
- } else if (stricmp (Argv[0], "-oc") == 0) {
- //
- // check for one more arg
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing output C filename");
- return STATUS_ERROR;
- }
-
- strcpy (mGlobals.StringCFileName, Argv[1]);
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-bn") == 0) {
- //
- // check for one more arg
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing base name");
- Usage ();
- return STATUS_ERROR;
- }
-
- strcpy (mGlobals.BaseName, Argv[1]);
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-oh") == 0) {
- //
- // -oh to specify output .h defines file name
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing output .h filename");
- return STATUS_ERROR;
- }
-
- strcpy (mGlobals.StringHFileName, Argv[1]);
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-skipext") == 0) {
- //
- // -skipext to skip scanning of files with certain filename extensions
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing filename extension");
- return STATUS_ERROR;
- }
- //
- // Allocate memory for a new list element, fill it in, and
- // add it to our list of excluded extensions. Always make sure it
- // has a "." as the first character.
- //
- NewList = malloc (sizeof (TEXT_STRING_LIST));
- if (NewList == NULL) {
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
-
- memset ((char *) NewList, 0, sizeof (TEXT_STRING_LIST));
- NewList->Str = malloc (strlen (Argv[1]) + 2);
- if (NewList->Str == NULL) {
- free (NewList);
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
-
- if (Argv[1][0] == '.') {
- strcpy (NewList->Str, Argv[1]);
- } else {
- NewList->Str[0] = '.';
- strcpy (NewList->Str + 1, Argv[1]);
- }
- //
- // Add it to our linked list
- //
- if (mGlobals.SkipExt == NULL) {
- mGlobals.SkipExt = NewList;
- } else {
- mGlobals.LastSkipExt->Next = NewList;
- }
-
- mGlobals.LastSkipExt = NewList;
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-lang") == 0) {
- //
- // "-lang eng" or "-lang spa+cat" to only output certain languages
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing language name");
- Usage ();
- return STATUS_ERROR;
- }
-
- if (AddCommandLineLanguage (Argv[1]) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- Argc--;
- Argv++;
- } else if (stricmp (Argv[0], "-od") == 0) {
- //
- // Output database file name -- check for another arg
- //
- if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (UTILITY_NAME, 0, 0, Argv[0], "missing output database file name");
- return STATUS_ERROR;
- }
-
- strcpy (mGlobals.OutputDatabaseFileName, Argv[1]);
- Argv++;
- Argc--;
- } else {
- //
- // Unrecognized arg
- //
- Error (UTILITY_NAME, 0, 0, Argv[0], "unrecognized option");
- Usage ();
- return STATUS_ERROR;
- }
-
- Argv++;
- Argc--;
- }
- //
- // Make sure they specified the mode parse/scan/dump
- //
- if (mGlobals.Mode == MODE_UNKNOWN) {
- Error (NULL, 0, 0, "must specify one of -parse/-scan/-dump", NULL);
- return STATUS_ERROR;
- }
- //
- // All modes require a database filename
- //
- if (mGlobals.DatabaseFileName == 0) {
- Error (NULL, 0, 0, "must specify a database filename using -db DbFileName", NULL);
- Usage ();
- return STATUS_ERROR;
- }
- //
- // If dumping the database file, then return immediately if all
- // parameters check out.
- //
- if (mGlobals.Mode == MODE_DUMP) {
- //
- // Not much use if they didn't specify -oh or -oc or -ou or -hpk
- //
- if ((mGlobals.DumpUFileName[0] == 0) &&
- (mGlobals.StringHFileName[0] == 0) &&
- (mGlobals.StringCFileName[0] == 0) &&
- (mGlobals.HiiExportPackFileName[0] == 0)
- ) {
- Error (NULL, 0, 0, "-dump without -oc/-oh/-ou/-hpk is a NOP", NULL);
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
- }
- //
- // Had to specify source string file and output string defines header filename.
- //
- if (mGlobals.Mode == MODE_SCAN) {
- if (Argc < 1) {
- Error (UTILITY_NAME, 0, 0, NULL, "must specify at least one source file to scan with -scan");
- Usage ();
- return STATUS_ERROR;
- }
- //
- // Get the list of filenames
- //
- while (Argc > 0) {
- NewList = malloc (sizeof (TEXT_STRING_LIST));
- if (NewList == NULL) {
- Error (UTILITY_NAME, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- memset (NewList, 0, sizeof (TEXT_STRING_LIST));
- NewList->Str = (CHAR8 *) malloc (strlen (Argv[0]) + 1);
- if (NewList->Str == NULL) {
- Error (UTILITY_NAME, 0, 0, "memory allocation failure", NULL);
- return STATUS_ERROR;
- }
-
- strcpy (NewList->Str, Argv[0]);
- if (mGlobals.ScanFileName == NULL) {
- mGlobals.ScanFileName = NewList;
- } else {
- mGlobals.LastScanFileName->Next = NewList;
- }
-
- mGlobals.LastScanFileName = NewList;
- Argc--;
- Argv++;
- }
- } else {
- //
- // Parse mode -- must specify an input unicode file name
- //
- if (Argc < 1) {
- Error (UTILITY_NAME, 0, 0, NULL, "must specify input unicode string file name with -parse");
- Usage ();
- return STATUS_ERROR;
- }
-
- strcpy (mGlobals.SourceFiles.FileName, Argv[0]);
- }
-
- return STATUS_SUCCESS;
-}
-//
-// Found "-lang eng,spa+cat" on the command line. Parse the
-// language list and save the setting for later processing.
-//
-static
-STATUS
-AddCommandLineLanguage (
- IN CHAR8 *Language
- )
-{
- WCHAR_STRING_LIST *WNewList;
- WCHAR *From;
- WCHAR *To;
- //
- // Keep processing the input string until we find the end.
- //
- while (*Language) {
- //
- // Allocate memory for a new list element, fill it in, and
- // add it to our list.
- //
- WNewList = MALLOC (sizeof (WCHAR_STRING_LIST));
- if (WNewList == NULL) {
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
-
- memset ((char *) WNewList, 0, sizeof (WCHAR_STRING_LIST));
- WNewList->Str = malloc ((strlen (Language) + 1) * sizeof (WCHAR));
- if (WNewList->Str == NULL) {
- free (WNewList);
- Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
- //
- // Copy it as unicode to our new structure. Then remove the
- // plus signs in it, and verify each language name is 3 characters
- // long. If we find a comma, then we're done with this group, so
- // break out.
- //
- UnicodeSPrint (WNewList->Str, (strlen (Language) + 1) * sizeof (WCHAR), L"%a", Language);
- From = To = WNewList->Str;
- while (*From) {
- if (*From == L',') {
- break;
- }
-
- if ((StrLen (From) < LANGUAGE_IDENTIFIER_NAME_LEN) ||
- (
- (From[LANGUAGE_IDENTIFIER_NAME_LEN] != 0) &&
- (From[LANGUAGE_IDENTIFIER_NAME_LEN] != UNICODE_PLUS_SIGN) &&
- (From[LANGUAGE_IDENTIFIER_NAME_LEN] != L',')
- )
- ) {
- Error (UTILITY_NAME, 0, 0, Language, "invalid format for language name on command line");
- FREE (WNewList->Str);
- FREE (WNewList);
- return STATUS_ERROR;
- }
-
- StrnCpy (To, From, LANGUAGE_IDENTIFIER_NAME_LEN);
- To += LANGUAGE_IDENTIFIER_NAME_LEN;
- From += LANGUAGE_IDENTIFIER_NAME_LEN;
- if (*From == L'+') {
- From++;
- }
- }
-
- *To = 0;
- //
- // Add it to our linked list
- //
- if (mGlobals.Language == NULL) {
- mGlobals.Language = WNewList;
- } else {
- mGlobals.LastLanguage->Next = WNewList;
- }
-
- mGlobals.LastLanguage = WNewList;
- //
- // Skip to next entry (comma-separated list)
- //
- while (*Language) {
- if (*Language == L',') {
- Language++;
- break;
- }
-
- Language++;
- }
- }
-
- return STATUS_SUCCESS;
-}
-//
-// The contents of the text file are expected to be (one per line)
-// STRING_IDENTIFIER_NAME ScopeName
-// For example:
-// STR_ID_MY_FAVORITE_STRING IBM
-//
-static
-STATUS
-ParseIndirectionFiles (
- TEXT_STRING_LIST *Files
- )
-{
- FILE *Fptr;
- CHAR8 Line[200];
- CHAR8 *StringName;
- CHAR8 *ScopeName;
- CHAR8 *End;
- UINT32 LineCount;
- WCHAR_MATCHING_STRING_LIST *NewList;
-
- Line[sizeof (Line) - 1] = 0;
- Fptr = NULL;
- while (Files != NULL) {
- Fptr = fopen (Files->Str, "r");
- LineCount = 0;
- if (Fptr == NULL) {
- Error (NULL, 0, 0, Files->Str, "failed to open input indirection file for reading");
- return STATUS_ERROR;
- }
-
- while (fgets (Line, sizeof (Line), Fptr) != NULL) {
- //
- // remove terminating newline for error printing purposes.
- //
- if (Line[strlen (Line) - 1] == '\n') {
- Line[strlen (Line) - 1] = 0;
- }
-
- LineCount++;
- if (Line[sizeof (Line) - 1] != 0) {
- Error (Files->Str, LineCount, 0, "line length exceeds maximum supported", NULL);
- goto Done;
- }
-
- StringName = Line;
- while (*StringName && (isspace (*StringName))) {
- StringName++;
- }
-
- if (*StringName) {
- if ((*StringName == '_') || isalpha (*StringName)) {
- End = StringName;
- while ((*End) && (*End == '_') || (isalnum (*End))) {
- End++;
- }
-
- if (isspace (*End)) {
- *End = 0;
- End++;
- while (isspace (*End)) {
- End++;
- }
-
- if (*End) {
- ScopeName = End;
- while (*End && !isspace (*End)) {
- End++;
- }
-
- *End = 0;
- //
- // Add the string name/scope pair
- //
- NewList = malloc (sizeof (WCHAR_MATCHING_STRING_LIST));
- if (NewList == NULL) {
- Error (NULL, 0, 0, "memory allocation error", NULL);
- goto Done;
- }
-
- memset (NewList, 0, sizeof (WCHAR_MATCHING_STRING_LIST));
- NewList->Str1 = (WCHAR *) malloc ((strlen (StringName) + 1) * sizeof (WCHAR));
- NewList->Str2 = (WCHAR *) malloc ((strlen (ScopeName) + 1) * sizeof (WCHAR));
- if ((NewList->Str1 == NULL) || (NewList->Str2 == NULL)) {
- Error (NULL, 0, 0, "memory allocation error", NULL);
- goto Done;
- }
-
- UnicodeSPrint (NewList->Str1, strlen (StringName) + 1, L"%a", StringName);
- UnicodeSPrint (NewList->Str2, strlen (ScopeName) + 1, L"%a", ScopeName);
- if (mGlobals.IndirectionList == NULL) {
- mGlobals.IndirectionList = NewList;
- } else {
- mGlobals.LastIndirectionList->Next = NewList;
- }
-
- mGlobals.LastIndirectionList = NewList;
- } else {
- Error (Files->Str, LineCount, 0, StringName, "invalid line : expected 'StringIdentifier Scope'");
- goto Done;
- }
- } else {
- Error (Files->Str, LineCount, 0, StringName, "invalid line : expected 'StringIdentifier Scope'");
- goto Done;
- }
- } else {
- Error (Files->Str, LineCount, 0, StringName, "invalid string identifier");
- goto Done;
- }
- }
- }
-
- fclose (Fptr);
- Fptr = NULL;
- Files = Files->Next;
- }
-
-Done:
- if (Fptr != NULL) {
- fclose (Fptr);
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-ScanFiles (
- TEXT_STRING_LIST *ScanFiles
- )
-{
- char Line[MAX_LINE_LEN];
- FILE *Fptr;
- UINT32 LineNum;
- char *Cptr;
- char *SavePtr;
- char *TermPtr;
- char *StringTokenPos;
- TEXT_STRING_LIST *SList;
- BOOLEAN SkipIt;
-
- //
- // Put a null-terminator at the end of the line. If we read in
- // a line longer than we support, then we can catch it.
- //
- Line[MAX_LINE_LEN - 1] = 0;
- //
- // Process each file. If they gave us a skip extension list, then
- // skip it if the extension matches.
- //
- while (ScanFiles != NULL) {
- SkipIt = FALSE;
- for (SList = mGlobals.SkipExt; SList != NULL; SList = SList->Next) {
- if ((strlen (ScanFiles->Str) > strlen (SList->Str)) &&
- (strcmp (ScanFiles->Str + strlen (ScanFiles->Str) - strlen (SList->Str), SList->Str) == 0)
- ) {
- SkipIt = TRUE;
- //
- // printf ("Match: %s : %s\n", ScanFiles->Str, SList->Str);
- //
- break;
- }
- }
-
- if (!SkipIt) {
- if (mGlobals.VerboseScan) {
- printf ("Scanning %s\n", ScanFiles->Str);
- }
-
- Fptr = fopen (ScanFiles->Str, "r");
- if (Fptr == NULL) {
- Error (NULL, 0, 0, ScanFiles->Str, "failed to open input file for scanning");
- return STATUS_ERROR;
- }
-
- LineNum = 0;
- while (fgets (Line, sizeof (Line), Fptr) != NULL) {
- LineNum++;
- if (Line[MAX_LINE_LEN - 1] != 0) {
- Error (ScanFiles->Str, LineNum, 0, "line length exceeds maximum supported by tool", NULL);
- fclose (Fptr);
- return STATUS_ERROR;
- }
- //
- // Remove the newline from the input line so we can print a warning message
- //
- if (Line[strlen (Line) - 1] == '\n') {
- Line[strlen (Line) - 1] = 0;
- }
- //
- // Terminate the line at // comments
- //
- Cptr = strstr (Line, "//");
- if (Cptr != NULL) {
- *Cptr = 0;
- }
-
- Cptr = Line;
- while ((Cptr = strstr (Cptr, STRING_TOKEN)) != NULL) {
- //
- // Found "STRING_TOKEN". Make sure we don't have NUM_STRING_TOKENS or
- // something like that. Then make sure it's followed by
- // an open parenthesis, a string identifier, and then a closing
- // parenthesis.
- //
- if (mGlobals.VerboseScan) {
- printf (" %d: %s", LineNum, Cptr);
- }
-
- if (((Cptr == Line) || (!IsValidIdentifierChar (*(Cptr - 1), FALSE))) &&
- (!IsValidIdentifierChar (*(Cptr + sizeof (STRING_TOKEN) - 1), FALSE))
- ) {
- StringTokenPos = Cptr;
- SavePtr = Cptr;
- Cptr += strlen (STRING_TOKEN);
- while (*Cptr && isspace (*Cptr) && (*Cptr != '(')) {
- Cptr++;
- }
-
- if (*Cptr != '(') {
- Warning (ScanFiles->Str, LineNum, 0, StringTokenPos, "expected "STRING_TOKEN "(identifier)");
- } else {
- //
- // Skip over the open-parenthesis and find the next non-blank character
- //
- Cptr++;
- while (isspace (*Cptr)) {
- Cptr++;
- }
-
- SavePtr = Cptr;
- if ((*Cptr == '_') || isalpha (*Cptr)) {
- while ((*Cptr == '_') || (isalnum (*Cptr))) {
- Cptr++;
- }
-
- TermPtr = Cptr;
- while (*Cptr && isspace (*Cptr)) {
- Cptr++;
- }
-
- if (*Cptr != ')') {
- Warning (ScanFiles->Str, LineNum, 0, StringTokenPos, "expected "STRING_TOKEN "(identifier)");
- }
-
- if (*TermPtr) {
- *TermPtr = 0;
- Cptr = TermPtr + 1;
- } else {
- Cptr = TermPtr;
- }
- //
- // Add the string identifier to the list of used strings
- //
- ParserSetPosition (ScanFiles->Str, LineNum);
- StringDBSetStringReferenced (SavePtr, mGlobals.IgnoreNotFound);
- if (mGlobals.VerboseScan) {
- printf ("...referenced %s", SavePtr);
- }
- } else {
- Warning (ScanFiles->Str, LineNum, 0, StringTokenPos, "expected valid string identifier name");
- }
- }
- } else {
- //
- // Found it, but it's a substring of something else. Advance our pointer.
- //
- Cptr++;
- }
-
- if (mGlobals.VerboseScan) {
- printf ("\n");
- }
- }
- }
-
- fclose (Fptr);
- } else {
- //
- // Skipping this file type
- //
- if (mGlobals.VerboseScan) {
- printf ("Skip scanning of %s\n", ScanFiles->Str);
- }
- }
-
- ScanFiles = ScanFiles->Next;
- }
-
- return STATUS_SUCCESS;
-}
-//
-// Free the global string lists we allocated memory for
-//
-static
-void
-FreeLists (
- VOID
- )
-{
- TEXT_STRING_LIST *Temp;
- WCHAR_STRING_LIST *WTemp;
-
- //
- // Traverse the include paths, freeing each
- //
- while (mGlobals.IncludePaths != NULL) {
- Temp = mGlobals.IncludePaths->Next;
- free (mGlobals.IncludePaths->Str);
- free (mGlobals.IncludePaths);
- mGlobals.IncludePaths = Temp;
- }
- //
- // If we did a scan, then free up our
- // list of files to scan.
- //
- while (mGlobals.ScanFileName != NULL) {
- Temp = mGlobals.ScanFileName->Next;
- free (mGlobals.ScanFileName->Str);
- free (mGlobals.ScanFileName);
- mGlobals.ScanFileName = Temp;
- }
- //
- // If they gave us a list of filename extensions to
- // skip on scan, then free them up.
- //
- while (mGlobals.SkipExt != NULL) {
- Temp = mGlobals.SkipExt->Next;
- free (mGlobals.SkipExt->Str);
- free (mGlobals.SkipExt);
- mGlobals.SkipExt = Temp;
- }
- //
- // Free up any languages specified
- //
- while (mGlobals.Language != NULL) {
- WTemp = mGlobals.Language->Next;
- free (mGlobals.Language->Str);
- free (mGlobals.Language);
- mGlobals.Language = WTemp;
- }
- //
- // Free up our indirection list
- //
- while (mGlobals.IndirectionList != NULL) {
- mGlobals.LastIndirectionList = mGlobals.IndirectionList->Next;
- free (mGlobals.IndirectionList->Str1);
- free (mGlobals.IndirectionList->Str2);
- free (mGlobals.IndirectionList);
- mGlobals.IndirectionList = mGlobals.LastIndirectionList;
- }
-
- while (mGlobals.IndirectionFileName != NULL) {
- mGlobals.LastIndirectionFileName = mGlobals.IndirectionFileName->Next;
- free (mGlobals.IndirectionFileName->Str);
- free (mGlobals.IndirectionFileName);
- mGlobals.IndirectionFileName = mGlobals.LastIndirectionFileName;
- }
-}
-
-static
-BOOLEAN
-IsValidIdentifierChar (
- CHAR8 Char,
- BOOLEAN FirstChar
- )
-{
- //
- // If it's the first character of an identifier, then
- // it must be one of [A-Za-z_].
- //
- if (FirstChar) {
- if (isalpha (Char) || (Char == '_')) {
- return TRUE;
- }
- } else {
- //
- // If it's not the first character, then it can
- // be one of [A-Za-z_0-9]
- //
- if (isalnum (Char) || (Char == '_')) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static
-void
-RewindFile (
- SOURCE_FILE *SourceFile
- )
-{
- SourceFile->LineNum = 1;
- SourceFile->FileBufferPtr = SourceFile->FileBuffer;
- SourceFile->EndOfFile = 0;
-}
-
-static
-BOOLEAN
-SkipTo (
- SOURCE_FILE *SourceFile,
- WCHAR WChar,
- BOOLEAN StopAfterNewline
- )
-{
- while (!EndOfFile (SourceFile)) {
- //
- // Check for the character of interest
- //
- if (SourceFile->FileBufferPtr[0] == WChar) {
- return TRUE;
- } else {
- if (SourceFile->FileBufferPtr[0] == UNICODE_LF) {
- SourceFile->LineNum++;
- if (StopAfterNewline) {
- SourceFile->FileBufferPtr++;
- if (SourceFile->FileBufferPtr[0] == 0) {
- SourceFile->FileBufferPtr++;
- }
-
- return FALSE;
- }
- }
-
- SourceFile->FileBufferPtr++;
- }
- }
-
- return FALSE;
-}
-
-static
-void
-Version (
- VOID
- )
-/*++
-
-Routine Description:
-
- Displays the standard utility information to SDTOUT
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -Utility to process unicode strings file..\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-static
-void
-Usage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Print usage information for this utility.
-
-Arguments:
-
- None.
-
-Returns:
-
- Nothing.
-
---*/
-{
- int Index;
- static const char *Str[] = {
- "",
- " Usage: "UTILITY_NAME " -parse {parse options} [FileNames]",
- " "UTILITY_NAME " -scan {scan options} [FileName]",
- " "UTILITY_NAME " -dump {dump options}",
- " Common options include:",
- " -h,--help,-?,/? display help messages",
- " -V,--version display version information",
- " -db Database required name of output/input database file",
- " -bn BaseName for use in the .h and .c output files",
- " Default = "DEFAULT_BASE_NAME,
- " -v for verbose output",
- " -vdbw for verbose output when writing database",
- " -vdbr for verbose output when reading database",
- " -od FileName to specify an output database file name",
- " Parse options include:",
- " -i IncludePath add IncludePath to list of search paths",
- " -newdb to not read in existing database file",
- " -uqs to indicate that unquoted strings are used",
- " FileNames name of one or more unicode files to parse",
- " Scan options include:",
- " -scan scan text file(s) for STRING_TOKEN() usage",
- " -skipext .ext to skip scan of files with .ext filename extension",
- " -ignorenotfound ignore if a given STRING_TOKEN(STR) is not ",
- " found in the database",
- " FileNames one or more files to scan",
- " Dump options include:",
- " -oc FileName write string data to FileName",
- " -oh FileName write string defines to FileName",
- " -ou FileName dump database to unicode file FileName",
- " -lang Lang only dump for the language 'Lang'",
- " -if FileName to specify an indirection file",
- " -hpk FileName to create an HII export pack of the strings",
- "",
- " The expected process is to parse a unicode string file to create an initial",
- " database of string identifier names and string definitions. Then text files",
- " should be scanned for STRING_TOKEN() usages, and the referenced",
- " strings will be tagged as used in the database. After all files have been",
- " scanned, then the database should be dumped to create the necessary output",
- " files.",
- "",
- NULL
- };
-
- Version();
-
- for (Index = 0; Str[Index] != NULL; Index++) {
- fprintf (stdout, "%s\n", Str[Index]);
- }
-}
diff --git a/Tools/CCode/Source/StrGather/StrGather.h b/Tools/CCode/Source/StrGather/StrGather.h
deleted file mode 100644
index 40a0386ae7..0000000000
--- a/Tools/CCode/Source/StrGather/StrGather.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*++
-
-Copyright (c) 2004-2007, 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.
-
-Module Name:
-
- StrGather.h
-
-Abstract:
-
- Common defines and prototypes for StrGather.
-
---*/
-
-#ifndef _STR_GATHER_H_
-#define _STR_GATHER_H_
-
-#define MALLOC(size) malloc (size)
-#define FREE(ptr) free (ptr)
-
-#define UTILITY_NAME "StrGather"
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 31
-
-
-typedef CHAR16 WCHAR;
-
-#define UNICODE_TO_ASCII(w) (INT8) ((w) & 0xFF)
-#define ASCII_TO_UNICODE(a) (WCHAR) ((UINT8) (a))
-
-#define UNICODE_HASH L'#'
-#define UNICODE_BACKSLASH L'\\'
-#define UNICODE_SLASH L'/'
-#define UNICODE_EQUAL_SIGN L'='
-#define UNICODE_PLUS_SIGN L'+'
-
-#define UNICODE_FILE_START 0xFEFF
-#define UNICODE_CR 0x000D
-#define UNICODE_LF 0x000A
-#define UNICODE_NULL 0x0000
-#define UNICODE_SPACE L' '
-#define UNICODE_SLASH L'/'
-#define UNICODE_DOUBLE_QUOTE L'"'
-#define UNICODE_Z L'Z'
-#define UNICODE_z L'z'
-#define UNICODE_A L'A'
-#define UNICODE_a L'a'
-#define UNICODE_F L'F'
-#define UNICODE_f L'f'
-#define UNICODE_UNDERSCORE L'_'
-#define UNICODE_0 L'0'
-#define UNICODE_9 L'9'
-#define UNICODE_TAB L'\t'
-#define UNICODE_NBR_STRING L"\\nbr"
-#define UNICODE_BR_STRING L"\\br"
-#define UNICODE_WIDE_STRING L"\\wide"
-#define UNICODE_NARROW_STRING L"\\narrow"
-
-//
-// This is the length of a valid string identifier
-//
-#define LANGUAGE_IDENTIFIER_NAME_LEN 3
-
-typedef struct _TEXT_STRING_LIST {
- struct _TEXT_STRING_LIST *Next;
- CHAR8 *Str;
-} TEXT_STRING_LIST;
-
-typedef struct _WCHAR_STRING_LIST {
- struct _WCHAR_STRING_LIST *Next;
- WCHAR *Str;
-} WCHAR_STRING_LIST;
-
-typedef struct _WCHAR_MATCHING_STRING_LIST {
- struct _WCHAR_MATCHING_STRING_LIST *Next;
- WCHAR *Str1;
- WCHAR *Str2;
-} WCHAR_MATCHING_STRING_LIST;
-
-#endif // #ifndef _STR_GATHER_H_
diff --git a/Tools/CCode/Source/StrGather/StringDB.c b/Tools/CCode/Source/StrGather/StringDB.c
deleted file mode 100644
index 16ef0526d7..0000000000
--- a/Tools/CCode/Source/StrGather/StringDB.c
+++ /dev/null
@@ -1,2759 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- StringDB.c
-
-Abstract:
-
- String database implementation
-
---*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h> // for tolower()
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/MultiPhase.h>
-#include <Common/InternalFormRepresentation.h>
-#include <Protocol/UgaDraw.h> // for EFI_UGA_PIXEL definition
-#include <Protocol/Hii.h>
-
-#include "EfiUtilityMsgs.h"
-#include "StrGather.h"
-#include "StringDB.h"
-
-
-#define STRING_OFFSET RELOFST
-
-#define STRING_DB_KEY (('S' << 24) | ('D' << 16) | ('B' << 8) | 'K')
-//
-// Version supported by this tool
-//
-#define STRING_DB_VERSION 0x00010000
-
-#define STRING_DB_MAJOR_VERSION_MASK 0xFFFF0000
-#define STRING_DB_MINOR_VERSION_MASK 0x0000FFFF
-
-#define DEFINE_STR L"// #define"
-
-#define LANGUAGE_CODE_WIDTH 4
-//
-// This is the header that gets written to the top of the
-// output binary database file.
-//
-typedef struct {
- UINT32 Key;
- UINT32 HeaderSize;
- UINT32 Version;
- UINT32 NumStringIdenfiers;
- UINT32 StringIdentifiersSize;
- UINT32 NumLanguages;
-} STRING_DB_HEADER;
-
-//
-// When we write out data to the database, we have a UINT16 identifier, which
-// indicates what follows, followed by the data. Here's the structure.
-//
-typedef struct {
- UINT16 DataType;
- UINT16 Reserved;
-} DB_DATA_ITEM_HEADER;
-
-#define DB_DATA_TYPE_INVALID 0x0000
-#define DB_DATA_TYPE_STRING_IDENTIFIER 0x0001
-#define DB_DATA_TYPE_LANGUAGE_DEFINITION 0x0002
-#define DB_DATA_TYPE_STRING_DEFINITION 0x0003
-#define DB_DATA_TYPE_LAST DB_DATA_TYPE_STRING_DEFINITION
-
-//
-// We have to keep track of a list of languages, each of which has its own
-// list of strings. Define a structure to keep track of all languages and
-// their list of strings.
-//
-typedef struct _STRING_LIST {
- struct _STRING_LIST *Next;
- UINT32 Size; // number of bytes in string, including null terminator
- WCHAR *LanguageName;
- WCHAR *StringName; // for example STR_ID_TEXT1
- WCHAR *Scope; //
- WCHAR *Str; // the actual string
- UINT16 Flags; // properties of this string (used, undefined)
-} STRING_LIST;
-
-typedef struct _LANGUAGE_LIST {
- struct _LANGUAGE_LIST *Next;
- WCHAR LanguageName[4];
- WCHAR *PrintableLanguageName;
- STRING_LIST *String;
- STRING_LIST *LastString;
-} LANGUAGE_LIST;
-
-//
-// We also keep track of all the string identifier names, which we assign unique
-// values to. Create a structure to keep track of them all.
-//
-typedef struct _STRING_IDENTIFIER {
- struct _STRING_IDENTIFIER *Next;
- UINT32 Index; // only need 16 bits, but makes it easier with UINT32
- WCHAR *StringName;
- UINT16 Flags; // if someone referenced it via STRING_TOKEN()
-} STRING_IDENTIFIER;
-//
-// Keep our globals in this structure to be as modular as possible.
-//
-typedef struct {
- FILE *StringDBFptr;
- LANGUAGE_LIST *LanguageList;
- LANGUAGE_LIST *LastLanguageList;
- LANGUAGE_LIST *CurrentLanguage; // keep track of the last language they used
- STRING_IDENTIFIER *StringIdentifier;
- STRING_IDENTIFIER *LastStringIdentifier;
- UINT8 *StringDBFileName;
- UINT32 NumStringIdentifiers;
- UINT32 NumStringIdentifiersReferenced;
- STRING_IDENTIFIER *CurrentStringIdentifier; // keep track of the last string identifier they added
- WCHAR *CurrentScope;
-} STRING_DB_DATA;
-
-static STRING_DB_DATA mDBData;
-
-static const char *mSourceFileHeader[] = {
- "//",
- "// DO NOT EDIT -- auto-generated file",
- "//",
- "// This file is generated by the string gather utility",
- "//",
- NULL
-};
-
-static
-STRING_LIST *
-StringDBFindString (
- WCHAR *LanguageName,
- WCHAR *StringName,
- WCHAR *Scope,
- WCHAR_STRING_LIST *LanguagesOfInterest,
- WCHAR_MATCHING_STRING_LIST *IndirectionList
- );
-
-static
-STRING_IDENTIFIER *
-StringDBFindStringIdentifierByName (
- WCHAR *Name
- );
-
-static
-STRING_IDENTIFIER *
-StringDBFindStringIdentifierByIndex (
- UINT32 Index
- );
-
-static
-LANGUAGE_LIST *
-StringDBFindLanguageList (
- WCHAR *LanguageName
- );
-
-static
-void
-StringDBWriteStandardFileHeader (
- FILE *OutFptr
- );
-
-static
-WCHAR *
-AsciiToWchar (
- CHAR8 *Str
- );
-
-static
-WCHAR *
-DuplicateString (
- WCHAR *Str
- );
-
-static
-STATUS
-StringDBWriteStringIdentifier (
- FILE *DBFptr,
- UINT16 StringId,
- UINT16 Flags,
- WCHAR *IdentifierName
- );
-
-static
-STATUS
-StringDBReadStringIdentifier (
- FILE *DBFptr
- );
-
-static
-STATUS
-StringDBWriteLanguageDefinition (
- FILE *DBFptr,
- WCHAR *LanguageName,
- WCHAR *PrintableLanguageName
- );
-
-static
-STATUS
-StringDBReadLanguageDefinition (
- FILE *DBFptr
- );
-
-static
-STATUS
-StringDBWriteString (
- FILE *DBFptr,
- UINT16 Flags,
- WCHAR *Language,
- WCHAR *StringName,
- WCHAR *Scope,
- WCHAR *Str
- );
-
-static
-STATUS
-StringDBReadString (
- FILE *DBFptr
- );
-
-static
-STATUS
-StringDBReadGenericString (
- FILE *DBFptr,
- UINT16 *Size,
- WCHAR **Str
- );
-
-static
-STATUS
-StringDBWriteGenericString (
- FILE *DBFptr,
- WCHAR *Str
- );
-
-static
-void
-StringDBAssignStringIndexes (
- VOID
- );
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
- Constructor function for the string database handler.
-
-Arguments:
- None.
-
-Returns:
- None.
-
---*/
-void
-StringDBConstructor (
- VOID
- )
-{
- memset ((char *) &mDBData, 0, sizeof (STRING_DB_DATA));
- mDBData.CurrentScope = DuplicateString (L"NULL");
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
- Destructor function for the string database handler.
-
-Arguments:
- None.
-
-Returns:
- None.
-
---*/
-void
-StringDBDestructor (
- VOID
- )
-{
- LANGUAGE_LIST *NextLang;
- STRING_LIST *NextStr;
- STRING_IDENTIFIER *NextIdentifier;
- //
- // Close the database file if it's open
- //
- if (mDBData.StringDBFptr != NULL) {
- fclose (mDBData.StringDBFptr);
- mDBData.StringDBFptr = NULL;
- }
- //
- // If we've allocated any strings/languages, free them up
- //
- while (mDBData.LanguageList != NULL) {
- NextLang = mDBData.LanguageList->Next;
- //
- // Free up all strings for this language
- //
- while (mDBData.LanguageList->String != NULL) {
- NextStr = mDBData.LanguageList->String->Next;
- FREE (mDBData.LanguageList->String->Str);
- FREE (mDBData.LanguageList->String);
- mDBData.LanguageList->String = NextStr;
- }
-
- FREE (mDBData.LanguageList->PrintableLanguageName);
- FREE (mDBData.LanguageList);
- mDBData.LanguageList = NextLang;
- }
- //
- // Free up string identifiers
- //
- while (mDBData.StringIdentifier != NULL) {
- NextIdentifier = mDBData.StringIdentifier->Next;
- FREE (mDBData.StringIdentifier->StringName);
- FREE (mDBData.StringIdentifier);
- mDBData.StringIdentifier = NextIdentifier;
- }
- //
- // Free the filename
- //
- if (mDBData.StringDBFileName != NULL) {
- FREE (mDBData.StringDBFileName);
- mDBData.StringDBFileName = NULL;
- }
- //
- // We save a copy of the scope, so free it up if we
- // have one.
- //
- if (mDBData.CurrentScope != NULL) {
- FREE (mDBData.CurrentScope);
- mDBData.CurrentScope = NULL;
- }
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Dump the contents of a database to an output C file.
-
-Arguments:
-
- FileName - name of the output file to write
- BaseName - used for the name of the C array defined
- Languages - list of languages of interest
-
-Returns:
-
- STATUS
-
-Notes:
-
- Languages is a pointer to a linked list of languages specified on
- the command line. Format is "eng" and "spa+cat". For this, print
- the strings for eng. Print the strings for spa too, but if one is
- missing look for a cat string and print if it it exists.
-
---*/
-STATUS
-StringDBDumpCStrings (
- CHAR8 *FileName,
- CHAR8 *BaseName,
- WCHAR_STRING_LIST *LanguagesOfInterest,
- WCHAR_MATCHING_STRING_LIST *IndirectionList
- )
-{
- FILE *Fptr;
- LANGUAGE_LIST *Lang;
- STRING_LIST *CurrString;
- STRING_LIST EmptyString;
- UINT32 Offset;
- UINT32 StringIndex;
- UINT32 TempIndex;
- UINT32 BytesThisLine;
- EFI_HII_STRING_PACK StringPack;
- UINT8 *Ptr;
- UINT32 Len;
- WCHAR ZeroString[1];
- WCHAR_STRING_LIST *LOIPtr;
- BOOLEAN LanguageOk;
- WCHAR *TempStringPtr;
- WCHAR *LangName;
- STRING_IDENTIFIER *StringIdentifier;
- WCHAR Line[200];
-
- if ((Fptr = fopen (FileName, "w")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open output C string file");
- return STATUS_ERROR;
- }
- //
- // Assign index values to the string identifiers
- //
- StringDBAssignStringIndexes ();
- //
- // Write the standard header to the output file, then the structure
- // definition header.
- //
- StringDBWriteStandardFileHeader (Fptr);
- fprintf (Fptr, "\nunsigned char %s[] = {\n", BaseName);
- //
- // If a given string is not defined, then we'll use this one.
- //
- memset (&EmptyString, 0, sizeof (EmptyString));
- EmptyString.Size = sizeof (ZeroString);
- EmptyString.Str = ZeroString;
- //
- // Process each language, then each string for each langage
- //
- ZeroString[0] = 0;
- for (Lang = mDBData.LanguageList; Lang != NULL; Lang = Lang->Next) {
- //
- // If we have a language list, then make sure this language is in that
- // list.
- //
- LanguageOk = TRUE;
- LangName = Lang->LanguageName;
- if (LanguagesOfInterest != NULL) {
- LanguageOk = FALSE;
- for (LOIPtr = LanguagesOfInterest; LOIPtr != NULL; LOIPtr = LOIPtr->Next) {
- if (StrnCmp (LOIPtr->Str, Lang->LanguageName, LANGUAGE_IDENTIFIER_NAME_LEN) == 0) {
- LangName = LOIPtr->Str;
- LanguageOk = TRUE;
- break;
- }
- }
- }
-
- if (!LanguageOk) {
- continue;
- }
- //
- // Process each string for this language. We have to make 3 passes on the strings:
- // Pass1: computes sizes and fill in the string pack header
- // Pass2: write the array of offsets
- // Pass3: write the strings
- //
- //
- // PASS 1: Fill in and print the HII string pack header
- //
- // Compute the size for this language package and write
- // the header out. Each string package contains:
- // Header
- // Offset[] -- an array of offsets to strings, of type RELOFST each
- // String[] -- the actual strings themselves
- //
- AsciiSPrint ( Line, sizeof(Line),
- "\n//******************************************************************************"
- "\n// Start of string definitions for %s/%s",
- Lang->LanguageName,
- Lang->PrintableLanguageName
- );
- fprintf (Fptr, "%s", Line);
- memset ((char *) &StringPack, 0, sizeof (EFI_HII_STRING_PACK));
- StringPack.Header.Type = EFI_HII_STRING;
- StringPack.NumStringPointers = (UINT16) mDBData.NumStringIdentifiersReferenced;
- //
- // First string is the language name. If we're printing all languages, then
- // it's just the "spa". If we were given a list of languages to print, then it's
- // the "spacat" string. Compute its offset and fill in
- // the info in the header. Since we know the language name string's length,
- // and the printable language name follows it, use that info to fill in the
- // entry for the printable language name as well.
- //
- StringPack.LanguageNameString = (STRING_OFFSET) (sizeof (EFI_HII_STRING_PACK) + (mDBData.NumStringIdentifiersReferenced * sizeof (STRING_OFFSET)));
- StringPack.PrintableLanguageName = (STRING_OFFSET) (StringPack.LanguageNameString + (StrLen (LangName) + 1) * sizeof (WCHAR));
- //
- // Add up the size of all strings so we can fill in our header.
- //
- Len = 0;
- for (StringIndex = 0; StringIndex < mDBData.NumStringIdentifiersReferenced; StringIndex++) {
- //
- // For the first string (language name), we print out the "spacat" if they
- // requested it. We set LangName to point to the proper language name string above.
- //
- if (StringIndex == STRING_ID_LANGUAGE_NAME) {
- Len += (StrLen (LangName) + 1) * sizeof (WCHAR);
- } else {
- //
- // Find a string with this language.stringname
- //
- StringIdentifier = StringDBFindStringIdentifierByIndex (StringIndex);
- if (StringIdentifier == NULL) {
- Error (NULL, 0, 0, "internal error", "invalid string index 0x%X", StringIndex);
- return STATUS_ERROR;
- }
- //
- // Find a matching string if this string identifier was referenced
- //
- EmptyString.Flags = STRING_FLAGS_UNDEFINED;
- CurrString = NULL;
- if (StringIdentifier->Flags & STRING_FLAGS_REFERENCED) {
- CurrString = StringDBFindString (
- Lang->LanguageName,
- StringIdentifier->StringName,
- NULL,
- LanguagesOfInterest,
- IndirectionList
- );
- if (NULL == CurrString) {
- //
- // If string for Lang->LanguageName is not found, try to get an English version
- //
- CurrString = StringDBFindString (
- L"eng",
- StringIdentifier->StringName,
- NULL,
- LanguagesOfInterest,
- IndirectionList
- );
- }
- }
-
- if (CurrString == NULL) {
- CurrString = &EmptyString;
- EmptyString.Flags |= StringIdentifier->Flags;
- }
-
- Len += CurrString->Size;
- }
- }
- StringPack.Header.Length = sizeof (EFI_HII_STRING_PACK)
- + mDBData.NumStringIdentifiersReferenced * sizeof (STRING_OFFSET)
- + Len;
- //
- // Write out the header one byte at a time
- //
- Ptr = (UINT8 *) &StringPack;
- for (TempIndex = 0; TempIndex < sizeof (EFI_HII_STRING_PACK); TempIndex++, Ptr++) {
- if ((TempIndex & 0x07) == 0) {
- fprintf (Fptr, "\n ");
- }
-
- fprintf (Fptr, "0x%02X, ", (UINT32) *Ptr);
- }
-
- fprintf (Fptr, "\n // offset 0x%X\n", sizeof (StringPack));
- //
- // PASS2 : write the offsets
- //
- // Traverse the list of strings again and write the array of offsets. The
- // offset to the first string is the size of the string pack header
- // plus the size of the offsets array. The other strings follow it.
- //
- StringIndex = 0;
- Offset = sizeof (StringPack) + mDBData.NumStringIdentifiersReferenced * sizeof (STRING_OFFSET);
- for (StringIndex = 0; StringIndex < mDBData.NumStringIdentifiersReferenced; StringIndex++) {
- //
- // Write the offset, followed by a useful comment
- //
- fprintf (Fptr, " ");
- Ptr = (UINT8 *) &Offset;
- for (TempIndex = 0; TempIndex < sizeof (STRING_OFFSET); TempIndex++) {
- fprintf (Fptr, "0x%02X, ", (UINT32) Ptr[TempIndex]);
- }
- //
- // Find the string name
- //
- StringIdentifier = StringDBFindStringIdentifierByIndex (StringIndex);
- if (StringIdentifier == NULL) {
- Error (NULL, 0, 0, "internal error", "invalid string index 0x%X", StringIndex);
- return STATUS_ERROR;
- }
-
- AsciiSPrint (Line, sizeof(Line) , " // offset to string %s (0x%04X)", StringIdentifier->StringName, StringIndex);
- fprintf (Fptr, "%s", Line);
- //
- // For the first string (language name), we print out the "spacat" if they
- // requested it. We set LangName to point to the proper language name string above.
- //
- if (StringIndex == STRING_ID_LANGUAGE_NAME) {
- Offset += (StrLen (LangName) + 1) * sizeof (WCHAR);
- CurrString = StringDBFindString (
- Lang->LanguageName,
- StringIdentifier->StringName,
- NULL, // scope
- NULL,
- NULL
- );
- } else {
- //
- // Find a matching string
- //
- CurrString = StringDBFindString (
- Lang->LanguageName,
- StringIdentifier->StringName,
- NULL, // scope
- LanguagesOfInterest,
- IndirectionList
- );
-
- if (NULL == CurrString) {
- CurrString = StringDBFindString (
- L"eng",
- StringIdentifier->StringName,
- NULL, // scope
- LanguagesOfInterest,
- IndirectionList
- );
- }
-
- EmptyString.LanguageName = Lang->LanguageName;
- if (CurrString == NULL) {
- CurrString = &EmptyString;
- EmptyString.Flags = STRING_FLAGS_UNDEFINED;
- } else if ((StringIdentifier->Flags & STRING_FLAGS_REFERENCED) == 0) {
- CurrString = &EmptyString;
- EmptyString.Flags = 0;
- }
-
- Offset += CurrString->Size;
- }
- //
- // Print useful info about this string
- //
- if ((StringIdentifier->Flags & STRING_FLAGS_REFERENCED) == 0) {
- fprintf (Fptr, " - not referenced");
- }
-
- if (CurrString->Flags & STRING_FLAGS_UNDEFINED) {
- fprintf (Fptr, " - not defined for this language");
- } else if (StrCmp (CurrString->LanguageName, Lang->LanguageName) != 0) {
- AsciiSPrint (
- Line, sizeof(Line),
- " - not defined for this language -- using secondary language %s definition",
- CurrString->LanguageName
- );
- fprintf ( Fptr, "%s", Line);
- }
-
- fprintf (Fptr, "\n");
- }
- //
- // For unreferenced string identifiers, print a message that they are not referenced anywhere
- //
- while (StringIndex < mDBData.NumStringIdentifiers) {
- StringIdentifier = StringDBFindStringIdentifierByIndex (StringIndex);
- if (StringIdentifier != NULL) {
- AsciiSPrint (Line, sizeof(Line), " // %s not referenced\n", StringIdentifier->StringName);
- fprintf (Fptr, "%s", Line);
- }
-
- StringIndex++;
- }
-
- //
- // PASS 3: write the strings themselves.
- // Keep track of how many bytes we write per line because some editors
- // (Visual Studio for instance) can't handle too long of lines.
- //
- Offset = sizeof (StringPack) + mDBData.NumStringIdentifiersReferenced * sizeof (STRING_OFFSET);
- for (StringIndex = 0; StringIndex < mDBData.NumStringIdentifiersReferenced; StringIndex++) {
- StringIdentifier = StringDBFindStringIdentifierByIndex (StringIndex);
- if (StringIdentifier == NULL) {
- Error (NULL, 0, 0, "internal error", "invalid string index 0x%X", StringIndex);
- return STATUS_ERROR;
- }
-
- AsciiSPrint (Line, sizeof(Line), " // string %s offset 0x%08X\n ", StringIdentifier->StringName, Offset);
- fprintf (Fptr, "%s", Line);
- //
- // For the first string (language name), we print out the "spacat" if they
- // requested it. We set LangName to point to the proper language name string above.
- //
- if (StringIndex == STRING_ID_LANGUAGE_NAME) {
- TempStringPtr = LangName;
- } else {
- //
- // Find a matching string if this string identifier was referenced
- //
- CurrString = NULL;
- if (StringIdentifier->Flags & STRING_FLAGS_REFERENCED) {
- CurrString = StringDBFindString (
- Lang->LanguageName,
- StringIdentifier->StringName,
- NULL, // scope
- LanguagesOfInterest,
- IndirectionList
- );
- if (NULL == CurrString) {
- CurrString = StringDBFindString (
- L"eng",
- StringIdentifier->StringName,
- NULL, // scope
- LanguagesOfInterest,
- IndirectionList
- );
- }
- }
-
- if (CurrString == NULL) {
- CurrString = &EmptyString;
- }
-
- TempStringPtr = CurrString->Str;
- }
-
- BytesThisLine = 0;
- for (TempIndex = 0; TempStringPtr[TempIndex] != 0; TempIndex++) {
- fprintf (
- Fptr,
- "0x%02X, 0x%02X, ",
- (UINT32) TempStringPtr[TempIndex] & 0xFF,
- (UINT32) ((TempStringPtr[TempIndex] >> 8) & 0xFF)
- );
- BytesThisLine += 2;
- Offset += 2;
- //
- // Let's say we only allow 14 per line
- //
- if (BytesThisLine > 14) {
- fprintf (Fptr, "\n ");
- BytesThisLine = 0;
- }
- }
- //
- // Print NULL WCHAR at the end of this string.
- //
- fprintf (Fptr, "0x00, 0x00,\n");
- Offset += 2;
- }
- //
- // Sanity check the offset. Make sure our running offset is what we put in the
- // string pack header.
- //
- if (StringPack.Header.Length != Offset) {
- Error (
- __FILE__,
- __LINE__,
- 0,
- "application error",
- "stringpack size 0x%X does not match final size 0x%X",
- StringPack.Header.Length,
- Offset
- );
- }
- }
- //
- // Print terminator string pack, closing brace and close the file.
- // The size of 0 triggers to the consumer that this is the end.
- //
- memset ((char *) &StringPack, 0, sizeof (EFI_HII_STRING_PACK));
- StringPack.Header.Type = EFI_HII_STRING;
- Ptr = (UINT8 *) &StringPack;
- fprintf (Fptr, "\n // strings terminator pack");
- for (TempIndex = 0; TempIndex < sizeof (StringPack); TempIndex++, Ptr++) {
- if ((TempIndex & 0x0F) == 0) {
- fprintf (Fptr, "\n ");
- }
-
- fprintf (Fptr, "0x%02X, ", (UINT32) *Ptr);
- }
-
- fprintf (Fptr, "\n};\n");
- fclose (Fptr);
- return STATUS_SUCCESS;
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Dump the #define string names
-
-Arguments:
-
- FileName - name of the output file to write
- BaseName - used for the protection #ifndef/#endif
-
-Returns:
-
- STATUS
-
---*/
-STATUS
-StringDBDumpStringDefines (
- CHAR8 *FileName,
- CHAR8 *BaseName
- )
-{
- FILE *Fptr;
- STRING_IDENTIFIER *Identifier;
- CHAR8 CopyBaseName[100];
- WCHAR Line[200];
- UINT32 Index;
- const CHAR8 *StrDefHeader[] = {
- "#ifndef _%s_STRINGS_DEFINE_H_\n",
- "#define _%s_STRINGS_DEFINE_H_\n\n",
- NULL
- };
-
- if ((Fptr = fopen (FileName, "w")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open output string defines file");
- return STATUS_ERROR;
- }
- //
- // Get the base source filename and convert to uppercase.
- //
- if (sizeof (CopyBaseName) <= strlen (BaseName) + 1) {
- Error (NULL, 0, 0, "application error", "StringDBDumpStringDefines() string length insufficient");
- return STATUS_ERROR;
- }
-
- strcpy (CopyBaseName, BaseName);
- for (Index = 0; CopyBaseName[Index] != 0; Index++) {
- if (islower (CopyBaseName[Index])) {
- CopyBaseName[Index] = (INT8) toupper (CopyBaseName[Index]);
- }
- }
- //
- // Assign index values to the string identifiers
- //
- StringDBAssignStringIndexes ();
- //
- // Write the standard header to the output file, and then the
- // protective #ifndef.
- //
- StringDBWriteStandardFileHeader (Fptr);
- for (Index = 0; StrDefHeader[Index] != NULL; Index++) {
- fprintf (Fptr, StrDefHeader[Index], CopyBaseName);
- }
- //
- // Print all the #defines for the string identifiers. Print identifiers
- // whose names start with '$' as comments. Add comments for string
- // identifiers not used as well.
- //
- Identifier = mDBData.StringIdentifier;
- while (Identifier != NULL) {
- if (Identifier->StringName[0] == L'$') {
- fprintf (Fptr, "// ");
- }
-
- if (Identifier->Flags & STRING_FLAGS_REFERENCED) {
- AsciiSPrint (Line, sizeof(Line), "#define %-40s 0x%04X\n", Identifier->StringName, Identifier->Index);
- fprintf (Fptr, "%s", Line);
- } else {
- AsciiSPrint (Line, sizeof(Line), "//#define %-40s 0x%04X // not referenced\n", Identifier->StringName, Identifier->Index);
- fprintf (Fptr, "%s", Line);
- }
-
- Identifier = Identifier->Next;
- }
-
- fprintf (Fptr, "\n#endif\n");
- fclose (Fptr);
- return STATUS_SUCCESS;
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Add a string identifier to the database.
-
-Arguments:
-
- StringName - name of the string identifier. For example "STR_MY_STRING"
- NewId - if an ID has been assigned
- Flags - characteristics for the identifier
-
-Returns:
-
- STATUS
-
---*/
-STATUS
-StringDBAddStringIdentifier (
- WCHAR *StringName,
- UINT16 *NewId,
- UINT16 Flags
- )
-{
- STRING_IDENTIFIER *StringIdentifier;
- STATUS Status;
- //
- // If it was already used for some other language, then we don't
- // need to add it. But set it to the current string identifier.
- // The referenced bit is sticky.
- //
- Status = STATUS_SUCCESS;
- StringIdentifier = StringDBFindStringIdentifierByName (StringName);
- if (StringIdentifier != NULL) {
- if (Flags & STRING_FLAGS_REFERENCED) {
- StringIdentifier->Flags |= STRING_FLAGS_REFERENCED;
- }
-
- mDBData.CurrentStringIdentifier = StringIdentifier;
- *NewId = (UINT16) StringIdentifier->Index;
- return Status;
- }
-
- StringIdentifier = (STRING_IDENTIFIER *) MALLOC (sizeof (STRING_IDENTIFIER));
- if (StringIdentifier == NULL) {
- Error (NULL, 0, 0, NULL, "memory allocation error");
- return STATUS_ERROR;
- }
-
- memset ((char *) StringIdentifier, 0, sizeof (STRING_IDENTIFIER));
- StringIdentifier->StringName = (WCHAR *) malloc ((StrLen (StringName) + 1) * sizeof (WCHAR));
- if (StringIdentifier->StringName == NULL) {
- Error (NULL, 0, 0, NULL, "memory allocation error");
- return STATUS_ERROR;
- }
-
- StrCpy (StringIdentifier->StringName, StringName);
- if (*NewId != STRING_ID_INVALID) {
- StringIdentifier->Index = *NewId;
- StringIdentifier->Flags |= STRING_FLAGS_INDEX_ASSIGNED;
- if (mDBData.NumStringIdentifiers <= StringIdentifier->Index) {
- mDBData.NumStringIdentifiers = StringIdentifier->Index + 1;
- }
- } else {
- StringIdentifier->Index = mDBData.NumStringIdentifiers++;
- }
-
- StringIdentifier->Flags |= Flags;
- //
- // Add it to our list of string identifiers
- //
- if (mDBData.StringIdentifier == NULL) {
- mDBData.StringIdentifier = StringIdentifier;
- } else {
- mDBData.LastStringIdentifier->Next = StringIdentifier;
- }
-
- mDBData.LastStringIdentifier = StringIdentifier;
- mDBData.CurrentStringIdentifier = StringIdentifier;
- *NewId = (UINT16) StringIdentifier->Index;
- return Status;
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Add a new string to the database.
-
-Arguments:
-
- LanguageName - "eng" or "spa" language name
- StringName - "STR_MY_TEXT" string name
- Scope - from the #scope statements in the string file
- Format - if we should format the string
- Flags - characteristic flags for the string
-
-Returns:
-
- STATUS
-
-Notes:
-
- Several of the fields can be "inherited" from the previous calls to
- our database functions. For example, if scope is NULL here, then
- we'll use the previous setting.
-
---*/
-STATUS
-StringDBAddString (
- WCHAR *LanguageName,
- WCHAR *StringName,
- WCHAR *Scope,
- WCHAR *String,
- BOOLEAN Format,
- UINT16 Flags
- )
-{
- LANGUAGE_LIST *Lang;
- UINT32 Size;
- STRING_LIST *Str;
- UINT16 StringIndex;
- WCHAR TempLangName[4];
- STRING_IDENTIFIER *StringIdentifier;
-
- //
- // Check that language name is exactly 3 characters, or emit an error.
- // Truncate at 3 if it's longer, or make it 3 if it's shorter.
- //
- if (LanguageName != NULL) {
- Size = StrLen (LanguageName);
- if (Size != 3) {
- ParserError (0, "invalid length for language name", "%S", LanguageName);
- if (Size > 3) {
- LanguageName[3] = 0;
- } else {
- //
- // Make a local copy of the language name string, and extend to
- // 3 characters since we make assumptions elsewhere in this program
- // on the length.
- //
- StrCpy (TempLangName, LanguageName);
- for (; Size < 3; Size++) {
- TempLangName[Size] = L'?';
- }
-
- TempLangName[4] = 0;
- LanguageName = TempLangName;
- }
- }
- }
- //
- // If they specified a language, make sure they've defined it already
- // via a #langdef statement. Otherwise use the current default language.
- //
- if (LanguageName != NULL) {
- Lang = StringDBFindLanguageList (LanguageName);
- if (Lang == NULL) {
- ParserError (0, "language not defined", "%S", LanguageName);
- return STATUS_ERROR;
- } else {
- StringDBSetCurrentLanguage (LanguageName);
- }
- } else {
- Lang = mDBData.CurrentLanguage;
- if (Lang == NULL) {
- //
- // Have to call SetLanguage() first
- //
- ParserError (0, "no language defined", "%S", StringName);
- return STATUS_ERROR;
- }
- }
- //
- // If they didn't define a string identifier, use the last string identifier
- // added.
- //
- if (StringName == NULL) {
- StringName = mDBData.CurrentStringIdentifier->StringName;
- if (StringName == NULL) {
- ParserError (0, "no string identifier previously specified", NULL);
- return STATUS_ERROR;
- }
- }
- //
- // If scope was not specified, use the default setting
- //
- if (Scope != NULL) {
- Scope = DuplicateString (Scope);
- } else {
- Scope = DuplicateString (mDBData.CurrentScope);
- }
- //
- // printf ("Adding string: %S.%S.%S\n", Lang->LanguageName, StringName, Scope);
- //
- // Check for duplicates for this Language.StringName.Scope. Allow multiple
- // definitions of the language name and printable language name, since the
- // user does not specifically define them.
- //
- if (StringDBFindString (Lang->LanguageName, StringName, Scope, NULL, NULL) != NULL) {
- if ((StrCmp (StringName, LANGUAGE_NAME_STRING_NAME) == 0) &&
- (StrCmp (StringName, PRINTABLE_LANGUAGE_NAME_STRING_NAME) == 0)
- ) {
- ParserError (
- 0,
- "string multiply defined",
- "Language.Name.Scope = %S.%S.%S",
- Lang->LanguageName,
- StringName,
- Scope
- );
- return STATUS_ERROR;
- }
- }
-
- StringIndex = STRING_ID_INVALID;
- if (StringDBAddStringIdentifier (StringName, &StringIndex, Flags) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- StringIdentifier = StringDBFindStringIdentifierByName (StringName);
- //
- // Add this string to the end of the strings for this language.
- //
- Str = (STRING_LIST *) malloc (sizeof (STRING_LIST));
- if (Str == NULL) {
- Error (NULL, 0, 0, NULL, "memory allocation error");
- return STATUS_ERROR;
- }
-
- memset ((char *) Str, 0, sizeof (STRING_LIST));
- Size = (StrLen (String) + 1) * sizeof (WCHAR);
- Str->Flags = Flags;
- Str->Scope = Scope;
- Str->StringName = StringIdentifier->StringName;
- Str->LanguageName = DuplicateString (LanguageName);
- Str->Str = (WCHAR *) MALLOC (Size);
- if (Str->Str == NULL) {
- Error (NULL, 0, 0, NULL, "memory allocation error");
- return STATUS_ERROR;
- }
- //
- // If not formatting, just copy the string.
- //
- StrCpy (Str->Str, String);
- if (Format) {
- StringDBFormatString (Str->Str);
- }
- //
- // Size may change after formatting. We set the size to
- // the actual size of the string, including the null for
- // easier processing later.
- //
- Str->Size = (StrLen (Str->Str) + 1) * sizeof (WCHAR);
- if (Lang->String == NULL) {
- Lang->String = Str;
- } else {
- Lang->LastString->Next = Str;
- }
-
- Lang->LastString = Str;
- return STATUS_SUCCESS;
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Given a language name, see if a language list for it has been defined
-
-Arguments:
-
- LanguageName - like "eng"
-
-Returns:
-
- A pointer to the language list
-
---*/
-static
-LANGUAGE_LIST *
-StringDBFindLanguageList (
- WCHAR *LanguageName
- )
-{
- LANGUAGE_LIST *Lang;
-
- Lang = mDBData.LanguageList;
- while (Lang != NULL) {
- if (StrCmp (LanguageName, Lang->LanguageName) == 0) {
- break;
- }
-
- Lang = Lang->Next;
- }
-
- return Lang;
-}
-
-/*****************************************************************************/
-STATUS
-StringDBSetCurrentLanguage (
- WCHAR *LanguageName
- )
-{
- LANGUAGE_LIST *Lang;
-
- Lang = StringDBFindLanguageList (LanguageName);
- if (Lang == NULL) {
- ParserError (0, "language not previously defined", "%S", LanguageName);
- return STATUS_ERROR;
- }
-
- mDBData.CurrentLanguage = Lang;
- return STATUS_SUCCESS;
-}
-
-/*****************************************************************************/
-STATUS
-StringDBAddLanguage (
- WCHAR *LanguageName,
- WCHAR *PrintableLanguageName
- )
-{
- LANGUAGE_LIST *Lang;
- //
- // Check for redefinitions
- //
- Lang = StringDBFindLanguageList (LanguageName);
- if (Lang != NULL) {
- //
- // Better be the same printable name
- //
- if (StrCmp (PrintableLanguageName, Lang->PrintableLanguageName) != 0) {
- ParserError (
- 0,
- "language redefinition",
- "%S:%S != %S:%S",
- Lang->LanguageName,
- Lang->PrintableLanguageName,
- LanguageName,
- PrintableLanguageName
- );
- return STATUS_ERROR;
- //
- // } else {
- // ParserWarning (0, "benign language redefinition", "%S", PrintableLanguageName);
- // return STATUS_WARNING;
- //
- }
- } else {
- //
- // Allocate memory to keep track of this new language
- //
- Lang = (LANGUAGE_LIST *) malloc (sizeof (LANGUAGE_LIST));
- if (Lang == NULL) {
- Error (NULL, 0, 0, NULL, "memory allocation error");
- return STATUS_ERROR;
- }
-
- memset ((char *) Lang, 0, sizeof (LANGUAGE_LIST));
- //
- // Save the language name, then allocate memory to save the
- // printable language name
- //
- StrCpy (Lang->LanguageName, LanguageName);
- Lang->PrintableLanguageName = (WCHAR *) malloc ((StrLen (PrintableLanguageName) + 1) * sizeof (WCHAR));
- if (Lang->PrintableLanguageName == NULL) {
- Error (NULL, 0, 0, NULL, "memory allocation error");
- return STATUS_ERROR;
- }
-
- StrCpy (Lang->PrintableLanguageName, PrintableLanguageName);
-
- if (mDBData.LanguageList == NULL) {
- mDBData.LanguageList = Lang;
- } else {
- mDBData.LastLanguageList->Next = Lang;
- }
-
- mDBData.LastLanguageList = Lang;
- }
- //
- // Default is to make our active language this new one
- //
- StringDBSetCurrentLanguage (LanguageName);
- //
- // The first two strings for any language are the language name,
- // followed by the printable language name. Add them and set them
- // to referenced so they never get stripped out.
- //
- StringDBAddString (
- LanguageName,
- LANGUAGE_NAME_STRING_NAME,
- NULL,
- LanguageName,
- FALSE,
- STRING_FLAGS_REFERENCED
- );
- StringDBAddString (
- LanguageName,
- PRINTABLE_LANGUAGE_NAME_STRING_NAME,
- NULL,
- PrintableLanguageName,
- FALSE,
- STRING_FLAGS_REFERENCED
- );
- return STATUS_SUCCESS;
-}
-
-/*****************************************************************************/
-static
-STRING_IDENTIFIER *
-StringDBFindStringIdentifierByName (
- WCHAR *StringName
- )
-{
- STRING_IDENTIFIER *Identifier;
-
- Identifier = mDBData.StringIdentifier;
- while (Identifier != NULL) {
- if (StrCmp (StringName, Identifier->StringName) == 0) {
- return Identifier;
- }
-
- Identifier = Identifier->Next;
- }
-
- return NULL;
-}
-
-static
-STRING_IDENTIFIER *
-StringDBFindStringIdentifierByIndex (
- UINT32 StringIndex
- )
-{
- STRING_IDENTIFIER *Identifier;
-
- Identifier = mDBData.StringIdentifier;
- while (Identifier != NULL) {
- if (Identifier->Index == StringIndex) {
- return Identifier;
- }
-
- Identifier = Identifier->Next;
- }
-
- return NULL;
-}
-
-/*****************************************************************************/
-static
-void
-StringDBWriteStandardFileHeader (
- FILE *OutFptr
- )
-{
- UINT32 TempIndex;
- for (TempIndex = 0; mSourceFileHeader[TempIndex] != NULL; TempIndex++) {
- fprintf (OutFptr, "%s\n", mSourceFileHeader[TempIndex]);
- }
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Given a Unicode string from an input file, reformat the string to replace
- backslash control sequences with the appropriate encoding.
-
-Arguments:
-
- String - pointer to string to reformat
-
-Returns:
-
- Nothing
-
---*/
-void
-StringDBFormatString (
- WCHAR *String
- )
-{
- WCHAR *From;
- WCHAR *To;
- int HexNibbles;
- WCHAR HexValue;
- //
- // Go through the string and process any formatting characters
- //
- From = String;
- To = String;
- while (*From) {
- if (*From == UNICODE_BACKSLASH) {
- //
- // First look for \wide and replace with the appropriate control character. Note that
- // when you have "define STR L"ABC"", then sizeof(ABC) is 8 because the null char is
- // counted. Make adjustments for this. We advance From below, so subtract 2 each time.
- //
- if (StrnCmp (From, UNICODE_WIDE_STRING, sizeof (UNICODE_WIDE_STRING) / sizeof (WCHAR) - 1) == 0) {
- *To = WIDE_CHAR;
- From += sizeof (UNICODE_WIDE_STRING) / sizeof (WCHAR) - 2;
- } else if (StrnCmp (From, UNICODE_NARROW_STRING, sizeof (UNICODE_NARROW_STRING) / sizeof (WCHAR) - 1) == 0) {
- //
- // Found: \narrow
- //
- *To = NARROW_CHAR;
- From += sizeof (UNICODE_NARROW_STRING) / sizeof (WCHAR) - 2;
- } else if (StrnCmp (From, UNICODE_NBR_STRING, sizeof (UNICODE_NBR_STRING) / sizeof (WCHAR) - 1) == 0) {
- //
- // Found: \nbr
- //
- *To = NON_BREAKING_CHAR;
- From += sizeof (UNICODE_NBR_STRING) / sizeof (WCHAR) - 2;
- } else if (StrnCmp (From, UNICODE_BR_STRING, sizeof (UNICODE_BR_STRING) / sizeof (WCHAR) - 1) == 0) {
- //
- // Found: \br -- pass through untouched
- //
- *To = *From;
- } else {
- //
- // Standard one-character control sequences such as \n, \r, \\, or \x
- //
- From++;
- switch (*From) {
- case ASCII_TO_UNICODE ('n'):
- *To = UNICODE_CR;
- To++;
- *To = UNICODE_LF;
- break;
-
- //
- // carriage return
- //
- case ASCII_TO_UNICODE ('r'):
- *To = UNICODE_CR;
- break;
-
- //
- // backslash
- //
- case UNICODE_BACKSLASH:
- *To = UNICODE_BACKSLASH;
- break;
-
- //
- // Tab
- //
- case ASCII_TO_UNICODE ('t'):
- *To = UNICODE_TAB;
- break;
-
- //
- // embedded double-quote
- //
- case UNICODE_DOUBLE_QUOTE:
- *To = UNICODE_DOUBLE_QUOTE;
- break;
-
- //
- // Hex Unicode character \x1234. We'll process up to 4 hex characters
- //
- case ASCII_TO_UNICODE ('x'):
- HexValue = 0;
- for (HexNibbles = 0; HexNibbles < 4; HexNibbles++) {
- if ((From[1] >= UNICODE_0) && (From[1] <= UNICODE_9)) {
- HexValue = (HexValue << 4) | (From[1] - UNICODE_0);
- } else if ((From[1] >= UNICODE_a) && (From[1] <= UNICODE_f)) {
- HexValue = (HexValue << 4) | (10 + From[1] - UNICODE_a);
- } else if ((From[1] >= UNICODE_A) && (From[1] <= UNICODE_F)) {
- HexValue = (HexValue << 4) | (10 + From[1] - UNICODE_A);
- } else {
- break;
- }
-
- From++;
- }
-
- if (HexNibbles == 0) {
- ParserWarning (
- 0,
- "expected at least one valid hex digit with \\x escaped character in string",
- "\\%C",
- *From
- );
- } else {
- *To = HexValue;
- }
- break;
-
- default:
- *To = UNICODE_SPACE;
- ParserWarning (0, "invalid escaped character in string", "\\%C", *From);
- break;
- }
- }
- } else {
- *To = *From;
- }
-
- From++;
- To++;
- }
-
- *To = 0;
-}
-
-/*****************************************************************************/
-STATUS
-StringDBReadDatabase (
- CHAR8 *DBFileName,
- BOOLEAN IgnoreIfNotExist,
- BOOLEAN Verbose
- )
-{
- STRING_DB_HEADER DbHeader;
- STATUS Status;
- FILE *DBFptr;
- DB_DATA_ITEM_HEADER DataItemHeader;
-
- Status = STATUS_SUCCESS;
- DBFptr = NULL;
- //
- // if (Verbose) {
- // fprintf (stdout, "Reading database file %s\n", DBFileName);
- // }
- //
- // Try to open the input file
- //
- if ((DBFptr = fopen (DBFileName, "rb")) == NULL) {
- if (IgnoreIfNotExist) {
- return STATUS_SUCCESS;
- }
-
- Error (NULL, 0, 0, DBFileName, "failed to open input database file for reading");
- return STATUS_ERROR;
- }
- //
- // Read and verify the database header
- //
- if (fread ((void *) &DbHeader, sizeof (STRING_DB_HEADER), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, DBFileName, "failed to read header from database file");
- Status = STATUS_ERROR;
- goto Finish;
- }
-
- if (DbHeader.Key != STRING_DB_KEY) {
- Error (NULL, 0, 0, DBFileName, "invalid header in database file");
- Status = STATUS_ERROR;
- goto Finish;
- }
-
- if ((DbHeader.Version & STRING_DB_MAJOR_VERSION_MASK) != (STRING_DB_VERSION & STRING_DB_MAJOR_VERSION_MASK)) {
- Error (NULL, 0, 0, DBFileName, "incompatible database file version -- rebuild clean");
- Status = STATUS_ERROR;
- goto Finish;
- }
- //
- // Read remaining items
- //
- while (fread (&DataItemHeader, sizeof (DataItemHeader), 1, DBFptr) == 1) {
- switch (DataItemHeader.DataType) {
- case DB_DATA_TYPE_STRING_IDENTIFIER:
- StringDBReadStringIdentifier (DBFptr);
- break;
-
- case DB_DATA_TYPE_LANGUAGE_DEFINITION:
- StringDBReadLanguageDefinition (DBFptr);
- break;
-
- case DB_DATA_TYPE_STRING_DEFINITION:
- StringDBReadString (DBFptr);
- break;
-
- default:
- Error (
- NULL,
- 0,
- 0,
- "database corrupted",
- "invalid data item type 0x%X at offset 0x%X",
- (UINT32) DataItemHeader.DataType,
- ftell (DBFptr) - sizeof (DataItemHeader)
- );
- Status = STATUS_ERROR;
- goto Finish;
- }
- }
-
-Finish:
- if (DBFptr != NULL) {
- fclose (DBFptr);
- }
-
- return Status;
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Write everything we know to the output database file. Write:
-
- Database header
- String identifiers[]
- StringPacks[]
-
-Arguments:
-
- DBFileName - name of the file to write to
- Verbose - for debug purposes, print info messages along the way.
-
-Returns:
-
- STATUS
-
---*/
-STATUS
-StringDBWriteDatabase (
- CHAR8 *DBFileName,
- BOOLEAN Verbose
- )
-{
- STRING_DB_HEADER DbHeader;
- UINT32 Counter;
- UINT32 StrLength;
- LANGUAGE_LIST *Lang;
- STRING_IDENTIFIER *StringIdentifier;
- STRING_LIST *StrList;
- FILE *DBFptr;
-
- if (Verbose) {
- fprintf (stdout, "Writing database %s\n", DBFileName);
- }
-
- if ((DBFptr = fopen (DBFileName, "wb")) == NULL) {
- Error (NULL, 0, 0, DBFileName, "failed to open output database file for writing");
- return STATUS_ERROR;
- }
- //
- // Fill in and write the database header
- //
- memset (&DbHeader, 0, sizeof (STRING_DB_HEADER));
- DbHeader.HeaderSize = sizeof (STRING_DB_HEADER);
- DbHeader.Key = STRING_DB_KEY;
- DbHeader.Version = STRING_DB_VERSION;
- //
- // Count the number of languages we have
- //
- for (Lang = mDBData.LanguageList; Lang != NULL; Lang = Lang->Next) {
- DbHeader.NumLanguages++;
- }
- //
- // Count up how many string identifiers we have, and total up the
- // size of the names plus the size of the flags field we will
- // write out too.
- //
- DbHeader.NumStringIdenfiers = mDBData.NumStringIdentifiers;
- StringIdentifier = mDBData.StringIdentifier;
- for (Counter = 0; Counter < mDBData.NumStringIdentifiers; Counter++) {
- StrLength = StrLen (StringIdentifier->StringName) + 1;
- DbHeader.StringIdentifiersSize += StrLength * sizeof (WCHAR) + sizeof (StringIdentifier->Flags);
- StringIdentifier = StringIdentifier->Next;
- }
-
- //
- // Write the header
- //
- fwrite (&DbHeader, sizeof (STRING_DB_HEADER), 1, DBFptr);
- if (Verbose) {
- fprintf (stdout, " Number of string identifiers 0x%04X\n", DbHeader.NumStringIdenfiers);
- fprintf (stdout, " Number of languages %d\n", DbHeader.NumLanguages);
- }
- //
- // Write the string identifiers
- //
- for (StringIdentifier = mDBData.StringIdentifier; StringIdentifier != NULL; StringIdentifier = StringIdentifier->Next) {
- StringDBWriteStringIdentifier (
- DBFptr,
- (UINT16) StringIdentifier->Index,
- StringIdentifier->Flags,
- StringIdentifier->StringName
- );
- }
- //
- // Now write all the strings for each language
- //
- for (Lang = mDBData.LanguageList; Lang != NULL; Lang = Lang->Next) {
- StringDBWriteLanguageDefinition (DBFptr, Lang->LanguageName, Lang->PrintableLanguageName);
- for (StrList = Lang->String; StrList != NULL; StrList = StrList->Next) {
- StringDBWriteString (
- DBFptr,
- StrList->Flags,
- Lang->LanguageName,
- StrList->StringName,
- StrList->Scope,
- StrList->Str
- );
- }
- }
-
- fclose (DBFptr);
- return STATUS_SUCCESS;
-}
-
-STATUS
-StringDBSetStringReferenced (
- CHAR8 *StringIdentifierName,
- BOOLEAN IgnoreNotFound
- )
-{
- STRING_IDENTIFIER *Id;
- WCHAR *WName;
- STATUS Status;
- //
- // See if it's already been defined.
- //
- Status = STATUS_SUCCESS;
- WName = (WCHAR *) malloc ((strlen (StringIdentifierName) + 1) * sizeof (WCHAR));
- UnicodeSPrint (WName, (strlen (StringIdentifierName) + 1) * sizeof (WCHAR), L"%a", StringIdentifierName);
- Id = StringDBFindStringIdentifierByName (WName);
- if (Id != NULL) {
- Id->Flags |= STRING_FLAGS_REFERENCED;
- } else {
- if (IgnoreNotFound == 0) {
- ParserWarning (0, StringIdentifierName, "string identifier not found in database");
- Status = STATUS_WARNING;
- }
- }
-
- free (WName);
- return Status;
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Dump the contents of a database to an output unicode file.
-
-Arguments:
-
- DBFileName - name of the pre-existing database file to read
- OutputFileName - name of the file to dump the database contents to
- Verbose - for printing of additional info useful for debugging
-
-Returns:
-
- STATUS
-
-Notes:
-
- There's some issue with the unicode printing routines. Therefore to
- write to the output file properly, open it as binary and use fwrite.
- Ideally we could open it with just L"w" and use fwprintf().
-
---*/
-STATUS
-StringDBDumpDatabase (
- CHAR8 *DBFileName,
- CHAR8 *OutputFileName,
- BOOLEAN Verbose
- )
-{
- LANGUAGE_LIST *Lang;
- STRING_IDENTIFIER *StringIdentifier;
- STRING_LIST *StrList;
- FILE *OutFptr;
- WCHAR WChar;
- WCHAR CrLf[2];
- WCHAR Line[200];
- WCHAR *Scope;
- //
- // This function assumes the database has already been read, and
- // we're just dumping our internal data structures to a unicode file.
- //
- if (Verbose) {
- fprintf (stdout, "Dumping database file %s\n", DBFileName);
- }
-
- OutFptr = fopen (OutputFileName, "wb");
- if (OutFptr == NULL) {
- Error (NULL, 0, 0, OutputFileName, "failed to open output file for writing");
- return STATUS_ERROR;
- }
-
- WChar = UNICODE_FILE_START;
- fwrite (&WChar, sizeof (WCHAR), 1, OutFptr);
- CrLf[1] = UNICODE_LF;
- CrLf[0] = UNICODE_CR;
- //
- // The default control character is '/'. Make it '#' by writing
- // "/=#" to the output file.
- //
- UnicodeSPrint (Line, sizeof(Line), L"/=#");
- fwrite (Line, StrLen (Line) * sizeof (WCHAR), 1, OutFptr);
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- //
- // Dump all the string identifiers and their values
- //
- StringDBAssignStringIndexes ();
- for (StringIdentifier = mDBData.StringIdentifier; StringIdentifier != NULL; StringIdentifier = StringIdentifier->Next) {
- //
- // Write the "#define " string
- //
- if (StringIdentifier->Flags & STRING_FLAGS_REFERENCED) {
- UnicodeSPrint (
- Line,
- sizeof(Line), L"%s %-60.60s 0x%04X",
- DEFINE_STR,
- StringIdentifier->StringName,
- StringIdentifier->Index
- );
- } else {
- UnicodeSPrint (
- Line,
- sizeof(Line), L"%s %-60.60s 0x%04X // NOT REFERENCED",
- DEFINE_STR,
- StringIdentifier->StringName,
- StringIdentifier->Index
- );
- }
-
- fwrite (Line, StrLen (Line) * sizeof (WCHAR), 1, OutFptr);
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- }
-
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- //
- // Now write all the strings for each language.
- //
- WChar = UNICODE_DOUBLE_QUOTE;
- Scope = NULL;
- for (Lang = mDBData.LanguageList; Lang != NULL; Lang = Lang->Next) {
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- UnicodeSPrint (Line, sizeof(Line), L"#langdef %s \"%s\"", Lang->LanguageName, Lang->PrintableLanguageName);
- fwrite (Line, StrLen (Line) * sizeof (WCHAR), 1, OutFptr);
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- //
- // Now the strings (in double-quotes) for this language. Write
- // #string STR_NAME #language eng "string"
- //
- for (StrList = Lang->String; StrList != NULL; StrList = StrList->Next) {
- //
- // Print the internal flags for debug
- //
- UnicodeSPrint (Line, sizeof(Line), L"// flags=0x%02X", (UINT32) StrList->Flags);
- fwrite (Line, StrLen (Line) * sizeof (WCHAR), 1, OutFptr);
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- //
- // Print the scope if changed
- //
- if ((Scope == NULL) || (StrCmp (Scope, StrList->Scope) != 0)) {
- UnicodeSPrint (Line, sizeof(Line), L"#scope %s", StrList->Scope);
- fwrite (Line, StrLen (Line) * sizeof (WCHAR), 1, OutFptr);
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- Scope = StrList->Scope;
- }
-
- UnicodeSPrint (
- Line,
- sizeof(Line), L"#string %-50.50s #language %s \"",
- StrList->StringName,
- Lang->LanguageName
- );
- fwrite (Line, StrLen (Line) * sizeof (WCHAR), 1, OutFptr);
- fwrite (StrList->Str, StrList->Size - sizeof (WCHAR), 1, OutFptr);
- UnicodeSPrint (Line, sizeof(Line), L"\"");
- fwrite (Line, StrLen (Line) * sizeof (WCHAR), 1, OutFptr);
- fwrite (&CrLf, sizeof (CrLf), 1, OutFptr);
- }
- }
-
- fclose (OutFptr);
- return STATUS_SUCCESS;
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Given a primary language, a string identifier number, and a list of
- languages, find a secondary string.
-
-Arguments:
-
- LanguageName - primary language, like "spa"
- StringId - string index value
- LanguageList - linked list of "eng", "spa+cat",...
-
-Returns:
-
- Pointer to a secondary string if found. NULL otherwise.
-
-Notes:
-
- Given: LanguageName "spa" and LanguageList "spa+cat", match the
- "spa" and extract the "cat" and see if there is a string defined
- for "cat".StringId.
-
---*/
-static
-STATUS
-StringDBWriteStringIdentifier (
- FILE *DBFptr,
- UINT16 StringId,
- UINT16 Flags,
- WCHAR *IdentifierName
- )
-{
- DB_DATA_ITEM_HEADER Hdr;
- memset (&Hdr, 0, sizeof (DB_DATA_ITEM_HEADER));
- Hdr.DataType = DB_DATA_TYPE_STRING_IDENTIFIER;
- if (fwrite (&Hdr, sizeof (DB_DATA_ITEM_HEADER), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to write string to output database file", NULL);
- return STATUS_ERROR;
- }
-
- if (fwrite (&StringId, sizeof (StringId), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to write StringId to output database", NULL);
- return STATUS_ERROR;
- }
-
- if (fwrite (&Flags, sizeof (Flags), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to write StringId flags to output database", NULL);
- return STATUS_ERROR;
- }
-
- if (StringDBWriteGenericString (DBFptr, IdentifierName) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-StringDBReadStringIdentifier (
- FILE *DBFptr
- )
-{
- WCHAR *IdentifierName;
- UINT16 Flags;
- UINT16 StringId;
- UINT16 Size;
-
- if (fread (&StringId, sizeof (StringId), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to read StringId from database", NULL);
- return STATUS_ERROR;
- }
-
- if (fread (&Flags, sizeof (Flags), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to read StringId flags from database", NULL);
- return STATUS_ERROR;
- }
-
- if (StringDBReadGenericString (DBFptr, &Size, &IdentifierName) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- StringDBAddStringIdentifier (IdentifierName, &StringId, Flags);
- //
- // printf ("STRID: 0x%04X %S\n", (UINT32)StringId, IdentifierName);
- //
- FREE (IdentifierName);
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-StringDBWriteString (
- FILE *DBFptr,
- UINT16 Flags,
- WCHAR *Language,
- WCHAR *StringName,
- WCHAR *Scope,
- WCHAR *Str
- )
-{
- DB_DATA_ITEM_HEADER Hdr;
- memset (&Hdr, 0, sizeof (DB_DATA_ITEM_HEADER));
- Hdr.DataType = DB_DATA_TYPE_STRING_DEFINITION;
- if (fwrite (&Hdr, sizeof (DB_DATA_ITEM_HEADER), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to write string header to output database file", NULL);
- return STATUS_ERROR;
- }
-
- if (fwrite (&Flags, sizeof (Flags), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to write string flags to output database", NULL);
- return STATUS_ERROR;
- }
-
- if (StringDBWriteGenericString (DBFptr, Language) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- if (StringDBWriteGenericString (DBFptr, StringName) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- if (StringDBWriteGenericString (DBFptr, Scope) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- if (StringDBWriteGenericString (DBFptr, Str) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
- //
- // printf ("DBWriteString: %S.%S.%S\n", Language, StringName, Scope);
- //
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-StringDBReadString (
- FILE *DBFptr
- )
-{
- UINT16 Flags;
- UINT16 Size;
- WCHAR *Language;
- WCHAR *StringName;
- WCHAR *Scope;
- WCHAR *Str;
-
- if (fread (&Flags, sizeof (Flags), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to read string flags from database", NULL);
- return STATUS_ERROR;
- }
-
- if (StringDBReadGenericString (DBFptr, &Size, &Language) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- if (StringDBReadGenericString (DBFptr, &Size, &StringName) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- if (StringDBReadGenericString (DBFptr, &Size, &Scope) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- if (StringDBReadGenericString (DBFptr, &Size, &Str) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
- //
- // If the first or second string (language name and printable language name),
- // then skip them. They're added via language definitions data items in
- // the database.
- //
- if (StringName[0] != L'$') {
- StringDBAddString (Language, StringName, Scope, Str, FALSE, Flags);
- }
- //
- // printf ("DBReadString: %S.%S.%S\n", Language, StringName, Scope);
- //
- FREE (Language);
- FREE (StringName);
- if (Str != NULL) {
- FREE (Str);
- }
-
- if (Scope != NULL) {
- FREE (Scope);
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-StringDBWriteLanguageDefinition (
- FILE *DBFptr,
- WCHAR *LanguageName,
- WCHAR *PrintableLanguageName
- )
-{
- DB_DATA_ITEM_HEADER Hdr;
- memset (&Hdr, 0, sizeof (DB_DATA_ITEM_HEADER));
- Hdr.DataType = DB_DATA_TYPE_LANGUAGE_DEFINITION;
- if (fwrite (&Hdr, sizeof (DB_DATA_ITEM_HEADER), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to write string to output database file", NULL);
- return STATUS_ERROR;
- }
-
- if (StringDBWriteGenericString (DBFptr, LanguageName) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- if (StringDBWriteGenericString (DBFptr, PrintableLanguageName) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-StringDBReadLanguageDefinition (
- FILE *DBFptr
- )
-{
- WCHAR *LanguageName;
- WCHAR *PrintableLanguageName;
- UINT16 Size;
- STATUS Status;
-
- if (StringDBReadGenericString (DBFptr, &Size, &LanguageName) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
-
- if (StringDBReadGenericString (DBFptr, &Size, &PrintableLanguageName) != STATUS_SUCCESS) {
- return STATUS_ERROR;
- }
- //
- // printf("LANG: %S %S\n", LanguageName, PrintableLanguageName);
- //
- Status = StringDBAddLanguage (LanguageName, PrintableLanguageName);
- FREE (LanguageName);
- FREE (PrintableLanguageName);
- return Status;
-}
-//
-// All unicode strings in the database consist of a UINT16 length
-// field, followed by the string itself. This routine reads one
-// of those and returns the info.
-//
-static
-STATUS
-StringDBReadGenericString (
- FILE *DBFptr,
- UINT16 *Size,
- WCHAR **Str
- )
-{
- UINT16 LSize;
- UINT16 Flags;
- WCHAR *LStr;
-
- if (fread (&LSize, sizeof (UINT16), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to read a string length field from the database", NULL);
- return STATUS_ERROR;
- }
-
- if (fread (&Flags, sizeof (UINT16), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to read a string flags field from the database", NULL);
- return STATUS_ERROR;
- }
-
- LStr = MALLOC (LSize);
- if (LStr == NULL) {
- Error (__FILE__, __LINE__, 0, "memory allocation failed reading the database", NULL);
- return STATUS_ERROR;
- }
-
- if (fread (LStr, sizeof (WCHAR), (UINT32) LSize / sizeof (WCHAR), DBFptr) != (UINT32) LSize / sizeof (WCHAR)) {
- Error (NULL, 0, 0, "failed to read string from database", NULL);
- Error (NULL, 0, 0, "database read failure", "offset 0x%X", ftell (DBFptr));
- free (LStr);
- return STATUS_ERROR;
- }
- //
- // printf ("DBR: %S\n", LStr);
- //
- // If the flags field indicated we were asked to write a NULL string, then
- // return them a NULL pointer.
- //
- if (Flags & STRING_FLAGS_UNDEFINED) {
- *Size = 0;
- *Str = NULL;
- } else {
- *Size = LSize;
- *Str = LStr;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STATUS
-StringDBWriteGenericString (
- FILE *DBFptr,
- WCHAR *Str
- )
-{
- UINT16 Size;
- UINT16 Flags;
- WCHAR ZeroString[1];
- //
- // Strings in the database consist of a size UINT16 followed
- // by the string itself.
- //
- if (Str == NULL) {
- ZeroString[0] = 0;
- Str = ZeroString;
- Size = sizeof (ZeroString);
- Flags = STRING_FLAGS_UNDEFINED;
- } else {
- Flags = 0;
- Size = (UINT16) ((StrLen (Str) + 1) * sizeof (WCHAR));
- }
-
- if (fwrite (&Size, sizeof (UINT16), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to write string size to database", NULL);
- return STATUS_ERROR;
- }
-
- if (fwrite (&Flags, sizeof (UINT16), 1, DBFptr) != 1) {
- Error (NULL, 0, 0, "failed to write string flags to database", NULL);
- return STATUS_ERROR;
- }
-
- if (fwrite (Str, sizeof (WCHAR), Size / sizeof (WCHAR), DBFptr) != Size / sizeof (WCHAR)) {
- Error (NULL, 0, 0, "failed to write string to database", NULL);
- return STATUS_ERROR;
- }
-
- return STATUS_SUCCESS;
-}
-
-static
-STRING_LIST *
-StringDBFindString (
- WCHAR *LanguageName,
- WCHAR *StringName,
- WCHAR *Scope,
- WCHAR_STRING_LIST *LanguagesOfInterest,
- WCHAR_MATCHING_STRING_LIST *IndirectionList
- )
-{
- LANGUAGE_LIST *Lang;
- STRING_LIST *CurrString;
- WCHAR_MATCHING_STRING_LIST *IndListPtr;
- WCHAR TempLangName[LANGUAGE_IDENTIFIER_NAME_LEN + 1];
- WCHAR *WCharPtr;
-
- //
- // If we were given an indirection list, then see if one was specified for this
- // string identifier. That is to say, if the indirection says "STR_ID_MY_FAVORITE MyScope",
- // then if this string name matches one in the list, then do a lookup with the
- // specified scope and return that value.
- //
- if (IndirectionList != NULL) {
- for (IndListPtr = IndirectionList; IndListPtr != NULL; IndListPtr = IndListPtr->Next) {
- if (StrCmp (StringName, IndListPtr->Str1) == 0) {
- CurrString = StringDBFindString (LanguageName, StringName, IndListPtr->Str2, LanguagesOfInterest, NULL);
- if (CurrString != NULL) {
- return CurrString;
- }
- }
- }
- }
- //
- // First look for exact match language.stringname
- //
- for (Lang = mDBData.LanguageList; Lang != NULL; Lang = Lang->Next) {
- if (StrCmp (LanguageName, Lang->LanguageName) == 0) {
- //
- // Found language match. Try to find string name match
- //
- for (CurrString = Lang->String; CurrString != NULL; CurrString = CurrString->Next) {
- if (StrCmp (StringName, CurrString->StringName) == 0) {
- //
- // Found a string name match. See if we're supposed to find
- // a scope match.
- //
- if (Scope != NULL) {
- if (StrCmp (CurrString->Scope, Scope) == 0) {
- return CurrString;
- }
- } else {
- return CurrString;
- }
- }
- }
- }
- }
- //
- // If we got here, then we didn't find a match. Look for secondary string
- // matches. That is to say, if we're processing "spa", and they requested
- // "spa+cat", then recursively call with "cat"
- //
- while (LanguagesOfInterest != NULL) {
- //
- // If this is the language we're looking for, then process the
- // languages of interest list for it.
- //
- if (StrnCmp (LanguageName, LanguagesOfInterest->Str, LANGUAGE_IDENTIFIER_NAME_LEN) == 0) {
- WCharPtr = LanguagesOfInterest->Str + LANGUAGE_IDENTIFIER_NAME_LEN;
- while (*WCharPtr) {
- //
- // Double-check the length, though it should have been checked on the
- // command line.
- //
- if (StrLen (WCharPtr) < LANGUAGE_IDENTIFIER_NAME_LEN) {
- Error (NULL, 0, 0, "malformed alternate language list", "%S", LanguagesOfInterest->Str);
- return NULL;
- }
-
- StrnCpy (TempLangName, WCharPtr, LANGUAGE_IDENTIFIER_NAME_LEN);
- TempLangName[LANGUAGE_IDENTIFIER_NAME_LEN] = 0;
- CurrString = StringDBFindString (TempLangName, StringName, NULL, NULL, IndirectionList);
- if (CurrString != NULL) {
- return CurrString;
- }
-
- WCharPtr += LANGUAGE_IDENTIFIER_NAME_LEN;
- }
- }
-
- LanguagesOfInterest = LanguagesOfInterest->Next;
- }
-
- return NULL;
-}
-
-STATUS
-StringDBSetScope (
- WCHAR *Scope
- )
-{
- //
- // Free up existing scope memory.
- //
- if (mDBData.CurrentScope != NULL) {
- FREE (mDBData.CurrentScope);
- }
-
- mDBData.CurrentScope = DuplicateString (Scope);
- return STATUS_SUCCESS;
-}
-//
-// We typically don't assign index values to string identifiers
-// until we're ready to write out files. To reduce the size of
-// the output file, re-order the string identifiers to move any
-// unreferenced ones to the end. Then we'll walk the list
-// again to assign string indexes, keeping track of the last
-// one referenced.
-//
-static
-void
-StringDBAssignStringIndexes (
- VOID
- )
-{
- STRING_IDENTIFIER *StrId;
- STRING_IDENTIFIER *FirstUsed;
- STRING_IDENTIFIER *LastUsed;
- STRING_IDENTIFIER *FirstUnused;
- STRING_IDENTIFIER *LastUnused;
- UINT32 Index;
- UINT32 MaxReferenced;
-
- //
- // Create two lists -- used and unused. Then put them together with
- // the unused ones on the end.
- //
- FirstUsed = NULL;
- LastUsed = NULL;
- FirstUnused = NULL;
- LastUnused = NULL;
- StrId = mDBData.StringIdentifier;
- while (StrId != NULL) {
- if ((StrId->Flags & STRING_FLAGS_REFERENCED) == 0) {
- //
- // Put it on the unused list
- //
- if (FirstUnused == NULL) {
- FirstUnused = StrId;
- } else {
- LastUnused->Next = StrId;
- }
-
- LastUnused = StrId;
- StrId = StrId->Next;
- LastUnused->Next = NULL;
- } else {
- //
- // Put it on the used list
- //
- if (FirstUsed == NULL) {
- FirstUsed = StrId;
- } else {
- LastUsed->Next = StrId;
- }
-
- LastUsed = StrId;
- StrId = StrId->Next;
- LastUsed->Next = NULL;
- }
- }
- //
- // Join the lists
- //
- if (FirstUsed != NULL) {
- mDBData.StringIdentifier = FirstUsed;
- LastUsed->Next = FirstUnused;
- } else {
- mDBData.StringIdentifier = FirstUnused;
- }
-
- MaxReferenced = 0;
- Index = 0;
- for (StrId = mDBData.StringIdentifier; StrId != NULL; StrId = StrId->Next) {
- StrId->Index = Index;
- Index++;
- if (StrId->Flags & STRING_FLAGS_REFERENCED) {
- mDBData.NumStringIdentifiersReferenced = Index;
- }
- }
-
- mDBData.NumStringIdentifiers = Index;
-}
-
-static
-WCHAR *
-DuplicateString (
- WCHAR *Str
- )
-{
- WCHAR *NewStr;
- if (Str == NULL) {
- return NULL;
- }
-
- NewStr = MALLOC ((StrLen (Str) + 1) * sizeof (WCHAR));
- if (NewStr == NULL) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return NULL;
- }
-
- StrCpy (NewStr, Str);
- return NewStr;
-}
-
-static
-WCHAR *
-AsciiToWchar (
- CHAR8 *Str
- )
-{
- UINT32 Len;
- WCHAR *NewStr;
- WCHAR *Ptr;
-
- Len = strlen (Str) + 1;
- NewStr = (WCHAR *) malloc (Len * sizeof (WCHAR));
- for (Ptr = NewStr; *Str != 0; Str++, Ptr++) {
- *Ptr = (UINT16) (UINT8) *Str;
- }
-
- *Ptr = 0;
- return NewStr;
-}
-
-/*****************************************************************************/
-
-/*++
-
-Routine Description:
-
- Create an HII export string pack for the strings in our database.
-
-Arguments:
-
- FileName - name of the output file to write
-
-Returns:
-
- STATUS
-
-
---*/
-STATUS
-StringDBCreateHiiExportPack (
- CHAR8 *FileName
- )
-{
- FILE *Fptr;
- LANGUAGE_LIST *Lang;
- STRING_LIST *CurrString;
- STRING_LIST EmptyString;
- UINT32 Offset;
- UINT32 StringIndex;
- UINT32 TempIndex;
- EFI_HII_STRING_PACK StringPack;
- UINT32 Len;
- WCHAR ZeroString[1];
- WCHAR *TempStringPtr;
- WCHAR *LangName;
- STRING_IDENTIFIER *StringIdentifier;
-
- if ((Fptr = fopen (FileName, "wb")) == NULL) {
- Error (NULL, 0, 0, FileName, "failed to open output HII export file");
- return STATUS_ERROR;
- }
- //
- // Assign index values to the string identifiers
- //
- StringDBAssignStringIndexes ();
- //
- // If a given string is not defined, then we'll use this one.
- //
- memset (&EmptyString, 0, sizeof (EmptyString));
- EmptyString.Size = sizeof (ZeroString);
- EmptyString.Str = ZeroString;
- //
- // Process each language, then each string for each langage
- //
- ZeroString[0] = 0;
- for (Lang = mDBData.LanguageList; Lang != NULL; Lang = Lang->Next) {
- //
- // Process each string for this language. We have to make 3 passes on the strings:
- // Pass1: computes sizes and fill in the string pack header
- // Pass2: write the array of offsets
- // Pass3: write the strings
- //
- //
- // PASS 1: Fill in and print the HII string pack header
- //
- // Compute the size for this language package and write
- // the header out. Each string package contains:
- // Header
- // Offset[] -- an array of offsets to strings, of type RELOFST each
- // String[] -- the actual strings themselves
- //
- memset ((char *) &StringPack, 0, sizeof (EFI_HII_STRING_PACK));
- StringPack.Header.Type = EFI_HII_STRING;
- StringPack.NumStringPointers = (UINT16) mDBData.NumStringIdentifiersReferenced;
- LangName = Lang->LanguageName;
- //
- // First string is the language name. If we're printing all languages, then
- // it's just the "spa". If we were given a list of languages to print, then it's
- // the "spacat" string. Compute its offset and fill in
- // the info in the header. Since we know the language name string's length,
- // and the printable language name follows it, use that info to fill in the
- // entry for the printable language name as well.
- //
- StringPack.LanguageNameString = (STRING_OFFSET) (sizeof (EFI_HII_STRING_PACK) + (mDBData.NumStringIdentifiersReferenced * sizeof (STRING_OFFSET)));
- StringPack.PrintableLanguageName = (STRING_OFFSET) (StringPack.LanguageNameString + (StrLen (LangName) + 1) * sizeof (WCHAR));
- //
- // Add up the size of all strings so we can fill in our header.
- //
- Len = 0;
- for (StringIndex = 0; StringIndex < mDBData.NumStringIdentifiersReferenced; StringIndex++) {
- //
- // For the first string (language name), we print out the "spacat" if they
- // requested it. We set LangName to point to the proper language name string above.
- //
- if (StringIndex == STRING_ID_LANGUAGE_NAME) {
- Len += (StrLen (LangName) + 1) * sizeof (WCHAR);
- } else {
- //
- // Find a string with this language.stringname
- //
- StringIdentifier = StringDBFindStringIdentifierByIndex (StringIndex);
- if (StringIdentifier == NULL) {
- Error (NULL, 0, 0, "internal error", "invalid string index 0x%X", StringIndex);
- return STATUS_ERROR;
- }
- //
- // Find a matching string if this string identifier was referenced
- //
- EmptyString.Flags = STRING_FLAGS_UNDEFINED;
- CurrString = NULL;
- if (StringIdentifier->Flags & STRING_FLAGS_REFERENCED) {
- CurrString = StringDBFindString (
- Lang->LanguageName,
- StringIdentifier->StringName,
- NULL,
- NULL, // LanguagesOfInterest,
- NULL
- );
- //
- // IndirectionList);
- //
- if (NULL == CurrString) {
- //
- // If string for Lang->LanguageName is not found, try to get an English version
- //
- CurrString = StringDBFindString (
- L"eng",
- StringIdentifier->StringName,
- NULL,
- NULL, // LanguagesOfInterest,
- NULL
- );
- //
- // IndirectionList);
- //
- }
- }
-
- if (CurrString == NULL) {
- CurrString = &EmptyString;
- EmptyString.Flags |= StringIdentifier->Flags;
- }
-
- Len += CurrString->Size;
- }
- }
- StringPack.Header.Length = sizeof (EFI_HII_STRING_PACK)
- + mDBData.NumStringIdentifiersReferenced * sizeof (STRING_OFFSET)
- + Len;
- //
- // Write out the string pack header
- //
- fwrite ((void *) &StringPack, sizeof (StringPack), 1, Fptr);
- //
- // PASS2 : write the offsets
- //
- // Traverse the list of strings again and write the array of offsets. The
- // offset to the first string is the size of the string pack header
- // plus the size of the offsets array. The other strings follow it.
- //
- StringIndex = 0;
- Offset = sizeof (StringPack) + mDBData.NumStringIdentifiersReferenced * sizeof (STRING_OFFSET);
- for (StringIndex = 0; StringIndex < mDBData.NumStringIdentifiersReferenced; StringIndex++) {
- //
- // Write the offset
- //
- fwrite (&Offset, sizeof (STRING_OFFSET), 1, Fptr);
- //
- // Find the string name
- //
- StringIdentifier = StringDBFindStringIdentifierByIndex (StringIndex);
- if (StringIdentifier == NULL) {
- Error (NULL, 0, 0, "internal error", "invalid string index 0x%X", StringIndex);
- return STATUS_ERROR;
- }
- //
- // For the first string (language name), we print out the "spacat" if they
- // requested it. We set LangName to point to the proper language name string above.
- //
- if (StringIndex == STRING_ID_LANGUAGE_NAME) {
- Offset += (StrLen (LangName) + 1) * sizeof (WCHAR);
- CurrString = StringDBFindString (
- Lang->LanguageName,
- StringIdentifier->StringName,
- NULL, // scope
- NULL,
- NULL
- );
- } else {
- //
- // Find a matching string
- //
- CurrString = StringDBFindString (
- Lang->LanguageName,
- StringIdentifier->StringName,
- NULL, // scope
- NULL, // LanguagesOfInterest,
- NULL
- );
- //
- // IndirectionList);
- //
- if (NULL == CurrString) {
- CurrString = StringDBFindString (
- L"eng",
- StringIdentifier->StringName,
- NULL, // scope
- NULL, // LanguagesOfInterest,
- NULL
- );
- //
- // IndirectionList);
- //
- }
-
- EmptyString.LanguageName = Lang->LanguageName;
- if (CurrString == NULL) {
- CurrString = &EmptyString;
- EmptyString.Flags = STRING_FLAGS_UNDEFINED;
- } else if ((StringIdentifier->Flags & STRING_FLAGS_REFERENCED) == 0) {
- CurrString = &EmptyString;
- EmptyString.Flags = 0;
- }
-
- Offset += CurrString->Size;
- }
- }
-
- //
- // PASS 3: write the strings themselves.
- //
- Offset = sizeof (StringPack) + mDBData.NumStringIdentifiersReferenced * sizeof (STRING_OFFSET);
- for (StringIndex = 0; StringIndex < mDBData.NumStringIdentifiersReferenced; StringIndex++) {
- StringIdentifier = StringDBFindStringIdentifierByIndex (StringIndex);
- if (StringIdentifier == NULL) {
- Error (NULL, 0, 0, "internal error", "invalid string index 0x%X", StringIndex);
- return STATUS_ERROR;
- }
- //
- // For the first string (language name), we print out the "spacat" if they
- // requested it. We set LangName to point to the proper language name string above.
- //
- if (StringIndex == STRING_ID_LANGUAGE_NAME) {
- TempStringPtr = LangName;
- } else {
- //
- // Find a matching string if this string identifier was referenced
- //
- CurrString = NULL;
- if (StringIdentifier->Flags & STRING_FLAGS_REFERENCED) {
- CurrString = StringDBFindString (
- Lang->LanguageName,
- StringIdentifier->StringName,
- NULL, // scope
- NULL, // LanguagesOfInterest,
- NULL
- );
- //
- // IndirectionList);
- //
- if (NULL == CurrString) {
- CurrString = StringDBFindString (
- L"eng",
- StringIdentifier->StringName,
- NULL, // scope
- NULL, // LanguagesOfInterest,
- NULL
- );
- //
- // IndirectionList);
- //
- }
- }
-
- if (CurrString == NULL) {
- CurrString = &EmptyString;
- }
-
- TempStringPtr = CurrString->Str;
- }
-
- for (TempIndex = 0; TempStringPtr[TempIndex] != 0; TempIndex++) {
- fwrite (&TempStringPtr[TempIndex], sizeof (CHAR16), 1, Fptr);
- Offset += 2;
- }
- //
- // Print NULL WCHAR at the end of this string.
- //
- TempIndex = 0;
- fwrite (&TempIndex, sizeof (CHAR16), 1, Fptr);
- Offset += 2;
- }
- //
- // Sanity check the offset. Make sure our running offset is what we put in the
- // string pack header.
- //
- if (StringPack.Header.Length != Offset) {
- Error (
- __FILE__,
- __LINE__,
- 0,
- "application error",
- "stringpack size 0x%X does not match final size 0x%X",
- StringPack.Header.Length,
- Offset
- );
- }
- }
- //
- // Print terminator string pack, closing brace and close the file.
- // The size of 0 triggers to the consumer that this is the end.
- //
- memset ((char *) &StringPack, 0, sizeof (EFI_HII_STRING_PACK));
- StringPack.Header.Type = EFI_HII_STRING;
- fwrite ((void *) &StringPack, sizeof (StringPack), 1, Fptr);
- fclose (Fptr);
- return STATUS_SUCCESS;
-}
diff --git a/Tools/CCode/Source/StrGather/StringDB.h b/Tools/CCode/Source/StrGather/StringDB.h
deleted file mode 100644
index c52573151f..0000000000
--- a/Tools/CCode/Source/StrGather/StringDB.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- StringDB.h
-
-Abstract:
-
- Common defines and prototypes for string database management
-
---*/
-
-#ifndef _STRING_DB_H_
-#define _STRING_DB_H_
-
-#define LANGUAGE_NAME_STRING_NAME L"$LANGUAGE_NAME"
-#define PRINTABLE_LANGUAGE_NAME_STRING_NAME L"$PRINTABLE_LANGUAGE_NAME"
-
-void
-StringDBConstructor (
- void
- )
-;
-void
-StringDBDestructor (
- void
- )
-;
-
-STATUS
-StringDBAddString (
- WCHAR *LanguageName,
- WCHAR *StringIdentifier,
- WCHAR *Scope,
- WCHAR *String,
- BOOLEAN Format,
- UINT16 Flags
- )
-;
-
-STATUS
-StringDBSetScope (
- WCHAR *Scope
- )
-;
-
-#define STRING_FLAGS_REFERENCED 0x0001 // if referenced somewhere
-#define STRING_FLAGS_UNDEFINED 0x0002 // if we added it for padding purposes
-#define STRING_FLAGS_INDEX_ASSIGNED 0x0004 // so don't change the index value
-#define STRING_ID_INVALID 0xFFFF
-#define STRING_ID_LANGUAGE_NAME 0x0000
-#define STRING_ID_PRINTABLE_LANGUAGE_NAME 0x0001
-
-STATUS
-StringDBAddStringIdentifier (
- WCHAR *StringIdentifier,
- UINT16 *NewId,
- UINT16 Flags
- )
-;
-
-STATUS
-StringDBReadDatabase (
- CHAR8 *DBFileName,
- BOOLEAN IgnoreIfNotExist,
- BOOLEAN Verbose
- )
-;
-
-STATUS
-StringDBWriteDatabase (
- CHAR8 *DBFileName,
- BOOLEAN Verbose
- )
-;
-
-STATUS
-StringDBDumpDatabase (
- CHAR8 *DBFileName,
- CHAR8 *OutputFileName,
- BOOLEAN Verbose
- )
-;
-
-STATUS
-StringDBAddLanguage (
- WCHAR *LanguageName,
- WCHAR *PrintableLanguageName
- )
-;
-
-STATUS
-StringDBDumpCStrings (
- CHAR8 *FileName,
- CHAR8 *BaseName,
- WCHAR_STRING_LIST *LanguagesOfInterest,
- WCHAR_MATCHING_STRING_LIST *IndirectionList
- )
-;
-
-STATUS
-StringDBDumpStringDefines (
- CHAR8 *FileName,
- CHAR8 *BaseName
- )
-;
-
-STATUS
-StringDBSetCurrentLanguage (
- WCHAR *LanguageName
- )
-;
-
-STATUS
-StringDBSetStringReferenced (
- CHAR8 *StringIdentifierName,
- BOOLEAN IgnoreNotFound
- )
-;
-
-void
-StringDBFormatString (
- WCHAR *String
- )
-;
-
-#endif // #ifndef _STRING_DB_H_
diff --git a/Tools/CCode/Source/StrGather/build.xml b/Tools/CCode/Source/StrGather/build.xml
deleted file mode 100644
index 901b4a87e4..0000000000
--- a/Tools/CCode/Source/StrGather/build.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK StrGather Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="StrGather"/>
- <property name="FileSet" value="*.c *.h"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
-
- <compilerarg value="-fshort-wchar" if="gcc"/>
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools String"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/String/PrintLib.c b/Tools/CCode/Source/String/PrintLib.c
deleted file mode 100644
index eef3f4d083..0000000000
--- a/Tools/CCode/Source/String/PrintLib.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-
-Module Name:
-
- PrintLib.c
-
-Abstract:
-
- Print Library.
-
---*/
-
-#include <Common/UefiBaseTypes.h>
-#include <Library/PrintLib.h>
-
-#include "CommonLib.h"
-#include "PrintLibInternal.h"
-
-typedef struct {
- RETURN_STATUS Status;
- CHAR8 *String;
-} STATUS_LOOKUP_TABLE_ENTRY;
-
-static CONST STATUS_LOOKUP_TABLE_ENTRY StatusString[] = {
- { RETURN_SUCCESS, "Success" },
- { RETURN_LOAD_ERROR, "Load Error" },
- { RETURN_INVALID_PARAMETER, "Invalid Parameter" },
- { RETURN_UNSUPPORTED, "Unsupported" },
- { RETURN_BAD_BUFFER_SIZE, "Bad Buffer Size" },
- { RETURN_BUFFER_TOO_SMALL, "Buffer Too Small" },
- { RETURN_NOT_READY, "Not Ready" },
- { RETURN_DEVICE_ERROR, "Device Error" },
- { RETURN_WRITE_PROTECTED, "Write Protected" },
- { RETURN_OUT_OF_RESOURCES, "Out of Resources" },
- { RETURN_VOLUME_CORRUPTED, "Volume Corrupt" },
- { RETURN_VOLUME_FULL, "Volume Full" },
- { RETURN_NO_MEDIA, "No Media" },
- { RETURN_MEDIA_CHANGED, "Media changed" },
- { RETURN_NOT_FOUND, "Not Found" },
- { RETURN_ACCESS_DENIED, "Access Denied" },
- { RETURN_NO_RESPONSE, "No Response" },
- { RETURN_NO_MAPPING, "No mapping" },
- { RETURN_TIMEOUT, "Time out" },
- { RETURN_NOT_STARTED, "Not started" },
- { RETURN_ALREADY_STARTED, "Already started" },
- { RETURN_ABORTED, "Aborted" },
- { RETURN_ICMP_ERROR, "ICMP Error" },
- { RETURN_TFTP_ERROR, "TFTP Error" },
- { RETURN_PROTOCOL_ERROR, "Protocol Error" },
- { RETURN_WARN_UNKNOWN_GLYPH, "Warning Unknown Glyph" },
- { RETURN_WARN_DELETE_FAILURE, "Warning Delete Failure" },
- { RETURN_WARN_WRITE_FAILURE, "Warning Write Failure" },
- { RETURN_WARN_BUFFER_TOO_SMALL, "Warning Buffer Too Small" },
- { 0, NULL }
-};
-
-
-/**
- VSPrint function to process format and place the results in Buffer. Since a
- VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
- this is the main print working routine
-
- @param StartOfBuffer Unicode buffer to print the results of the parsing of Format into.
-
- @param BufferSize Maximum number of characters to put into buffer. Zero means
- no limit.
-
- @param Flags Intial flags value. Can only have FORMAT_UNICODE and OUTPUT_UNICODE set
-
- @param FormatString Unicode format string see file header for more details.
-
- @param Marker Vararg list consumed by processing Format.
-
- @return Number of characters printed.
-
-**/
-UINTN
-BasePrintLibVSPrint (
- OUT CHAR8 *Buffer,
- IN UINTN BufferSize,
- IN UINTN Flags,
- IN CONST CHAR8 *Format,
- IN VA_LIST Marker
- )
-{
- CHAR8 *OriginalBuffer;
- CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];
- UINTN BytesPerOutputCharacter;
- UINTN BytesPerFormatCharacter;
- UINTN FormatMask;
- UINTN FormatCharacter;
- UINTN Width;
- UINTN Precision;
- INT64 Value;
- CHAR8 *ArgumentString;
- UINTN Character;
- GUID *TmpGuid;
- TIME *TmpTime;
- UINTN Count;
- UINTN ArgumentMask;
- INTN BytesPerArgumentCharacter;
- UINTN ArgumentCharacter;
- BOOLEAN Done;
- UINTN Index;
- CHAR8 Prefix;
- BOOLEAN ZeroPad;
- BOOLEAN Comma;
- UINTN Digits;
- UINTN Radix;
- RETURN_STATUS Status;
-
- OriginalBuffer = Buffer;
-
- if ((Flags & OUTPUT_UNICODE) != 0) {
- BytesPerOutputCharacter = 2;
- } else {
- BytesPerOutputCharacter = 1;
- }
- if ((Flags & FORMAT_UNICODE) != 0) {
- BytesPerFormatCharacter = 2;
- FormatMask = 0xffff;
- } else {
- BytesPerFormatCharacter = 1;
- FormatMask = 0xff;
- }
-
- //
- // Reserve space for the Null terminator.
- // If BufferSize is 0, this will set BufferSize to the max unsigned value
- //
- BufferSize--;
-
- //
- // Get the first character from the format string
- //
- FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;
-
- //
- // Loop until the end of the format string is reached or the output buffer is full
- //
- while (FormatCharacter != 0 && BufferSize > 0) {
- //
- // Clear all the flag bits except those that may have been passed in
- //
- Flags &= (OUTPUT_UNICODE | FORMAT_UNICODE);
-
- //
- // Set the default width to zero, and the default precision to 1
- //
- Width = 0;
- Precision = 1;
- Prefix = 0;
- Comma = FALSE;
- ZeroPad = FALSE;
- Count = 0;
- Digits = 0;
-
- switch (FormatCharacter) {
- case '%':
- //
- // Parse Flags and Width
- //
- for (Done = FALSE; !Done; ) {
- Format += BytesPerFormatCharacter;
- FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;
- switch (FormatCharacter) {
- case '.':
- Flags |= PRECISION;
- break;
- case '-':
- Flags |= LEFT_JUSTIFY;
- break;
- case '+':
- Flags |= PREFIX_SIGN;
- break;
- case ' ':
- Flags |= PREFIX_BLANK;
- break;
- case ',':
- Flags |= COMMA_TYPE;
- break;
- case 'L':
- case 'l':
- Flags |= LONG_TYPE;
- break;
- case '*':
- if ((Flags & PRECISION) == 0) {
- Flags |= PAD_TO_WIDTH;
- Width = VA_ARG (Marker, UINTN);
- } else {
- Precision = VA_ARG (Marker, UINTN);
- }
- break;
- case '0':
- if ((Flags & PRECISION) == 0) {
- Flags |= PREFIX_ZERO;
- }
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- for (Count = 0; ((FormatCharacter >= '0') && (FormatCharacter <= '9')); ){
- Count = (Count * 10) + FormatCharacter - '0';
- Format += BytesPerFormatCharacter;
- FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;
- }
- Format -= BytesPerFormatCharacter;
- if ((Flags & PRECISION) == 0) {
- Flags |= PAD_TO_WIDTH;
- Width = Count;
- } else {
- Precision = Count;
- }
- break;
- default:
- Done = TRUE;
- break;
- }
- }
-
- //
- // Limit the maximum field width to the remaining characters in the output buffer
- //
- if (Width > BufferSize) {
- Width = BufferSize;
- }
-
- //
- // Handle each argument type
- //
- switch (FormatCharacter) {
- case 'X':
- Flags |= PREFIX_ZERO;
- //
- // break skiped on purpose
- //
- case 'x':
- Flags |= RADIX_HEX;
- //
- // break skiped on purpose
- //
- case 'd':
- if ((Flags & LONG_TYPE) == 0) {
- Value = (VA_ARG (Marker, INTN));
- } else {
- Value = VA_ARG (Marker, INT64);
- }
- if ((Flags & PREFIX_BLANK) != 0) {
- Prefix = ' ';
- }
- if ((Flags & PREFIX_SIGN) != 0) {
- Prefix = '+';
- }
- if ((Flags & COMMA_TYPE) != 0) {
- Comma = TRUE;
- }
- if ((Flags & RADIX_HEX) == 0) {
- Radix = 10;
- if (Comma) {
- Flags &= (~PREFIX_ZERO);
- Precision = 1;
- }
- if (Value < 0) {
- Flags |= PREFIX_SIGN;
- Prefix = '-';
- Value = -Value;
- }
- } else {
- Radix = 16;
- Comma = FALSE;
- if ((Flags & LONG_TYPE) == 0 && Value < 0) {
- Value = (UINTN)Value;
- }
- }
- //
- // Convert Value to a reversed string
- //
- Count = BasePrintLibValueToString (ValueBuffer, Value, Radix);
- if (Value == 0 && Precision == 0) {
- Count = 0;
- }
- ArgumentString = (CHAR8 *)ValueBuffer + Count;
- Digits = 3 - (Count % 3);
- if (Comma && Count != 0) {
- Count += ((Count - 1) / 3);
- }
- if (Prefix != 0) {
- Count++;
- }
- Flags |= ARGUMENT_REVERSED;
- ZeroPad = TRUE;
- if ((Flags & PREFIX_ZERO) != 0) {
- if ((Flags & PAD_TO_WIDTH) != 0) {
- if ((Flags & PRECISION) == 0) {
- Precision = Width;
- }
- }
- }
- break;
-
- case 's':
- case 'S':
- Flags |= ARGUMENT_UNICODE;
- //
- // break skipped on purpose
- //
- case 'a':
- ArgumentString = (CHAR8 *)VA_ARG (Marker, CHAR8 *);
- if (ArgumentString == NULL) {
- Flags &= (~ARGUMENT_UNICODE);
- ArgumentString = "<null string>";
- }
- break;
-
- case 'c':
- Character = VA_ARG (Marker, UINTN) & 0xffff;
- ArgumentString = (CHAR8 *)&Character;
- Flags |= ARGUMENT_UNICODE;
- break;
-
- case 'g':
- TmpGuid = VA_ARG (Marker, GUID *);
- if (TmpGuid == NULL) {
- ArgumentString = "<null guid>";
- } else {
- BasePrintLibSPrint (
- ValueBuffer,
- 0,
- 0,
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- TmpGuid->Data1,
- TmpGuid->Data2,
- TmpGuid->Data3,
- TmpGuid->Data4[0],
- TmpGuid->Data4[1],
- TmpGuid->Data4[2],
- TmpGuid->Data4[3],
- TmpGuid->Data4[4],
- TmpGuid->Data4[5],
- TmpGuid->Data4[6],
- TmpGuid->Data4[7]
- );
- ArgumentString = ValueBuffer;
- }
- break;
-
- case 't':
- TmpTime = VA_ARG (Marker, TIME *);
- if (TmpTime == NULL) {
- ArgumentString = "<null time>";
- } else {
- BasePrintLibSPrint (
- ValueBuffer,
- 0,
- 0,
- "%02d/%02d/%04d %02d:%02d",
- TmpTime->Month,
- TmpTime->Day,
- TmpTime->Year,
- TmpTime->Hour,
- TmpTime->Minute
- );
- ArgumentString = ValueBuffer;
- }
- break;
-
- case 'r':
- Status = VA_ARG (Marker, RETURN_STATUS);
- ArgumentString = ValueBuffer;
- for (Index = 0; StatusString[Index].String != NULL; Index++) {
- if (Status == StatusString[Index].Status) {
- ArgumentString = StatusString[Index].String;
- }
- }
- if (ArgumentString == ValueBuffer) {
- BasePrintLibSPrint ((CHAR8 *) ValueBuffer, 0, 0, "%08X", Status);
- }
- break;
-
- case '%':
- default:
- //
- // if the type is '%' or unknown, then print it to the screen
- //
- ArgumentString = (CHAR8 *)&FormatCharacter;
- Flags |= ARGUMENT_UNICODE;
- break;
- }
- break;
- case '\n':
- ArgumentString = "\n";
-
- break;
- default:
- ArgumentString = (CHAR8 *)&FormatCharacter;
- Flags |= ARGUMENT_UNICODE;
- break;
- }
-
- //
- // Retrieve the ArgumentString attriubutes
- //
- if ((Flags & ARGUMENT_UNICODE) != 0) {
- ArgumentMask = 0xffff;
- BytesPerArgumentCharacter = 2;
- } else {
- ArgumentMask = 0xff;
- BytesPerArgumentCharacter = 1;
- }
- if ((Flags & ARGUMENT_REVERSED) != 0) {
- BytesPerArgumentCharacter = -BytesPerArgumentCharacter;
- } else {
- //
- // Compute the number of characters in ArgumentString and store it in Count
- // ArgumentString is either null-terminated, or it contains Precision characters
- //
- for (Count = 0; Count < Precision || ((Flags & PRECISION) == 0); Count++) {
- ArgumentCharacter = ((ArgumentString[Count * BytesPerArgumentCharacter] & 0xff) | ((ArgumentString[Count * BytesPerArgumentCharacter + 1]) << 8)) & ArgumentMask;
- if (ArgumentCharacter == 0) {
- break;
- }
- }
- }
-
- //
- // Limit the length of the string to append to the remaining characters in the output buffer
- //
- if (Count > BufferSize) {
- Count = BufferSize;
- }
- if (Precision < Count) {
- Precision = Count;
- }
-
- //
- // Pad before the string
- //
- if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH)) {
- Buffer = BasePrintLibFillBuffer (Buffer, Width - Precision, ' ', BytesPerOutputCharacter);
- }
-
- if (ZeroPad) {
- if (Prefix != 0) {
- Buffer = BasePrintLibFillBuffer (Buffer, 1, Prefix, BytesPerOutputCharacter);
- }
- Buffer = BasePrintLibFillBuffer (Buffer, Precision - Count, '0', BytesPerOutputCharacter);
- } else {
- Buffer = BasePrintLibFillBuffer (Buffer, Precision - Count, ' ', BytesPerOutputCharacter);
- if (Prefix != 0) {
- Buffer = BasePrintLibFillBuffer (Buffer, 1, Prefix, BytesPerOutputCharacter);
- }
- }
-
- //
- // Output the Prefix character if it is present
- //
- Index = 0;
- if (Prefix) {
- Index++;
- }
-
- //
- // Copy the string into the output buffer performing the required type conversions
- //
- while (Index < Count) {
- ArgumentCharacter = ((*ArgumentString & 0xff) | (*(ArgumentString + 1) << 8)) & ArgumentMask;
-
- Buffer = BasePrintLibFillBuffer (Buffer, 1, ArgumentCharacter, BytesPerOutputCharacter);
- ArgumentString += BytesPerArgumentCharacter;
- Index++;
- if (Comma) {
- Digits++;
- if (Digits == 3) {
- Digits = 0;
- Index++;
- if (Index < Count) {
- Buffer = BasePrintLibFillBuffer (Buffer, 1, ',', BytesPerOutputCharacter);
- }
- }
- }
- }
-
- //
- // Pad after the string
- //
- if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH | LEFT_JUSTIFY)) {
- Buffer = BasePrintLibFillBuffer (Buffer, Width - Precision, ' ', BytesPerOutputCharacter);
- }
-
- //
- // Reduce the number of characters
- //
- BufferSize -= Count;
-
- //
- // Get the next character from the format string
- //
- Format += BytesPerFormatCharacter;
-
- //
- // Get the next character from the format string
- //
- FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;
- }
-
- //
- // Null terminate the Unicode or ASCII string
- //
- Buffer = BasePrintLibFillBuffer (Buffer, 1, 0, BytesPerOutputCharacter);
-
- return ((Buffer - OriginalBuffer) / BytesPerOutputCharacter);
-}
-
-UINTN
-BasePrintLibSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN UINTN Flags,
- IN CONST CHAR8 *FormatString,
- ...
- )
-{
- VA_LIST Marker;
-
- VA_START (Marker, FormatString);
- return BasePrintLibVSPrint (StartOfBuffer, BufferSize, Flags, FormatString, Marker);
-}
-
-UINTN
-EFIAPI
-UnicodeVSPrint (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- IN VA_LIST Marker
- )
-{
- return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker);
-}
-
-UINTN
-EFIAPI
-UnicodeSPrint (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- ...
- )
-{
- VA_LIST Marker;
-
- VA_START (Marker, FormatString);
- return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
-}
-
-UINTN
-EFIAPI
-UnicodeVSPrintAsciiFormat (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- IN VA_LIST Marker
- )
-{
- return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE,FormatString, Marker);
-}
-
-UINTN
-EFIAPI
-UnicodeSPrintAsciiFormat (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- ...
- )
-{
- VA_LIST Marker;
-
- VA_START (Marker, FormatString);
- return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize >> 1, FormatString, Marker);
-}
-
-UINTN
-EFIAPI
-AsciiVSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- IN VA_LIST Marker
- )
-{
- return BasePrintLibVSPrint (StartOfBuffer, BufferSize, 0, FormatString, Marker);
-}
-
-UINTN
-EFIAPI
-AsciiSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR8 *FormatString,
- ...
- )
-{
- VA_LIST Marker;
-
- VA_START (Marker, FormatString);
- return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
-}
-
-UINTN
-EFIAPI
-AsciiVSPrintUnicodeFormat (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- IN VA_LIST Marker
- )
-{
- return BasePrintLibVSPrint (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker);
-}
-
-UINTN
-EFIAPI
-AsciiSPrintUnicodeFormat (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- ...
- )
-{
- VA_LIST Marker;
-
- VA_START (Marker, FormatString);
- return AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);
-}
-
-UINTN
-EFIAPI
-UnicodeValueToString (
- IN OUT CHAR16 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- )
-{
- return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 2);
-}
-
-UINTN
-EFIAPI
-AsciiValueToString (
- IN OUT CHAR8 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width
- )
-{
- return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 1);
-}
diff --git a/Tools/CCode/Source/String/PrintLibInternal.c b/Tools/CCode/Source/String/PrintLibInternal.c
deleted file mode 100644
index 63d0c7196f..0000000000
--- a/Tools/CCode/Source/String/PrintLibInternal.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-
-Module Name:
-
- PrintLibInternal.c
-
-Abstract:
-
- Print Library worker functions.
-
---*/
-
-#include <Common/UefiBaseTypes.h>
-#include <Library/PrintLib.h>
-
-#include "CommonLib.h"
-#include "PrintLibInternal.h"
-
-static CONST CHAR8 mHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
-
-CHAR8 *
-BasePrintLibFillBuffer (
- CHAR8 *Buffer,
- INTN Length,
- UINTN Character,
- INTN Increment
- )
-{
- INTN Index;
-
- for (Index = 0; Index < Length; Index++) {
- *Buffer = (CHAR8) Character;
- *(Buffer + 1) = (CHAR8) (Character >> 8);
- Buffer += Increment;
- }
- return Buffer;
-}
-
-/**
- Print worker function that prints a Value as a decimal number in Buffer.
-
- @param Buffer Location to place the Unicode or ASCII string of Value.
-
- @param Value Value to convert to a Decimal or Hexidecimal string in Buffer.
-
- @param Flags Flags to use in printing string, see file header for details.
-
- @param Precision Minimum number of digits to return in the ASCII string
-
- @return Number of characters printed.
-
-**/
-UINTN
-EFIAPI
-BasePrintLibValueToString (
- IN OUT CHAR8 *Buffer,
- IN INT64 Value,
- IN UINTN Radix
- )
-{
- UINTN Digits;
- UINT32 Remainder;
-
- //
- // Loop to convert one digit at a time in reverse order
- //
- *(Buffer++) = 0;
- Digits = 0;
- do {
- // Value = (INT64)DivU64x32Remainder ((UINT64)Value, (UINT32)Radix, &Remainder);
- Remainder = (UINT64)Value % (UINT32)Radix;
- Value = (UINT64)Value / (UINT32)Radix;
- *(Buffer++) = mHexStr[Remainder];
- Digits++;
- } while (Value != 0);
- return Digits;
-}
-
-UINTN
-BasePrintLibConvertValueToString (
- IN OUT CHAR8 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width,
- IN UINTN Increment
- )
-{
- CHAR8 *OriginalBuffer;
- CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];
- UINTN Count;
- UINTN Digits;
- UINTN Index;
-
- OriginalBuffer = Buffer;
-
- if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
- Flags &= (~PREFIX_ZERO);
- }
-
- if (Width == 0 || Width > (MAXIMUM_VALUE_CHARACTERS - 1)) {
- Width = MAXIMUM_VALUE_CHARACTERS - 1;
- }
-
- if (Value < 0) {
- Value = -Value;
- Buffer = BasePrintLibFillBuffer (Buffer, 1, '-', Increment);
- }
-
- Count = BasePrintLibValueToString (ValueBuffer, Value, 10);
-
- if ((Flags & PREFIX_ZERO) != 0) {
- Buffer = BasePrintLibFillBuffer (Buffer, Width - Count, '0', Increment);
- }
-
- Digits = 3 - (Count % 3);
- for (Index = 0; Index < Count; Index++) {
- Buffer = BasePrintLibFillBuffer (Buffer, 1, ValueBuffer[Count - Index], Increment);
- if ((Flags & COMMA_TYPE) != 0) {
- Digits++;
- if (Digits == 3) {
- Digits = 0;
- if ((Index + 1) < Count) {
- Buffer = BasePrintLibFillBuffer (Buffer, 1, ',', Increment);
- }
- }
- }
- }
-
- Buffer = BasePrintLibFillBuffer (Buffer, 1, 0, Increment);
-
- return ((Buffer - OriginalBuffer) / Increment);
-}
diff --git a/Tools/CCode/Source/String/PrintLibInternal.h b/Tools/CCode/Source/String/PrintLibInternal.h
deleted file mode 100644
index 87f0955e05..0000000000
--- a/Tools/CCode/Source/String/PrintLibInternal.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-
-Module Name:
-
- PrintLibInternal.h
-
-Abstract:
-
- Print Library.
-
---*/
-
-
-
-//
-// Print primitives
-//
-//#define LEFT_JUSTIFY 0x01
-#define PREFIX_SIGN 0x02
-#define PREFIX_BLANK 0x04
-//#define COMMA_TYPE 0x08
-#define LONG_TYPE 0x10
-//#define PREFIX_ZERO 0x20
-#define OUTPUT_UNICODE 0x40
-#define RADIX_HEX 0x80
-#define FORMAT_UNICODE 0x100
-#define PAD_TO_WIDTH 0x200
-#define ARGUMENT_UNICODE 0x400
-#define PRECISION 0x800
-#define ARGUMENT_REVERSED 0x1000
-
-///
-/// Define the maximum number of characters that are required to encode
-/// a decimal, hexidecimal, GUID, or TIME value with a Nll terminator.
-/// Maximum Length Decimal String = 28 "-9,223,372,036,854,775,808"
-/// Maximum Length Hexidecimal String = 17 "FFFFFFFFFFFFFFFF"
-/// Maximum Length GUID = 37 "00000000-0000-0000-0000-000000000000"
-/// Maximum Length TIME = 18 "12/12/2006 12:12"
-///
-#define MAXIMUM_VALUE_CHARACTERS 38
-
-//
-//
-//
-typedef struct {
- UINT16 Year;
- UINT8 Month;
- UINT8 Day;
- UINT8 Hour;
- UINT8 Minute;
- UINT8 Second;
- UINT8 Pad1;
- UINT32 Nanosecond;
- INT16 TimeZone;
- UINT8 Daylight;
- UINT8 Pad2;
-} TIME;
-
-UINTN
-BasePrintLibSPrint (
- OUT CHAR8 *Buffer,
- IN UINTN BufferSize,
- IN UINTN Flags,
- IN CONST CHAR8 *FormatString,
- ...
- );
-
-CHAR8 *
-BasePrintLibFillBuffer (
- CHAR8 *Buffer,
- INTN Length,
- UINTN Character,
- INTN Increment
- );
-
-UINTN
-EFIAPI
-BasePrintLibValueToString (
- IN OUT CHAR8 *Buffer,
- IN INT64 Value,
- IN UINTN Radix
- );
-
-UINTN
-BasePrintLibConvertValueToString (
- IN OUT CHAR8 *Buffer,
- IN UINTN Flags,
- IN INT64 Value,
- IN UINTN Width,
- IN UINTN Increment
- );
diff --git a/Tools/CCode/Source/String/String.c b/Tools/CCode/Source/String/String.c
deleted file mode 100644
index 78d0a59fca..0000000000
--- a/Tools/CCode/Source/String/String.c
+++ /dev/null
@@ -1,732 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-
-Module Name:
-
- String.c
-
-Abstract:
-
- Unicode and ASCII string primatives.
-
---*/
-
-#include <assert.h>
-
-#include <Common/UefiBaseTypes.h>
-
-#include <string.h>
-
-#include "CommonLib.h"
-
-/**
- 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().
-
- @param String Pointer to a Null-terminated Unicode string.
-
- @return The length of String.
-
-**/
-UINTN
-EFIAPI
-StrLen (
- IN CONST CHAR16 *String
- )
-{
- UINTN Length;
-
- ASSERT (String != NULL);
-
- for (Length = 0; *String != L'\0'; String++, Length++) {
- ;
- }
- return Length;
-}
-
-/**
- Returns the length of a Null-terminated ASCII string.
-
- This function returns the number of ASCII characters in the Null-terminated
- ASCII string specified by String.
-
- If String is NULL, then ASSERT().
-
- @param String Pointer to a Null-terminated ASCII string.
-
- @return The length of String.
-
-**/
-UINTN
-EFIAPI
-AsciiStrLen (
- IN CONST CHAR8 *String
- )
-{
- UINTN Length;
-
- ASSERT (String != NULL);
-
- for (Length = 0; *String != '\0'; String++, Length++) {
- ;
- }
- return Length;
-}
-
-/**
- Copies one Null-terminated Unicode string to another Null-terminated Unicode
- string and returns the new Unicode string.
-
- This function copies the contents of the Unicode string Source to the Unicode
- string Destination, and returns Destination. If Source and Destination
- overlap, then the results are undefined.
-
- If Destination is NULL, then ASSERT().
- If Source is NULL, then ASSERT().
- If Source and Destination overlap, then ASSERT().
-
- @param Destination Pointer to a Null-terminated Unicode string.
- @param Source Pointer to a Null-terminated Unicode string.
-
- @return Destiantion
-
-**/
-CHAR16 *
-EFIAPI
-StrCpy (
- OUT CHAR16 *Destination,
- IN CONST CHAR16 *Source
- )
-{
- CHAR16 *ReturnValue;
-
- //
- // Destination cannot be NULL
- //
- ASSERT (Destination != NULL);
-
- //
- // Destination and source cannot overlap
- //
- ASSERT ((UINTN)(Destination - Source) > StrLen (Source));
- ASSERT ((UINTN)(Source - Destination) > StrLen (Source));
-
- ReturnValue = Destination;
- while (*Source) {
- *(Destination++) = *(Source++);
- }
- *Destination = 0;
- return ReturnValue;
-}
-
-/**
- Copies one Null-terminated Unicode string with a maximum length to another
- Null-terminated Unicode string with a maximum length and returns the new
- Unicode string.
-
- This function copies the contents of the Unicode string Source to the Unicode
- string Destination, and returns Destination. At most, Length Unicode
- characters are copied from Source to Destination. If Length is 0, then
- Destination is returned unmodified. If Length is greater that the number of
- Unicode characters in Source, then Destination is padded with Null Unicode
- characters. If Source and Destination overlap, then the results are
- undefined.
-
- If Destination is NULL, then ASSERT().
- If Source is NULL, then ASSERT().
- If Source and Destination overlap, then ASSERT().
-
- @param Destination Pointer to a Null-terminated Unicode string.
- @param Source Pointer to a Null-terminated Unicode string.
- @param Length Maximum number of Unicode characters to copy.
-
- @return Destination
-
-**/
-CHAR16 *
-EFIAPI
-StrnCpy (
- OUT CHAR16 *Destination,
- IN CONST CHAR16 *Source,
- IN UINTN Length
- )
-{
- CHAR16 *ReturnValue;
-
- if (Length == 0) {
- return Destination;
- }
-
- //
- // Destination cannot be NULL if Length is not zero
- //
- ASSERT (Destination != NULL);
-
- //
- // Destination and source cannot overlap
- // Q: Does Source have to be NULL-terminated?
- //
- ASSERT ((UINTN)(Destination - Source) > StrLen (Source));
- ASSERT ((UINTN)(Source - Destination) >= Length);
-
- ReturnValue = Destination;
-
- while ((*Source != L'\0') && (Length > 0)) {
- *(Destination++) = *(Source++);
- Length--;
- }
-
- memset (Destination, 0, Length * sizeof (*Destination));
- return ReturnValue;
-}
-
-/**
- Returns the size of a Null-terminated Unicode string in bytes, including the
- Null terminator.
-
- This function returns the size, in bytes, of the Null-terminated Unicode
- string specified by String.
-
- If String is NULL, then ASSERT().
-
- @param String Pointer to a Null-terminated Unicode string.
-
- @return The size of String.
-
-**/
-UINTN
-EFIAPI
-StrSize (
- IN CONST CHAR16 *String
- )
-{
- return (StrLen (String) + 1) * sizeof (*String);
-}
-
-/**
- Compares 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. 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 FirstString is NULL, then ASSERT().
- If SecondString is NULL, then ASSERT().
-
- @param FirstString Pointer to a Null-terminated Unicode string.
- @param SecondString Pointer to a Null-terminated Unicode string.
-
- @retval 0 FirstString is identical to SecondString.
- @retval !=0 FirstString is not identical to SecondString.
-
-**/
-INTN
-EFIAPI
-StrCmp (
- IN CONST CHAR16 *FirstString,
- IN CONST CHAR16 *SecondString
- )
-{
- //
- // ASSERT both strings should never be zero
- //
- ASSERT (StrSize (FirstString) != 0);
- ASSERT (StrSize (SecondString) != 0);
-
- while ((*FirstString != L'\0') && (*FirstString == *SecondString)) {
- FirstString++;
- SecondString++;
- }
- return *FirstString - *SecondString;
-}
-
-/**
- Compares two Null-terminated Unicode strings with maximum lengths, 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 FirstString is NULL, then ASSERT().
- If SecondString is NULL, then ASSERT().
-
- @param FirstString Pointer to a Null-terminated Unicode string.
- @param SecondString Pointer to a Null-terminated Unicode string.
- @param Length Maximum number of Unicode characters to compare.
-
- @retval 0 FirstString is identical to SecondString.
- @retval !=0 FirstString is not identical to SecondString.
-
-**/
-INTN
-EFIAPI
-StrnCmp (
- IN CONST CHAR16 *FirstString,
- IN CONST CHAR16 *SecondString,
- IN UINTN Length
- )
-{
- if (Length == 0) {
- return 0;
- }
-
- //
- // ASSERT both strings should never be zero
- //
- ASSERT (StrSize (FirstString) != 0);
- ASSERT (StrSize (SecondString) != 0);
-
- while ((*FirstString != L'\0') &&
- (*FirstString == *SecondString) &&
- (Length > 1)) {
- FirstString++;
- SecondString++;
- Length--;
- }
-
- return *FirstString - *SecondString;
-}
-
-/**
- Concatenates one Null-terminated Unicode string to another Null-terminated
- Unicode string, and returns the concatenated Unicode string.
-
- This function concatenates two Null-terminated Unicode strings. The contents
- of Null-terminated Unicode string Source are concatenated to the end of
- Null-terminated Unicode string Destination. The Null-terminated concatenated
- Unicode String is returned. If Source and Destination overlap, then the
- results are undefined.
-
- If Destination is NULL, then ASSERT().
- If Source is NULL, then ASSERT().
- If Source and Destination overlap, then ASSERT().
-
- @param Destination Pointer to a Null-terminated Unicode string.
- @param Source Pointer to a Null-terminated Unicode string.
-
- @return Destination
-
-**/
-CHAR16 *
-EFIAPI
-StrCat (
- IN OUT CHAR16 *Destination,
- IN CONST CHAR16 *Source
- )
-{
- StrCpy (Destination + StrLen (Destination), Source);
-
- //
- // Size of the resulting string should never be zero.
- //
- ASSERT (StrSize (Destination) != 0);
- return Destination;
-}
-
-/**
- Concatenates one Null-terminated Unicode string with a maximum length to the
- end of another Null-terminated Unicode string, and returns the concatenated
- Unicode string.
-
- This function concatenates two Null-terminated Unicode strings. The contents
- of Null-terminated Unicode string Source are concatenated to the end of
- Null-terminated Unicode string Destination, and Destination is returned. At
- most, Length Unicode characters are concatenated from Source to the end of
- Destination, and Destination is always Null-terminated. If Length is 0, then
- Destination is returned unmodified. If Source and Destination overlap, then
- the results are undefined.
-
- If Destination is NULL, then ASSERT().
- If Source is NULL, then ASSERT().
- If Source and Destination overlap, then ASSERT().
-
- @param Destination Pointer to a Null-terminated Unicode string.
- @param Source Pointer to a Null-terminated Unicode string.
- @param Length Maximum number of Unicode characters to concatenate from
- Source.
-
- @return Destination
-
-**/
-CHAR16 *
-EFIAPI
-StrnCat (
- IN OUT CHAR16 *Destination,
- IN CONST CHAR16 *Source,
- IN UINTN Length
- )
-{
- StrnCpy (Destination + StrLen (Destination), Source, Length);
-
- //
- // Size of the resulting string should never be zero.
- //
- ASSERT (StrSize (Destination) != 0);
- return Destination;
-}
-
-/**
- Copies one Null-terminated ASCII string to another Null-terminated ASCII
- string and returns the new ASCII string.
-
- This function copies the contents of the ASCII string Source to the ASCII
- string Destination, and returns Destination. If Source and Destination
- overlap, then the results are undefined.
-
- If Destination is NULL, then ASSERT().
- If Source is NULL, then ASSERT().
- If Source and Destination overlap, then ASSERT().
-
- @param Destination Pointer to a Null-terminated ASCII string.
- @param Source Pointer to a Null-terminated ASCII string.
-
- @return Destination
-
-**/
-CHAR8 *
-EFIAPI
-AsciiStrCpy (
- OUT CHAR8 *Destination,
- IN CONST CHAR8 *Source
- )
-{
- CHAR8 *ReturnValue;
-
- //
- // Destination cannot be NULL
- //
- ASSERT (Destination != NULL);
-
- //
- // Destination and source cannot overlap
- //
- ASSERT ((UINTN)(Destination - Source) > AsciiStrLen (Source));
- ASSERT ((UINTN)(Source - Destination) > AsciiStrLen (Source));
-
- ReturnValue = Destination;
- while (*Source) {
- *(Destination++) = *(Source++);
- }
- *Destination = 0;
- return ReturnValue;
-}
-
-/**
- Copies one Null-terminated ASCII string with a maximum length to another
- Null-terminated ASCII string with a maximum length and returns the new ASCII
- string.
-
- This function copies the contents of the ASCII string Source to the ASCII
- string Destination, and returns Destination. At most, Length ASCII characters
- are copied from Source to Destination. If Length is 0, then Destination is
- returned unmodified. If Length is greater that the number of ASCII characters
- in Source, then Destination is padded with Null ASCII characters. If Source
- and Destination overlap, then the results are undefined.
-
- If Destination is NULL, then ASSERT().
- If Source is NULL, then ASSERT().
- If Source and Destination overlap, then ASSERT().
-
- @param Destination Pointer to a Null-terminated ASCII string.
- @param Source Pointer to a Null-terminated ASCII string.
- @param Length Maximum number of ASCII characters to copy.
-
- @return Destination
-
-**/
-CHAR8 *
-EFIAPI
-AsciiStrnCpy (
- OUT CHAR8 *Destination,
- IN CONST CHAR8 *Source,
- IN UINTN Length
- )
-{
- CHAR8 *ReturnValue;
-
- if (Length == 0) {
- return Destination;
- }
-
- //
- // Destination cannot be NULL
- //
- ASSERT (Destination != NULL);
-
- //
- // Destination and source cannot overlap
- //
- ASSERT ((UINTN)(Destination - Source) > AsciiStrLen (Source));
- ASSERT ((UINTN)(Source - Destination) >= Length);
-
- ReturnValue = Destination;
-
- while (*Source && Length > 0) {
- *(Destination++) = *(Source++);
- Length--;
- }
-
- // ZeroMem (Destination, Length * sizeof (*Destination));
- memset (Destination, 0, Length * sizeof (*Destination));
- return ReturnValue;
-}
-
-/**
- Returns the size of a Null-terminated ASCII string in bytes, including the
- Null terminator.
-
- This function returns the size, in bytes, of the Null-terminated ASCII string
- specified by String.
-
- If String is NULL, then ASSERT().
-
- @param String Pointer to a Null-terminated ASCII string.
-
- @return The size of String.
-
-**/
-UINTN
-EFIAPI
-AsciiStrSize (
- IN CONST CHAR8 *String
- )
-{
- return (AsciiStrLen (String) + 1) * sizeof (*String);
-}
-
-/**
- Compares two Null-terminated ASCII strings, and returns the difference
- between the first mismatched ASCII characters.
-
- This function compares the Null-terminated ASCII string FirstString to the
- Null-terminated ASCII string SecondString. If FirstString is identical to
- SecondString, then 0 is returned. Otherwise, the value returned is the first
- mismatched ASCII character in SecondString subtracted from the first
- mismatched ASCII character in FirstString.
-
- If FirstString is NULL, then ASSERT().
- If SecondString is NULL, then ASSERT().
-
- @param FirstString Pointer to a Null-terminated ASCII string.
- @param SecondString Pointer to a Null-terminated ASCII string.
-
- @retval 0 FirstString is identical to SecondString.
- @retval !=0 FirstString is not identical to SecondString.
-
-**/
-INTN
-EFIAPI
-AsciiStrCmp (
- IN CONST CHAR8 *FirstString,
- IN CONST CHAR8 *SecondString
- )
-{
- //
- // ASSERT both strings should never be zero
- //
- ASSERT (AsciiStrSize (FirstString));
- ASSERT (AsciiStrSize (SecondString));
-
- while ((*FirstString != '\0') && (*FirstString == *SecondString)) {
- FirstString++;
- SecondString++;
- }
-
- return *FirstString - *SecondString;
-}
-
-STATIC
-CHAR8
-EFIAPI
-AsciiToUpper (
- IN CHAR8 Chr
- )
-{
- return (Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr;
-}
-
-/**
- Performs a case insensitive comparison of two Null-terminated ASCII strings,
- and returns the difference between the first mismatched ASCII characters.
-
- This function performs a case insensitive comparison of the Null-terminated
- ASCII string FirstString to the Null-terminated ASCII string SecondString. If
- FirstString is identical to SecondString, then 0 is returned. Otherwise, the
- value returned is the first mismatched lower case ASCII character in
- SecondString subtracted from the first mismatched lower case ASCII character
- in FirstString.
-
- If FirstString is NULL, then ASSERT().
- If SecondString is NULL, then ASSERT().
-
- @param FirstString Pointer to a Null-terminated ASCII string.
- @param SecondString Pointer to a Null-terminated ASCII string.
-
- @retval 0 FirstString is identical to SecondString using case insensitive
- comparisons.
- @retval !=0 FirstString is not identical to SecondString using case
- insensitive comparisons.
-
-**/
-INTN
-EFIAPI
-AsciiStriCmp (
- IN CONST CHAR8 *FirstString,
- IN CONST CHAR8 *SecondString
- )
-{
- //
- // ASSERT both strings should never be zero
- //
- ASSERT (AsciiStrSize (FirstString));
- ASSERT (AsciiStrSize (SecondString));
-
- while ((*FirstString != '\0') &&
- (AsciiToUpper (*FirstString) == AsciiToUpper (*SecondString))) {
- FirstString++;
- SecondString++;
- }
-
- return AsciiToUpper (*FirstString) - AsciiToUpper (*SecondString);
-}
-
-/**
- Compares two Null-terminated ASCII strings with maximum lengths, and returns
- the difference between the first mismatched ASCII characters.
-
- This function compares the Null-terminated ASCII string FirstString to the
- Null-terminated ASCII string SecondString. At most, Length ASCII 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 ASCII character in SecondString subtracted from the
- first mismatched ASCII character in FirstString.
-
- If FirstString is NULL, then ASSERT().
- If SecondString is NULL, then ASSERT().
-
- @param FirstString Pointer to a Null-terminated ASCII string.
- @param SecondString Pointer to a Null-terminated ASCII string.
-
- @retval 0 FirstString is identical to SecondString.
- @retval !=0 FirstString is not identical to SecondString.
-
-**/
-INTN
-EFIAPI
-AsciiStrnCmp (
- IN CONST CHAR8 *FirstString,
- IN CONST CHAR8 *SecondString,
- IN UINTN Length
- )
-{
- //
- // ASSERT both strings should never be zero
- //
- ASSERT (AsciiStrSize (FirstString));
- ASSERT (AsciiStrSize (SecondString));
-
- while ((*FirstString != '\0') &&
- (*FirstString == *SecondString) &&
- (Length > 1)) {
- FirstString++;
- SecondString++;
- Length--;
- }
- return *FirstString - *SecondString;
-}
-
-/**
- Concatenates one Null-terminated ASCII string to another Null-terminated
- ASCII string, and returns the concatenated ASCII string.
-
- This function concatenates two Null-terminated ASCII strings. The contents of
- Null-terminated ASCII string Source are concatenated to the end of Null-
- terminated ASCII string Destination. The Null-terminated concatenated ASCII
- String is returned.
-
- If Destination is NULL, then ASSERT().
- If Source is NULL, then ASSERT().
-
- @param Destination Pointer to a Null-terminated ASCII string.
- @param Source Pointer to a Null-terminated ASCII string.
-
- @return Destination
-
-**/
-CHAR8 *
-EFIAPI
-AsciiStrCat (
- IN OUT CHAR8 *Destination,
- IN CONST CHAR8 *Source
- )
-{
- AsciiStrCpy (Destination + AsciiStrLen (Destination), Source);
-
- //
- // Size of the resulting string should never be zero.
- //
- ASSERT (AsciiStrSize (Destination) != 0);
- return Destination;
-}
-
-/**
- Concatenates one Null-terminated ASCII string with a maximum length to the
- end of another Null-terminated ASCII string, and returns the concatenated
- ASCII string.
-
- This function concatenates two Null-terminated ASCII strings. The contents
- of Null-terminated ASCII string Source are concatenated to the end of Null-
- terminated ASCII string Destination, and Destination is returned. At most,
- Length ASCII characters are concatenated from Source to the end of
- Destination, and Destination is always Null-terminated. If Length is 0, then
- Destination is returned unmodified. If Source and Destination overlap, then
- the results are undefined.
-
- If Destination is NULL, then ASSERT().
- If Source is NULL, then ASSERT().
- If Source and Destination overlap, then ASSERT().
-
- @param Destination Pointer to a Null-terminated ASCII string.
- @param Source Pointer to a Null-terminated ASCII string.
- @param Length Maximum number of ASCII characters to concatenate from
- Source.
-
- @return Destination
-
-**/
-CHAR8 *
-EFIAPI
-AsciiStrnCat (
- IN OUT CHAR8 *Destination,
- IN CONST CHAR8 *Source,
- IN UINTN Length
- )
-{
- AsciiStrnCpy (Destination + AsciiStrLen (Destination), Source, Length);
-
- //
- // Size of the resulting string should never be zero.
- //
- ASSERT (AsciiStrSize (Destination) != 0);
- return Destination;
-}
diff --git a/Tools/CCode/Source/String/build.xml b/Tools/CCode/Source/String/build.xml
deleted file mode 100644
index b42504ea25..0000000000
--- a/Tools/CCode/Source/String/build.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK String
- Copyright (c) 2006, Intel Corporation
--->
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LibName" value="String"/>
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${LibName}/tmp"/>
-
- <target name="GenTool" depends="init, String">
- <echo message="The EDK Library: ${LibName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Library: ${LibName}"/>
- <mkdir dir="${BUILD_DIR}"/>
-
- <condition property="syslibdirs" value="">
- <os family="mac"/>
- </condition>
-
- <condition property="syslibs" value="">
- <os family="mac"/>
- </condition>
-
- <condition property="syslibdirs" value="${env.CYGWIN_HOME}/lib/e2fsprogs">
- <os family="windows"/>
- </condition>
-
- <condition property="syslibs" value="uuid">
- <os family="windows"/>
- </condition>
-
- <condition property="syslibdirs" value="/usr/lib">
- <os name="Linux"/>
- </condition>
-
- <condition property="syslibs" value="uuid">
- <os name="Linux"/>
- </condition>
-
- </target>
-
- <target name="String" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${LIB_DIR}/${LibName}"
- outtype="static"
- debug="true"
- optimize="speed">
- <compilerarg value="${ExtraArgus}" if="ExtraArgus" />
- <compilerarg value="-fshort-wchar" if="gcc"/>
-
- <fileset dir="${basedir}/${LibName}"
- includes="*.c" />
-
- <includepath path="${PACKAGE_DIR}/${LibName}"/>
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- </cc>
- </target>
-
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Library: ${LibName}${ext_static}"/>
- <delete dir="${PACKAGE_DIR}/${LibName}/tmp">
- </delete>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${LIB_DIR}/${LibName}${ext_static}"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/Strip/Strip.c b/Tools/CCode/Source/Strip/Strip.c
deleted file mode 100644
index a7efd54936..0000000000
--- a/Tools/CCode/Source/Strip/Strip.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-
-Module Name:
-
- Strip.c
-
-Abstract:
-
- Quick Exe2Bin equivalent.
-
---*/
-
-#include <stdio.h>
-#include <memory.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define UTILITY_NAME "Strip"
-#define UTILITY_MAJOR_VERSION 1
-#define UTILITY_MINOR_VERSION 1
-
-
-void
-Version(
- void
- )
-/*++
-
-Routine Description:
-
- Print out version information for Strip.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- printf ("%s v%d.%d -EDK Utility to Convert EXE to BIN\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 2005-2006 Intel Corporation. All rights reserved.\n");
-}
-
-void
-Usage(
- void
- )
-/*++
-
-Routine Description:
-
- Print out usage information for Strip.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- Version();
- printf ("\nUsage: %s InputFile OutputFile\n", UTILITY_NAME);
-}
-
-int
-main (
- int argc,
- char *argv[]
- )
-/*++
-
-Routine Description:
-
- Converts executable files to binary files.
-
-Arguments:
-
- argc - Number of command line arguments
- argv[] - Array of pointers to the command line arguments
-
-Returns:
-
- Zero - Function completed successfully.
- Non-zero - Function exited with errors.
-
---*/
-{
- FILE *InFile;
- FILE *OutFile;
- int Index;
- int FileSize;
- char *Buffer;
- char *Ptrx;
-
- if (argc == 1) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return 0;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return 0;
- }
-
- if (argc < 3) {
- Usage();
- return -1;
- }
-
- InFile = fopen (argv[1], "rb");
- OutFile = fopen (argv[2], "wb");
-
- if (!InFile) {
- printf ("Unable to open input file, exit\n");
- return -1;
- }
-
- if (OutFile == NULL) {
- printf ("Unable to open output file, exit.\n");
- return -1;
- }
-
- fseek (InFile, 0, SEEK_END);
- FileSize = ftell (InFile);
-
- if (FileSize < 0x200) {
- printf ("%d is not a legal file size, exit\n", FileSize);
- return -1;
- }
-
- fseek (InFile, 0, SEEK_SET);
-
- Buffer = (char *) malloc (FileSize);
- if (Buffer == NULL) {
- printf ("Error: Out of resources.\n");
- return -1;
- }
-
- fread (Buffer, 1, FileSize, InFile);
-
- Ptrx = Buffer + 0x200;
-
- Index = FileSize - 0x200;
-
- fwrite (Ptrx, Index, 1, OutFile);
-
- fclose (InFile);
- fclose (OutFile);
- free (Buffer);
-
- return 0;
-}
diff --git a/Tools/CCode/Source/Strip/build.xml b/Tools/CCode/Source/Strip/build.xml
deleted file mode 100644
index e079c7e3c6..0000000000
--- a/Tools/CCode/Source/Strip/build.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK Strip Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="Strip"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed!"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/Ia32"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/TianoTools.msa b/Tools/CCode/Source/TianoTools.msa
deleted file mode 100644
index e2758a97b7..0000000000
--- a/Tools/CCode/Source/TianoTools.msa
+++ /dev/null
@@ -1,326 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Tiano C Tools</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>A169C678-3F55-4b6a-80BF-FD8B8DCAB883</GuidValue>
- <Version>2.0</Version>
- <Abstract>This is the TianoTools Module</Abstract>
- <Description>This Module provides the EFI/Tiano Tools that are used to create EFI/Tiano
- Modules and Platform Binary Files (PBF)
- These tools require compilation only once if the Developer Workstation and
- the Developer's choice of HOST tool chain are stable. If the developer
- updates either the OS or the HOST tool chain, these tools should be rebuilt.</Description>
- <Copyright>Copyright 2006, Intel Corporation</Copyright>
- <License URL="http://opensource.org/licenses/bsd-license.php">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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>EBC IA32 X64 IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>build.xml</Filename>
- <Filename>Common/build.xml</Filename>
- <Filename>Common/CommonLib.c</Filename>
- <Filename>Common/CommonLib.h</Filename>
- <Filename>Common/Crc32.c</Filename>
- <Filename>Common/Crc32.h</Filename>
- <Filename>Common/EfiCompress.c</Filename>
- <Filename>Common/EfiCompress.h</Filename>
- <Filename>Common/EfiCustomizedCompress.h</Filename>
- <Filename>Common/EfiDecompress.c</Filename>
- <Filename>Common/EfiDecompress.h</Filename>
- <Filename>Common/EfiUtilityMsgs.c</Filename>
- <Filename>Common/EfiUtilityMsgs.h</Filename>
- <Filename>Common/FvLib.c</Filename>
- <Filename>Common/FvLib.h</Filename>
- <Filename>Common/MyAlloc.c</Filename>
- <Filename>Common/MyAlloc.h</Filename>
- <Filename>Common/ParseInf.c</Filename>
- <Filename>Common/ParseInf.h</Filename>
- <Filename>Common/SimpleFileParsing.c</Filename>
- <Filename>Common/SimpleFileParsing.h</Filename>
- <Filename>Common/WinNtInclude.h</Filename>
- <Filename>CompressDll/build.xml</Filename>
- <Filename>CompressDll/CompressDll.c</Filename>
- <Filename>CompressDll/CompressDll.h</Filename>
- <Filename>CreateMtFile/build.xml</Filename>
- <Filename>CreateMtFile/CreateMtFile.c</Filename>
- <Filename>CustomizedCompress/build.xml</Filename>
- <Filename>CustomizedCompress/CustomizedCompress.c</Filename>
- <Filename>EfiCompress/build.xml</Filename>
- <Filename>EfiCompress/EfiCompressMain.c</Filename>
- <Filename>EfiCompress/makefile</Filename>
- <Filename>EfiRom/build.xml</Filename>
- <Filename>EfiRom/EfiRom.c</Filename>
- <Filename>FlashMap/build.xml</Filename>
- <Filename>FlashMap/FlashDefFile.c</Filename>
- <Filename>FlashMap/FlashDefFile.h</Filename>
- <Filename>FlashMap/FlashMap.c</Filename>
- <Filename>FlashMap/Microcode.c</Filename>
- <Filename>FlashMap/Microcode.h</Filename>
- <Filename>FlashMap/Symbols.c</Filename>
- <Filename>FlashMap/Symbols.h</Filename>
- <Filename>FwImage/build.xml</Filename>
- <Filename>FwImage/fwimage.c</Filename>
- <Filename>GenAcpiTable/build.xml</Filename>
- <Filename>GenAcpiTable/GenAcpiTable.c</Filename>
- <Filename>GenCapsuleHdr/build.xml</Filename>
- <Filename>GenCapsuleHdr/CreateGuid.c</Filename>
- <Filename>GenCapsuleHdr/GenCapsuleHdr.c</Filename>
- <Filename>GenCRC32Section/build.xml</Filename>
- <Filename>GenCRC32Section/GenCRC32Section.c</Filename>
- <Filename>GenCRC32Section/GenCRC32Section.h</Filename>
- <Filename>GenDepex/build.xml</Filename>
- <Filename>GenDepex/DepexParser.c</Filename>
- <Filename>GenDepex/DepexParser.h</Filename>
- <Filename>GenDepex/GenDepex.c</Filename>
- <Filename>GenDepex/GenDepex.h</Filename>
- <Filename>GenFfsFile/build.xml</Filename>
- <Filename>GenFfsFile/GenFfsFile.c</Filename>
- <Filename>GenFfsFile/GenFfsFile.h</Filename>
- <Filename>GenFfsFile/SimpleFileParsing.c</Filename>
- <Filename>GenFvImage/build.xml</Filename>
- <Filename>GenFvImage/Ebc/PeCoffLoaderEx.c</Filename>
- <Filename>GenFvImage/GenFvImageExe.c</Filename>
- <Filename>GenFvImage/GenFvImageExe.h</Filename>
- <Filename>GenFvImage/GenFvImageLib.c</Filename>
- <Filename>GenFvImage/GenFvImageLib.h</Filename>
- <Filename>GenFvImage/GenFvImageLibInternal.h</Filename>
- <Filename>GenFvMap/build.xml</Filename>
- <Filename>GenFvMap/GenFvMap.cpp</Filename>
- <Filename>GenSection/build.xml</Filename>
- <Filename>GenSection/GenSection.c</Filename>
- <Filename>GenSection/GenSection.h</Filename>
- <Filename>GenTEImage/build.xml</Filename>
- <Filename>GenTEImage/GenTEImage.c</Filename>
- <Filename>GuidChk/build.xml</Filename>
- <Filename>GuidChk/CommonUtils.h</Filename>
- <Filename>GuidChk/FileSearch.c</Filename>
- <Filename>GuidChk/FileSearch.h</Filename>
- <Filename>GuidChk/GuidChk.c</Filename>
- <Filename>GuidChk/GuidList.c</Filename>
- <Filename>GuidChk/UtilsMsgs.c</Filename>
- <Filename>GuidChk/UtilsMsgs.h</Filename>
- <Filename>Include/Common/BaseTypes.h</Filename>
- <Filename>Include/Common/Capsule.h</Filename>
- <Filename>Include/Common/Dependency.h</Filename>
- <Filename>Include/Common/EfiImage.h</Filename>
- <Filename>Include/Common/FirmwareFileSystem.h</Filename>
- <Filename>Include/Common/FirmwareVolumeHeader.h</Filename>
- <Filename>Include/Common/FirmwareVolumeImageFormat.h</Filename>
- <Filename>Include/Common/InternalFormRepresentation.h</Filename>
- <Filename>Include/Common/MultiPhase.h</Filename>
- <Filename>Include/Common/UefiBaseTypes.h</Filename>
- <Filename>Include/Common/Variable.h</Filename>
- <Filename>Include/Common/WorkingBlockHeader.h</Filename>
- <Filename>Include/Guid/AcpiTableStorage.h</Filename>
- <Filename>Include/Guid/Apriori.h</Filename>
- <Filename>Include/Guid/Capsule.h</Filename>
- <Filename>Include/Guid/FirmwareFileSystem.h</Filename>
- <Filename>Include/Ia32/ProcessorBind.h</Filename>
- <Filename>Include/IndustryStandard/EfiPci.h</Filename>
- <Filename>Include/IndustryStandard/pci22.h</Filename>
- <Filename>Include/IndustryStandard/pci23.h</Filename>
- <Filename>Include/IndustryStandard/pci30.h</Filename>
- <Filename>Include/IndustryStandard/Acpi1_0.h</Filename>
- <Filename>Include/IndustryStandard/Acpi2_0.h</Filename>
- <Filename>Include/IndustryStandard/Acpi3_0.h</Filename>
- <Filename>Include/IndustryStandard/Acpi.h</Filename>
- <Filename>Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h</Filename>
- <Filename>Include/Library/PeCoffLib.h</Filename>
- <Filename>Include/Library/PrintLib.h</Filename>
- <Filename>Include/Protocol/DevicePath.h</Filename>
- <Filename>Include/Protocol/GuidedSectionExtraction.h</Filename>
- <Filename>Include/Protocol/Hii.h</Filename>
- <Filename>Include/Protocol/UgaDraw.h</Filename>
- <Filename>MakeDeps/build.xml</Filename>
- <Filename>MakeDeps/MakeDeps.c</Filename>
- <Filename>ModifyInf/build.xml</Filename>
- <Filename>ModifyInf/ModifyInf.c</Filename>
- <Filename>Pccts/antlr/antlr.1</Filename>
- <Filename>Pccts/antlr/antlr.c</Filename>
- <Filename>Pccts/antlr/antlr.g</Filename>
- <Filename>Pccts/antlr/antlr.ilk</Filename>
- <Filename>Pccts/antlr/antlr.pdb</Filename>
- <Filename>Pccts/antlr/antlr.r</Filename>
- <Filename>Pccts/antlr/antlr1.txt</Filename>
- <Filename>Pccts/antlr/AntlrMS.mak</Filename>
- <Filename>Pccts/antlr/AntlrPPC.mak</Filename>
- <Filename>Pccts/antlr/bits.c</Filename>
- <Filename>Pccts/antlr/build.c</Filename>
- <Filename>Pccts/antlr/build.xml</Filename>
- <Filename>Pccts/antlr/dumpcycles.c</Filename>
- <Filename>Pccts/antlr/dumpnode.c</Filename>
- <Filename>Pccts/antlr/egman.c</Filename>
- <Filename>Pccts/antlr/err.c</Filename>
- <Filename>Pccts/antlr/fcache.c</Filename>
- <Filename>Pccts/antlr/fset.c</Filename>
- <Filename>Pccts/antlr/fset2.c</Filename>
- <Filename>Pccts/antlr/gen.c</Filename>
- <Filename>Pccts/antlr/generic.h</Filename>
- <Filename>Pccts/antlr/globals.c</Filename>
- <Filename>Pccts/antlr/hash.c</Filename>
- <Filename>Pccts/antlr/hash.h</Filename>
- <Filename>Pccts/antlr/lex.c</Filename>
- <Filename>Pccts/antlr/main.c</Filename>
- <Filename>Pccts/antlr/makefile</Filename>
- <Filename>Pccts/antlr/makefile1</Filename>
- <Filename>Pccts/antlr/misc.c</Filename>
- <Filename>Pccts/antlr/mode.h</Filename>
- <Filename>Pccts/antlr/mrhoist.c</Filename>
- <Filename>Pccts/antlr/parser.dlg</Filename>
- <Filename>Pccts/antlr/pred.c</Filename>
- <Filename>Pccts/antlr/proto.h</Filename>
- <Filename>Pccts/antlr/README</Filename>
- <Filename>Pccts/antlr/scan.c</Filename>
- <Filename>Pccts/antlr/stdpccts.h</Filename>
- <Filename>Pccts/antlr/syn.h</Filename>
- <Filename>Pccts/antlr/tokens.h</Filename>
- <Filename>Pccts/antlr/vc70.pdb</Filename>
- <Filename>Pccts/build.xml</Filename>
- <Filename>Pccts/CHANGES_FROM_131.txt</Filename>
- <Filename>Pccts/CHANGES_FROM_133.txt</Filename>
- <Filename>Pccts/CHANGES_FROM_133_BEFORE_MR13.txt</Filename>
- <Filename>Pccts/CHANGES_SUMMARY.txt</Filename>
- <Filename>Pccts/dlg/automata.c</Filename>
- <Filename>Pccts/dlg/build.xml</Filename>
- <Filename>Pccts/dlg/dlg.1</Filename>
- <Filename>Pccts/dlg/dlg.h</Filename>
- <Filename>Pccts/dlg/dlg.r</Filename>
- <Filename>Pccts/dlg/dlg1.txt</Filename>
- <Filename>Pccts/dlg/dlg_a.c</Filename>
- <Filename>Pccts/dlg/dlg_p.c</Filename>
- <Filename>Pccts/dlg/dlg_p.g</Filename>
- <Filename>Pccts/dlg/DlgMS.mak</Filename>
- <Filename>Pccts/dlg/DlgPPC.mak</Filename>
- <Filename>Pccts/dlg/err.c</Filename>
- <Filename>Pccts/dlg/main.c</Filename>
- <Filename>Pccts/dlg/makefile</Filename>
- <Filename>Pccts/dlg/makefile1</Filename>
- <Filename>Pccts/dlg/mode.h</Filename>
- <Filename>Pccts/dlg/output.c</Filename>
- <Filename>Pccts/dlg/parser.dlg</Filename>
- <Filename>Pccts/dlg/relabel.c</Filename>
- <Filename>Pccts/dlg/stdpccts.h</Filename>
- <Filename>Pccts/dlg/support.c</Filename>
- <Filename>Pccts/dlg/tokens.h</Filename>
- <Filename>Pccts/h/antlr.h</Filename>
- <Filename>Pccts/h/AParser.cpp</Filename>
- <Filename>Pccts/h/AParser.h</Filename>
- <Filename>Pccts/h/ast.c</Filename>
- <Filename>Pccts/h/ast.h</Filename>
- <Filename>Pccts/h/ASTBase.cpp</Filename>
- <Filename>Pccts/h/ASTBase.h</Filename>
- <Filename>Pccts/h/AToken.h</Filename>
- <Filename>Pccts/h/ATokenBuffer.cpp</Filename>
- <Filename>Pccts/h/ATokenBuffer.h</Filename>
- <Filename>Pccts/h/ATokenStream.h</Filename>
- <Filename>Pccts/h/ATokPtr.h</Filename>
- <Filename>Pccts/h/ATokPtrImpl.h</Filename>
- <Filename>Pccts/h/BufFileInput.cpp</Filename>
- <Filename>Pccts/h/BufFileInput.h</Filename>
- <Filename>Pccts/h/charbuf.h</Filename>
- <Filename>Pccts/h/charptr.c</Filename>
- <Filename>Pccts/h/charptr.h</Filename>
- <Filename>Pccts/h/config.h</Filename>
- <Filename>Pccts/h/DLexer.h</Filename>
- <Filename>Pccts/h/DLexerBase.cpp</Filename>
- <Filename>Pccts/h/DLexerBase.h</Filename>
- <Filename>Pccts/h/DLG_stream_input.h</Filename>
- <Filename>Pccts/h/dlgauto.h</Filename>
- <Filename>Pccts/h/dlgdef.h</Filename>
- <Filename>Pccts/h/err.h</Filename>
- <Filename>Pccts/h/int.h</Filename>
- <Filename>Pccts/h/PBlackBox.h</Filename>
- <Filename>Pccts/h/pccts_assert.h</Filename>
- <Filename>Pccts/h/pccts_iostream.h</Filename>
- <Filename>Pccts/h/pccts_istream.h</Filename>
- <Filename>Pccts/h/pccts_setjmp.h</Filename>
- <Filename>Pccts/h/pccts_stdarg.h</Filename>
- <Filename>Pccts/h/pccts_stdio.h</Filename>
- <Filename>Pccts/h/pccts_stdlib.h</Filename>
- <Filename>Pccts/h/pccts_string.h</Filename>
- <Filename>Pccts/h/PCCTSAST.cpp</Filename>
- <Filename>Pccts/h/PCCTSAST.h</Filename>
- <Filename>Pccts/h/pcctscfg.h</Filename>
- <Filename>Pccts/h/pcnames.bat</Filename>
- <Filename>Pccts/h/slist.cpp</Filename>
- <Filename>Pccts/h/SList.h</Filename>
- <Filename>Pccts/history.ps</Filename>
- <Filename>Pccts/history.txt</Filename>
- <Filename>Pccts/KNOWN_PROBLEMS.txt</Filename>
- <Filename>Pccts/makefile</Filename>
- <Filename>Pccts/MPW_Read_Me</Filename>
- <Filename>Pccts/NOTES.bcc</Filename>
- <Filename>Pccts/NOTES.msvc</Filename>
- <Filename>Pccts/README</Filename>
- <Filename>Pccts/RIGHTS</Filename>
- <Filename>Pccts/support/genmk/genmk.c</Filename>
- <Filename>Pccts/support/genmk/genmk_old.c</Filename>
- <Filename>Pccts/support/genmk/makefile</Filename>
- <Filename>Pccts/support/rexpr/makefile</Filename>
- <Filename>Pccts/support/rexpr/rexpr.c</Filename>
- <Filename>Pccts/support/rexpr/rexpr.h</Filename>
- <Filename>Pccts/support/rexpr/test.c</Filename>
- <Filename>Pccts/support/set/set.c</Filename>
- <Filename>Pccts/support/set/set.h</Filename>
- <Filename>Pccts/support/sym/sym.c</Filename>
- <Filename>Pccts/support/sym/template.h</Filename>
- <Filename>PeCoffLoader/BasePeCoff.c</Filename>
- <Filename>PeCoffLoader/build.xml</Filename>
- <Filename>PeCoffLoader/Common/EfiImage.h</Filename>
- <Filename>PeCoffLoader/Ia32/PeCoffLoaderEx.c</Filename>
- <Filename>PeCoffLoader/Ipf/PeCoffLoaderEx.c</Filename>
- <Filename>PeCoffLoader/X64/PeCoffLoaderEx.c</Filename>
- <Filename>PeiRebase/build.xml</Filename>
- <Filename>PeiRebase/makefile</Filename>
- <Filename>PeiRebase/PeiRebaseExe.c</Filename>
- <Filename>PeiRebase/PeiRebaseExe.h</Filename>
- <Filename>SecApResetVectorFixup/build.xml</Filename>
- <Filename>SecApResetVectorFixup/SecApResetVectorFixup.c</Filename>
- <Filename>SecApResetVectorFixup/SecApResetVectorFixup.h</Filename>
- <Filename>SecFixup/build.xml</Filename>
- <Filename>SecFixup/SecFixup.c</Filename>
- <Filename>SecFixup/SecFixup.h</Filename>
- <Filename>SetStamp/build.xml</Filename>
- <Filename>SetStamp/SetStamp.c</Filename>
- <Filename>SplitFile/build.xml</Filename>
- <Filename>SplitFile/SplitFile.c</Filename>
- <Filename>StrGather/build.xml</Filename>
- <Filename>StrGather/StrGather.c</Filename>
- <Filename>StrGather/StrGather.h</Filename>
- <Filename>StrGather/StringDB.c</Filename>
- <Filename>StrGather/StringDB.h</Filename>
- <Filename>String/build.xml</Filename>
- <Filename>String/PrintLib.c</Filename>
- <Filename>String/PrintLibInternal.c</Filename>
- <Filename>String/PrintLibInternal.h</Filename>
- <Filename>String/String.c</Filename>
- <Filename>Strip/build.xml</Filename>
- <Filename>Strip/Strip.c</Filename>
- <Filename>VfrCompile/build.xml</Filename>
- <Filename>VfrCompile/DLGLexer.cpp</Filename>
- <Filename>VfrCompile/DLGLexer.h</Filename>
- <Filename>VfrCompile/EfiVfr.h</Filename>
- <Filename>VfrCompile/EfiVfrParser.cpp</Filename>
- <Filename>VfrCompile/EfiVfrParser.h</Filename>
- <Filename>VfrCompile/parser.dlg</Filename>
- <Filename>VfrCompile/tokens.h</Filename>
- <Filename>VfrCompile/VfrCompile.cpp</Filename>
- <Filename>VfrCompile/VfrCompile.g</Filename>
- <Filename>VfrCompile/VfrServices.cpp</Filename>
- <Filename>VfrCompile/VfrServices.h</Filename>
- <Filename>ZeroDebugData/build.xml</Filename>
- <Filename>ZeroDebugData/ZeroDebugData.c</Filename>
- </SourceFiles>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/Tools/CCode/Source/VfrCompile/EfiVfr.h b/Tools/CCode/Source/VfrCompile/EfiVfr.h
deleted file mode 100644
index 6419ad7e71..0000000000
--- a/Tools/CCode/Source/VfrCompile/EfiVfr.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2005, 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.
-
-Module Name:
-
- EfiVfr.h
-
-Abstract:
-
- Defines and prototypes for the EFI internal forms representation
- setup protocol and drivers
-
---*/
-
-#ifndef _EFI_VFR_H_
-#define _EFI_VFR_H_
-
-#include <string.h>
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/InternalFormRepresentation.h>
-
-//
-// This number should be incremented with each change to the VFR compiler.
-// We write the version to the output list file for debug purposes.
-//
-#define VFR_COMPILER_VERSION "1.88"
-
-//
-// Maximum file path for filenames
-//
-#ifndef MAX_PATH
-#define MAX_PATH 255
-#endif
-#define MAX_QUEUE_COUNT 255
-#define MAX_LINE_LEN 1024
-#define PROGRAM_NAME "VfrCompile"
-
-//
-// We parse C-style structure definitions which can then be referenced
-// in VFR statements.
-// We need to define an internal structure that can be used to
-// track the fields in a structure definition, and another structure
-// to keep track of the structure name and subfields.
-//
-typedef struct _STRUCT_FIELD_DEFINITION {
- struct _STRUCT_FIELD_DEFINITION *Next;
- int DataSize;
- int Offset; // from the start of the structure
- int ArrayLength;
- char IsArray;
- char *Name;
-} STRUCT_FIELD_DEFINITION;
-
-typedef struct _STRUCT_DEFINITION {
- struct _STRUCT_DEFINITION *Next;
- int Size;
- int LineNum; // line number where the structure was defined
- int IsNonNV; // if this is the non-NV data structure definition
- int Referenced; // if it's referenced anywhere in the VFR
- int VarStoreIdValid; // found a 'varstore' statement for it in the VFR
- unsigned short VarStoreId; // key from a varstore IFR statement
- int VarStoreLineNum; // line number where VARSTORE was defined
- char *Name;
- STRUCT_FIELD_DEFINITION *Field;
- STRUCT_FIELD_DEFINITION *LastField;
-} STRUCT_DEFINITION;
-
-//
-// For the IdEqValList variable list of UINT16's, keep track of them using
-// a linked list until we know how many there are.
-// We also use a linked list of these to keep track of labels used in
-// the VFR script so we can catch duplicates.
-// We'll also use it to keep track of defined varstore id's so we can
-// detect duplicate definitions.
-//
-typedef struct _UINT16_LIST {
- struct _UINT16_LIST *Next;
- UINT16 Value;
- UINT32 LineNum;
-} UINT16_LIST;
-
-typedef struct _GOTO_REFERENCE {
- struct _GOTO_REFERENCE *Next;
- UINT32 RefLineNum; // line number of source file where referenced
- UINT16 Value;
-} GOTO_REFERENCE;
-
-typedef struct _FORM_ID_VALUE {
- struct _FORM_ID_VALUE *Next;
- UINT32 LineNum;
- UINT16 Value;
-} FORM_ID_VALUE;
-
-//
-// We keep track in the parser of all "#line 4 "x.y"" strings so we
-// can cross-reference the line numbers in the preprocessor output .i file
-// to the original input files.
-//
-typedef struct _PARSER_LINE_DEFINITION {
- struct _PARSER_LINE_DEFINITION *Next;
- UINT32 HashLineNum; // from the #line stmt
- UINT32 TokenLineNum; // line number in the .i file
- CHAR8 *FileName; // from the #line stmt
-} PARSER_LINE_DEFINITION;
-
-extern PARSER_LINE_DEFINITION *gLineDefinition;
-extern PARSER_LINE_DEFINITION *gLastLineDefinition;
-
-extern
-char *
-ConvertLineNumber (
- UINT32 *LineNum
- )
-/*++
-
-Routine Description:
- Given the line number in the preprocessor-output file, use the line number
- information we've saved to determine the source file name and line number
- where the code originally came from. This is required for error reporting.
-
-Arguments:
- LineNum - the line number in the preprocessor-output file.
-
-Returns:
- Returns a pointer to the source file name. Also returns the line number
- in the provided LineNum argument
-
---*/
-;
-
-typedef struct _IFR_BYTE {
- struct _IFR_BYTE *Next;
- UINT32 LineNum;
- UINT8 OpcodeByte;
- UINT8 KeyByte;
-} IFR_BYTE;
-
-typedef struct {
- CHAR8 VfrFileName[MAX_PATH];
- CHAR8 VfrListFileName[MAX_PATH];
- INT8 CreateListFile;
- INT8 CreateIfrBinFile;
- CHAR8 IfrOutputFileName[MAX_PATH];
- CHAR8 OutputDirectory[MAX_PATH];
- CHAR8 PreprocessorOutputFileName[MAX_PATH];
- CHAR8 VfrBaseFileName[MAX_PATH]; // name of input VFR file with no path or extension
- CHAR8 *IncludePaths;
- CHAR8 *CPreprocessorOptions;
-} OPTIONS;
-
-extern OPTIONS gOptions;
-
-VOID
-WriteStandardFileHeader (
- FILE *OutFptr
- )
-/*++
-
-Routine Description:
- This function is invoked to emit a standard header to an
- output text file.
-
-Arguments:
- OutFptr - file to write the header to
-
-Returns:
- None
-
---*/
-;
-
-#endif // #ifndef _EFI_VFR_H_
diff --git a/Tools/CCode/Source/VfrCompile/VfrCompile.g b/Tools/CCode/Source/VfrCompile/VfrCompile.g
deleted file mode 100644
index 9fdd7caca6..0000000000
--- a/Tools/CCode/Source/VfrCompile/VfrCompile.g
+++ /dev/null
@@ -1,3529 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2005, 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.
-
-Module Name:
-
- VfrCompile.g
-
-Abstract:
-
- PCCTS parser and lexer definitions for the EFI VFR forms compiler
-
---*/
-
-#header<<
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/MultiPhase.h>
-#include <Common/InternalFormRepresentation.h>
-#include <Protocol/UgaDraw.h>
-#include <Protocol/Hii.h>
-
-#include "CommonLib.h"
-#include "EfiUtilityMsgs.h"
-#include "EfiVfr.h"
-#include "VfrServices.h"
-
-#include <ctype.h>
-#ifndef __GNUC__
-#include <direct.h>
-#include <process.h> // for spawn functions
-#else
-#include <unistd.h>
-#endif
-
->>
-
-<<
-
-//
-// Base info for DLG-generated scanner
-//
-#include "DLexerBase.h"
-
-//
-// Include the scanner file generated by DLG
-//
-#include "DLGLexer.h"
-
-class DLGLexerVfr : public DLGLexer
-{
-public:
- DLGLexerVfr (DLGFileInput *F) : DLGLexer (F) {};
- INT32 errstd (char *Text)
- {
- printf ("unrecognized input '%s'\n", Text);
- }
-
-};
-
-//
-// Base token definitions for ANTLR
-//
-#include "AToken.h"
-
-//
-// 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.
-//
-#ifdef __GNUC__
-#define PREPROCESSOR_COMMAND "gcc "
-#define PREPROCESSOR_OPTIONS "-x c -E -P -DVFRCOMPILE "
-#define FILE_SEP_CHAR '/'
-#define FILE_SEP_STRING "/"
-#else
-#define PREPROCESSOR_COMMAND "cl.exe "
-#define PREPROCESSOR_OPTIONS "/nologo /P /TC /DVFRCOMPILE "
-#define FILE_SEP_CHAR '/'
-#define FILE_SEP_STRING "/"
-#endif
-
-typedef ANTLRCommonToken ANTLRToken;
-
-//
-// Specify the filename extensions for the files we generate.
-//
-#define VFR_BINARY_FILENAME_EXTENSION ".c"
-#define VFR_LIST_FILENAME_EXTENSION ".lst"
-
-static
-VOID
-Usage ();
-
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- );
-
-static
-VOID
-Cleanup ();
-
-//
-// Globals
-//
-OPTIONS gOptions;
-
-int
-main (
- int argc,
- char **argv
- )
-/*++
-
-Routine Description:
- Application entry point function. Parse command-line arguments,
- invoke the parser, clean up, and return.
-
-Arguments:
- argc - standard argc passed to main() per C conventions
- argv - standard argv passed to main() per C conventions
-
-Returns:
- STATUS_SUCCESS - program executed with no errors or warnings
- STATUS_WARNING - program executed with warnings
- STATUS_ERROR - non-recoverable errors encountered while processing
-
---*/
-{
- FILE *VfrFptr;
- char *Cmd;
- char *Cptr;
- int Len;
- STATUS Status;
-
- //
- // Set our program name for the error printing routines.
- // Then set printing limits.
- //
- SetUtilityName (PROGRAM_NAME);
- SetPrintLimits (20, 20, 30);
- //
- // Process the command-line arguments
- //
- if (ProcessArgs (argc, argv) != STATUS_SUCCESS) {
- Usage ();
- Cleanup();
- return STATUS_ERROR;
- }
- VfrFptr = NULL;
- //
- // Verify the VFR script file exists
- //
- if ((VfrFptr = fopen (gOptions.VfrFileName, "r")) == NULL) {
- Error (PROGRAM_NAME, 0, 0, gOptions.VfrFileName, "could not open input VFR file");
- Cleanup();
- return STATUS_ERROR;
- }
- //
- // Now close the file and make a system call to run the preprocessor
- // on it.
- //
- fclose (VfrFptr);
-// Len = strlen (PREPROCESSOR_OPTIONS) + strlen (gOptions.VfrFileName) + 10;
-// if (gOptions.CPreprocessorOptions != NULL) {
-// Len += strlen (gOptions.CPreprocessorOptions) + 1;
-// }
-// if (gOptions.IncludePaths != NULL) {
-// Len += strlen (gOptions.IncludePaths) + 1;
-// }
-// Cmd = (char *)malloc (Len);
-// if (Cmd == NULL) {
-// Error (PROGRAM_NAME, 0, 0, NULL, "could not allocate memory");
-// Cleanup();
-// return STATUS_ERROR;
-// }
-// strcpy (Cmd, PREPROCESSOR_OPTIONS);
-// if (gOptions.IncludePaths != NULL) {
-// strcat (Cmd, gOptions.IncludePaths);
-// strcat (Cmd, " ");
-// }
-// if (gOptions.CPreprocessorOptions != NULL) {
-// strcat (Cmd, gOptions.CPreprocessorOptions);
-// strcat (Cmd, " ");
-// }
-// strcat (Cmd, gOptions.VfrFileName);
-//#ifndef __GNUC__
-// Status = _spawnlp (_P_WAIT, PREPROCESSOR_COMMAND, Cmd, NULL);
-//#else
-// {
-// char CommandLine[1000];
-// char *p;
-//
-// //
-// // Lean the slashes forward.
-// //
-// for (p = gOptions.PreprocessorOutputFileName; *p; p++) {
-// if (*p=='\\') {
-// *p=FILE_SEP_CHAR;
-// }
-// }
-//
-// //
-// // Lean the slashes forward.
-// //
-// for (p = Cmd; *p; p++) {
-// if (*p=='\\') {
-// *p=FILE_SEP_CHAR;
-// }
-// }
-//
-// sprintf(CommandLine, "%s %s > %s", PREPROCESSOR_COMMAND, Cmd, gOptions.PreprocessorOutputFileName);
-// Status = system (CommandLine);
-// }
-//#endif
-// if (Status != 0) {
-// Error (PROGRAM_NAME, 0, 0, gOptions.VfrFileName, "failed to spawn C preprocessor on VFR file");
-// printf ("Command: '%s %s'\n", PREPROCESSOR_COMMAND, Cmd);
-// Cleanup();
-// return STATUS_ERROR;
-// }
-// free (Cmd);
- //
- // Open the preprocessor output file
- //
- if ((VfrFptr = fopen (gOptions.VfrFileName, "r")) == NULL) {
- Error (PROGRAM_NAME, 0, 0, "failed to open input VFR preprocessor output file",
- gOptions.PreprocessorOutputFileName);
- Cleanup();
- return STATUS_ERROR;
- }
- //
- // Define input VFR file
- //
- DLGFileInput InputFile (VfrFptr);
- //
- // Define an instance of the scanner
- //
- DLGLexerVfr Scanner (&InputFile);
- //
- // Define token buffer between scanner and parser
- //
- ANTLRTokenBuffer Pipe (&Scanner);
- //
- // Create a token to use as a model
- //
- ANTLRToken Tok;
- //
- // Tell the scanner what type the token is
- //
- Scanner.setToken (&Tok);
- //
- // Create an instance of our parser
- //
- EfiVfrParser Parser (&Pipe);
- //
- // Initialize the parser
- //
- Parser.init ();
- Status = GetUtilityStatus ();
- if (Status != STATUS_SUCCESS) {
- Cleanup();
- return Status;
- }
- //
- // Start the first rule
- //
- Parser.program ();
- //
- // Close the input script file
- //
- fclose (VfrFptr);
- Parser.WriteIfrBytes ();
- //
- // Call cleanup, which does some extra checking of the script
- //
- Parser.Cleanup ();
- Cleanup();
- //
- // If we had an error somewhere, delete our output files so that
- // a subsequent build will rebuild them.
- //
- Status = GetUtilityStatus ();
- if (Status == STATUS_ERROR) {
- remove (gOptions.IfrOutputFileName);
- }
- return Status;
-}
-static
-VOID
-Cleanup ()
-/*++
-
-Routine Description:
- Free up memory allocated during parsing.
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- //
- // Free up our string we allocated to track the include paths
- //
- if (gOptions.IncludePaths != NULL) {
- free (gOptions.IncludePaths);
- gOptions.IncludePaths = NULL;
- }
- //
- // Free up our string we allocated to track preprocessor options
- //
- if (gOptions.CPreprocessorOptions != NULL) {
- free (gOptions.CPreprocessorOptions);
- gOptions.CPreprocessorOptions = NULL;
- }
-}
-
-static
-STATUS
-ProcessArgs (
- int Argc,
- char *Argv[]
- )
-/*++
-
-Routine Description:
- Process the command-line arguments.
-
-Arguments:
- Argc - standard argc passed to main()
- Argv - standard argv passed to main()
-
-Returns:
- STATUS_SUCCESS - program should continue (all args ok)
-
---*/
-{
- char *IncludePaths;
- char *CPreprocessorOptions;
- int Len;
- char CopyStr[MAX_PATH];
- char *Cptr;
-
- //
- // Put options in known state.
- //
- memset ((char *)&gOptions, 0, sizeof (OPTIONS));
- //
- // Go through all the arguments that start with '-'
- //
- Argc--;
- Argv++;
- while ((Argc > 0) && (Argv[0][0] == '-')) {
- //
- // -? or -h help option -- return an error for printing usage
- //
- if ((stricmp (Argv[0], "-?") == 0) || (stricmp (Argv[0], "-h") == 0)) {
- return STATUS_ERROR;
- break;
- //
- // -l to create a listing output file
- //
- } else if (stricmp (Argv[0], "-l") == 0) {
- gOptions.CreateListFile = 1;
- //
- // -I include_path option for finding include files. We'll pass this
- // to the preprocessor. Turn them all into a single include string.
- //
- } else if (stricmp (Argv[0], "-i") == 0) {
- if ((Argc < 2) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing path argument");
- return STATUS_ERROR;
- }
- Argc--;
- Argv++;
- Len = strlen (" -I ");
- Len += strlen (Argv[0]) + 2;
- if (gOptions.IncludePaths != NULL) {
- Len += strlen (gOptions.IncludePaths);
- }
- IncludePaths = (CHAR8 *)malloc (Len);
- if (IncludePaths == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
- IncludePaths[0] = 0;
- if (gOptions.IncludePaths != NULL) {
- strcpy (IncludePaths, gOptions.IncludePaths);
- free (gOptions.IncludePaths);
- }
- strcat (IncludePaths, " -I ");
- strcat (IncludePaths, Argv[0]);
- gOptions.IncludePaths = IncludePaths;
- //
- // -od OutputDirectory to define a common directory for output files
- //
- } else if (stricmp (Argv[0], "-od") == 0) {
- if ((Argc < 2) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing output directory name");
- return STATUS_ERROR;
- }
- Argc--;
- Argv++;
- strcpy (gOptions.OutputDirectory, Argv[0]);
- } else if (stricmp (Argv[0], "-ibin") == 0) {
- gOptions.CreateIfrBinFile = 1;
- } else if (stricmp (Argv[0], "-nostrings") == 0) {
- // deprecated option
- //
- // -ppflag C-preprocessor-flag option for passing options to the C preprocessor.
- // Turn them all into a single string.
- //
- } else if (stricmp (Argv[0], "-ppflag") == 0) {
- if (Argc < 2) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing C-preprocessor argument");
- return STATUS_ERROR;
- }
- Argc--;
- Argv++;
- Len = strlen (Argv[0]) + 2;
- if (gOptions.CPreprocessorOptions != NULL) {
- Len += strlen (gOptions.CPreprocessorOptions);
- }
- CPreprocessorOptions = (CHAR8 *)malloc (Len);
- if (CPreprocessorOptions == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
- return STATUS_ERROR;
- }
- CPreprocessorOptions[0] = 0;
- if (gOptions.CPreprocessorOptions != NULL) {
- strcpy (CPreprocessorOptions, gOptions.CPreprocessorOptions);
- free (gOptions.CPreprocessorOptions);
- }
- strcat (CPreprocessorOptions, " ");
- strcat (CPreprocessorOptions, Argv[0]);
- gOptions.CPreprocessorOptions = CPreprocessorOptions;
- } else {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "unrecognized option");
- return STATUS_ERROR;
- }
- Argc--;
- Argv++;
- }
- //
- // Must specify at least the vfr file name
- //
- if (Argc > 1) {
- Error (PROGRAM_NAME, 0, 0, Argv[1], "unrecognized argument after VFR file name");
- return STATUS_ERROR;
- } else if (Argc < 1) {
- Error (PROGRAM_NAME, 0, 0, NULL, "must specify VFR file name");
- return STATUS_ERROR;
- }
- strcpy (gOptions.VfrFileName, Argv[0]);
- //
- // We run the preprocessor on the VFR file to manage #include statements.
- // Unfortunately the preprocessor does not allow you to specify the
- // output name or path of the resultant .i file, so we have to do
- // some work. Here we'll extract the basename of the VFR file, then
- // append .i on the end.
- //
- strcpy (CopyStr, gOptions.VfrFileName);
- Cptr = CopyStr + strlen (CopyStr) - 1;
- for (;(Cptr > CopyStr) && (*Cptr != '\\') && (*Cptr != ':') && (*Cptr != '/'); Cptr--);
- if (Cptr == CopyStr) {
- strcpy (gOptions.PreprocessorOutputFileName, Cptr);
- strcpy (gOptions.VfrBaseFileName, Cptr);
- } else {
- strcpy (gOptions.PreprocessorOutputFileName, Cptr+1);
- strcpy (gOptions.VfrBaseFileName, Cptr+1);
- }
- for (Cptr = gOptions.PreprocessorOutputFileName; *Cptr && (*Cptr != '.'); Cptr++);
- strcpy (Cptr, ".i");
- //
- // Terminate the vfr file basename at the extension
- //
- for (Cptr = gOptions.VfrBaseFileName; *Cptr && (*Cptr != '.'); Cptr++) {
- }
- *Cptr = 0;
- //
- // If they defined an output directory, prepend all output files
- // with the working directory. Output files of interest:
- // VfrListFileName -- list file
- // IfrOutputFileName -- IFR bytes
- // StringOutputFileName -- string bytes
- // StringListFileName -- not used
- // StringDefineFileName -- #defines of string identifiers
- //
- // We have two cases:
- // 1. Output directory (-od) not specified, in which case output files
- // go to the current working directory.
- // 2. Output directory specified, in which case the output files
- // go directly to the specified directory.
- //
- if (gOptions.OutputDirectory[0] == 0) {
- CopyStr[0] = 0;
-#ifndef __GNUC__
- _getcwd (CopyStr, sizeof (CopyStr));
-#else
- getcwd (CopyStr, sizeof (CopyStr));
-#endif
- strcpy (gOptions.OutputDirectory, CopyStr);
- }
- //
- // Make sure output directory has a trailing backslash
- //
- if (gOptions.OutputDirectory[strlen (gOptions.OutputDirectory) - 1] != '\\' ||
- gOptions.OutputDirectory[strlen (gOptions.OutputDirectory) - 1] != '/') {
- strcat (gOptions.OutputDirectory, FILE_SEP_STRING);
- }
- //
- // Create the base output file name as: path\base, copy it to all the output
- // filenames, and then add the appropriate extension to each.
- //
- strcpy (gOptions.VfrListFileName, gOptions.OutputDirectory);
- strcat (gOptions.VfrListFileName, gOptions.VfrBaseFileName);
- strcpy (gOptions.IfrOutputFileName, gOptions.VfrListFileName);
- strcat (gOptions.VfrListFileName, VFR_LIST_FILENAME_EXTENSION);
- strcat (gOptions.IfrOutputFileName, VFR_BINARY_FILENAME_EXTENSION);
- //
- // We set a default list file name, so if they do not
- // want a list file, null out the name now.
- //
- if (gOptions.CreateListFile == 0) {
- gOptions.VfrListFileName[0] = 0;
- }
- return STATUS_SUCCESS;
-}
-static
-VOID
-Usage ()
-/*++
-
-Routine Description:
- Print utility usage instructions
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- int Index;
- const char *Help[] = {
- " ",
- "VfrCompile version " VFR_COMPILER_VERSION,
- " ",
- " Usage: VfrCompile {options} [VfrFile]",
- " ",
- " where options include:",
- " -? or -h prints this help",
- " -l create an output IFR listing file",
- " -i IncPath add IncPath to the search path for VFR included files",
- " -od OutputDir deposit all output files to directory OutputDir (default=cwd)",
- " -ibin create an IFR HII pack file",
- " where parameters include:",
- " VfrFile name of the input VFR script file",
- " ",
- NULL
- };
- for (Index = 0; Help[Index] != NULL; Index++) {
- fprintf (stdout, "%s\n", Help[Index]);
- }
-}
-
->>
-
-
-#lexaction
-<<
-
-#include "EfiVfr.h"
-
-PARSER_LINE_DEFINITION *gLineDefinition = NULL;
-PARSER_LINE_DEFINITION *gLastLineDefinition = NULL;
-
-VOID
-AddFileLine (
- char *TokenString,
- UINT32 TokenLine
- )
-/*++
-
-Routine Description:
- During the lexer phase, if we encounter a #line statement output by
- the preprocessor, this function gets called. We'll save off the info
- for error reporting purposes. The preprocessor line information has the
- form:
-
- #line 3 "FileName.c"
-
-Arguments:
- TokenString - the parsed string as shown above
- TokenLine - the line number in the preprocessed output file
-
-Returns:
- NA
-
---*/
-{
- PARSER_LINE_DEFINITION *LineDef;
- CHAR8 *Cptr;
-
- //
- // Allocate a structure in which we can keep track of this line information.
- //
- LineDef = (PARSER_LINE_DEFINITION *)malloc (sizeof (PARSER_LINE_DEFINITION));
- memset ((char *)LineDef, 0, sizeof (PARSER_LINE_DEFINITION));
- LineDef->TokenLineNum = TokenLine;
- LineDef->HashLineNum = atoi (TokenString + 6);
- //
- // Find the quotes in the filename, then allocate space in the line
- // def structure for a copy of the filename. Finally, copy it without
- // quotes to the line def.
- //
- for (Cptr = TokenString + 7; *Cptr && (*Cptr != '"'); Cptr++);
- if (*Cptr == '"') {
- LineDef->FileName = (CHAR8 *)malloc (strlen (Cptr));
- Cptr++;
- strcpy (LineDef->FileName, Cptr);
- for (Cptr = LineDef->FileName; *Cptr && (*Cptr != '"'); Cptr++);
- *Cptr = 0;
- //
- // Now add this new one to the list
- //
- if (gLineDefinition == NULL) {
- gLineDefinition = LineDef;
- } else {
- gLastLineDefinition->Next = LineDef;
- }
- gLastLineDefinition = LineDef;
- } else {
- Error (PROGRAM_NAME, 0, 0, "invalid line definition in preprocessor output file", TokenString);
- free (LineDef);
- return;
- }
-}
-char *
-ConvertLineNumber (
- UINT32 *LineNum
- )
-/*++
-
-Routine Description:
- Given the line number in the preprocessor-output file, use the line number
- information we've saved to determine the source file name and line number
- where the code originally came from. This is required for error reporting.
-
-Arguments:
- LineNum - the line number in the preprocessor-output file.
-
-Returns:
- Returns a pointer to the source file name. Also returns the line number
- in the provided LineNum argument
-
---*/
-{
- PARSER_LINE_DEFINITION *LineDef;
- //
- // Step through our linked list of #line information we saved off.
- // For each one, look at its line number, and the line number of the
- // next record, and see if the passed-in line number is in the range.
- // If it is, then convert the line number to the appropriate line number
- // of the original source file.
- //
- for (LineDef = gLineDefinition; LineDef != NULL; LineDef = LineDef->Next) {
- //
- // The given LineNum is the line number from the .i file.
- // Find a line definition whose range includes this line number,
- // convert the line number, and return the filename.
- //
- if (LineDef->TokenLineNum <= *LineNum) {
- if (LineDef->Next != NULL) {
- if (LineDef->Next->TokenLineNum > *LineNum) {
- *LineNum = *LineNum - LineDef->TokenLineNum + LineDef->HashLineNum;
- return LineDef->FileName;
- }
- } else {
- //
- // Last one in the list of line definitions, so has to be right
- //
- *LineNum = *LineNum - LineDef->TokenLineNum + LineDef->HashLineNum;
- return LineDef->FileName;
- }
- }
- }
- return NULL;
-}
-
->>
-
-//
-// Define a lexical class for parsing quoted strings. Basically
-// starts with a double quote, and ends with a double quote that
-// is not preceeded with a backslash.
-//
-#lexclass QUOTED_STRING
-#token TheString "~[\"]*\"" << mode (START); >>
-
-//
-// Define a lexical class for parsing "#pragma pack" statements.
-// We do this just for convenience (since we skip them here) so
-// that users can include some minimal .h files.
-//
-#lexclass PRAGMA_PACK
-#token "pack" << skip (); >>
-#token "[\ \t]" << skip (); >>
-#token "\(" << skip (); >>
-#token "[0-9]*" << skip (); >>
-#token "\)" << skip (); 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 pragma pack statements
-//
-#token "\#pragma" << skip (); mode(PRAGMA_PACK); >>
-
-//
-// Skip over 'extern' in any included .H file
-//
-#token "extern" << skip (); >>
-
-//
-// 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 LineDefinition "#line\ [0-9]+\ \"~[\"]+\"[\ \t]*\n" << AddFileLine (begexpr (), line ()); skip (); >>
-#token FormSet("formset") "formset"
-#token EndFormSet("endformset") "endformset"
-#token Title("title") "title"
-#token FormId("formid") "formid"
-#token OneOf("oneof") "oneof"
-#token Prompt("prompt") "prompt"
-#token OrderedList("orderedlist") "orderedlist"
-#token EndList("endlist") "endlist"
-#token EndForm("endform") "endform"
-#token EndOneOf("endoneof") "endoneof"
-#token Form("form") "form"
-#token Subtitle("subtitle") "subtitle"
-#token Help("help") "help"
-#token VarId("varid") "varid"
-#token Text("text") "text"
-#token Option("option") "option"
-#token Value("value") "value"
-#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 AND("AND") "AND"
-#token OR("OR") "OR"
-#token GrayOutIf("grayoutif") "grayoutif"
-#token NOT("NOT") "NOT"
-#token Label("label") "label"
-#token Timeout("timeout") "timeout"
-#token Inventory("inventory") "inventory"
-#token StringToken("STRING_TOKEN") "STRING_TOKEN"
-#token NonNvDataMap("_NON_NV_DATA_MAP") "_NON_NV_DATA_MAP"
-#token Struct("struct") "struct"
-#token Uint64("UINT64") "UINT64"
-#token Uint32("UINT32") "UINT32"
-#token Uint16("UINT16") "UINT16"
-#token Char16("CHAR16") "CHAR16"
-#token Uint8("UINT8") "UINT8"
-#token Guid("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 Hidden("hidden") "hidden"
-#token Goto("goto") "goto"
-#token InconsistentIf "inconsistentif"
-#token EndIf("endif") "endif"
-#token IdEqId("ideqid") "ideqid"
-#token IdEqVal("ideqval") "ideqval"
-#token VarEqVal("vareqval") "vareqval"
-#token Var("var") "var"
-#token IdEqValList("ideqvallist") "ideqvallist"
-#token Length("length") "length"
-#token Values("values") "values"
-#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 LateCheckFlag("LATE_CHECK") "LATE_CHECK"
-#token Class("class") "class"
-#token Subclass("subclass") "subclass"
-#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 VarStore("varstore") "varstore"
-#token Name("name") "name"
-#token Oem("oem") "oem"
-#token True("TRUE") "TRUE"
-#token False("FALSE") "FALSE"
-#token GreaterThan(">") ">"
-#token GreaterEqual(">=") ">="
-#token LessThan("<") "<"
-#token LessEqual("<=") "<="
-
-//
-// 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"
-
-#token LanguageIdentifier("language identifier") "[a-z][a-z][a-z]" // 3 lowercase characters
-#token StringIdentifier("string identifier") "[A-Za-z_][A-Za-z_0-9]*"
-#token Number("numeric value") "(0x[0-9A-Fa-f]+) | [0-9]+"
-#token OpenBrace("{") "\{"
-#token CloseBrace("}") "\}"
-#token OpenParen("(") "\("
-#token CloseParen(")") "\)"
-#token OpenBracket("[") "\["
-#token CloseBracket("]") "\]"
-
-//
-// Define all other invalid characters so that they get through the lexical phase
-// and we can catch them during the parse phase. We get much better error
-// messages then.
-//
-#token InvalidCharacters("invalid characters") "~[;:=,\.\|]"
-
-//
-// This is the overall definition of a VFR form definition script.
-//
-program :
- ( dataStructDefinition )*
- formSetStatement
- ( vfrStatementVarStore )*
- ( formDefinition )*
- EFS:EndFormSet ";" << WriteOpByte (EFS->getLine(), EFI_IFR_END_FORM_SET_OP); >>
- "@" // end of file
- ;
-
-formSetStatement :
- FS:FormSet << WriteOpByte (FS->getLine(), EFI_IFR_FORM_SET_OP); >>
- Guid "="
- OpenBrace
- G1:Number ","
- G2:Number ","
- G3:Number ","
- OpenBrace
- G4:Number ","
- G5:Number ","
- G6:Number ","
- G7:Number ","
- G8:Number ","
- G9:Number ","
- G10:Number ","
- G11:Number
- CloseBrace
- CloseBrace << WriteGuidValue (G1->getLine (), G1->getText (), G2->getText (), G3->getText (),
- G4->getText (), G5->getText (), G6->getText (), G7->getText (),
- G8->getText (), G9->getText (), G10->getText (), G11->getText ()
- );
- >>
- ","
- Title "=" getStringId ","
- Help "=" getStringId ","
- //
- // insert padding for an EFI_PHYSICAL_ADDRESS (UINT64)
- //
- << WriteDWord (0, 0); WriteDWord (0, 0); >>
- Class "=" CVAL:classDefinition "," << WriteClass (); >>
- Subclass "=" SVAL:subclassDefinition "," << WriteSubclass (); >>
- << WriteWord (mNvDataStructSize); >>
- ;
-
-//
-// A form can be of multiple classes, thus allow CLASS_A | CLASS_B | CLASS_C
-//
-classDefinition :
- validClassNames ( "\|" validClassNames )*
- ;
-
-validClassNames :
- CND:ClassNonDevice << SetClass (CND->getLine(), EFI_NON_DEVICE_CLASS); >>
- | CDD:ClassDiskDevice << SetClass (CDD->getLine(), EFI_DISK_DEVICE_CLASS); >>
- | CVD:ClassVideoDevice << SetClass (CVD->getLine(), EFI_VIDEO_DEVICE_CLASS); >>
- | CNW:ClassNetworkDevice << SetClass (CNW->getLine(), EFI_NETWORK_DEVICE_CLASS); >>
- | CID:ClassInputDevice << SetClass (CID->getLine(), EFI_INPUT_DEVICE_CLASS); >>
- | COB:ClassOnBoardDevice << SetClass (COB->getLine(), EFI_ON_BOARD_DEVICE_CLASS); >>
- | COD:ClassOtherDevice << SetClass (COD->getLine(), EFI_OTHER_DEVICE_CLASS); >>
- | CNUM:Number << SetClass (CNUM->getLine(), GetNumber (CNUM->getText(), CNUM->getLine(), 4)); >>
- ; << PrintErrorMessage (LT(1)->getLine(), LT(1)->getText(), "invalid class"); >>
-
-//
-// A form can only be of one subclass type.
-//
-subclassDefinition :
- SSA:SubclassSetupApplication << SetSubclass (SSA->getLine(), EFI_SETUP_APPLICATION_SUBCLASS); >>
- | SGA:SubclassGeneralApplication << SetSubclass (SGA->getLine(), EFI_GENERAL_APPLICATION_SUBCLASS); >>
- | SFP:SubclassFrontPage << SetSubclass (SFP->getLine(), EFI_FRONT_PAGE_SUBCLASS); >>
- | SSU:SubclassSingleUse << SetSubclass (SSU->getLine(), EFI_SINGLE_USE_SUBCLASS); >>
- | SNUM:Number << SetSubclass (SNUM->getLine(), GetNumber (SNUM->getText(), SNUM->getLine(), 4)); >>
- ; << PrintErrorMessage (LT(1)->getLine(), LT(1)->getText(), "invalid subclass"); >>
-
-//
-// Parse a C type data structure for storing VFR setup data. Allow:
-// typedef struct _XXX_ {
-// (fields)
-// } MY_NV_DATA;
-//
-dataStructDefinition :
- << int IsNonNV = 0; >>
- { TypeDef }
- S:Struct
- (
- NonNvDataMap << IsNonNV = 1; >>
- |
- { StringIdentifier }
- ) << StartStructDefinition (IsNonNV, S->getLine()); >>
- OpenBrace
- dataStructFields
- CloseBrace NAME:StringIdentifier << EndStructDefinition (NAME->getText(), NAME->getLine()); >>
- ";"
- ;
-
-//
-// Parse a C type data structure for defining data that is not stored in NV.
-// typedef struct _NON_NV_DATA_MAP {
-// (fields)
-// } NON_NV_DATA_MAP;
-//
-nonNvDataStructDefinition :
- { TypeDef }
- Struct NonNvDataMap
- { StringIdentifier }
- OpenBrace
- dataStructFields
- CloseBrace NAME:StringIdentifier << AddStructField (NAME->getText(), NAME->getLine(), 0, 0, 0); >>
- ";"
- ;
-
-dataStructFields :
- ( dataStructField64 | dataStructField32 | dataStructField16 | dataStructField8 ) *
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// UINT64 Name[4];
-// UINT64 Name;
-//
-// Used while parsing the NV data map structures.
-//
-dataStructField64 :
- << int ArrayLength = 1; char IsArray = 0; >>
- "UINT64"
- NAME:StringIdentifier
- ( ";" | OpenBracket IVal:Number CloseBracket ";" << ArrayLength = GetNumber (IVal->getText(), IVal->getLine(), 4); IsArray = 1; >> )
- << AddStructField (NAME->getText(), NAME->getLine(), 8, ArrayLength, IsArray); >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// UINT32 Name[4];
-// UINT32 Name;
-//
-// Used while parsing the NV data map structures.
-//
-dataStructField32 :
- << int ArrayLength = 1; char IsArray = 0; >>
- "UINT32"
- NAME:StringIdentifier
- ( ";" | OpenBracket IVal:Number CloseBracket ";" << ArrayLength = GetNumber (IVal->getText(), IVal->getLine(), 4); IsArray = 1; >> )
- << AddStructField (NAME->getText(), NAME->getLine(), 4, ArrayLength, IsArray); >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// UINT16 Name[4];
-// UINT16 Name;
-//
-// Used while parsing the NV data map structures.
-//
-dataStructField16 :
- << int ArrayLength = 1; char IsArray = 0; >>
- ( "UINT16" | "CHAR16" )
- NAME:StringIdentifier
- ( ";" | OpenBracket IVal:Number CloseBracket ";" << ArrayLength = GetNumber (IVal->getText(), IVal->getLine(), 4); IsArray = 1; >> )
- << AddStructField (NAME->getText(), NAME->getLine(), 2, ArrayLength, IsArray); >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// UINT8 Name[4];
-// UINT8 Name;
-//
-// Used while parsing the NV data map structures.
-//
-dataStructField8 :
- << int ArrayLength = 1; char IsArray = 0; >>
- "UINT8"
- NAME:StringIdentifier
- ( ";" | OpenBracket IVal:Number CloseBracket ";" << ArrayLength = GetNumber (IVal->getText(), IVal->getLine(), 4); IsArray = 1; >> )
- << AddStructField (NAME->getText(), NAME->getLine(), 1, ArrayLength, IsArray); >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// form formid = 1,
-// title = STRING_TOKEN(STR_FORM_TITLE);
-// -- form statements --
-// endform;
-//
-// The Form ID cannot be 0
-//
-formDefinition :
- FRM:Form FormId << WriteOpByte (FRM->getLine(), EFI_IFR_FORM_OP); >>
- "="
- VAL:Number << WriteWord (GetNumber (VAL->getText(), VAL->getLine(), 2)); AddFormId (GetNumber (VAL->getText(), VAL->getLine(), 2), VAL->getLine()); >>
- ","
- Title "=" getStringId ";" // writes string identifier
- ( vfrStatements )*
- ENDF:EndForm ";" << WriteOpByte (ENDF->getLine(), EFI_IFR_END_FORM_OP); >>
- ;
-
-//
-// VFR statements in a formset
-//
-vfrStatements :
- vfrStatementSubTitle |
- vfrStatementOneOf |
- vfrStatementTextText |
- vfrStatementCheckBox |
- vfrStatementNumeric |
- vfrStatementDate |
- vfrStatementTime |
- vfrStatementPassword |
- vfrStatementString |
- vfrStatementSuppressIf |
- vfrStatementHidden |
- vfrStatementGoto |
- vfrStatementGrayOutIf |
- vfrStatementInconsistentIf |
- vfrStatementLabel |
- vfrStatementBanner |
- vfrStatementInventory |
- vfrStatementOrderedList |
- vfrStatementOem |
- vfrStatementSaveRestoreDefaults
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// label 100;
-//
-vfrStatementLabel :
- OPID:Label << WriteOpByte (OPID->getLine(), EFI_IFR_LABEL_OP); >>
- VAL:Number <<
- WriteWord (GetNumber (VAL->getText(), VAL->getLine(), 2));
- AddLabel (GetNumber (VAL->getText(), VAL->getLine(), 2), VAL->getLine());
- >>
- ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// oem 0x12, 0x34, 0x56;
-//
-vfrStatementOem :
- OPID:Oem << WriteOpByte (OPID->getLine(), EFI_IFR_OEM_DEFINED_OP); >>
- ( VAL1:Number << WriteByte (GetNumber (VAL1->getText(), VAL1->getLine(), 1), 0); >> )
- ( "," VAL2:Number << WriteByte (GetNumber (VAL2->getText(), VAL2->getLine(), 1), 0); >> )*
- ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// inconsistentif NOT .... AND NOT .... OR ... endif;
-//
-vfrStatementInconsistentIf :
- << ResetFlags (); >>
- IIFOP:InconsistentIf << WriteOpByte (IIFOP->getLine(), EFI_IFR_INCONSISTENT_IF_OP); >>
- Prompt "=" getStringId ","
- {
- FF:Flags "=" flagsField ( "\|" flagsField )* ","
- }
- << WriteFlags (); >> // write the flags field
- vfrBooleanExpression
- EOP:EndIf ";" << WriteOpByte (EOP->getLine(), EFI_IFR_END_IF_OP); >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// TRUE AND (ideqval SomeStruct.SomeMember >= 0x10 OR
-// ideqid SomeStruct.SomeMember < SomeStruct.SomeOtherMember) AND
-// (ideqlist SomeStruct.SomeOtherMember == 0x10, 0x20, 0x30 OR
-// vareqval var(VAR_EQ_TEST_NAME) == 0x1)
-//
-// For supporting complex express, divide the vfrBooleanExpression to two parts
-// so that pred-LL(k) parser can parse incrementally.
-//
-vfrBooleanExpression :
- leftPartVfrBooleanExp { rightPartVfrBooleanExp }
- ;
-
-leftPartVfrBooleanExp :
- OpenParen vfrBooleanExpression CloseParen |
- (ideqval | ideqid | ideqvallist | vareqval | truefalse) |
- NOPID:NOT leftPartVfrBooleanExp << WriteOpByte (NOPID->getLine(), EFI_IFR_NOT_OP); >>
- ;
-
-rightPartVfrBooleanExp :
- AOPID:AND vfrBooleanExpression << WriteOpByte (AOPID->getLine(), EFI_IFR_AND_OP); >> |
- OOPID:OR vfrBooleanExpression << WriteOpByte (OOPID->getLine(), EFI_IFR_OR_OP); >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// TRUE
-//
-truefalse :
- TOPID:True << WriteOpByte (TOPID->getLine(), EFI_IFR_TRUE_OP); >> |
- FOPID:False << WriteOpByte (FOPID->getLine(), EFI_IFR_FALSE_OP); >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// varstore MY_STRUCT_NAME, key = 0x1234, name = "MyVariableName", guid = {...};
-//
-vfrStatementVarStore :
- OP:VarStore << WriteOpByte (OP->getLine(), EFI_IFR_VARSTORE_OP); >>
- STRUCT_NAME:StringIdentifier ","
- Key "=" KNUM:Number ","
- Name "=" VAR_NAME:StringIdentifier ","
- Guid "="
- OpenBrace
- G1:Number ","
- G2:Number ","
- G3:Number ","
- OpenBrace
- G4:Number ","
- G5:Number ","
- G6:Number ","
- G7:Number ","
- G8:Number ","
- G9:Number ","
- G10:Number ","
- G11:Number
- CloseBrace
- CloseBrace << WriteGuidValue (G1->getLine (), G1->getText (), G2->getText (), G3->getText (),
- G4->getText (), G5->getText (), G6->getText (), G7->getText (),
- G8->getText (), G9->getText (), G10->getText (), G11->getText ()
- );
- WriteWord (GetNumber (KNUM->getText(), KNUM->getLine(), 2));
- AddVarStore (STRUCT_NAME->getText(), VAR_NAME->getText(), GetNumber (KNUM->getText(), KNUM->getLine(), 2), STRUCT_NAME->getLine());
- >>
-
- ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// vareqval var(0x100) == 0x20
-//
-vareqval :
- OPID:VarEqVal << WriteOpByte (OPID->getLine(), EFI_IFR_EQ_VAR_VAL_OP); >>
- Var OpenParen
- VAR:Number << WriteWord (GetNumber (VAR->getText(), VAR->getLine(), 2)); >>
- CloseParen
- compareNumber
- ;
-
-ideqval :
- OPID:IdEqVal << WriteOpByte (OPID->getLine(), EFI_IFR_EQ_ID_VAL_OP); >>
- vfrStructFieldName[0]
- compareNumber
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// ideqid MyNVData3.Field16A == MyNVData3.Field16B
-//
-// NOTE: Before processing the second variable store in the ideqid statement, set a global flag
-// so that when we parse the second variable we set the secondary variable store id.
-//
-ideqid :
- OPID:IdEqId << WriteOpByte (OPID->getLine(), EFI_IFR_EQ_ID_ID_OP); >>
- vfrStructFieldName[0]
- compareVfrStructFieldNameNL0
- ;
-
-//*****************************************************************************
-//
-// compareNumber is the combination of compare operation and Number
-//
-compareNumber :
- (
- "=="
- VAL1:Number << WriteWord (GetNumber (VAL1->getText(), VAL1->getLine(), 2)); >>
- ) |
- (
- GTOPID:GreaterThan
- VAL2:Number << WriteWord (GetNumber (VAL2->getText(), VAL2->getLine(), 2));
- WriteOpByte (GTOPID->getLine(), EFI_IFR_GT_OP); >>
- ) |
- (
- GEOPID:GreaterEqual
- VAL3:Number << WriteWord (GetNumber (VAL3->getText(), VAL3->getLine(), 2));
- WriteOpByte (GEOPID->getLine(), EFI_IFR_GE_OP); >>
- ) |
- (
- LTOPID:LessThan
- VAL4:Number << WriteWord (GetNumber (VAL4->getText(), VAL4->getLine(), 2));
- WriteOpByte (LTOPID->getLine(), EFI_IFR_GE_OP);
- WriteOpByte (LTOPID->getLine(), EFI_IFR_NOT_OP); >>
- ) |
- (
- LEOPID:LessEqual
- VAL5:Number << WriteWord (GetNumber (VAL5->getText(), VAL5->getLine(), 2));
- WriteOpByte (LEOPID->getLine(), EFI_IFR_GT_OP);
- WriteOpByte (LEOPID->getLine(), EFI_IFR_NOT_OP); >>
- )
- ;
-
-//*****************************************************************************
-//
-// compareVfrStructFieldNameNL0 is the combination of compare operation and vfrStructFieldNameNL[0]
-//
-compareVfrStructFieldNameNL0 :
- (
- "==" << mIdEqIdStmt = 1; >>
- vfrStructFieldNameNL[0] << mIdEqIdStmt = 0; >>
- ) |
- (
- GTOPID:GreaterThan << mIdEqIdStmt = 1; >>
- vfrStructFieldNameNL[0] << mIdEqIdStmt = 0;
- WriteOpByte (GTOPID->getLine(), EFI_IFR_GT_OP); >>
- ) |
- (
- GEOPID:GreaterEqual << mIdEqIdStmt = 1; >>
- vfrStructFieldNameNL[0] << mIdEqIdStmt = 0;
- WriteOpByte (GEOPID->getLine(), EFI_IFR_GE_OP); >>
- ) |
- (
- LTOPID:LessThan << mIdEqIdStmt = 1; >>
- vfrStructFieldNameNL[0] << mIdEqIdStmt = 0;
- WriteOpByte (LTOPID->getLine(), EFI_IFR_GE_OP);
- WriteOpByte (LTOPID->getLine(), EFI_IFR_NOT_OP); >>
- ) |
- (
- LEOPID:LessEqual << mIdEqIdStmt = 1; >>
- vfrStructFieldNameNL[0] << mIdEqIdStmt = 0;
- WriteOpByte (LEOPID->getLine(), EFI_IFR_GT_OP);
- WriteOpByte (LEOPID->getLine(), EFI_IFR_NOT_OP); >>
- )
- ;
-
-
-ideqvallist :
- OPID:IdEqValList << WriteOpByte (OPID->getLine(), EFI_IFR_EQ_ID_LIST_OP); >>
- vfrStructFieldName[0]
- "=="
- ( VAL:Number << QueueIdEqValList (GetNumber (VAL->getText(), VAL->getLine(), 2)); >> ) +
- << FlushQueueIdEqValList(); >>
- ;
-
-vfrStatementGoto :
- << UINT32 LineNum, KeyValue = 0; ResetFlags (); >>
- IDG:Goto << WriteOpByte (IDG->getLine(), EFI_IFR_REF_OP); >>
- VAL:Number "," << WriteWord (GetNumber (VAL->getText(), VAL->getLine(), 2));
- AddGotoReference (GetNumber (VAL->getText(), VAL->getLine(), 2), VAL->getLine());
- >>
- KP:Prompt "=" getStringId "," << LineNum = KP->getLine(); >>
- Help "=" getStringId
- {
- ","
- FF:Flags "=" flagsField ( "\|" flagsField )* << LineNum = FF->getLine(); >>
- }
- {
- "," Key "=" KNUM:Number << LineNum = KNUM->getLine(); KeyValue = GetNumber(KNUM->getText(), LineNum, 2); >>
- }
- << WriteFlagsKey (KeyValue, LineNum); >>
- ";"
- ;
-
-vfrStatementHidden :
- IDH:Hidden << WriteOpByte (IDH->getLine(), EFI_IFR_HIDDEN_OP); >>
- Value "="
- VAL:Number "," << WriteWord (GetNumber (VAL->getText(), VAL->getLine(), 2)); >>
- Key "="
- KVAL:Number << WriteWord (GetNumber (KVAL->getText(), KVAL->getLine(), 2)); >>
- ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// suppressif <boolean_expression> { grayoutif } <statements>+ endif;
-// Note:
-// You can have: suppressif:grayoutif:statements:endif
-// suppressif:grayoutif:endif -- serves no purpose
-// suppressif:statements:endif
-// suppressif:endif -- serves no purpose
-//
-vfrStatementSuppressIf :
- << ResetFlags (); >>
- OPID:SuppressIf << WriteOpByte (OPID->getLine(), EFI_IFR_SUPPRESS_IF_OP); SetIfStart (OPID->getLine()); >>
- {
- FF:Flags "=" flagsField ( "\|" flagsField )* ","
- }
- << WriteFlags (); >> // write the flags field
- vfrBooleanExpression
- ";"
- { suppressIfGrayOutIf } ( suppressIfAndGrayoutIfSubstatements )+
- ENDOP:EndIf ";" << WriteOpByte (ENDOP->getLine(), EFI_IFR_END_IF_OP); SetIfStart (0); >>
- ;
-
-//
-// This is the form for a grayoutif nested in a suppressif statement
-//
-suppressIfGrayOutIf :
- << ResetFlags (); >>
- OPID:GrayOutIf << WriteOpByte (OPID->getLine(), EFI_IFR_GRAYOUT_IF_OP); >>
- {
- FF:Flags "=" flagsField ( "\|" flagsField )* ","
- }
- << WriteFlags (); >> // write the flags field
- vfrBooleanExpression
- ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// grayoutif { flags = n, } <boolean_expression> endif;
-// Note:
-// You can have: grayoutif:suppressif:statements:endif
-// grayoutif:statements:endif
-//
-//
-vfrStatementGrayOutIf :
- << ResetFlags (); >>
- OPID:GrayOutIf << WriteOpByte (OPID->getLine(), EFI_IFR_GRAYOUT_IF_OP); SetIfStart (OPID->getLine()); >>
- {
- FF:Flags "=" flagsField ( "\|" flagsField )* ","
- }
- << WriteFlags (); >> // write the flags field
- vfrBooleanExpression
- ";"
- { grayoutIfSuppressIf } ( suppressIfAndGrayoutIfSubstatements )+
- ENDOP:EndIf ";" << WriteOpByte (ENDOP->getLine(), EFI_IFR_END_IF_OP); SetIfStart (0); >>
- ;
-
-//
-// This is the format for a suppressif nested in a grayoutif
-//
-grayoutIfSuppressIf :
- << ResetFlags (); >>
- OPID:SuppressIf << WriteOpByte (OPID->getLine(), EFI_IFR_SUPPRESS_IF_OP); >>
- {
- FF:Flags "=" flagsField ( "\|" flagsField )* ","
- }
- << WriteFlags (); >> // write the flags field
- vfrBooleanExpression
- ";"
- ;
-
-//
-// These are the VFR statements that are valid inside a suppressif or grayoutif statement.
-//
-suppressIfAndGrayoutIfSubstatements :
- vfrStatementOneOf |
- vfrStatementTextText |
- vfrStatementCheckBox |
- vfrStatementNumeric |
- vfrStatementDate |
- vfrStatementTime |
- vfrStatementPassword |
- vfrStatementString |
- vfrStatementHidden |
- vfrStatementGoto |
- vfrStatementLabel |
- vfrStatementInventory |
- vfrStatementOrderedList |
- vfrStatementSaveRestoreDefaults
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// password varid = MyNvData.Password,
-// prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
-// help = STRING_TOKEN(STR_PASSWORD_HELP),
-// minsize = 6,
-// maxsize = 20,
-// encoding = 1,
-// endpassword;
-
-vfrStatementPassword :
- << UINT32 KeyValue = 0; UINT32 LineNum; ResetFlags (); >>
- IDPW:Password << WriteOpByte (IDPW->getLine(), EFI_IFR_PASSWORD_OP); >>
- VarId "=" vfrStructFieldNameArray[0] ","
- Prompt "=" getStringId ","
- KH:Help "=" getStringId "," << LineNum = KH->getLine(); >>
- {
- FF:Flags "=" flagsField ( "\|" flagsField )* "," << LineNum = FF->getLine(); >>
- }
- {
- Key "=" KNUM:Number "," << LineNum = KNUM->getLine(); KeyValue = GetNumber(KNUM->getText(), LineNum, 2); >>
- }
- << WriteFlagsKey (KeyValue, LineNum); >>
- MinSize "=" MIN:Number "," << WriteByte (GetNumber (MIN->getText(), MIN->getLine(), 1), 0); >>
- MaxSize "=" MAX:Number "," << WriteByte (GetNumber (MAX->getText(), MAX->getLine(), 1), 0); >>
- Encoding "=" ENC:Number "," << WriteWord (GetNumber (ENC->getText(), ENC->getLine(), 2)); >>
- EndPassword ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// string varid = MyNv.String,
-// prompt = STRING_TOKEN(STR_STRING_PROMPT),
-// help = STRING_TOKEN(STR_STRING_HELP),
-// flags = INTERACTIVE,
-// key = 0x1234,
-// minsize = 6,
-// maxsize = 0x14,
-// endstring;
-//
-// Since flags and key are optional, we can't use Flags->getLine(). Therefore for error
-// reporting we save the line number of the "help" keyword.
-//
-vfrStatementString :
- << unsigned int KeyValue = 0; UINT32 LineNum; ResetFlags (); >>
- IDS:String << WriteOpByte (IDS->getLine(), EFI_IFR_STRING_OP); >>
- VarId "=" vfrStructFieldNameArray[0] ","
- Prompt "=" getStringId ","
- KH:Help "=" getStringId "," << LineNum = KH->getLine(); >>
- {
- FF:Flags "="
- flagsField ( "\|" flagsField )* << LineNum = FF->getLine(); >>
- ","
- }
- {
- Key "=" KNUM:Number "," << LineNum = KNUM->getLine(); KeyValue = GetNumber(KNUM->getText(), LineNum, 2); >>
- }
- << WriteFlagsKey (KeyValue, LineNum); >>
- MinSize "=" MIN:Number "," << WriteByte (GetNumber (MIN->getText(), MIN->getLine(), 1), 0); >>
- MaxSize "=" MAX:Number "," << WriteByte (GetNumber (MAX->getText(), MAX->getLine(), 1), 0); >>
- EndString ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// numeric varid = MyIfrNVData.HowOldAreYouInYears,
-// prompt = STRING_TOKEN(STR_NUMERIC_PROMPT),
-// help = STRING_TOKEN(STR_NUMERIC_HELP),
-// flags = INTERACTIVE, // flags is optional
-// key = 0x1234, // key is optional if (flags & INTERACTIVE = 0)
-// minimum = 0x0,
-// maximum = 0xf0,
-// step = 1, // step is option, and step=1 if not specified
-// default = 0; // default is optional, and default=minimum if not specified
-// endnumeric;
-//
-// Make flags and key optional. However if flags includes INTERACTIVE, then a key is required.
-// That check is done in WriteFlagsKey() function.
-//
-vfrStatementNumeric :
- << UINT32 LineNum, KeyValue = 0; ResetFlags (); >>
- IDN:Numeric << WriteOpByte (IDN->getLine(), EFI_IFR_NUMERIC_OP); >>
- VarId "=" vfrStructFieldName[2] ","
- Prompt "=" getStringId ","
- KH:Help "=" getStringId "," << LineNum = KH->getLine(); >>
- {
- FF:Flags "=" flagsField ( "\|" flagsField )* "," << LineNum = FF->getLine (); >>
- }
- {
- Key "=" KNUM:Number "," << LineNum = KNUM->getLine(); KeyValue = GetNumber(KNUM->getText(), LineNum, 2); >>
- }
- << WriteFlagsKey (KeyValue, LineNum); >>
- minMaxStepDefault
- EndNumeric ";" << WriteMinMaxStepDefault (); >>
- ;
-
-//
-// Parse minimum/maximum/step/default statements. Special cases:
-// - if step not specified, then the value is 1
-// - if default not specified, then the value is the min value specified
-// - if max < min, print a warning and swap the values (changes default too)
-//
-minMaxStepDefault :
- << InitMinMaxStepDefault (); >>
- Minimum "=" MIN:Number "," << SetMinMaxStepDefault (GetNumber (MIN->getText(), MIN->getLine(), 2), 0, MIN->getLine()); >>
- Maximum "=" MAX:Number "," << SetMinMaxStepDefault (GetNumber (MAX->getText(), MAX->getLine(), 2), 1, MAX->getLine()); >>
- { Step "=" STEP:Number "," << SetMinMaxStepDefault (GetNumber (STEP->getText(), STEP->getLine(), 2), 2, STEP->getLine()); >> }
- { Default "=" DEF:Number "," << SetMinMaxStepDefault (GetNumber (DEF->getText(), DEF->getLine(), 2), 3, DEF->getLine()); >> }
- ;
-
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// date year varid = Date.Year, // "Date.Year" is a special case we recognize
-// prompt = STRING_TOKEN(STR_DATE_PROMPT),
-// help = STRING_TOKEN(STR_DATE_YEAR_HELP),
-// minimum = 1939,
-// maximum = 2101,
-// step = 1,
-// default = 1964,
-//
-// month varid = Date.Month,
-// prompt = STRING_TOKEN(STR_DATE_PROMPT),
-// help = STRING_TOKEN(STR_DATE_MONTH_HELP),
-// minimum = 1,
-// maximum = 12,
-// step = 1,
-// default = 1,
-//
-// day varid = Date.Day,
-// prompt = STRING_TOKEN(STR_DATE_PROMPT),
-// help = STRING_TOKEN(STR_DATE_DAY_HELP),
-// minimum = 1,
-// maximum = 31,
-// step = 0x1,
-// default = 1,
-//
-// enddate;
-//
-vfrStatementDate :
- Date
- IDY:Year VarId "=" << WriteOpByte (IDY->getLine(), EFI_IFR_DATE_OP); >>
- vfrStructFieldName[2] ","
- dateTimeSubStatement
- IDM:Month VarId "=" << WriteOpByte (IDM->getLine(), EFI_IFR_DATE_OP); >>
- vfrStructFieldName[2] ","
- dateTimeSubStatement
- IDD:Day VarId "=" << WriteOpByte (IDD->getLine(), EFI_IFR_DATE_OP); >>
- vfrStructFieldName[2] ","
- dateTimeSubStatement
- EndDate ";"
- ;
-
-vfrStatementTime :
- Time
- IDH:Hour VarId "=" << WriteOpByte (IDH->getLine(), EFI_IFR_TIME_OP); >>
- vfrStructFieldName[2] ","
- dateTimeSubStatement
- IDM:Minute VarId "=" << WriteOpByte (IDM->getLine(), EFI_IFR_TIME_OP); >>
- vfrStructFieldName[2] ","
- dateTimeSubStatement
- IDS:Second VarId "=" << WriteOpByte (IDS->getLine(), EFI_IFR_TIME_OP); >>
- vfrStructFieldName[2] ","
- dateTimeSubStatement
- EndTime ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// text text = STRING_ID;
-// text text = STRING_ID, text = STRING_ID;
-// text text = STRING_ID, text = STRING_ID, flags = x, key = y;
-//
-vfrStatementTextText :
- << ResetFlags (); >>
- IDT:Text << WriteOpByte (IDT->getLine(), EFI_IFR_TEXT_OP); >>
- Help "=" getStringId ","
- Text "="
- getStringId // writes string identifier
- { "," Text "=" getStringId
- "," Flags "=" flagsField ( "\|" flagsField )* << WriteFlags (); >>
- ","
- Key "=" KNUM:Number << WriteWord (GetNumber(KNUM->getText(), KNUM->getLine(), 2)); >>
- }
- ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// inventory help = ID, text = ID;
-// inventory help = ID, text = id, text = ID;
-//
-vfrStatementInventory :
- IDI:Inventory << WriteOpByte (IDI->getLine(), EFI_IFR_INVENTORY_OP); >>
- Help "=" getStringId ","
- Text "=" getStringId // writes string identifier
- { "," Text "=" getStringId
- }
- ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// restore defaults,
-// formid = 4,
-// prompt = STRING_TOKEN(STR_RESTORE_DEFAULTS_PROMPT),
-// help = STRING_TOKEN(STR_RESTORE_DEFAULTS_HELP),
-// flags = 0,
-// key = 0;
-//
-// save defaults,
-// formid = 4,
-// prompt = STRING_TOKEN(STR_SAVE_DEFAULTS_PROMPT),
-// help = STRING_TOKEN(STR_SAVE_DEFAULTS_HELP),
-// flags = 0,
-// key = 0;
-//
-vfrStatementSaveRestoreDefaults :
- << unsigned int KeyValue = 0; UINT32 LineNum; ResetFlags (); >>
- ( IDS:Save << WriteOpByte (IDS->getLine(), EFI_IFR_SAVE_DEFAULTS_OP); >>
- | IDR:Restore << WriteOpByte (IDR->getLine(), EFI_IFR_RESTORE_DEFAULTS_OP); >>
- )
- Defaults ","
- FormId "=" FRMID:Number "," << WriteWord (GetNumber (FRMID->getText(), FRMID->getLine(), 2));
- AddGotoReference (GetNumber (FRMID->getText(), FRMID->getLine(), 2), FRMID->getLine());
- >>
- Prompt "=" getStringId ","
- KH:Help "=" getStringId << LineNum = KH->getLine(); >>
- {
- "," FF:Flags "=" flagsField ( "\|" flagsField )* << LineNum = FF->getLine(); >>
- }
- {
- "," Key "=" KNUM:Number << LineNum = KNUM->getLine(); KeyValue = GetNumber(KNUM->getText(), LineNum, 2); >>
- }
- << WriteFlagsKey (KeyValue, LineNum); >>
- ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// flags = 0x10 | DEFAULT | MANUFACTURING | INTERACTIVE | NV_ACCESS | RESET_REQUIRED | LATE_CHECK
-//
-//
-flagsField :
- VAL:Number << SetFlags (GetNumber(VAL->getText(), VAL->getLine(), 4), VAL->getLine()); >>
- | IF:InteractiveFlag << SetFlags (EFI_IFR_FLAG_INTERACTIVE, IF->getLine()); >>
- | MF:ManufacturingFlag << SetFlags (EFI_IFR_FLAG_MANUFACTURING, MF->getLine()); >>
- | DF:DefaultFlag << SetFlags (EFI_IFR_FLAG_DEFAULT, DF->getLine()); >>
- | NV:NVAccessFlag << SetFlags (EFI_IFR_FLAG_NV_ACCESS, NV->getLine()); >>
- | RR:ResetRequiredFlag << SetFlags (EFI_IFR_FLAG_RESET_REQUIRED, RR->getLine()); >>
- | LC:LateCheckFlag << SetFlags (EFI_IFR_FLAG_LATE_CHECK, LC->getLine()); >>
- ;
-
-dateTimeSubStatement :
- Prompt "=" getStringId ","
- Help "=" getStringId ","
- << WriteByte (0, 0); WriteWord (0); >> // bogus flags and key
- minMaxStepDefault << WriteMinMaxStepDefault (); >>
- ;
-
-vfrStatementCheckBox :
- << UINT32 LineNum, KeyValue = 0; ResetFlags (); >>
- IDCB:CheckBox << WriteOpByte (IDCB->getLine(), EFI_IFR_CHECKBOX_OP); >>
- VarId "=" vfrStructFieldName[1] ","
- Prompt "=" getStringId ","
- Help "=" getStringId ","
- FF:Flags "=" flagsField ( "\|" flagsField )* "," << LineNum = FF->getLine(); >>
- {
- Key "=" KV:Number "," << LineNum = KV->getLine(); KeyValue = GetNumber(KV->getText(), LineNum, 2); >>
- }
- << WriteFlagsKey (KeyValue, LineNum); >>
- EndCheckBox ";"
- ;
-
-vfrStatementSubTitle :
- IDS:Subtitle Text "=" << WriteOpByte (IDS->getLine(), EFI_IFR_SUBTITLE_OP); >>
- getStringId // writes string indentifier
- ";"
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// banner
-// title = STRING_TOKEN(STR_BANNER_TITLE),
-// line 1,
-// align center; // or left or right
-//
-// banner,
-// title = STRING_TOKEN(STR_BANNER_TITLE), timeout = 100;
-//
-vfrStatementBanner :
- IDB:Banner { "," } << WriteOpByte (IDB->getLine(), EFI_IFR_BANNER_OP); >>
- Title "=" getStringId ","
- (
- Line VAL:Number "," << WriteWord (GetNumber(VAL->getText(), VAL->getLine(), 2)); >>
- Align
- ( Left << WriteByte (EFI_IFR_BANNER_ALIGN_LEFT, 0); >>
- | Center << WriteByte (EFI_IFR_BANNER_ALIGN_CENTER, 0); >>
- | Right << WriteByte (EFI_IFR_BANNER_ALIGN_RIGHT, 0); >>
- ) ";"
- |
- Timeout "=" TO:Number ";" << WriteWord (GetNumber(TO->getText(), TO->getLine(), 2)); >>
- << WriteByte (EFI_IFR_BANNER_TIMEOUT, 0); >>
- )
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// oneof varid = MyNv.OneOfData,
-// prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
-// help = STRING_TOKEN(STR_ONE_OF_HELP),
-// option text = STRING_TOKEN(STR_ONE_OF_TEXT),
-// value = 0,
-// flags = DEFAULT | INTERACTIVE;
-//
-// supressif/grayoutif are supported inside oneof stmt.
-// We do not restrict the number of oneOfOptionText to >=2, but >=1.
-// The situation that all oneOfOptionText are suppressed is also possiable.
-//
-vfrStatementOneOf :
- << ResetFlags (); >>
- IDOO:OneOf << WriteOpByte (IDOO->getLine(), EFI_IFR_ONE_OF_OP); >>
- VarId "=" vfrStructFieldName[2] ","
- Prompt "=" getStringId "," // writes string identifier
- Help "=" getStringId "," // writes string identifier
- ( oneOfOptionText )+ // there must be at least 1 option to be choosed, not 2.
- IDEOO:EndOneOf ";" << TestOneOfFlags (IDEOO->getLine()); WriteOpByte (IDEOO->getLine(), EFI_IFR_END_ONE_OF_OP); >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// orderedlist varid = MyNv.OrderedListData,
-// prompt = STRING_TOKEN(STR_ORDERED_LIST_PROMPT),
-// help = STRING_TOKEN(STR_ORDERED_LIST_HELP),
-// option text = STRING_TOKEN(STR_ORDERED_LIST_TEXT), value = 0, flags = INTERACTIVE;
-// -- additional option text --
-// endlist;
-//
-vfrStatementOrderedList :
- << ResetFlags (); InitOrderedList(); >>
- IDOL:OrderedList << WriteOpByte (IDOL->getLine(), EFI_IFR_ORDERED_LIST_OP); >>
- VarId "=" vfrStructFieldNameArray[1] ","
- Prompt "=" getStringId "," // writes string identifier
- Help "=" getStringId "," // writes string identifier
- orderedListOptionText ( orderedListOptionText )+
- IDEOL:EndList ";" << WriteOpByte (IDEOL->getLine(), EFI_IFR_END_OP); EndOrderedList(IDEOL->getLine()); >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// option text = STRING_TOKEN(STRING_ID), value = 0 flags = 99;
-//
-// Differs from the oneOfOptionText in that we don't allow the DEFAULT flag to
-// be set, and value cannot be 0.
-//
-orderedListOptionText :
- << UINT32 KeyValue = 0; >>
- IDO:Option << WriteOpByte (IDO->getLine(), EFI_IFR_ONE_OF_OPTION_OP); >>
- Text "=" getStringId "," // writes string identifier
- Value "=" WVAL:Number "," <<
- if (GetNumber(WVAL->getText(), WVAL->getLine(), 2) == 0) {
- PrintErrorMessage (WVAL->getLine(), "value=0 is invalid for ordered lists", NULL);
- } else {
- WriteWord (GetNumber(WVAL->getText(), WVAL->getLine(), 2));
- }
- >>
- FF:Flags "=" orderedListFlagsField
- ("\|" orderedListFlagsField )*
- {
- "," Key "=" KV:Number << KeyValue = GetNumber (KV->getText(), KV->getLine(), 2); >>
- }
- << WriteFlagsKey (KeyValue, FF->getLine()); >>
- ";" << mOptionCount++; >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// flags = 0x10 | DEFAULT | MANUFACTURING | INTERACTIVE | NV_ACCESS | RESET_REQUIRED | LATE_CHECK
-//
-// The ordered list flags field cannot have a default.
-//
-orderedListFlagsField :
- VAL:Number << SetFlags (GetNumber(VAL->getText(), VAL->getLine(), 4), VAL->getLine()); >>
- | IF:InteractiveFlag << SetFlags (EFI_IFR_FLAG_INTERACTIVE, IF->getLine()); >>
- | MF:ManufacturingFlag << SetFlags (EFI_IFR_FLAG_MANUFACTURING, MF->getLine()); >>
- | NV:NVAccessFlag << SetFlags (EFI_IFR_FLAG_NV_ACCESS, NV->getLine()); >>
- | RR:ResetRequiredFlag << SetFlags (EFI_IFR_FLAG_RESET_REQUIRED, RR->getLine()); >>
- | LC:LateCheckFlag << SetFlags (EFI_IFR_FLAG_LATE_CHECK, LC->getLine()); >>
- | DF:DefaultFlag << PrintWarningMessage (DF->getLine(), "DEFAULT flag not valid for ordered lists", NULL); >>
- ;
-
-//
-// Parse references to VFR structure field names of form "MyNvStructure.Field".
-// This implementation is specific to strings, passwords, and references in an
-// ordered list statement because we want to specify the size of the entire
-// field, rather than just one element. Then call a function to write out its
-// offset and length.
-//
-vfrStructFieldNameArray[int FieldWidth] :
- << int ArrayIndex = 1; char IsArrayIndex = 0; >>
- SName:StringIdentifier
- "."
- SFieldName:StringIdentifier
- { OpenBracket AIndex:Number CloseBracket << ArrayIndex = GetNumber(AIndex->getText(), AIndex->getLine(), 4); IsArrayIndex = 1; >> }
- <<
- WriteFieldOffset (1,
- SName->getText(),
- SName->getLine(),
- SFieldName->getText(),
- SFieldName->getLine(),
- ArrayIndex,
- IsArrayIndex,
- FieldWidth,
- 1
- );
- >>
- ;
-
-//
-// Parse references to VFR structure field names of form "MyNvStructure.Field",
-// then call a function to write out its offset and length.
-//
-vfrStructFieldName[int FieldWidth] :
- << int ArrayIndex = 1; char IsArrayIndex = 0; >>
- SName:StringIdentifier
- "."
- SFieldName:StringIdentifier
- { OpenBracket AIndex:Number CloseBracket << ArrayIndex = GetNumber(AIndex->getText(), AIndex->getLine(), 4); IsArrayIndex = 1; >> }
- <<
- WriteFieldOffset (1,
- SName->getText(),
- SName->getLine(),
- SFieldName->getText(),
- SFieldName->getLine(),
- ArrayIndex,
- IsArrayIndex,
- FieldWidth,
- 0
- );
- >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-//
-// MyNvStructure.FieldName[4]
-//
-// Parse references to VFR structure field names of form "MyNvStructure.Field",
-// then call a function to write out the offset with no length.
-//
-vfrStructFieldNameNL[int FieldWidth] :
- << int ArrayIndex = 1; char IsArrayIndex = 0; >>
- SName:StringIdentifier
- "."
- SFieldName:StringIdentifier
- { OpenBracket AIndex:Number CloseBracket << ArrayIndex = GetNumber(AIndex->getText(), AIndex->getLine(), 4); IsArrayIndex = 1; >> }
- <<
- WriteFieldOffset (0,
- SName->getText(),
- SName->getLine(),
- SFieldName->getText(),
- SFieldName->getLine(),
- ArrayIndex,
- IsArrayIndex,
- FieldWidth,
- 0
- );
- >>
- ;
-
-//*****************************************************************************
-//
-// PARSE:
-// suppressif TRUE OR FALSE;
-// grayoutif FALSE OR TRUE;
-// option text = STRING_TOKEN(STRING_ID), value = 0 flags = 99;
-// option text = STRING_TOKEN(STRING_ID2), value = 1 flags = 98;
-// endif;
-//
-oneOfOptionText :
- suppressIfOptionText |
- grayOutIfOptionText |
- commonOptionText
- ;
-
-suppressIfOptionText :
- << ResetFlags (); >>
- OPID:SuppressIf << WriteOpByte (OPID->getLine(), EFI_IFR_SUPPRESS_IF_OP); SetIfStart (OPID->getLine()); >>
- {
- FF:Flags "=" flagsField ( "\|" flagsField )* ","
- }
- << WriteFlags (); >> // write the flags field
- vfrBooleanExpression
- ";"
- { suppressIfGrayOutIf } ( commonOptionText )+
- ENDOP:EndIf ";" << WriteOpByte (ENDOP->getLine(), EFI_IFR_END_IF_OP); SetIfStart (0); >>
- ;
-
-grayOutIfOptionText :
- << ResetFlags (); >>
- OPID:GrayOutIf << WriteOpByte (OPID->getLine(), EFI_IFR_GRAYOUT_IF_OP); SetIfStart (OPID->getLine()); >>
- {
- FF:Flags "=" flagsField ( "\|" flagsField )* ","
- }
- << WriteFlags (); >> // write the flags field
- vfrBooleanExpression
- ";"
- { grayoutIfSuppressIf } ( commonOptionText )+
- ENDOP:EndIf ";" << WriteOpByte (ENDOP->getLine(), EFI_IFR_END_IF_OP); SetIfStart (0); >>
- ;
-
-commonOptionText :
- << UINT32 KeyValue = 0; >>
- IDO:Option << WriteOpByte (IDO->getLine(), EFI_IFR_ONE_OF_OPTION_OP); >>
- Text "=" getStringId "," // writes string identifier
- Value "=" WVal:Number "," << WriteWord (GetNumber(WVal->getText(), WVal->getLine(), 2)); >>
- FF:Flags "=" flagsField ("\|" flagsField )*
- {
- "," Key "=" KV:Number << KeyValue = GetNumber (KV->getText(), KV->getLine(), 2); >>
- }
- << WriteFlagsKey (KeyValue, FF->getLine()); >>
- ";" << mOptionCount++; >>
- ;
-
-//
-// Gets a string identifier. It must be a numeric value of form:
-//
-// STRING_TOKEN(100)
-//
-getStringId :
- << unsigned short StrId; >>
- StringToken OpenParen
- IdVal:Number << StrId = GetNumber (IdVal->getText(), IdVal->getLine(), 2); WriteStringIdWord (StrId); >>
- CloseParen
- ;
-
-//******************************************************************************
-//
-// Parser class definition.
-//
-class EfiVfrParser {
-<<
-//
-// Parser definitions go here
-//
-private:
- STRUCT_DEFINITION *mFirstStructDefinition;
- STRUCT_DEFINITION *mLastStructDefinition;
- INT32 mNvDataStructSize;
- INT32 mNonNvDataStructSize;
- //
- // Flag to indicate that we're processing a ideqid VFR statement so that
- // we can do late checks on the statement.
- //
- INT32 mIdEqIdStmt;
- INT32 mLastNVVariableDataSize;
- GOTO_REFERENCE *mGotoReferences;
- FORM_ID_VALUE *mFormIdValues;
- VfrOpcodeHandler mOpcodeHandler;
- UINT16_LIST *mUint16List;
- UINT16_LIST *mLastUint16;
- UINT16_LIST *mDefinedLabels;
- UINT16_LIST *mDefinedVarStoreId;
- UINT16_LIST *mLastDefinedVarStoreId;
- UINT32 mMinimumValue, mMaximumValue, mStepValue, mDefaultValue;
- UINT32 mStmtFlags;
- UINT32 mSubStmtFlags;
- UINT32 mSubStmtFlagsLineNum;
- EFI_GUID mFormSetGuid;
- UINT8 mNvDataStructDefined;
- UINT16 mClass, mSubclass;
- UINT32 mIfStart;
- UINT32 mOptionCount; // how many "option" fields in a given statement
- UINT32 mLastVarIdSize;
- UINT8 mOutput;
-public:
-
-VOID
-EfiVfrParser::SetIfStart (
- UINT32 LineNum
- )
-/*++
-
-Routine Description:
- Invoked during VFR parsing when an "if" is encountered. Save the
- source line number so we can point to it if we don't find a
- corresponding endif later.
-
-Arguments:
- LineNum - source line number where the "if" was parsed.
-
-Returns:
- None
-
---*/
-{
- mIfStart = LineNum;
-}
-VOID
-EfiVfrParser::SetClass (
- UINT32 LineNum,
- UINT32 Value
- )
-/*++
-
-Routine Description:
- Invoked during VFR parsing when a "class" statement is found. Check the
- range on the class value and save it for later.
-
-Arguments:
- LineNum - source line number where the class statement was parsed.
- Value - the class value
-
-Returns:
- None
-
---*/
-{
- if (Value & 0xFFFF0000) {
- PrintWarningMessage (LineNum, NULL, "class value exceeds maximum allowed");
- }
- mClass |= (UINT16)Value;
-}
-VOID
-EfiVfrParser::SetSubclass (
- UINT32 LineNum,
- UINT32 Value
- )
-/*++
-
-Routine Description:
- Invoked during VFR parsing when a subclass statement is found. Check the
- range on the value and save it for later.
-
-Arguments:
- LineNum - source line number where the class statement was parsed.
- Value - the subclass value from the VFR statement
-
-Returns:
- None
-
---*/
-{
- if (Value & 0xFFFF0000) {
- PrintWarningMessage (LineNum, NULL, "subclass value exceeds maximum allowed");
- }
- mSubclass |= (UINT16)Value;
-}
-VOID EfiVfrParser::WriteClass ()
-{
- WriteWord (mClass);
- mClass = 0;
-}
-VOID EfiVfrParser::WriteSubclass ()
-{
- WriteWord (mSubclass);
- mSubclass = 0;
-}
-VOID EfiVfrParser::WriteIfrBytes ()
-{
- mOpcodeHandler.WriteIfrBytes ();
-}
-VOID
-EfiVfrParser::WriteFlagsKey (
- UINT32 KeyValue,
- UINT32 LineNum
- )
-/*++
-
-Routine Description:
- Write out the flags and key values from the previous VFR statement.
- Many statements take a flags/key pair. If not specified, then 0
- values are written out. However do not allow an interactive flags field
- to be specified if no key value is specified. Also, if NV_ACCESS flag
- is set but INTERACTIVE is not, then set interactive and issue a warning.
-
-Arguments:
- KeyValue - the key value from the VFR statement
- LineNum - source line number where the statement was parsed
-
-Returns:
- None
-
---*/
-{
- if ((mSubStmtFlags & EFI_IFR_FLAG_INTERACTIVE) && (KeyValue == 0)) {
- PrintErrorMessage (LineNum, NULL, "invalid or missing key value - required with INTERACTIVE");
- }
- if ((mSubStmtFlags & EFI_IFR_FLAG_NV_ACCESS) && !(mSubStmtFlags & EFI_IFR_FLAG_INTERACTIVE)) {
- PrintWarningMessage (LineNum, NULL, "NV_ACCESS without INTERACTIVE has no effect -- setting INTERACTIVE");
- mSubStmtFlags |= EFI_IFR_FLAG_INTERACTIVE;
- }
- WriteFlags ();
- WriteWord (KeyValue);
-}
-VOID
-EfiVfrParser::InitOrderedList ()
-{
- mOptionCount = 0;
-}
-VOID
-EfiVfrParser::EndOrderedList (
- UINT32 LineNum
- )
-{
- if (mLastVarIdSize < mOptionCount) {
- PrintErrorMessage (LineNum, NULL, "number of options exceeds the variable store size");
- }
-}
-VOID
-EfiVfrParser::ResetFlags ()
-/*++
-
-Routine Description:
-
- Flags are set for each substatement in a given one-of statement.
- To make sure there are no conflicts, for example setting DEFAULT on
- more than one substatement, we keep track of the flags at a statement
- level and a substatement level. This function resets the flags so
- we get a fresh start.
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- mStmtFlags = 0;
- mSubStmtFlagsLineNum = 0;
- mSubStmtFlags = 0;
-}
-//
-// Test validity of flags value for a one-of statement.
-//
-VOID
-EfiVfrParser::TestOneOfFlags (
- UINT32 LineNum
- )
-{
- //
- // One of the fields must have had the default bit set
- //
- if ((mStmtFlags & EFI_IFR_FLAG_DEFAULT) == 0) {
- PrintWarningMessage (LineNum, "default value must be specified", NULL);
- }
-}
-VOID
-EfiVfrParser::SetFlags (
- UINT32 Flags,
- UINT32 LineNum
- )
-{
- //
- // Check for redefinitions and invalid combinations
- //
- if (mStmtFlags & Flags & EFI_IFR_FLAG_MANUFACTURING) {
- PrintErrorMessage (LineNum, "MANUFACTURING", "a field with this flag already defined");
- }
- if (mStmtFlags & Flags & EFI_IFR_FLAG_DEFAULT) {
- PrintErrorMessage (LineNum, "DEFAULT", "a field with this flag already defined");
- }
- mSubStmtFlags |= Flags;
- mSubStmtFlagsLineNum = LineNum;
-}
-VOID
-EfiVfrParser::WriteFlags ()
-{
- //
- // Check value for validity
- //
- if (mSubStmtFlags & ~(EFI_IFR_FLAG_DEFAULT |
- EFI_IFR_FLAG_MANUFACTURING |
- EFI_IFR_FLAG_INTERACTIVE |
- EFI_IFR_FLAG_NV_ACCESS |
- EFI_IFR_FLAG_RESET_REQUIRED |
- EFI_IFR_FLAG_LATE_CHECK )) {
- PrintWarningMessage (mSubStmtFlagsLineNum, "invalid bits defined in flag", NULL);
- }
- WriteByte ((UINT8)mSubStmtFlags, 'F');
- //
- // We can now clear the substatement flags
- //
- mStmtFlags |= mSubStmtFlags;
- mSubStmtFlags = 0;
-}
-//
-// When we parse a min/max/step/default sequence, save off the values for
-// later use. Call this first to init the values.
-//
-VOID
-EfiVfrParser::InitMinMaxStepDefault ()
-{
- mMinimumValue = 0;
- mMaximumValue = 0;
- mStepValue = 1;
- mDefaultValue = 0;
-}
-VOID
-EfiVfrParser::WriteMinMaxStepDefault ()
-{
- WriteWord (mMinimumValue);
- WriteWord (mMaximumValue);
- WriteWord (mStepValue);
- WriteWord (mDefaultValue);
-}
-VOID
-EfiVfrParser::SetMinMaxStepDefault (
- UINT16 Value,
- INT32 MMSD,
- INT32 LineNum
- )
-{
- UINT16 TempValue;
- //
- // Min specified
- //
- if (MMSD == 0) {
- mMinimumValue = Value;
- mDefaultValue = Value;
- //
- // Max specified
- //
- } else if (MMSD == 1) {
- mMaximumValue = Value;
- //
- // If min > max, then swap the values. That includes resetting the default
- // value as well.
- //
- if (mMinimumValue > mMaximumValue) {
- PrintWarningMessage (LineNum, NULL, "maximum < minimum");
- TempValue = Value;
- mMaximumValue = mMinimumValue;
- mMinimumValue = TempValue;
- mDefaultValue = mMinimumValue;
- }
- //
- // Step specified
- //
- } else if (MMSD == 2) {
- mStepValue = Value;
- //
- // Default specified. Make sure min <= default <= max.
- //
- } else if (MMSD == 3) {
- mDefaultValue = Value;
- if (mMinimumValue > Value) {
- PrintErrorMessage (LineNum, NULL, "default value < minimum value");
- } else if (Value > mMaximumValue) {
- PrintErrorMessage (LineNum, NULL, "default value > maximum value");
- }
- } else {
- PrintErrorMessage (LineNum, "application error", "internal MMSD error");
- }
-}
-VOID
-EfiVfrParser::AddLabel (
- UINT32 LabelNumber,
- UINT32 LineNum
- )
-{
- UINT16_LIST *Label;
-
- //
- // Added a label from the user VFR script. Make sure they haven't already
- // defined the same label elsewhere
- //
- for (Label = mDefinedLabels; Label != NULL; Label = Label->Next) {
- if (Label->Value == LabelNumber) {
- PrintErrorMessage (LineNum, NULL, "label already defined");
- PrintErrorMessage (Label->LineNum, NULL, "previous definition of redefined label");
- break;
- }
- }
- Label = (UINT16_LIST *)malloc (sizeof (UINT16_LIST));
- if (Label == NULL) {
- PrintErrorMessage (0, NULL, "memory allocation error");
- return;
- }
- memset ((char *)Label, 0, sizeof (UINT16_LIST));
- Label->Value = LabelNumber;
- Label->LineNum = LineNum;
- Label->Next = mDefinedLabels;
- mDefinedLabels = Label;
-}
-VOID
-EfiVfrParser::QueueIdEqValList (
- UINT16 Value
- )
-{
- UINT16_LIST *U16;
-
- U16 = (UINT16_LIST *)malloc (sizeof (UINT16_LIST));
- if (U16 == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failed");
- } else {
- memset ((char *)U16, 0, sizeof (UINT16_LIST));
- U16->Value = Value;
- if (mUint16List == NULL) {
- mUint16List = U16;
- } else {
- mLastUint16->Next = U16;
- }
- mLastUint16 = U16;
- }
-}
-VOID
-EfiVfrParser::FlushQueueIdEqValList ()
-{
- UINT32 Count;
-
- //
- // We queued up a list of IdEqValList items. The IFR requires a count
- // followed by the actual values. Do it.
- //
- Count = 0;
- mLastUint16 = mUint16List;
- while (mLastUint16 != NULL) {
- Count++;
- mLastUint16 = mLastUint16->Next;
- }
- // BUGBUG -- check for more than 16K items?
- WriteWord (Count);
- //
- // Now write the values.
- //
- mLastUint16 = mUint16List;
- while (mLastUint16 != NULL) {
- WriteWord ((UINT32)mLastUint16->Value);
- mLastUint16 = mLastUint16->Next;
- }
- //
- // Free up the list
- //
- mLastUint16 = mUint16List;
- while (mUint16List != NULL) {
- mLastUint16 = mUint16List->Next;
- free (mUint16List);
- mUint16List = mLastUint16;
- }
-}
-VOID
-EfiVfrParser::PrintErrorMessage (
- UINT32 LineNum,
- CHAR8 *Msg1,
- CHAR8 *Msg2
- )
-{
- char *FileName;
-
- if (LineNum != 0) {
- FileName = ConvertLineNumber ((UINT32 *)&LineNum);
- Error (FileName, LineNum, 0, Msg1, Msg2);
- } else {
- Error (PROGRAM_NAME, 0, 0, Msg1, Msg2);
- }
-}
-VOID
-EfiVfrParser::PrintWarningMessage (
- UINT32 LineNum,
- CHAR8 *Msg1,
- CHAR8 *Msg2
- )
-{
- char *FileName;
-
- if (LineNum != 0) {
- FileName = ConvertLineNumber ((UINT32 *)&LineNum);
- Warning (FileName, LineNum, 0, Msg1, Msg2);
- } else {
- Warning (PROGRAM_NAME, 0, 0, Msg1, Msg2);
- }
-}
-VOID
-EfiVfrParser::syn (
- ANTLRAbstractToken *Tok,
- ANTLRChar *Egroup,
- SetWordType *Eset,
- ANTLRTokenType ETok,
- INT32 Huh
- )
-/*++
-
-Routine Description:
- Called by the parser base class as a result of parse syntax errors.
-
-Arguments:
- Tok - token that caused the error
- Egroup - not sure
- Eset - index in token table of the expected token
- Huh - not sure
-
-Returns:
- NA
-
---*/
-{
- char *FileName;
- UINT32 LineNum;
-
- LineNum = Tok->getLine ();
- FileName = ConvertLineNumber ((UINT32 *)&LineNum);
- //
- // Sometimes the token number is 0, in which case I don't know what to
- // print.
- //
- if (ETok == 0) {
- Error (FileName, LineNum, 0, Tok->getText (), "unexpected token");
- } else {
- //
- // If we were expecting an endif, then report the line where the corresponding
- // IF began.
- //
- if ((strcmp (_token_tbl[ETok], "endif") == 0) && (mIfStart != 0)) {
- LineNum = mIfStart;
- FileName = ConvertLineNumber (&LineNum);
- Error (FileName, LineNum, 0, "statement missing corresponding endif", NULL);
- } else {
- Error (FileName, LineNum, 0, Tok->getText (), "expected %s", _token_tbl[ETok]);
- }
- }
-}
-
-VOID
-EfiVfrParser::init()
-/*++
-
-Routine Description:
- Initializations function for our parser.
-
-Arguments:
- None.
-
-Returns:
- None.
-
---*/
-{
- ANTLRParser::init();
-
- //
- // Used for queuing a variable list of UINT16's
- //
- mUint16List = NULL;
- mLastUint16 = NULL;
- mFirstStructDefinition = NULL;
- mLastStructDefinition = NULL;
- mNvDataStructSize = 0;
- mNonNvDataStructSize = 0;
- mNvDataStructDefined = 0;
- mGotoReferences = NULL;
- mFormIdValues = NULL;
- mDefinedLabels = NULL;
- mClass = 0;
- mSubclass = 0;
- mIfStart = 0;
- mDefinedVarStoreId = NULL;
- mLastDefinedVarStoreId = NULL;
- mIdEqIdStmt = 0;
- mLastNVVariableDataSize = 0;
-
- memset ((char *)&mFormSetGuid, 0, sizeof (EFI_GUID));
-}
-//
-// Destructor for the parser.
-//
-EfiVfrParser::~EfiVfrParser(VOID)
-{
- Cleanup();
-}
-VOID
-EfiVfrParser::Cleanup (VOID)
-/*++
-
-Routine Description:
- Free memory allocated during parsing
-
-Arguments:
- None.
-
-Returns:
- None.
-
---*/
-{
- STRUCT_DEFINITION *NextStruct;
- STRUCT_FIELD_DEFINITION *NextField;
- UINT8 Buff[6];
- UINT16_LIST *NextU16List;
-
- //
- // Free up the structure definitions if any
- //
- while (mFirstStructDefinition != NULL) {
- //
- // Free up all the fields for this struct
- //
- while (mFirstStructDefinition->Field != NULL) {
- NextField = mFirstStructDefinition->Field->Next;
- free (mFirstStructDefinition->Field->Name);
- free (mFirstStructDefinition->Field);
- mFirstStructDefinition->Field = NextField;
- }
- NextStruct = mFirstStructDefinition->Next;
- free (mFirstStructDefinition->Name);
- free (mFirstStructDefinition);
- mFirstStructDefinition = NextStruct;
- }
- //
- // Free up the goto references and form id defines
- //
- FreeGotoReferences ();
- //
- // Free up label list
- //
- while (mDefinedLabels != NULL) {
- NextU16List = mDefinedLabels->Next;
- delete (mDefinedLabels);
- mDefinedLabels = NextU16List;
- }
- //
- // Free up the list of defined variable storage IDs
- //
- while (mDefinedVarStoreId != NULL) {
- NextU16List = mDefinedVarStoreId->Next;
- delete (mDefinedVarStoreId);
- mDefinedVarStoreId = NextU16List;
- }
-}
-
-INT32
-EfiVfrParser::AtoX (
- CHAR8 *HexString,
- INT32 NumBytes,
- UINT32 *HexValue
- )
-/*++
-
-Routine Description:
- Given a pointer to a ascii hex string, convert to a number with the given
- number of bytes.
-
-Arguments:
- HexString - pointer to a string of format 30BCA
- Size - number of bytes to convert
- HexValue - return result
-
-Returns:
- The number of bytes converted.
-
---*/
-{
- INT32 Count;
- INT32 Value;
-
- *HexValue = 0;
- Count = 0;
- while (Count < NumBytes) {
- if ((*HexString >= '0') && (*HexString <= '9')) {
- Value = *HexString - '0';
- } else if ((*HexString >= 'a') && (*HexString <= 'f')) {
- Value = *HexString - 'a' + 10;
- } else if ((*HexString >= 'A') && (*HexString <= 'F')) {
- Value = *HexString - 'A' + 10;
- } else {
- return Count;
- }
- HexString++;
- *HexValue = (*HexValue << 4) | Value;
- if ((*HexString >= '0') && (*HexString <= '9')) {
- Value = *HexString - '0';
- } else if ((*HexString >= 'a') && (*HexString <= 'f')) {
- Value = *HexString - 'a' + 10;
- } else if ((*HexString >= 'A') && (*HexString <= 'F')) {
- Value = *HexString - 'A' + 10;
- } else {
- return Count;
- }
- *HexValue = (*HexValue << 4) | Value;
- HexString++;
- Count++;
- }
- return Count;
-}
-VOID
-EfiVfrParser::WriteGuidValue (
- UINT32 TokenLineNum,
- CHAR8 *G1,
- CHAR8 *G2,
- CHAR8 *G3,
- CHAR8 *G4,
- CHAR8 *G5,
- CHAR8 *G6,
- CHAR8 *G7,
- CHAR8 *G8,
- CHAR8 *G9,
- CHAR8 *G10,
- CHAR8 *G11
- )
-/*++
-
-Routine Description:
- A Guid was parsed, likely of format:
- #define MY_GUID { 0x12345678, 0xAABB, 0xCCDD, 0xEE, 0xFF, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }
-
- Write out the value.
-
-Arguments:
- TokenLineNum - line number where the guid was used
- G1-G11 - the 11 fields of the guid value
-
-Returns:
- None.
-
---*/
-{
- UINT32 Value;
- INT32 Loop;
-
- mFormSetGuid.Data1 = GetNumber (G1, TokenLineNum, 4);
- mFormSetGuid.Data2 = (UINT16)GetNumber (G2, TokenLineNum, 2);
- mFormSetGuid.Data3 = (UINT16)GetNumber (G3, TokenLineNum, 2);
- mFormSetGuid.Data4[0] = (UINT8)GetNumber (G4, TokenLineNum, 1);
- mFormSetGuid.Data4[1] = (UINT8)GetNumber (G5, TokenLineNum, 1);
- mFormSetGuid.Data4[2] = (UINT8)GetNumber (G6, TokenLineNum, 1);
- mFormSetGuid.Data4[3] = (UINT8)GetNumber (G7, TokenLineNum, 1);
- mFormSetGuid.Data4[4] = (UINT8)GetNumber (G8, TokenLineNum, 1);
- mFormSetGuid.Data4[5] = (UINT8)GetNumber (G9, TokenLineNum, 1);
- mFormSetGuid.Data4[6] = (UINT8)GetNumber (G10, TokenLineNum, 1);
- mFormSetGuid.Data4[7] = (UINT8)GetNumber (G11, TokenLineNum, 1);
-
- WriteDWord (mFormSetGuid.Data1, 'G');
- WriteWord (mFormSetGuid.Data2);
- WriteWord (mFormSetGuid.Data3);
- WriteByte (mFormSetGuid.Data4[0], 0);
- WriteByte (mFormSetGuid.Data4[1], 0);
- WriteByte (mFormSetGuid.Data4[2], 0);
- WriteByte (mFormSetGuid.Data4[3], 0);
- WriteByte (mFormSetGuid.Data4[4], 0);
- WriteByte (mFormSetGuid.Data4[5], 0);
- WriteByte (mFormSetGuid.Data4[6], 0);
- WriteByte (mFormSetGuid.Data4[7], 0);
-}
-VOID
-EfiVfrParser::WriteFieldOffset (
- INT8 WriteLength,
- CHAR8 *StructName,
- INT32 LineNum1,
- CHAR8 *FieldName,
- INT32 LineNum2,
- INT32 ArrayIndex,
- INT8 IsArrayIndex,
- INT32 FieldWidth,
- INT8 WriteArraySize
- )
-/*++
-
-Routine Description:
- A VFR script referenced the NV store structure. Given the structure's name
- and the field's name, write the offset of the field to the output file.
-
-Arguments:
- WriteLength - write the field length byte out
- StructName - name of the NV store structure
- LineNum1 - line number in the VFR where we are (for error printing)
- FieldName - the name of the field within the NV store structure
- LineNum2 - line number in the VFR where FieldName is referenced
- ArrayIndex - the index specified, for example NV_DATA.Field[ArrayIndex]
- IsArrayIndex - non-zero if an array index was specified
- FieldWidth - expected size for the Field (1 byte? 2 bytes?)
- WriteArraySize - write the size of the entire field, not the size of a single element
-
-Returns:
- None.
-
---*/
-{
- STRUCT_DEFINITION *StructDef;
- STRUCT_FIELD_DEFINITION *FieldDef;
- UINT32 Offset;
- UINT32 VarSize;
- CHAR8 Msg[100];
- //
- // If we're writing an array size, then they better have referenced the field without an
- // index.
- //
- if (WriteArraySize && IsArrayIndex) {
- sprintf (Msg, "array index specified where an array is required");
- PrintErrorMessage (LineNum2, FieldName, Msg);
- return;
- }
- //
- // Look through our list of known structures for a match
- //
- for (StructDef = mFirstStructDefinition; StructDef != NULL; StructDef = StructDef->Next) {
- //
- // Check for matching structure name
- //
- if (strcmp (StructDef->Name, StructName) == 0) {
- //
- // Mark it as referenced (for debug purposes only). Check the
- // flag that indicates that we have already found a varstore VFR
- // statement for it.
- //
- StructDef->Referenced++;
- if (StructDef->VarStoreIdValid == 0) {
- //
- // Set it valid so we don't flag it multiple times, then emit the error
- //
- StructDef->VarStoreIdValid = 1;
- PrintErrorMessage (LineNum1, StructName, "varstore statement missing for this variable store");
- }
- //
- // Let the opcode-handler know which variable storage we're now using
- //
- if (mIdEqIdStmt) {
- mOpcodeHandler.SetSecondaryVarStoreId (StructDef->VarStoreId);
- } else {
- mOpcodeHandler.SetVarStoreId (StructDef->VarStoreId);
- }
- //
- // Found matching structure name. Now find the matching field name
- //
- for (FieldDef = StructDef->Field; FieldDef != NULL; FieldDef = FieldDef->Next) {
- if (strcmp (FieldDef->Name, FieldName) == 0) {
- //
- // Make sure the variable size is valid
- //
- if ((FieldWidth != 0) && (FieldDef->DataSize > FieldWidth)) {
- sprintf (Msg, "field width exceeds %d byte%c", FieldWidth, FieldWidth == 1 ? ' ' : 's');
- PrintErrorMessage (LineNum2, FieldName, Msg);
- }
- //
- // If they specified an index (MyVfrData.FieldX[10]), then make sure that the
- // data structure was declared as an array, and that the index is in bounds.
- // If they did not specify an index, then we'll assume 0. This is required for
- // strings.
- //
- if (IsArrayIndex) {
- VarSize = FieldDef->DataSize;
- if (FieldDef->IsArray == 0) {
- PrintErrorMessage (LineNum2, FieldName, "field is not declared as an array");
- return;
- }
- if (FieldDef->ArrayLength < ArrayIndex) {
- PrintErrorMessage (LineNum2, FieldName, "array index exceeds declared size of field");
- return;
- }
- } else {
- if (FieldDef->IsArray) {
- VarSize = FieldDef->DataSize * FieldDef->ArrayLength;
- } else {
- VarSize = FieldDef->DataSize;
- }
- }
- //
- // If we're in the middle of a ideqid VFR statement, then this is the second
- // variable ID that we're now processing. Make sure that its size is the same
- // as the first variable.
- //
- if (mIdEqIdStmt) {
- if (mLastVarIdSize != VarSize) {
- PrintErrorMessage (LineNum2, FieldName, "variables must have the same size");
- return;
- }
- }
- mLastVarIdSize = VarSize;
- //
- // If we're supposed to write an array size, then require it to be an array
- //
- if (WriteArraySize && !FieldDef->IsArray) {
- PrintErrorMessage (LineNum2, FieldName, "array required");
- return;
- }
- //
- // Write the variable offset and size. If we're in the non-NV structure, then
- // set the offset beyond the NV data structure size.
- //
- Offset = FieldDef->Offset + FieldDef->DataSize * (ArrayIndex - 1);
- if (StructDef->IsNonNV) Offset += mNvDataStructSize;
- WriteWord (Offset);
- if (WriteLength) {
- if (WriteArraySize) {
- if (FieldDef->DataSize * FieldDef->ArrayLength > 255) {
- PrintErrorMessage (LineNum2, FieldName, "array size exceeds 255 maximum encoding limit");
- return;
- }
- WriteByte (FieldDef->DataSize * FieldDef->ArrayLength, 0);
- } else {
- WriteByte (FieldDef->DataSize, 0);
- }
- }
- return;
- }
- }
- sprintf (Msg, "structure %s does not have a field named '%s'", StructName, FieldName);
- PrintErrorMessage (LineNum2, Msg, NULL);
- PrintErrorMessage (StructDef->LineNum, "see structure definition", NULL);
- return;
- }
- }
- //
- // The structure was not found in the defined list. See if it's the "Date" structure
- //
- if (strcmp (StructName, "Date") == 0) {
- //
- // BUGBUG -- remove support for Date and Time as valid structure
- // names. They should use the NON_NV_DATA_MAP structure for this.
- //
- // Someone specified Date.Years|Months|Days
- // BUGBUG -- define some constants for the IDs used here
- // Length == 0 implies that this is not user NV data storage.
- //
- if (strcmp (FieldName, "Year") == 0) {
- //
- // Write ID (offset), ID, and size
- //
- WriteWord (mNvDataStructSize + mNonNvDataStructSize + 0);
- if (WriteLength) {
- WriteByte (0, 0);
- }
- } else if (strcmp (FieldName, "Month") == 0) {
- //
- // Write ID (offset), ID, and size
- //
- WriteWord (mNvDataStructSize + mNonNvDataStructSize + 2);
- if (WriteLength) {
- WriteByte (0, 0);
- }
- } else if (strcmp (FieldName, "Day") == 0) {
- //
- // Write ID (offset), ID, and size
- //
- WriteWord (mNvDataStructSize + mNonNvDataStructSize + 4);
- if (WriteLength) {
- WriteByte (0, 0);
- }
- } else {
- PrintErrorMessage (LineNum1, FieldName, "expected valid field name TheYear/TheMonth/TheDay");
- }
- return;
- } else if (strcmp (StructName, "Time") == 0) {
- //
- // Someone specified Time.Hours|Minutes|Seconds
- // BUGBUG -- define some constants for the IDs used here
- //
- if (strcmp (FieldName, "Hours") == 0) {
- //
- // Write ID (offset), ID, and size
- //
- WriteWord (mNvDataStructSize + mNonNvDataStructSize + 6);
- if (WriteLength) {
- WriteByte (0, 0);
- }
- } else if (strcmp (FieldName, "Minutes") == 0) {
- //
- // Write ID (offset), ID, and size
- //
- WriteWord (mNvDataStructSize + mNonNvDataStructSize + 8);
- if (WriteLength) {
- WriteByte (0, 0);
- }
- } else if (strcmp (FieldName, "Seconds") == 0) {
- //
- // Write ID (offset), ID, and size
- //
- WriteWord (mNvDataStructSize + mNonNvDataStructSize + 10);
- if (WriteLength) {
- WriteByte (0, 0);
- }
- } else {
- PrintErrorMessage (LineNum1, FieldName, "expected valid field name Hours/Minutes/Seconds");
- }
- return;
- } else {
- PrintErrorMessage (LineNum1, StructName, "undefined structure");
- return;
- }
-}
-VOID
-EfiVfrParser::StartStructDefinition (
- INT32 IsNonNV,
- INT32 LineNum
- )
-/*++
-
-Routine Description:
- Called when we encounter a new "struct _MY_STRUCT..." statement while parsing.
- Initialize internal data and structures for parsing the fields of the structure.
-
-Arguments:
- LineNum - line number in the source file (for error reporting purposes)
- IsNonNv - flag indicating (if nonzero) that the variable referred to is not in
- the standard NV store.
-Returns:
- None
-
---*/
-{
- STRUCT_DEFINITION *StructDef;
- //
- // Allocate memory for the structure record
- //
- StructDef = (STRUCT_DEFINITION *)malloc (sizeof (STRUCT_DEFINITION));
- memset (StructDef, 0, sizeof (STRUCT_DEFINITION));
- StructDef->LineNum = LineNum;
- //
- // Set flag indicating non-NV data structure or not
- //
- StructDef->IsNonNV = IsNonNV;
- //
- // Add it to the end of our linked list. If it's the first one
- // defined, then it's the default varstore ID, so set it valid.
- //
- if (mFirstStructDefinition == NULL) {
- mFirstStructDefinition = StructDef;
- StructDef->VarStoreIdValid = 1;
- } else {
- mLastStructDefinition->Next = StructDef;
- }
- mLastStructDefinition = StructDef;
-}
-VOID
-EfiVfrParser::EndStructDefinition (
- CHAR8 *StructName,
- INT32 LineNum
- )
-{
- STRUCT_DEFINITION *StructDef;
- STRUCT_FIELD_DEFINITION *FieldDef;
- UINT32 Offset;
- //
- // Make sure they have not already defined a structure with this name
- //
- for (StructDef = mFirstStructDefinition; StructDef != NULL; StructDef = StructDef->Next) {
- if ((StructDef->Name != NULL) && (strcmp (StructDef->Name, StructName) == 0)) {
- PrintErrorMessage (LineNum, StructName, "structure with this name already defined");
- //
- // Fall through and fill in the rest of the structure information. We do
- // this because the structure has already been added to our global list,
- // so will be used elsewhere, so we want it to contain valid fields.
- //
- }
- }
- //
- // Allocate memory for the structure name
- //
- mLastStructDefinition->Name = (char *)malloc (strlen (StructName) + 1);
- strcpy (mLastStructDefinition->Name, StructName);
- //
- // Compute the structure size, and the offsets to each field
- //
- Offset = 0;
- for (FieldDef = mLastStructDefinition->Field; FieldDef != NULL; FieldDef = FieldDef->Next) {
- FieldDef->Offset = Offset;
- Offset += FieldDef->ArrayLength * FieldDef->DataSize;
- }
- mLastStructDefinition->Size = Offset;
- //
- // Go through all the structure we have so far and figure out (if we can)
- // the size of the non-NV storage. We also assume that the first structure
- // definition is the primary/default storage for the VFR form.
- //
- if (mNonNvDataStructSize == 0) {
- for (StructDef = mFirstStructDefinition; StructDef != NULL; StructDef = StructDef->Next) {
- if (StructDef->IsNonNV) {
- mNonNvDataStructSize = StructDef->Size;
- break;
- }
- }
- }
- if (mNvDataStructSize == 0) {
- for (StructDef = mFirstStructDefinition; StructDef != NULL; StructDef = StructDef->Next) {
- if (StructDef->IsNonNV == 0) {
- mNvDataStructSize = StructDef->Size;
- break;
- }
- }
- }
-}
-VOID
-EfiVfrParser::AddStructField (
- CHAR8 *FieldName,
- INT32 LineNum,
- INT32 DataSize,
- INT32 ArrayLength,
- INT8 IsArray
- )
-/*++
-
-Routine Description:
- We're parsing the VFR structure definition. Add another defined field to
- our definition.
-
-Arguments:
- FieldName - name of the field in the structure.
- LineNum - the line number from the input (preprocessor output) file
- DataSize - the size of the field (1, 2, or 4 bytes)
- ArrayLength - the number of elements (for array)
- IsArray - non-zero if the field is an array
-
-Returns:
- None.
-
---*/
-{
- STRUCT_FIELD_DEFINITION *FieldDef;
- STRUCT_FIELD_DEFINITION *Temp;
- //
- // Make sure we don't already have a field of this name in our structure
- //
- for (FieldDef = mLastStructDefinition->Field; FieldDef != NULL; FieldDef = FieldDef->Next) {
- if (strcmp (FieldDef->Name, FieldName) == 0) {
- PrintErrorMessage (LineNum, FieldName, "field with this name already defined");
- return;
- }
- }
- //
- // If it's an array, then they better not have a size of 0. For example:
- // UINT8 MyBytes[0];
- //
- if (IsArray && (ArrayLength <= 0)) {
- PrintErrorMessage (LineNum, FieldName, "invalid array size");
- return;
- }
- //
- // Allocate memory for a new structure field definition
- //
- FieldDef = (STRUCT_FIELD_DEFINITION *)malloc (sizeof (STRUCT_FIELD_DEFINITION));
- memset ((char *)FieldDef, 0, sizeof (STRUCT_FIELD_DEFINITION));
- FieldDef->ArrayLength = ArrayLength;
- FieldDef->DataSize = DataSize;
- FieldDef->IsArray = IsArray;
- FieldDef->Name = (char *)malloc (strlen (FieldName) + 1);
- strcpy (FieldDef->Name, FieldName);
- //
- // Add it to the end of the field list for the currently active structure
- //
- if (mLastStructDefinition->Field == NULL) {
- mLastStructDefinition->Field = FieldDef;
- } else {
- mLastStructDefinition->LastField->Next = FieldDef;
- }
- mLastStructDefinition->LastField = FieldDef;
-}
-VOID
-EfiVfrParser::AddVarStore (
- CHAR8 *StructName, // actual name of the structure
- CHAR8 *VarName, // actual NV variable name
- UINT16 VarStoreId, // key value
- INT32 LineNum // parse line number (for error reporting)
- )
-/*++
-
-Routine Description:
- Called while parsing a varstore statement. Add the variable store
- to our linked list.
-
-Arguments:
- StructName - the name of the typedef'ed structure to use
- VarName - the NV variable name as specified in the varstore statement
- VarStoreId - the variable store ID as specified in the varstore statememt
- LineNum - the line number from the input (preprocessor output) file
-
-Returns:
- None.
-
---*/
-{
- STRUCT_DEFINITION *StructDef;
- UINT16_LIST *L16Ptr;
- //
- // Go through our list of previously-defined variable store IDs and
- // make sure this one is not a duplicate in name or key value.
- //
- for (L16Ptr = mDefinedVarStoreId; L16Ptr != NULL; L16Ptr = L16Ptr->Next) {
- if (L16Ptr->Value == VarStoreId) {
- PrintErrorMessage (LineNum, "variable storage key already used", NULL);
- PrintErrorMessage (L16Ptr->LineNum, "previous usage of storage key", NULL);
- }
- }
- //
- // Key value of 0 is invalid since that's assigned by default to the default
- // variable store (the first structure parsed).
- //
- if (VarStoreId == 0) {
- PrintErrorMessage (LineNum, "variable storage key of 0 is invalid", NULL);
- }
- //
- // Create a new element to add to the list
- //
- L16Ptr = (UINT16_LIST *)malloc(sizeof (UINT16_LIST));
- memset (L16Ptr, 0, sizeof (UINT16_LIST));
- L16Ptr->LineNum = LineNum;
- L16Ptr->Value = VarStoreId;
- if (mDefinedVarStoreId == NULL) {
- mDefinedVarStoreId = L16Ptr;
- } else {
- mLastDefinedVarStoreId->Next = L16Ptr;
- }
- mLastDefinedVarStoreId = L16Ptr;
- //
- // Find the structure definition with this name
- //
- for (StructDef = mFirstStructDefinition; StructDef != NULL; StructDef = StructDef->Next) {
- if (strcmp (StructDef->Name, StructName) == 0) {
- //
- // Make sure they did not already define a variable storage ID
- // for this structure.
- //
- if (StructDef->VarStoreId != 0) {
- PrintErrorMessage (LineNum, StructName, "variable storage already defined for this structure");
- PrintErrorMessage (StructDef->VarStoreLineNum, StructName, "previous definition for variable storage");
- }
- StructDef->VarStoreId = VarStoreId;
- StructDef->VarStoreIdValid = 1;
- StructDef->VarStoreLineNum = LineNum;
- WriteWord (StructDef->Size);
- while (*VarName) {
- WriteByte(*VarName, 0);
- VarName++;
- }
- WriteByte(0,0);
- return;
- }
- }
- PrintErrorMessage (LineNum, StructName, "structure with this name not defined");
-}
-VOID
-EfiVfrParser::WriteDWord (
- UINT32 Value,
- UINT8 KeyByte
- )
-/*++
-
-Routine Description:
- During parsing, we came upon some code that requires a 32-bit value be
- written to the VFR binary file. Queue up the 4 bytes.
-
-Arguments:
- Value - the 32-bit value to write
- KeyByte - a single character which gets written out beside the first byte.
- This is used to tag the data in the output file so that during
- debug you have an idea what the value is.
-
-Returns:
- None.
-
---*/
-{
- //
- // Write 4 bytes, little endian. Specify a key byte only on the first one
- //
- mOpcodeHandler.AddByte ((UINT8)Value, KeyByte);
- Value \>>= 8;
- mOpcodeHandler.AddByte ((UINT8)Value, 0);
- Value \>>= 8;
- mOpcodeHandler.AddByte ((UINT8)Value, 0);
- Value \>>= 8;
- mOpcodeHandler.AddByte ((UINT8)Value, 0);
-}
-VOID
-EfiVfrParser::WriteOpByte (
- UINT32 LineNum,
- UINT8 ByteValue
- )
-/*++
-
-Routine Description:
-
- During parsing, we came upon a new VFR opcode. At this point we flush
- the output queue and then queue up this byte (with 'O' for opcode tag).
-
-Arguments:
-
- ByteValue - opcode value
-
-Returns:
-
- None.
-
---*/
-{
- mOpcodeHandler.AddOpcodeByte (ByteValue, LineNum);
-}
-VOID
-EfiVfrParser::WriteByte (
- UINT8 ByteValue,
- UINT8 Key
- )
-/*++
-
-Routine Description:
-
- During parsing of the VFR we spoonfeed this function with bytes to write to
- the output VFR binary file. This function simply queues up the bytes, and
- the queue gets flushed each time a new VFR opcode is encountered.
-
-Arguments:
-
- ByteValue - raw byte to write
- Key - character to tag the byte with when we write ByteValue to the
- output file.
-
-Returns:
-
- None.
-
---*/
-{
- mOpcodeHandler.AddByte (ByteValue, Key);
-}
-VOID
-EfiVfrParser::WriteWord (
- UINT32 Value
- )
-/*++
-
-Routine Description:
- During VFR parsing we came upon a case where we need to write out a
- 16-bit value. Queue it up.
-
-Arguments:
- Value - value to write.
-
-Returns:
- None.
-
---*/
-{
- mOpcodeHandler.AddByte ((UINT8)Value, 0);
- mOpcodeHandler.AddByte ((UINT8)((Value \>> 8) & 0xFF), 0);
-}
-VOID
-EfiVfrParser::WriteStringIdWord (
- UINT16 WordValue
- )
-{
- mOpcodeHandler.AddByte ((UINT8)WordValue, 'S');
- mOpcodeHandler.AddByte ((UINT8)((WordValue \>> 8) & 0xFF), 0);
-}
-VOID
-EfiVfrParser::FreeGotoReferences ()
-/*++
-
-Routine Description:
- Called during cleanup to free up the memory we allocated when
- keeping track of VFR goto statements.
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- GOTO_REFERENCE *CurrRef;
- GOTO_REFERENCE *NextRef;
- FORM_ID_VALUE *CurrFormId;
- FORM_ID_VALUE *NextFormId;
- UINT8 Found;
- CHAR8 Name[20];
-
- //
- // Go through all the "goto" references and make sure there was a
- // form ID of that value defined.
- //
- for (CurrRef = mGotoReferences; CurrRef != NULL; CurrRef = CurrRef->Next) {
- Found = 0;
- for (CurrFormId = mFormIdValues; CurrFormId != NULL; CurrFormId = CurrFormId->Next) {
- if (CurrRef->Value == CurrFormId->Value) {
- Found = 1;
- break;
- }
- }
- if (!Found) {
- sprintf (Name, "%d", (UINT32)CurrRef->Value);
- PrintErrorMessage (CurrRef->RefLineNum, Name, "undefined form ID");
- }
- }
- //
- // Now free up the form id and goto references
- //
- CurrFormId = mFormIdValues;
- while (CurrFormId != NULL) {
- NextFormId = CurrFormId->Next;
- free (CurrFormId);
- CurrFormId = NextFormId;
- }
- mFormIdValues = NULL;
- CurrRef = mGotoReferences;
- while (CurrRef != NULL) {
- NextRef = CurrRef->Next;
- free (CurrRef);
- CurrRef = NextRef;
- }
- mGotoReferences = NULL;
-}
-VOID
-EfiVfrParser::AddGotoReference (
- UINT32 GotoNumber,
- UINT32 LineNum
- )
-/*++
-
-Routine Description:
- During VFR parsing we came upon a goto statement. Since we support
- forward references, save the referenced label and at the end of parsing
- we'll check that the label was actually defined somewhere.
-
-Arguments:
- GotoNumber - the label number referenced
- LineNum - the line number where the reference was made (used for
- error reporting)
-
-Returns:
- None
-
---*/
-{
- GOTO_REFERENCE *NewRef;
-
- NewRef = (GOTO_REFERENCE *)malloc (sizeof (GOTO_REFERENCE));
- if (NewRef == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
- return;
- }
- memset ((char *)NewRef, 0, sizeof (GOTO_REFERENCE));
- NewRef->Value = (UINT16)GotoNumber;
- NewRef->RefLineNum = LineNum;
- NewRef->Next = mGotoReferences;
- mGotoReferences = NewRef;
-}
-VOID
-EfiVfrParser::AddFormId (
- INT32 FormIdValue,
- UINT32 LineNum
- )
-/*++
-
-Routine Description:
- This function is called when we parse "form formid = 3" statements.
- We save the form ID valud so we can verify that duplicates are not
- defined. Also, these are the targets of goto statements, so when we're
- done parsing the script we also go through all the goto statements to
- check that there was a target FormId defined as referenced by each
- goto statement.
-
- Note that formid = 0 is invalid.
-
-Arguments:
- FormIdValue - the parsed value for the Form ID
- LineNum - line number of the source file we're parsing
-
-Returns:
- NA
-
---*/
-{
- FORM_ID_VALUE *NewFormId;
- char *FileName;
- char *FileName2;
- UINT32 LineNum2;
- //
- // Verify that FormId != 0
- //
- if (FormIdValue == 0) {
- FileName = ConvertLineNumber (&LineNum);
- Error (FileName, LineNum, 0, "form ID cannot be 0", NULL);
- return;
- }
- //
- // First go through all previously defined form IDs and make sure they have not defined
- // duplicates.
- //
- for (NewFormId = mFormIdValues; NewFormId != NULL; NewFormId = NewFormId->Next) {
- if ((UINT16)FormIdValue == NewFormId->Value) {
- FileName = ConvertLineNumber (&LineNum);
- LineNum2 = NewFormId->LineNum;
- FileName2 = ConvertLineNumber (&LineNum2);
- Error (FileName, LineNum, 0, NULL, "form ID %d already defined", FormIdValue);
- Error (FileName2, LineNum2, 0, NULL, "form ID %d previous definition", FormIdValue);
- return;
- }
- }
- //
- // Allocate memory for a new one
- //
- NewFormId = (FORM_ID_VALUE *)malloc (sizeof (FORM_ID_VALUE));
- if (NewFormId == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
- return;
- }
- memset ((char *)NewFormId, 0, sizeof (FORM_ID_VALUE));
- NewFormId->LineNum = LineNum;
- NewFormId->Next = mFormIdValues;
- NewFormId->Value = (UINT16)FormIdValue;
- mFormIdValues = NewFormId;
-}
-UINT32
-EfiVfrParser::GetNumber (
- CHAR8 *NumStr,
- UINT32 LineNum,
- UINT32 NumBytes
- )
-{
- UINT32 Value;
-
- if ((NumStr[0] == '0') && (NumStr[1] == 'x')) {
- AtoX (NumStr + 2, 4, &Value);
- } else {
- Value = (UINT32)atoi (NumStr);
- }
- //
- // Check range
- //
- if ((NumBytes < 4) && (Value & ((UINT32)0xFFFFFFFF << (NumBytes * 8)))) {
- PrintErrorMessage (LineNum, NumStr, "value out of range");
- return 0;
- }
- return Value;
-}
-
->>
-
-} // end grammar class
-
diff --git a/Tools/CCode/Source/VfrCompile/VfrServices.cpp b/Tools/CCode/Source/VfrCompile/VfrServices.cpp
deleted file mode 100644
index d338672060..0000000000
--- a/Tools/CCode/Source/VfrCompile/VfrServices.cpp
+++ /dev/null
@@ -1,758 +0,0 @@
-/*++
-
-Copyright (c) 2004 - 2005, 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.
-
-Module Name:
-
- VfrServices.cpp
-
-Abstract:
-
- Support routines for the VFR compiler
-
---*/
-
-#include <stdio.h> // for FILE routines
-#include <stdlib.h> // for malloc() and free()
-
-#include <Common/UefiBaseTypes.h>
-#include <Common/MultiPhase.h>
-#include <Common/InternalFormRepresentation.h>
-#include <Protocol/UgaDraw.h> // for EFI_UGA_PIXEL definition
-#include <Protocol/Hii.h>
-
-#include "EfiUtilityMsgs.h"
-#include "EfiVfr.h"
-#include "VfrServices.h"
-
-
-static const char *mSourceFileHeader[] = {
- "//",
- "// DO NOT EDIT -- auto-generated file",
- "//",
- "// This file is generated by the VFR compiler.",
- "//",
- NULL
-};
-
-typedef struct {
- CHAR8 *Name;
- INT32 Size;
-} IFR_OPCODE_SIZES;
-
-//
-// Create a table that can be used to do internal checking on the IFR
-// bytes we emit.
-//
-static const IFR_OPCODE_SIZES mOpcodeSizes[] = {
- { 0, 0 }, // invalid
- { "EFI_IFR_FORM", sizeof (EFI_IFR_FORM) },
- { "EFI_IFR_SUBTITLE", sizeof (EFI_IFR_SUBTITLE) },
- { "EFI_IFR_TEXT", -6 }, //sizeof (EFI_IFR_TEXT) },
- { "unused 0x04 opcode", 0 }, // EFI_IFR_GRAPHIC_OP
- { "EFI_IFR_ONE_OF", sizeof (EFI_IFR_ONE_OF) },
- { "EFI_IFR_CHECKBOX", sizeof (EFI_IFR_CHECKBOX) },
- { "EFI_IFR_NUMERIC", sizeof (EFI_IFR_NUMERIC) },
- { "EFI_IFR_PASSWORD", sizeof (EFI_IFR_PASSWORD) },
- { "EFI_IFR_ONE_OF_OPTION", sizeof (EFI_IFR_ONE_OF_OPTION) },
- { "EFI_IFR_SUPPRESS", sizeof (EFI_IFR_SUPPRESS) },
- { "EFI_IFR_END_FORM", sizeof (EFI_IFR_END_FORM) },
- { "EFI_IFR_HIDDEN", sizeof (EFI_IFR_HIDDEN) },
- { "EFI_IFR_END_FORM_SET", sizeof (EFI_IFR_END_FORM_SET) },
- { "EFI_IFR_FORM_SET", sizeof (EFI_IFR_FORM_SET) },
- { "EFI_IFR_REF", sizeof (EFI_IFR_REF) },
- { "EFI_IFR_END_ONE_OF", sizeof (EFI_IFR_END_ONE_OF) },
- { "EFI_IFR_INCONSISTENT", sizeof (EFI_IFR_INCONSISTENT) },
- { "EFI_IFR_EQ_ID_VAL", sizeof (EFI_IFR_EQ_ID_VAL) },
- { "EFI_IFR_EQ_ID_ID", sizeof (EFI_IFR_EQ_ID_ID) },
- { "EFI_IFR_EQ_ID_LIST", -sizeof (EFI_IFR_EQ_ID_LIST) },
- { "EFI_IFR_AND", sizeof (EFI_IFR_AND) },
- { "EFI_IFR_OR", sizeof (EFI_IFR_OR) },
- { "EFI_IFR_NOT", sizeof (EFI_IFR_NOT) },
- { "EFI_IFR_END_EXPR", sizeof (EFI_IFR_END_EXPR) },
- { "EFI_IFR_GRAY_OUT", sizeof (EFI_IFR_GRAY_OUT) },
- { "EFI_IFR_DATE", sizeof (EFI_IFR_DATE) / 3 },
- { "EFI_IFR_TIME", sizeof (EFI_IFR_TIME) / 3 },
- { "EFI_IFR_STRING", sizeof (EFI_IFR_STRING) },
- { "EFI_IFR_LABEL", sizeof (EFI_IFR_LABEL) },
- { "EFI_IFR_SAVE_DEFAULTS", sizeof (EFI_IFR_SAVE_DEFAULTS) },
- { "EFI_IFR_RESTORE_DEFAULTS", sizeof (EFI_IFR_RESTORE_DEFAULTS) },
- { "EFI_IFR_BANNER", sizeof (EFI_IFR_BANNER) },
- { "EFI_IFR_INVENTORY", sizeof (EFI_IFR_INVENTORY) },
- { "EFI_IFR_EQ_VAR_VAL_OP", sizeof (EFI_IFR_EQ_VAR_VAL) },
- { "EFI_IFR_ORDERED_LIST_OP", sizeof (EFI_IFR_ORDERED_LIST) },
- { "EFI_IFR_VARSTORE_OP", -sizeof (EFI_IFR_VARSTORE) },
- { "EFI_IFR_VARSTORE_SELECT_OP", sizeof (EFI_IFR_VARSTORE_SELECT) },
- { "EFI_IFR_VARSTORE_SELECT_PAIR_OP", sizeof (EFI_IFR_VARSTORE_SELECT_PAIR) },
- { "EFI_IFR_TRUE", sizeof (EFI_IFR_TRUE)},
- { "EFI_IFR_FALSE", sizeof (EFI_IFR_FALSE)},
- { "EFI_IFR_GT", sizeof (EFI_IFR_GT)},
- { "EFI_IFR_GE", sizeof (EFI_IFR_GE)},
- { "EFI_IFR_OEM_DEFINED_OP", -2 },
-};
-
-
-VfrOpcodeHandler::VfrOpcodeHandler (
- )
-/*++
-
-Routine Description:
- Constructor for the VFR opcode handling class.
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- mIfrBytes = NULL;
- mLastIfrByte = NULL;
- mBytesWritten = 0;
- mQueuedByteCount = 0;
- mQueuedOpcodeByteValid = 0;
- mPrimaryVarStoreId = 0;
- mSecondaryVarStoreId = 0;
- mSecondaryVarStoreIdSet = 0;
- mPrimaryVarStoreIdSet = 0;
- mDefaultVarStoreId = 0;
-}
-
-VOID
-VfrOpcodeHandler::SetVarStoreId (
- UINT16 VarStoreId
- )
-/*++
-
-Routine Description:
- This function is invoked by the parser when a variable is referenced in the
- VFR. Save the variable store (and set a flag) so that we can later determine
- if we need to emit a varstore-select or varstore-select-pair opcode.
-
-Arguments:
- VarStoreId - ID of the variable store referenced in the VFR
-
-Returns:
- None
-
---*/
-{
- mPrimaryVarStoreId = VarStoreId;
- mPrimaryVarStoreIdSet = 1;
-}
-
-VOID
-VfrOpcodeHandler::SetSecondaryVarStoreId (
- UINT16 VarStoreId
- )
-/*++
-
-Routine Description:
- This function is invoked by the parser when a secondary variable is
- referenced in the VFR. Save the variable store (and set a flag) so
- that we can later determine if we need to emit a varstore-select or
- varstore-pair opcode.
-
-Arguments:
- VarStoreId - ID of the variable store referenced in the VFR
-
-Returns:
- None
-
---*/
-{
- mSecondaryVarStoreId = VarStoreId;
- mSecondaryVarStoreIdSet = 1;
-}
-
-VOID
-VfrOpcodeHandler::WriteIfrBytes (
- )
-/*++
-
-Routine Description:
- This function is invoked at the end of parsing. Its purpose
- is to write out all the IFR bytes that were queued up while
- parsing.
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- IFR_BYTE *Curr;
- IFR_BYTE *Next;
- UINT32 Count;
- UINT32 LineCount;
- UINT32 PoundLines;
- UINT32 ByteCount;
- CHAR8 Line[MAX_LINE_LEN];
- CHAR8 *Cptr;
- FILE *InFptr;
- FILE *OutFptr;
- UINT32 ListFile;
- EFI_HII_IFR_PACK_HEADER IfrHeader;
- UINT8 *Ptr;
- FILE *IfrBinFptr;
- UINT32 BytesLeftThisOpcode;
- //
- // If someone added a new opcode and didn't update our opcode sizes structure, error out.
- //
- if (sizeof(mOpcodeSizes) / sizeof (mOpcodeSizes[0]) != EFI_IFR_LAST_OPCODE + 1) {
- Error (__FILE__, __LINE__, 0, "application error", "internal IFR binary table size is incorrect");
- return;
- }
- //
- // Flush the queue
- //
- FlushQueue ();
- //
- // If there have been any errors to this point, then skip dumping the IFR
- // binary data. This way doing an nmake again will try to build it again, and
- // the build will fail if they did not fix the problem.
- //
- if (GetUtilityStatus () != STATUS_ERROR) {
- if ((IfrBinFptr = fopen (gOptions.IfrOutputFileName, "w")) == NULL) {
- Error (PROGRAM_NAME, 0, 0, gOptions.IfrOutputFileName, "could not open file for writing");
- return;
- }
- //
- // Write the standard file header to the output file
- //
- WriteStandardFileHeader (IfrBinFptr);
- //
- // Write the structure header
- //
- fprintf (IfrBinFptr, "\nunsigned char %sBin[] = {", gOptions.VfrBaseFileName);
- //
- // Write the header
- //
- memset ((char *)&IfrHeader, 0, sizeof (IfrHeader));
- IfrHeader.Header.Type = EFI_HII_IFR;
- IfrHeader.Header.Length = mBytesWritten + sizeof (IfrHeader);
- Ptr = (UINT8 *)&IfrHeader;
- for (Count = 0; Count < sizeof (IfrHeader); Count++, Ptr++) {
- if ((Count & 0x03) == 0) {
- fprintf (IfrBinFptr, "\n ");
- }
- fprintf (IfrBinFptr, "0x%02X, ", *Ptr);
- }
- //
- //
- // Write all the IFR bytes
- //
- fprintf (IfrBinFptr, "\n // start of IFR data");
- Curr = mIfrBytes;
- Count = 0;
- while (Curr != NULL) {
- if ((Count & 0x0F) == 0) {
- fprintf (IfrBinFptr, "\n ");
- }
- if (Curr->KeyByte != 0) {
- fprintf (IfrBinFptr, "/*%c*/ ", Curr->KeyByte);
- }
- fprintf (IfrBinFptr, "0x%02X, ", Curr->OpcodeByte);
- Count++;
- Curr = Curr->Next;
- }
- fprintf (IfrBinFptr, "\n};\n\n");
- //
- //
- // Close the file
- //
- fclose (IfrBinFptr);
- IfrBinFptr = NULL;
- }
- //
- // Write the bytes as binary data if the user specified to do so
- //
- if ((GetUtilityStatus () != STATUS_ERROR) && (gOptions.CreateIfrBinFile != 0)) {
- //
- // Use the Ifr output file name with a ".hpk" extension.
- //
- for (Cptr = gOptions.IfrOutputFileName + strlen (gOptions.IfrOutputFileName) - 1;
- (*Cptr != '.') && (Cptr > gOptions.IfrOutputFileName) && (*Cptr != '\\');
- Cptr--) {
- //
- // do nothing
- //
- }
- if (*Cptr == '.') {
- strcpy (Cptr, ".hpk");
- } else {
- strcat (gOptions.IfrOutputFileName, ".hpk");
- }
- if ((IfrBinFptr = fopen (gOptions.IfrOutputFileName, "wb")) == NULL) {
- Error (PROGRAM_NAME, 0, 0, gOptions.IfrOutputFileName, "could not open file for writing");
- return;
- }
- //
- // Write the structure header
- //
- memset ((char *)&IfrHeader, 0, sizeof (IfrHeader));
- IfrHeader.Header.Type = EFI_HII_IFR;
- IfrHeader.Header.Length = mBytesWritten + sizeof (IfrHeader);
- Ptr = (UINT8 *)&IfrHeader;
- for (Count = 0; Count < sizeof (IfrHeader); Count++, Ptr++) {
- fwrite (Ptr, 1, 1, IfrBinFptr);
- }
- //
- //
- // Write all the IFR bytes
- //
- Curr = mIfrBytes;
- Count = 0;
- while (Curr != NULL) {
- fwrite (&Curr->OpcodeByte, 1, 1, IfrBinFptr);
- Curr = Curr->Next;
- }
- //
- //
- // Close the file
- //
- fclose (IfrBinFptr);
- IfrBinFptr = NULL;
- }
- //
- // If creating a listing file, then open the input and output files
- //
- ListFile = 0;
- if (gOptions.CreateListFile) {
- //
- // Open the input VFR file and the output list file
- //
- if ((InFptr = fopen (gOptions.VfrFileName, "r")) == NULL) {
- Warning (PROGRAM_NAME, 0, 0, gOptions.VfrFileName, "could not open file for creating a list file");
- } else {
- if ((OutFptr = fopen (gOptions.VfrListFileName, "w")) == NULL) {
- Warning (PROGRAM_NAME, 0, 0, gOptions.VfrListFileName, "could not open output list file for writing");
- fclose (InFptr);
- InFptr = NULL;
- } else {
- LineCount = 0;
- ListFile = 1;
- PoundLines = 0;
- ByteCount = 0;
- }
- }
- }
- //
- // Write the list file
- //
- if (ListFile) {
- //
- // Write out the VFR compiler version
- //
- fprintf (OutFptr, "//\n// VFR compiler version " VFR_COMPILER_VERSION "\n//\n");
- Curr = mIfrBytes;
- while (Curr != NULL) {
- //
- // Print lines until we reach the line of the current opcode
- //
- while (LineCount < PoundLines + Curr->LineNum) {
- if (fgets (Line, sizeof (Line), InFptr) != NULL) {
- //
- // We should check for line length exceeded on the fgets(). Otherwise it
- // throws the listing file output off. Future enhancement perhaps.
- //
- fprintf (OutFptr, "%s", Line);
- if (strncmp (Line, "#line", 5) == 0) {
- PoundLines++;
- }
- }
- LineCount++;
- }
- //
- // Print all opcodes with line numbers less than where we are now
- //
- BytesLeftThisOpcode = 0;
- while ((Curr != NULL) && ((Curr->LineNum == 0) || (LineCount >= PoundLines + Curr->LineNum))) {
- if (BytesLeftThisOpcode == 0) {
- fprintf (OutFptr, ">%08X: ", ByteCount);
- if (Curr->Next != NULL) {
- BytesLeftThisOpcode = (UINT32)Curr->Next->OpcodeByte;
- }
- }
- fprintf (OutFptr, "%02X ", (UINT32)Curr->OpcodeByte);
- ByteCount++;
- BytesLeftThisOpcode--;
- if (BytesLeftThisOpcode == 0) {
- fprintf (OutFptr, "\n");
- }
- Curr = Curr->Next;
- }
- }
- //
- // Dump any remaining lines from the input file
- //
- while (fgets (Line, sizeof (Line), InFptr) != NULL) {
- fprintf (OutFptr, "%s", Line);
- }
- fclose (InFptr);
- fclose (OutFptr);
- }
- //
- // Debug code to make sure that each opcode we write out has as many
- // bytes as the IFR structure requires. If there were errors, then
- // don't do this step.
- //
- if (GetUtilityStatus () != STATUS_ERROR) {
- Curr = mIfrBytes;
- ByteCount = 0;
- while (Curr != NULL) {
- //
- // First byte is the opcode, second byte is the length
- //
- if (Curr->Next == NULL) {
- Error (__FILE__, __LINE__, 0, "application error", "last opcode written does not contain a length byte");
- break;
- }
- Count = (UINT32)Curr->Next->OpcodeByte;
- if (Count == 0) {
- Error (
- __FILE__,
- __LINE__,
- 0,
- "application error",
- "opcode with 0 length specified in output at offset 0x%X",
- ByteCount
- );
- break;
- }
- //
- // Check the length
- //
- if ((Curr->OpcodeByte > EFI_IFR_LAST_OPCODE) || (Curr->OpcodeByte == 0)) {
- Error (
- __FILE__,
- __LINE__,
- 0,
- "application error",
- "invalid opcode 0x%X in output at offset 0x%X",
- (UINT32) Curr->OpcodeByte, ByteCount
- );
- } else if (mOpcodeSizes[Curr->OpcodeByte].Size < 0) {
- //
- // For those cases where the length is variable, the size is negative, and indicates
- // the miniumum size.
- //
- if ((mOpcodeSizes[Curr->OpcodeByte].Size * -1) > Count) {
- Error (
- __FILE__,
- __LINE__,
- 0,
- "application error",
- "insufficient number of bytes written for %s at offset 0x%X",
- mOpcodeSizes[Curr->OpcodeByte].Name,
- ByteCount
- );
- }
- } else {
- //
- // Check for gaps
- //
- if (mOpcodeSizes[Curr->OpcodeByte].Size == 0) {
- Error (
- __FILE__,
- __LINE__,
- 0,
- "application error",
- "invalid opcode 0x%X in output at offset 0x%X",
- (UINT32)Curr->OpcodeByte,
- ByteCount
- );
- } else {
- //
- // Check size
- //
- if (mOpcodeSizes[Curr->OpcodeByte].Size != Count) {
- Error (
- __FILE__,
- __LINE__,
- 0,
- "application error",
- "invalid number of bytes (%d written s/b %d) written for %s at offset 0x%X",
- Count,
- mOpcodeSizes[Curr->OpcodeByte].Size,
- mOpcodeSizes[Curr->OpcodeByte].Name,
- ByteCount
- );
- }
- }
- }
- //
- // Skip to next opcode
- //
- while (Count > 0) {
- ByteCount++;
- if (Curr == NULL) {
- Error (__FILE__, __LINE__, 0, "application error", "last opcode written has invalid length");
- break;
- }
- Curr = Curr->Next;
- Count--;
- }
- }
- }
-}
-
-VfrOpcodeHandler::~VfrOpcodeHandler(
- )
-/*++
-
-Routine Description:
- Destructor for the VFR opcode handler. Free up memory allocated
- while parsing the VFR script.
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- IFR_BYTE *Curr;
- IFR_BYTE *Next;
- //
- // Free up the IFR bytes
- //
- Curr = mIfrBytes;
- while (Curr != NULL) {
- Next = Curr->Next;
- free (Curr);
- Curr = Next;
- }
-}
-
-int
-VfrOpcodeHandler::AddOpcodeByte (
- UINT8 OpcodeByte,
- UINT32 LineNum
- )
-/*++
-
-Routine Description:
- This function is invoked by the parser when a new IFR
- opcode should be emitted.
-
-Arguments:
- OpcodeByte - the IFR opcode
- LineNum - the line number from the source file that resulted
- in the opcode being emitted.
-
-Returns:
- 0 always
-
---*/
-{
- UINT32 Count;
-
- FlushQueue();
- //
- // Now add this new byte
- //
- mQueuedOpcodeByte = OpcodeByte;
- mQueuedLineNum = LineNum;
- mQueuedOpcodeByteValid = 1;
- return 0;
-}
-
-VOID
-VfrOpcodeHandler::AddByte (
- UINT8 ByteVal,
- UINT8 KeyByte
- )
-/*++
-
-Routine Description:
- This function is invoked by the parser when it determines
- that more raw IFR bytes should be emitted to the output stream.
- Here we just queue them up into an output buffer.
-
-Arguments:
- ByteVal - the raw byte to emit to the output IFR stream
- KeyByte - a value that can be used for debug.
-
-Returns:
- None
-
---*/
-{
- //
- // Check for buffer overflow
- //
- if (mQueuedByteCount > MAX_QUEUE_COUNT) {
- Error (PROGRAM_NAME, 0, 0, NULL, "opcode queue overflow");
- } else {
- mQueuedBytes[mQueuedByteCount] = ByteVal;
- mQueuedKeyBytes[mQueuedByteCount] = KeyByte;
- mQueuedByteCount++;
- }
-}
-
-int
-VfrOpcodeHandler::FlushQueue (
- )
-/*++
-
-Routine Description:
- This function is invoked to flush the internal IFR buffer.
-
-Arguments:
- None
-
-Returns:
- 0 always
-
---*/
-{
- UINT32 Count;
- UINT32 EmitNoneOnePair;
-
- EmitNoneOnePair = 0;
- //
- // If the secondary varstore was specified, then we have to emit
- // a varstore-select-pair opcode, which only applies to the following
- // statement.
- //
- if (mSecondaryVarStoreIdSet) {
- mSecondaryVarStoreIdSet = 0;
- //
- // If primary and secondary are the same as the current default
- // varstore, then we don't have to do anything.
- // Note that the varstore-select-pair only applies to the following
- // opcode.
- //
- if ((mPrimaryVarStoreId != mSecondaryVarStoreId) || (mPrimaryVarStoreId != mDefaultVarStoreId)) {
- IAddByte (EFI_IFR_VARSTORE_SELECT_PAIR_OP, 'O', mQueuedLineNum);
- IAddByte ((UINT8)sizeof (EFI_IFR_VARSTORE_SELECT_PAIR), 'L', 0);
- IAddByte ((UINT8)mPrimaryVarStoreId, 0, 0);
- IAddByte ((UINT8)(mPrimaryVarStoreId >> 8), 0, 0);
- IAddByte ((UINT8)mSecondaryVarStoreId, 0, 0);
- IAddByte ((UINT8)(mSecondaryVarStoreId >> 8), 0, 0);
- }
- } else if (mPrimaryVarStoreIdSet != 0) {
- mPrimaryVarStoreIdSet = 0;
- if (mDefaultVarStoreId != mPrimaryVarStoreId) {
- //
- // The VFR statement referenced a different variable store
- // than the last one we reported. Insert a new varstore select
- // statement.
- //
- IAddByte (EFI_IFR_VARSTORE_SELECT_OP, 'O', mQueuedLineNum);
- IAddByte ((UINT8)sizeof (EFI_IFR_VARSTORE_SELECT), 'L', 0);
- IAddByte ((UINT8)mPrimaryVarStoreId, 0, 0);
- IAddByte ((UINT8)(mPrimaryVarStoreId >> 8), 0, 0);
- mDefaultVarStoreId = mPrimaryVarStoreId;
- }
- }
- //
- // Likely a new opcode is being added. Since each opcode item in the IFR has
- // a header that specifies the size of the opcode item (which we don't
- // know until we find the next opcode in the VFR), we queue up bytes
- // until we know the size. Then we write them out. So flush the queue
- // now.
- //
- if (mQueuedOpcodeByteValid != 0) {
- //
- // Add the previous opcode byte, the length byte, and the binary
- // data.
- //
- IAddByte (mQueuedOpcodeByte, 'O', mQueuedLineNum);
- IAddByte ((UINT8)(mQueuedByteCount + 2), 'L', 0);
- for (Count = 0; Count < mQueuedByteCount; Count++) {
- IAddByte (mQueuedBytes[Count], mQueuedKeyBytes[Count], 0);
- }
- mQueuedByteCount = 0;
- mQueuedOpcodeByteValid = 0;
- }
- return 0;
-}
-
-int
-VfrOpcodeHandler::IAddByte (
- UINT8 ByteVal,
- UINT8 KeyByte,
- UINT32 LineNum
- )
-/*++
-
-Routine Description:
- This internal function is used to add actual IFR bytes to
- the output stream. Most other functions queue up the bytes
- in an internal buffer. Once they come here, there's no
- going back.
-
-
-Arguments:
- ByteVal - value to write to output
- KeyByte - key value tied to the byte -- useful for debug
- LineNum - line number from source file the byte resulted from
-
-Returns:
- 0 - if successful
- 1 - failed due to memory allocation failure
-
---*/
-{
- IFR_BYTE *NewByte;
- NewByte = (IFR_BYTE *)malloc (sizeof (IFR_BYTE));
- if (NewByte == NULL) {
- return 1;
- }
- memset ((char *)NewByte, 0, sizeof (IFR_BYTE));
- NewByte->OpcodeByte = ByteVal;
- NewByte->KeyByte = KeyByte;
- NewByte->LineNum = LineNum;
- //
- // Add to the list
- //
- if (mIfrBytes == NULL) {
- mIfrBytes = NewByte;
- } else {
- mLastIfrByte->Next = NewByte;
- }
- mLastIfrByte = NewByte;
- mBytesWritten++;
- return 0;
-}
-
-VOID
-WriteStandardFileHeader (
- FILE *OutFptr
- )
-/*++
-
-Routine Description:
- This function is invoked to emit a standard header to an
- output text file.
-
-Arguments:
- OutFptr - file to write the header to
-
-Returns:
- None
-
---*/
-{
- UINT32 TempIndex;
- for (TempIndex = 0; mSourceFileHeader[TempIndex] != NULL; TempIndex++) {
- fprintf (OutFptr, "%s\n", mSourceFileHeader[TempIndex]);
- }
- //
- // Write out the VFR compiler version
- //
- fprintf (OutFptr, "// VFR compiler version " VFR_COMPILER_VERSION "\n//\n");
-}
diff --git a/Tools/CCode/Source/VfrCompile/VfrServices.h b/Tools/CCode/Source/VfrCompile/VfrServices.h
deleted file mode 100644
index 6b8c560d63..0000000000
--- a/Tools/CCode/Source/VfrCompile/VfrServices.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/*++
-
-Copyright (c) 2004, 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.
-
-Module Name:
-
- VfrServices.h
-
-Abstract:
-
- Prototypes and defines for routines and classes used by the
- EFI VFR compiler.
-
---*/
-
-#ifndef _VFR_SERVICES_H_
-#define _VFR_SERVICES_H_
-
-class VfrOpcodeHandler
-{
-public:
- VfrOpcodeHandler (
- VOID
- )
- /*++
-
-Routine Description:
- Constructor for the VFR opcode handling class.
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
- ;
- ~VfrOpcodeHandler (
- VOID
- )
- /*++
-
-Routine Description:
- Destructor for the VFR opcode handler. Free up memory allocated
- while parsing the VFR script.
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
- ;
- void
- WriteIfrBytes (
- VOID
- )
- /*++
-
-Routine Description:
- This function is invoked at the end of parsing. Its purpose
- is to write out all the IFR bytes that were queued up while
- parsing.
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
- ;
- int
- AddOpcodeByte (
- UINT8 OpcodeByte,
- UINT32 LineNum
- )
- /*++
-
-Routine Description:
- This function is invoked by the parser when a new IFR
- opcode should be emitted.
-
-Arguments:
- OpcodeByte - the IFR opcode
- LineNum - the line number from the source file that resulted
- in the opcode being emitted.
-
-Returns:
- 0 always
-
---*/
- ;
- void
- AddByte (
- UINT8 ByteVal,
- UINT8 KeyByte
- )
- /*++
-
-Routine Description:
- This function is invoked by the parser when it determines
- that more raw IFR bytes should be emitted to the output stream.
- Here we just queue them up into an output buffer.
-
-Arguments:
- ByteVal - the raw byte to emit to the output IFR stream
- KeyByte - a value that can be used for debug.
-
-Returns:
- None
-
---*/
- ;
- void
- SetVarStoreId (
- UINT16 VarStoreId
- )
- /*++
-
-Routine Description:
- This function is invoked by the parser when a variable is referenced in the
- VFR. Save the variable store (and set a flag) so that we can later determine
- if we need to emit a varstore-select or varstore-select-pair opcode.
-
-Arguments:
- VarStoreId - ID of the variable store referenced in the VFR
-
-Returns:
- None
-
---*/
- ;
- void
- SetSecondaryVarStoreId (
- UINT16 VarStoreId
- )
- /*++
-
-Routine Description:
- This function is invoked by the parser when a secondary variable is
- referenced in the VFR. Save the variable store (and set a flag) so
- that we can later determine if we need to emit a varstore-select or
- varstore-pair opcode.
-
-Arguments:
- VarStoreId - ID of the variable store referenced in the VFR
-
-Returns:
- None
-
---*/
- ;
-
-/* */
-private:
- int
- FlushQueue (
- VOID
- )
- /*++
-
-Routine Description:
- This function is invoked to flush the internal IFR buffer.
-
-Arguments:
- None
-
-Returns:
- 0 always
-
---*/
- ;
- int
- IAddByte (
- UINT8 ByteVal,
- UINT8 KeyByte,
- UINT32 LineNum
- )
- /*++
-
-Routine Description:
- This internal function is used to add actual IFR bytes to
- the output stream. Most other functions queue up the bytes
- in an internal buffer. Once they come here, there's no
- going back.
-
-
-Arguments:
- ByteVal - value to write to output
- KeyByte - key value tied to the byte -- useful for debug
- LineNum - line number from source file the byte resulted from
-
-Returns:
- 0 - if successful
- 1 - failed due to memory allocation failure
-
---*/
- ;
-
-/* */
-private:
- IFR_BYTE *mIfrBytes;
- IFR_BYTE *mLastIfrByte;
- UINT32 mQueuedByteCount;
- UINT32 mBytesWritten;
- UINT32 mQueuedLineNum;
- UINT8 mQueuedBytes[MAX_QUEUE_COUNT];
- UINT8 mQueuedKeyBytes[MAX_QUEUE_COUNT];
- UINT8 mQueuedOpcodeByte;
- UINT32 mQueuedOpcodeByteValid;
- UINT16 mPrimaryVarStoreId;
- UINT8 mPrimaryVarStoreIdSet;
- UINT16 mSecondaryVarStoreId;
- UINT8 mSecondaryVarStoreIdSet;
- UINT16 mDefaultVarStoreId;
-};
-
-#endif // #ifndef _VFR_SERVICES_H_
diff --git a/Tools/CCode/Source/VfrCompile/build.xml b/Tools/CCode/Source/VfrCompile/build.xml
deleted file mode 100644
index 7b69070bcf..0000000000
--- a/Tools/CCode/Source/VfrCompile/build.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir="." name="VfrCompile">
-<!--
- EDK VfrCompile Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="VfrCompile"/>
- <property name="FileSet" value="*.cpp"/>
- <property name="FileSetPccts" value="ATokenBuffer.cpp DLexerBase.cpp AParser.cpp"/>
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Antlr, Dlg, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed"/>
- </target>
-
- <target name="init">
-
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
-
- <condition property="AntlrDepends">
- <uptodate targetfile="${PACKAGE_DIR}/VfrCompile/parser.dlg" srcfile="${PACKAGE_DIR}/VfrCompile/VfrCompile.g" value="true"/>
- </condition>
-
- <condition property="DlgDepends">
- <uptodate targetfile="${PACKAGE_DIR}/VfrCompile/DLGLexer.cpp" srcfile="${PACKAGE_DIR}/VfrCompile/parser.dlg" value="true"/>
- </condition>
-
- <condition property="CheckDepends">
- <or>
- <isset property="AntlrDepends"/>
- <isset property="DlgDepends"/>
- </or>
- </condition>
-
- <condition property="gxx_extra_libs" value="stdc++ System gcc_s.10.4 gcc">
- <os family="mac"/>
- </condition>
-
- <condition property="gxx_extra_libs" value="stdc++">
- <os name="linux"/>
- </condition>
-
- <condition property="gxx_extra_libs" value="stdc++">
- <os family="windows"/>
- </condition>
-
- </target>
-
- <target name="Antlr" depends="init" unless="AntlrDepends">
- <echo message="Executing ANTLR"/>
- <exec dir="${basedir}/${ToolName}" executable="${env.FRAMEWORK_TOOLS_PATH}/antlr" failonerror="TRUE">
- <arg line="-CC -e3 -ck 3 -o . VfrCompile.g"/>
- </exec>
- </target>
-
- <target name="Dlg" depends="Antlr" unless="DlgDepends">
- <echo message="Executing DLG"/>
- <exec dir="${basedir}/${ToolName}" executable="${env.FRAMEWORK_TOOLS_PATH}/dlg" failonerror="TRUE">
- <arg line="-C2 -i -CC -o . parser.dlg"/>
- </exec>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- debug="true"
- optimize="speed">
-
- <compilerarg value="-fpermissive" if="gcc"/>
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}" />
-
- <fileset dir="${basedir}/Pccts/h"
- includes="${FileSetPccts}" />
-
- <includepath path="${PACKAGE_DIR}/Pccts/h"/>
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools"/>
- <syslibset libs="${gxx_extra_libs}" if="gcc"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete>
- <fileset dir="${BUILD_DIR}" includes="*.obj"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${basedir}/${ToolName}/DLGLexer.cpp"/>
- <fileset file="${basedir}/${ToolName}/DLGLexer.h"/>
- <fileset file="${basedir}/${ToolName}/EfiVfrParser.cpp"/>
- <fileset file="${basedir}/${ToolName}/EfiVfrParser.h"/>
- <fileset file="${basedir}/${ToolName}/parser.dlg"/>
- <fileset file="${basedir}/${ToolName}/tokens.h"/>
- <fileset file="${basedir}/${ToolName}/VfrCompile.cpp"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/ZeroDebugData/ZeroDebugData.c b/Tools/CCode/Source/ZeroDebugData/ZeroDebugData.c
deleted file mode 100644
index 33d2c61e25..0000000000
--- a/Tools/CCode/Source/ZeroDebugData/ZeroDebugData.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/*++
-
-Copyright (c) 2004-2006 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.
-
-
-Module Name:
-
- ZeroDebugData.c
-
-Abstract:
-
- Zero the Debug Data Fields of Portable Executable (PE) format file.
-
---*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define UTILITY_NAME "GenTEImage"
-#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 1
-
-void
-Version (
- void
- )
-/*++
-Routine Description:
- print version information for this utility
-
-Arguments:
- None
-
-Returns:
- None
---*/
-// GC_TODO: void - add argument and description to function comment
-{
- //
- // print usage of command
- //
- printf ("%s v%d.%d -Utility to zero the Debug Data Fields of Portable Executable (PE) format file.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
- printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
-}
-
-void
-Usage (
- void
- )
-/*++
-Routine Description:
- print usage of ZeroDebugData command
-
-Arguments:
- None
-
-Returns:
- None
---*/
-// GC_TODO: void - add argument and description to function comment
-{
- Version();
- //
- // print usage of command
- //
- printf ("\nUsage: ZeroDebugData <PE-File> [DebugData-File]\n");
-}
-
-int
-ReadFromFile (
- FILE *fp,
- long offset,
- void *buffer,
- int size
- )
-/*++
-Routine Description:
- read data from a specified location of file
-
-Arguments:
- fp - file pointer
- offset - number of bytes from beginning of file
- buffer - buffer used to store data
- size - size of buffer
-
-Returns:
- = 0 - Success
- = -1 - Failed
---*/
-{
- //
- // set file pointer to the specified location of file
- //
- if (fseek (fp, offset, SEEK_SET) != 0) {
- printf ("Error: Cannot move the current location of the file.\n");
- return -1;
- }
- //
- // read data from the file
- //
- if (fread (buffer, size, 1, fp) != 1) {
- printf ("Error: Cannot read data from the file.\n");
- return -1;
- }
-
- return 0;
-}
-
-int
-ZeroDebugData (
- FILE *fp,
- FILE *fpData
- )
-/*++
-
-Routine Description:
-
- Zero the debug data fields of the file
-
-Arguments:
-
- fp - file pointer
- fpData - pointer to output file that ZeroDebugData progress is written to
-
-Returns:
-
- = 0 - Success
- = -1 - Failed
-
---*/
-{
- unsigned char header[4];
- unsigned long offset;
- unsigned long NumberOfRvaAndSizes;
- unsigned int nvalue;
- unsigned long lvalue;
- unsigned long Size;
- unsigned long Pointer;
- unsigned char *Buffer;
- unsigned long Index;
-
- //
- // read the header of file
- //
- if (ReadFromFile (fp, 0, header, 2) != 0) {
- printf ("Error: open image file\n");
- return -1;
- }
- //
- // "MZ" -- the header of image file (PE)
- //
- if (strncmp ((char *) header, "MZ", 2) != 0) {
- printf ("Error: Invalid Image file.\n");
- return -1;
- }
- //
- // At location 0x3C, the stub has the file offset to the
- // PE signature.
- //
- if (ReadFromFile (fp, 0x3C, &offset, 4) != 0) {
- return -1;
- }
- //
- // read the header of optional
- //
- if (ReadFromFile (fp, offset, header, 4) != 0) {
- return -1;
- }
- //
- // "PE\0\0" -- the signature of optional header
- //
- if (strncmp ((char *) header, "PE\0\0", 4) != 0) {
- printf ("Error: Invalid PE format file.\n");
- return -1;
- }
- //
- // Add 16 to skip COFF file header, and get to optional header.
- //
- offset += 24;
-
- //
- // Check the magic field, 0x10B for PE32 and 0x20B for PE32+
- //
- if (ReadFromFile (fp, offset, &nvalue, 2) != 0) {
- return -1;
- }
- //
- // If this is PE32 image file, offset of NumberOfRvaAndSizes is 92.
- // Else it is 108.
- //
- switch (nvalue & 0xFFFF) {
- case 0x10B:
- offset += 92;
- printf ("Info: Image is PE32. ");
- break;
-
- case 0x20B:
- offset += 108;
- printf ("Info: Image is PE32+. ");
- break;
-
- default:
- printf ("Error: Magic value is unknown.\n");
- return -1;
- }
- //
- // get the value of NumberOfRvaAndSizes
- //
- if (ReadFromFile (fp, offset, &NumberOfRvaAndSizes, 4) != 0) {
- printf ("Error: read NumberOfRvaAndSizes error.\n");
- return -1;
- }
- //
- // printf ("Info: NumberOfRvaAndSizes = %d\n", NumberOfRvaAndSizes);
- //
- //
- // Finding Debug Table, offset of Debug Table
- // is 4 + 6 * 8 = 52.
- //
- if (NumberOfRvaAndSizes >= 7) {
- if (ReadFromFile (fp, offset + 52, &lvalue, 4) != 0) {
- return -1;
- }
- //
- // Read the SizeOfData(16) and PointerToRawData(24)
- //
- if (ReadFromFile (fp, lvalue + 16, &Size, 4) != 0) {
- printf ("error: Size = %d\n", Size);
- return -1;
- }
-
- printf ("Debug data: size = %xh, ", Size);
- fprintf (fpData, "Debug data: size = %xh, ", Size);
-
- if (ReadFromFile (fp, lvalue + 20, &Pointer, 4) != 0) {
- printf ("error: LoadOffset = %xh\n", Pointer);
- return -1;
- }
- //
- // printf ("LoadOffset = %xh, ", Pointer);
- //
- fprintf (fpData, "LoadOffset = %xh, ", Pointer);
-
- if (ReadFromFile (fp, lvalue + 24, &Pointer, 4) != 0) {
- printf ("error: FileOffset = %xh\n", Pointer);
- return -1;
- }
-
- printf ("FileOffset = %xh, ", Pointer);
- fprintf (fpData, "FileOffset = %xh, \n", Pointer);
-
- if ((lvalue != 0) && (Pointer != 0)) {
- //
- // prepare buffer
- //
- Buffer = malloc (Size + 1);
- if (Buffer == NULL) {
- printf ("Error: Cannot allocate memory.\n");
- return -1;
- }
- //
- // set file pointer to the specified location of file
- //
- if (fseek (fp, Pointer, SEEK_SET) != 0) {
- printf ("Error: Cannot move the current location of the file.\n");
- free (Buffer);
- return -1;
- }
- //
- // read data from PE file
- //
- if (fread (Buffer, Size, 1, fp) != 1) {
- printf ("Error: Cannot read data from the file.\n");
- free (Buffer);
- return -1;
- }
- //
- // write to data file
- //
- for (Index = 0; Index < Size;) {
- fprintf (fpData, "%02x ", Buffer[Index]);
-
- Index++;
- if (Index % 8 == 0) {
- fprintf (fpData, "\n");
- }
- }
-
- fprintf (fpData, "\n");
-
- //
- // zero buffer and write back to PE file
- //
- if (fseek (fp, Pointer, SEEK_SET) != 0) {
- printf ("Error: Cannot move the current location of the file.\n");
- free (Buffer);
- return -1;
- }
-
- memset (Buffer, 0, Size);
- if (fwrite (Buffer, Size, 1, fp) != 1) {
- perror ("Error: Cannot write zero to the file.\n");
- free (Buffer);
- return -1;
- }
- //
- // set file pointer to the specified location of file
- //
- if (fseek (fp, lvalue + 4, SEEK_SET) != 0) {
- printf ("Error: Cannot move the current location of the file.\n");
- free (Buffer);
- return -1;
- }
-
- if (fwrite (Buffer, 4, 1, fp) != 1) {
- perror ("Error: Cannot write zero to the file.\n");
- free (Buffer);
- return -1;
- }
-
- free (Buffer);
- }
- }
-
- return 0;
-}
-
-int
-main (
- int argc,
- char *argv[]
- )
-/*++
-
-Routine Description:
-
- Prints the zero debug data of the PE file to the DebugData file.
- Executes the ZeroDebugData function.
-
-Arguments:
-
- argc - Standard C argument, number of command line arguments.
- argv[] - Standard C argument, array of pointers to the input files,
- such as the PE and DebugData files.
-
-Returns:
-
- zero - success
- nonzero - failure
-
---*/
-{
- FILE *fp;
- FILE *fpData;
- char DataFile[1024] = "";
-
- if (argc == 1) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
- (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
- Usage();
- return -1;
- }
-
- if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
- Version();
- return -1;
- }
-
- if (argc == 2) {
- Usage();
- return -1;
- }
-
- //
- // open the DebugData file, if not exists, return
- //
- if (argc >= 3) {
- strcpy (DataFile, argv[2]);
- } else {
- strcpy (DataFile, "DebugData.dat");
- }
-
- fpData = fopen (DataFile, "a+");
- if (fpData == NULL) {
- fpData = fopen (DataFile, "w");
- if (fpData == NULL) {
- printf ("Error: Cannot open the data file!\n");
- return -1;
- }
- }
- //
- // open the PE file
- //
- fp = fopen (argv[1], "r+b");
- if (fp == NULL) {
- printf ("Error: Cannot open the PE file!\n");
- return -1;
- }
- //
- // Zero the Debug Data to the PE file
- //
- printf ("Zero Debug Data to file %s:\n", argv[1]);
- fprintf (fpData, "\nZero Debug Data to file %s:\n", argv[1]);
- if ((int *) ZeroDebugData (fp, fpData) != 0) {
- printf ("Error: Zero Debug Data PE file\n");
- fclose (fp);
- return -1;
- }
-
- printf (" success\n");
-
- //
- // close the PE file
- //
- fflush (fpData);
- fflush (fp);
- fclose (fpData);
- fclose (fp);
-
- return 0;
-}
diff --git a/Tools/CCode/Source/ZeroDebugData/build.xml b/Tools/CCode/Source/ZeroDebugData/build.xml
deleted file mode 100644
index 194afc8709..0000000000
--- a/Tools/CCode/Source/ZeroDebugData/build.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="GenTool" basedir=".">
-<!--
- EDK ZeroDebugData Tool
- Copyright (c) 2006, Intel Corporation
--->
- <property name="ToolName" value="ZeroDebugData"/>
- <property name="FileSet" value="*.c"/>
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
-
- <target name="GenTool" depends="init, Tool">
- <echo message="The EDK Tool: ${ToolName} build has completed"/>
- </target>
-
- <target name="init">
- <echo message="Building the EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR}"/>
- </target>
-
- <target name="Tool" depends="init">
- <cc name="${ToolChain}" objdir="${BUILD_DIR}"
- outfile="${BIN_DIR}/${ToolName}"
- outtype="executable"
- optimize="speed"
- debug="true">
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"
- defaultexcludes="TRUE"
- excludes="*.xml *.inf"/>
-
- <includepath path="${PACKAGE_DIR}/Include"/>
- <includepath path="${PACKAGE_DIR}/Include/${HostArch}"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- </cc>
- </target>
-
- <target name="clean">
- <echo message="Removing Intermediate Files Only"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- </delete>
- </target>
-
- <target name="cleanall">
- <echo message="Removing Object Files and the Executable: ${ToolName}${ext_exe}"/>
- <delete failonerror="false" quiet="true" includeEmptyDirs="true">
- <fileset dir="${BUILD_DIR}"/>
- <fileset file="${BIN_DIR}/${ToolName}${ext_exe}"/>
- <fileset file="${BIN_DIR}/${ToolName}.pdb"/>
- </delete>
- </target>
-
-</project>
diff --git a/Tools/CCode/Source/build.xml b/Tools/CCode/Source/build.xml
deleted file mode 100644
index 528fd7f6e3..0000000000
--- a/Tools/CCode/Source/build.xml
+++ /dev/null
@@ -1,272 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="all" basedir="." name="C_Code">
-<!-- Copyright (c) 2006, Intel Corporation -->
-<!-- Filename: Tools/Source/build.xml -->
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <property name="ReallyVerbose" value="false"/>
- <property environment="env" />
-
- <property name="WORKSPACE" value="${env.WORKSPACE}" />
- <property name="WORKSPACE_DIR" value="${WORKSPACE}" />
- <property name="PACKAGE" value="Tools" />
- <property name="PACKAGE_DIR" value="${WORKSPACE}/Tools/CCode/Source" />
- <property name="LIB_DIR" value="${PACKAGE_DIR}/Library" />
- <property name="BIN_DIR" value="${WORKSPACE}/Tools/bin" />
- <property name="BUILD_MODE" value="PACKAGE" />
- <property name="Libs"
- value="Common/build.xml CustomizedCompress/build.xml PeCoffLoader/build.xml String/build.xml"/>
-
- <import file="${WORKSPACE_DIR}/Tools/Conf/BuildMacro.xml" />
-
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
- </path>
-
- <taskdef classpathref="classpath" resource="net/sf/antcontrib/antlib.xml" />
-
-
- <target name="all" depends="initArch, init, Tools">
- <echo message="The EDK II C Tools build complete!"/>
- </target>
-
- <target name="init">
- <echo message="EDK C Code Tools, build initialization"/>
- <taskdef classpathref="classpath" resource="GenBuild.tasks" />
- <taskdef classpathref="classpath" resource="cpptasks.tasks"/>
- <typedef classpathref="classpath" resource="cpptasks.types"/>
- <mkdir dir="${BIN_DIR}" />
- <mkdir dir="${LIB_DIR}" />
-
- </target>
-
- <target name="initArch">
- <condition property="HostArch" value="X64">
- <os arch="amd64"/>
- </condition>
- <condition property="HostArch" value="Ia32">
- <or>
- <os arch="x86"/>
- <os arch="i386"/>
- </or>
- </condition>
- <condition property="HostArch" value="Ia32">
- <os arch="i386"/>
- </condition>
-
- <if>
- <os family="unix" />
- <then>
- <echo message="OS Family UNIX, ${HostArch}" />
- </then>
- <elseif>
- <os family="dos" />
- <then>
- <echo message="OS Family DOS, ${HostArch}" />
- </then>
- </elseif>
- <elseif>
- <os family="mac" />
- <then>
- <echo message="OS Family OS X, ${HostArch}" />
- </then>
- </elseif>
- <else>
- <fail message="OS Family Unsupported, ${HostArch}" />
- </else>
- </if>
-
- <if>
- <not>
- <isset property="ToolChain" />
- </not>
- <then>
- <if>
- <isset property="env.TOOL_CHAIN" />
- <then>
- <property name="ToolChain" value="${env.TOOL_CHAIN}"/>
- </then>
- <else>
- <!-- Default Tool Chain is Microsoft Visual Studio -->
- <property name="ToolChain" value="msvc"/>
- </else>
- </if>
- </then>
- </if>
-
- <if>
- <equals arg1="${ToolChain}" arg2="gcc" />
- <then>
- <exec executable="gcc" outputproperty="host.gcc.ver">
- <arg line="-E" />
- <arg line="-P" />
- <arg line="-x c" />
- <arg line="gcc.ver" />
- </exec>
- <if>
- <contains string="${host.gcc.ver}" substring="4" />
- <then>
- <property name="ExtraArgus" value="-Wno-pointer-sign" />
- </then>
- </if>
- </then>
- </if>
-
- <condition property="linux" value="true">
- <os name="Linux"/>
- </condition>
-
- <condition property="intel_win">
- <and>
- <os family="dos"/>
- <equals arg1="${ToolChain}" arg2="intel"/>
- </and>
- </condition>
-
- <condition property="intel_linux">
- <and>
- <os name="Linux"/>
- <equals arg1="${ToolChain}" arg2="intel"/>
- </and>
- </condition>
-
- <condition property="intel_mac">
- <and>
- <os family="mac"/>
- <equals arg1="${ToolChain}" arg2="intel"/>
- </and>
- </condition>
-
- <condition property="gcc">
- <and>
- <equals arg1="${ToolChain}" arg2="gcc"/>
- </and>
- </condition>
-
- <condition property="cygwin">
- <and>
- <os family="dos"/>
- <equals arg1="${ToolChain}" arg2="gcc"/>
- </and>
- </condition>
-
- <condition property="x86_64_linux">
- <and>
- <os name="Linux"/>
- <equals arg1="${HostArch}" arg2="X64"/>
- </and>
- </condition>
-
- <condition property="windows" value="true">
- <os family="Windows"/>
- </condition>
-
- <condition property="OSX" value="true">
- <os family="Mac"/>
- </condition>
-
- <condition property="cyglinux">
- <or>
- <istrue value="${linux}"/>
- <istrue value="${cygwin}"/>
- </or>
- </condition>
-
- <!-- msft is a family, used by both Microsoft and Intel Windows compiler tool chains -->
- <condition property="msft">
- <isfalse value="${gcc}"/>
- </condition>
-
- <if>
- <istrue value="${ReallyVerbose}"/>
- <then>
- <echo message="Test property msvc: ${msvc}"/>
- <echo message="Test property gcc: ${gcc}"/>
- <echo message="Test property intel_win: ${intel_win}"/>
- <echo message="Test property intel_linux: ${intel_linux}"/>
- <echo message="Test property intel_mac: ${intel_mac}"/>
- <echo message="Test property msft: ${msft}"/>
- <echo message="Test property cygwin: ${cygwin}"/>
- <echo message="Test property cyglinux: ${cyglinux}"/>
- <echo message="Test property windows: ${windows}"/>
- <echo message="Test property linux: ${linux}"/>
- <echo message="Test property OSX: ${OSX}"/>
- <echo message="Test property x86_64_linux: ${x86_64_linux}"/>
- </then>
- </if>
-
- <property name="haveLibtool" value="false"/>
- <if>
- <and>
- <not>
- <isset property="env.CYGWIN_HOME"/>
- </not>
- <isset property="cygwin"/>
- </and>
- <then>
- <fail message="You must set the environment variable: CYGWIN_HOME"/>
- </then>
- </if>
-
- <if>
- <istrue value="${gcc}"/>
- <then>
- <property name="ext_static" value=".a"/>
- <property name="ext_dynamic" value=".so"/>
- <if>
- <istrue value="${cygwin}"/>
- <then>
- <property name="ext_exe" value=".exe"/>
- </then>
- <else>
- <property name="ext_exe" value=""/>
- </else>
- </if>
- </then>
- <else>
- <property name="ext_static" value=".lib"/>
- <property name="ext_dynamic" value=".dll"/>
- <property name="ext_exe" value=".exe"/>
- </else>
- </if>
- </target>
-
- <target name="Libraries" depends="initArch, init">
- <subant target="" inheritall="true">
- <fileset dir="${PACKAGE_DIR}"
- includes="${Libs}"/>
- </subant>
- </target>
-
- <target name="Tools" depends="Libraries">
- <subant target="" inheritall="true">
- <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"
- excludes="${Libs}"/>
- </subant>
- </target>
-
- <target name="clean" depends="initArch">
- <subant target="clean" inheritall="true">
- <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"/>
- </subant>
- </target>
-
- <target name="cleanall" depends="initArch">
- <subant target="cleanall" inheritall="true">
- <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"/>
- </subant>
- <delete dir="${LIB_DIR}"/>
- </target>
-</project>
diff --git a/Tools/Conf/BuildMacro.xml b/Tools/Conf/BuildMacro.xml
deleted file mode 100644
index 2e1d6ad737..0000000000
--- a/Tools/Conf/BuildMacro.xml
+++ /dev/null
@@ -1,1466 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="common">
- <!-- for user extended tasks or macros -->
- <import file="UserExtension.xml" optional="true"/>
-
- <!--
- Macro for intialize some properties. This Macro build will be called before source file build.
- -->
- <macrodef name="Build_Init">
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <var name="OBJECTS" value="" />
- <var name="SDB_FILES" value="" />
-
- <mkdir dir="${DEST_DIR_DEBUG}"/>
- <mkdir dir="${DEST_DIR_OUTPUT}"/>
-
- <if>
- <and>
- <isset property="PCH"/>
- <not>
- <equals arg1="${PCH}" arg2=""/>
- </not>
- </and>
- <then>
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"
- TargetFile="${DEST_DIR_OUTPUT}/AutoGen.h.gch">
- <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
- <EXTRA.INC/>
- </makedeps>
-
- <OnDependency>
- <sourcefiles>
- <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
- </sourcefiles>
- <targetfiles>
- <file Name="${DEST_DIR_OUTPUT}/AutoGen.h.gch"/>
- </targetfiles>
-
- <sequential>
- <!-- Generate pre-compiled header -->
- <cc userdefine="on">
- <command type="CC" cmd="${PCH}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/AutoGen.h.obj" dpath="${CC_DPATH}" libpath="${CC_LIBPATH}"
- include="${CC_INCLUDEPATH}">
- <EXTRA.INC/>
- <argument value="${PCH_FLAGS}"/>
- <EXTRA.ARG/>
- <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/AutoGen.h"/>
- </command>
- </cc>
-
- <if>
- <equals arg1="${CC_FAMILY}" arg2="GCC"/>
- <then>
- <move file="${DEST_DIR_OUTPUT}/AutoGen.h.obj" tofile="${DEST_DIR_DEBUG}/AutoGen.h.gch" overwrite="true"/>
- </then>
- </if>
- </sequential>
- </OnDependency>
-
- <if>
- <not>
- <equals arg1="${CC_FAMILY}" arg2="GCC"/>
- </not>
- <then>
- <var name="OBJECTS" value="${OBJECTS} AutoGen.h.obj"/>
- </then>
- </if>
- </then>
- <else>
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep">
- <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
- <EXTRA.INC/>
- </makedeps>
- </else>
- </if>
- </sequential>
- </macrodef>
-
-
- <!--
- macro definitions for building files with different types
- -->
- <!--
- C Code
- -->
- <macrodef name="Build_CCode">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="c"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <var name="FILE_BASENAME" value="@{FILENAME}" />
- <var name="FILE_PATH" value="@{FILEPATH}" />
- <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
-
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
- TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
- <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- <EXTRA.INC/>
- </makedeps>
-
- <OnDependency>
- <sourcefiles>
- <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
- <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
- </sourcefiles>
- <targetfiles>
- <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
- </targetfiles>
-
- <sequential>
- <cc userdefine="on">
- <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}"
- libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
- <EXTRA.INC/>
- <argument value="${CC_FLAGS}"/>
- <EXTRA.ARG/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
- </sequential>
- </OnDependency>
- <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
- <if>
- <equals arg1="@{FILEPATH}" arg2="." />
- <then>
- <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
- </then>
- <else>
- <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
- </else>
- </if>
- </sequential>
- </macrodef>
-
-
- <macrodef name="Build_AUTOGEN">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="c"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <var name="FILE_BASENAME" value="@{FILENAME}" />
- <var name="FILE_PATH" value="@{FILEPATH}" />
- <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
-
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
- TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
- <input file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- <EXTRA.INC/>
- </makedeps>
-
- <OnDependency>
- <sourcefiles>
- <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
- <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
- </sourcefiles>
- <targetfiles>
- <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
- </targetfiles>
-
- <sequential>
- <cc userdefine="on">
- <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}"
- libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
- <EXTRA.INC/>
- <argument value="${CC_FLAGS}"/>
- <EXTRA.ARG/>
- <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
- </sequential>
- </OnDependency>
- <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
- <if>
- <equals arg1="@{FILEPATH}" arg2="." />
- <then>
- <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
- </then>
- <else>
- <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
- </else>
- </if>
- </sequential>
- </macrodef>
-
- <macrodef name="Build_DPX">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="dxs"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
-
- <sequential>
- <var name="FILE_BASENAME" value="@{FILENAME}" />
- <var name="FILE_PATH" value="@{FILEPATH}" />
- <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
-
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
- TargetFile="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex">
- <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- <EXTRA.INC/>
- </makedeps>
-
- <OnDependency>
- <sourcefiles>
- <!--file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/-->
- <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
- <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex"/>
- </targetfiles>
-
- <sequential>
- <cc userdefine="on">
- <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" dpath="${CC_DPATH}"
- libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
- <EXTRA.INC/>
- <argument value="${PP_FLAGS}"/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
-
- <gendepex inputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" outputFile="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex"/>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <macrodef name="Build_ASM">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="asm"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <!-- Dispath ASM file, there are three type.
- asm - Build_Assembly
- S - Build_Gcc_Assembly
- s - Build_Ipf_Assembly -->
- <sequential>
- <if>
- <equals arg1="@{FILEEXT}" arg2="asm" />
- <then>
- <Build_Assembly FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">
- <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>
- <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>
- </Build_Assembly>
- </then>
- <elseif>
- <equals arg1="@{FILEEXT}" arg2="S" />
- <then>
- <Build_Gcc_Assembly FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">
- <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>
- <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>
- </Build_Gcc_Assembly>
- </then>
- </elseif>
- <elseif>
- <equals arg1="@{FILEEXT}" arg2="s" />
- <then>
- <Build_IPF_Assembly_Code FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">
- <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>
- <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>
- </Build_IPF_Assembly_Code>
- </then>
- </elseif>
- </if>
- </sequential>
- </macrodef>
-
- <!--
- IA32/x64 Assembly
- -->
- <macrodef name="Build_Assembly">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="asm"/>
-
- <element name="EXTRA.INC.1" optional="yes"/>
- <element name="EXTRA.ARG.1" optional="yes"/>
-
- <sequential>
- <var name="FILE_BASENAME" value="@{FILENAME}" />
- <var name="FILE_PATH" value="@{FILEPATH}" />
- <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
-
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
- TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
- <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- <EXTRA.INC.1/>
- </makedeps>
-
- <OnDependency>
- <sourcefiles>
- <file Listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
- <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
- </sourcefiles>
- <targetfiles>
- <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
- </targetfiles>
-
- <sequential>
- <cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
- dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
- <EXTRA.INC.1/>
- <argument value="${PP_FLAGS}"/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
-
- <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"
- match="^(#line +1 +.*@{FILEPATH}/@{FILENAME}\.@{FILEEXT}&quot;).+\1"
- replace=";"
- flags="gs"/>
- <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"
- match="^(#line .*)$"
- replace="; \1"
- byline="true"/>
- <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"
- match="([^_a-zA-Z])0x([0-9a-fA-F]+)"
- replace="\10\2h"
- flags="g"
- byline="true"/>
-
- <cc userdefine="on">
- <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}"
- libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">
- <EXTRA.INC.1/>
-
- <argument value="${ASM_FLAGS}"/>
- <EXTRA.ARG.1/>
-
- <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
- </command>
- </cc>
- </sequential>
- </OnDependency>
- <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
- <if>
- <equals arg1="@{FILEPATH}" arg2="." />
- <then>
- <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
- </then>
- <else>
- <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
- </else>
- </if>
- </sequential>
- </macrodef>
-
- <!--
- Build GCC assembly code
- -->
- <macrodef name="Build_Gcc_Assembly">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="asm"/>
-
- <element name="EXTRA.INC.1" optional="yes"/>
- <element name="EXTRA.ARG.1" optional="yes"/>
-
- <sequential>
- <var name="FILE_BASENAME" value="@{FILENAME}" />
- <var name="FILE_PATH" value="@{FILEPATH}" />
- <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
-
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
- TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
- <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- <EXTRA.INC.1/>
- </makedeps>
-
- <OnDependency>
- <sourcefiles>
- <file Listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
- <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
- </sourcefiles>
- <targetfiles>
- <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
- </targetfiles>
-
- <sequential>
- <cc userdefine="on">
- <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}"
- libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">
- <EXTRA.INC.1/>
-
- <argument value="${ASM_FLAGS}"/>
- <EXTRA.ARG.1/>
-
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
- </sequential>
- </OnDependency>
- <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
- <if>
- <equals arg1="@{FILEPATH}" arg2="." />
- <then>
- <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
- </then>
- <else>
- <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
- </else>
- </if>
- </sequential>
- </macrodef>
-
- <!--
- IPF Assembly
- -->
- <macrodef name="Build_IPF_Assembly_Code">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="s"/>
-
- <element name="EXTRA.INC.1" optional="yes"/>
- <element name="EXTRA.ARG.1" optional="yes"/>
-
- <sequential>
- <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
-
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
- TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
- <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- <EXTRA.INC.1/>
- </makedeps>
-
- <OnDependency>
- <sourcefiles>
- <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
- <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
- </targetfiles>
-
- <sequential>
- <cc userdefine="on">
- <command type="PP" cmd="${APP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${APP_FAMILY}"
- dpath="${APP_DPATH}" libpath="${APP_LIBPATH}" include="${APP_INCLUDEPATH}">
- <EXTRA.INC.1/>
- <argument value="${APP_FLAGS}"/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
-
- <cc userdefine="on">
- <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
- includepathDelimiter="-I" outputDelimiter="-o" dpath="${ASM_DPATH}"
- libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
- <EXTRA.INC.1/>
- <argument value="${ASM_FLAGS}"/>
- <EXTRA.ARG.1/>
- <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
- </command>
- </cc>
- </sequential>
- </OnDependency>
- <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
- <if>
- <equals arg1="@{FILEPATH}" arg2="." />
- <then>
- <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
- </then>
- <else>
- <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
- </else>
- </if>
- </sequential>
- </macrodef>
-
-
- <!--
- Assembly the preprocessed IPF assembly code
- -->
- <macrodef name="Build_IPF_PP_Code">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="i"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
-
- <cc userdefine="on">
- <command type="ASM" includepathDelimiter="-I" dpath="${ASM_DPATH}"
- libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">
- <includepath path="${WORKSPACE_DIR}"/>
- <includepath path="${MODULE_DIR}"/>
- <includepath path="${MODULE_DIR}/${ARCH}"/>
- <EXTRA.INC/>
-
- <argument value="${ASM_FLAGS}"/>
- <EXTRA.ARG/>
- <OutputFile File="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
-
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
- </sequential>
- </macrodef>
-
-
- <!--
- Library
- -->
- <macrodef name="Build_Library">
- <attribute name="FILENAME" />
- <attribute name="FILEEXT" default="obj"/>
-
- <sequential>
- <var name="FILE_BASENAME" value="@{FILENAME}" />
- <var name="FILE_PATH" value="." />
- <mkdir dir="${BIN_DIR}"/>
-
- <if>
- <equals arg1="${OBJECTS}" arg2="" trim="true"/>
- <then>
- <fail message="No object files"/>
- </then>
- </if>
-
- <OnDependency>
- <sourcefiles>
- <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />
- </sourcefiles>
- <targetfiles>
- <file name="${BIN_DIR}/@{FILENAME}.lib"/>
- </targetfiles>
-
- <sequential>
- <cc userdefine="on">
- <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"
- outputFile="${BIN_DIR}/@{FILENAME}.lib" dpath="${SLINK_DPATH}"
- libpath="${SLINK_LIBPATH}" include="${SLINK_INCLUDEPATH}">
- <argument value="${SLINK_FLAGS}"/>
-
- <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>
- </command>
- </cc>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <!--
- Unicode -> .sdb
- -->
- <macrodef name="Build_UNI">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="uni"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
- TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb">
- <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- <EXTRA.INC/>
- </makedeps>
-
- <OnDependency>
- <sourcefiles>
- <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
- </targetfiles>
-
- <sequential>
- <strgather commandtype="parse" newdatabase="true">
- <database name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
- <EXTRA.INC/>
- <EXTRA.ARG/>
- <inputfile name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </strgather>
- </sequential>
- </OnDependency>
-
- <var name="SDB_FILES" value="${SDB_FILES}, ${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
- </sequential>
- </macrodef>
-
- <!--
- .sdb(s) -> .c, .h -> .obj
- -->
- <macrodef name="Build_Unicode_Database">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="sdb"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <var name="FILE_BASENAME" value="@{FILENAME}" />
- <var name="FILE_PATH" value="@{FILEPATH}" />
- <OnDependency>
- <sourcefiles>
- <file list="${SDB_FILES}"/>
- <file list="${SOURCE_FILES}"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
- </targetfiles>
-
- <sequential>
- <strgather commandtype="scan" outputdatabase="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb" verbose="read">
- <skipext name=".uni"/>
- <skipext name=".h"/>
- <database list="${SDB_FILES}"/>
- <inputfile name="${SOURCE_FILES}"/>
- </strgather>
- </sequential>
- </OnDependency>
-
- <OnDependency>
- <sourcefiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}StrDefs.h"/>
- <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.hpk"/>
- <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
- </targetfiles>
-
- <sequential>
- <strgather basename="@{FILENAME}Strings" commandtype="dump"
- outputdefines="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}StrDefs.h"
- outputhpk="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.hpk"
- outputstring="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c">
- <database name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
- </strgather>
- </sequential>
- </OnDependency>
-
- <OnDependency>
- <sourcefiles>
- <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
- <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj"/>
- </targetfiles>
-
- <sequential>
- <cc userdefine="on">
- <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- includepathDelimiter="-I" dpath="${CC_DPATH}"
- libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj">
- <argument value="${CC_FLAGS}"/>
- <EXTRA.INC />
- <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
- </command>
- </cc>
- </sequential>
- </OnDependency>
-
- <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
- <if>
- <equals arg1="@{FILEPATH}" arg2="." />
- <then>
- <var name="OBJECTS" value="${OBJECTS} @{FILENAME}Strings.obj" />
- </then>
- <else>
- <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}Strings.obj" />
- </else>
- </if>
- </sequential>
- </macrodef>
-
- <!--
- Vfr
- -->
- <macrodef name="Build_VFR">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="vfr"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <mkdir dir="${DEST_DIR_DEBUG}/@{FILEPATH}"/>
-
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
- TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
- <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- <EXTRA.INC/>
- </makedeps>
-
- <OnDependency>
- <sourcefiles>
- <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
- <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
- </targetfiles>
-
- <sequential>
- <!-- if "TOOLCHIAN FAMILY" is "GCC", it should point the ouput file for preprocess compiler -->
- <if>
- <equals arg1="${CC_FAMILY}" arg2="GCC"/>
- <then>
- <cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
- dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
- <argument value="${VFRPP_FLAGS} -o ${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
- <!-- Output file of the preprocess -->
- <EXTRA.INC/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
- </then>
- <else>
- <cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
- dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
- <argument value="${VFRPP_FLAGS}"/>
- <!-- Output file of the preprocess -->
- <EXTRA.INC/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
- </else>
- </if>
-
- <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i">
- <EXTRA.INC/>
- </vfrcompile>
-
- <cc userdefine="on">
- <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}"
- includepathDelimiter="-I" family="${CC_FAMILY}" dpath="${CC_DPATH}"
- libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" >
- <argument value="${CC_FLAGS}"/>
- <EXTRA.INC/>
- <EXTRA.ARG/>
- <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.c"/>
- </command>
- </cc>
- </sequential>
- </OnDependency>
- <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
- <if>
- <equals arg1="@{FILEPATH}" arg2="." />
- <then>
- <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
- </then>
- <else>
- <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
- </else>
- </if>
- </sequential>
- </macrodef>
-
- <!--
- Build the real mode ASM file
- -->
- <macrodef name="Build_RealAsm">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="asm"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <OnDependency>
- <sourcefiles>
- <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.cat"/>
- </targetfiles>
-
- <sequential>
- <exec dir="${DEST_DIR_OUTPUT}" executable="${ASM}" failonerror="true">
- <arg line="/nologo /omf ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT} /Bl${ASMLINK} ${ASMLINK_FLAGS}"/>
- </exec>
- <concat destfile="${DEST_DIR_OUTPUT}/@{FILENAME}.cat" binary="yes">
- <filelist dir="${MODULE_DIR}" files="Blank2.pad"/>
- <filelist dir="${DEST_DIR_OUTPUT}" files="@{FILENAME}.com"/>
- </concat>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <!--
- Build Asl table file
- -->
- <macrodef name="Build_ASL">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="asl"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <mkdir dir="${DEST_DIR_OUTPUT}"/>
-
- <OnDependency>
- <sourcefiles>
- <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
- </targetfiles>
-
- <sequential>
- <cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}" family="${PP_FAMILY}"
- dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
- <argument value="${APP_FLAGS}"/>
- <EXTRA.INC/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
-
- <exec dir="${DEST_DIR_OUTPUT}" executable="${ASL}" failonerror="true" outputproperty="ASL_OUTPUT">
- <arg line="${DEST_DIR_OUTPUT}/@{FILENAME}.i"/>
- </exec>
-
- <if>
- <or>
- <contains string="${ASL_OUTPUT}" substring="Supports ACPI Specification Revision 2.0"/>
- <contains string="${ASL_OUTPUT}" substring="Supports ACPI Specification Revision 1.0"/>
- </or>
- <then>
- <fail message="Current Asl tool not support Acpi Spec 3.0. Pls update your Asl compiler."/>
- </then>
- </if>
-
- <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="aml"/>
-
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <!--
- Build Asl table c file
- -->
- <macrodef name="Build_CCASL">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="c"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <mkdir dir="${DEST_DIR_OUTPUT}"/>
-
- <OnDependency>
- <sourcefiles>
- <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
- </targetfiles>
-
- <sequential>
-
- <cc userdefine="on">
- <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.obj" dpath="${CC_DPATH}"
- libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
- <EXTRA.INC/>
- <argument value="${CC_FLAGS}"/>
- <EXTRA.ARG/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </command>
- </cc>
-
- <cc userdefine="on">
- <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" dpath="${DLINK_DPATH}" >
- <argument value="${SLINK_FLAGS}"/>
- <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILENAME}.obj"/>
- </command>
- </cc>
-
- <genacpitable inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.acpi" />
-
- <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="acpi"/>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
- <!--
- Build ACPI Bin File
- -->
- <macrodef name="Build_ACPIBIN">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="bin"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <mkdir dir="${DEST_DIR_OUTPUT}"/>
-
- <OnDependency>
- <sourcefiles>
- <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
- </targetfiles>
-
- <sequential>
- <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" tofile="${DEST_DIR_OUTPUT}/@{FILENAME}.acpi" />
-
- <exec executable="attrib">
- <arg line="-r ${DEST_DIR_OUTPUT}/@{FILENAME}.acpi"/>
- </exec>
-
- <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="acpi"/>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <!--
- DUMMY - for skipping the source file which should not be built
- -->
- <macrodef name="Build_DUMMY">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <!--echo message="Ignoring ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" level="info" /-->
- </sequential>
- </macrodef>
-
- <!--
- Generate efi file
- -->
- <macrodef name="GenEfi">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="efi"/>
-
- <element name="LIB.ARG" optional="yes"/>
- <element name="LINK.ARG" optional="yes"/>
-
- <sequential>
- <var name="FILE_BASENAME" value="@{FILENAME}" />
- <var name="FILE_PATH" value="@{FILEPATH}" />
- <OnDependency>
- <sourcefiles>
- <file list="${LIBS}"/>
- <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_DEBUG}/@{FILENAME}.efi"/>
- </targetfiles>
-
- <sequential>
- <!-- Generate a temporary lib file for object files -->
- <cc userdefine="on">
- <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}" dpath="${SLINK_DPATH}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}Local.lib"
- libpath="${SLINKLIBPATH}" include="${SLINK_INCLUDEPATH}">
- <argument value="${SLINK_FLAGS}"/>
-
- <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>
- </command>
- </cc>
-
- <!-- Link the temporary lib file with dependent libraries -->
- <cc userdefine="on">
- <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
- outputFile="${DEST_DIR_DEBUG}/@{FILENAME}.dll" dpath="${DLINK_DPATH}"
- libpath="${DLINK_LIBPATH}" include="${DLINK_INCLUDEPATH}">
- <argument value="${DLINK_FLAGS}"/>
- <libset libs="${DEST_DIR_OUTPUT}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>
- <LINK.ARG/>
- </command>
- </cc>
-
- <!-- Convert the dll file to efi file -->
- <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
- peImage="${DEST_DIR_DEBUG}/@{FILENAME}.dll" time="0"/>
-
- <!-- Copy the efi file to BIN and OUTPUT directory -->
- <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
- <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
- <if>
- <available file="${DEST_DIR_DEBUG}/@{FILENAME}.map" />
- <then>
- <copy file="${DEST_DIR_DEBUG}/@{FILENAME}.map" tofile="${BIN_DIR}/@{FILENAME}.map" />
- </then>
- </if>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <!--
- Binary
- -->
- <macrodef name="Build_Binary">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="bin"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
- </sequential>
- </macrodef>
-
- <!--
- Microcode
- -->
- <macrodef name="Build_MICROCODE">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="TXT"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <mkdir dir="${TARGET_DIR}/Microcode"/>
- <flashmap MCIFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" MCOFILE="${TARGET_DIR}/Microcode/@{FILENAME}.bin"/>
- </sequential>
- </macrodef>
-
- <!--
- Graphics (bmp, ...)
- -->
- <macrodef name="Build_BMP">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="bmp"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
- </sequential>
- </macrodef>
-
- <!--
- build EFI file
- -->
- <macrodef name="Build_EFI">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="efi"/>
-
- <element name="EXTRA.INC" optional="yes"/>
- <element name="EXTRA.ARG" optional="yes"/>
-
- <sequential>
- <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
- <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
- </sequential>
- </macrodef>
-
- <!--
- Build macro for Apriori
- -->
- <macrodef name="Build_Apriori">
- <attribute name="FILEPATH" default="."/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="apr"/>
- <attribute name="GUID"/>
-
- <sequential>
- <mkdir dir="${FV_DIR}/Apriori" />
- <gensection inputfile="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- outputfile="${FV_DIR}/Apriori/@{FILENAME}.sec"
- sectiontype="EFI_SECTION_RAW"/>
-
- <genffsfile BaseName="@{FILENAME}" ffsATTRIBCHECKSUM="TRUE" ffsFILETYPE="EFI_FV_FILETYPE_FREEFORM"
- fileGuid="@{GUID}" moduleType="BASE" outputDir="${FV_DIR}">
- <sectFile fileName="${FV_DIR}/Apriori/@{FILENAME}.sec"/>
- </genffsfile>
-
- </sequential>
- </macrodef>
-
-<!--############################################################################
- Build Sections
-#############################################################################-->
- <!--
- EFI_SECTION_TE
- -->
-
- <macrodef name="EFI_SECTION_TE">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="efi" />
-
- <element name="PRE.PROCESS" optional="yes"/>
- <element name="POST.PROCESS" optional="yes"/>
-
- <sequential>
- <OnDependency>
- <sourcefiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"/>
- </targetfiles>
-
- <sequential>
- <PRE.PROCESS/>
-
- <genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
- sectiontype="EFI_SECTION_TE"/>
-
- <POST.PROCESS/>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <!--
- EFI_SECTION_PE32
- -->
- <macrodef name="EFI_SECTION_PE32">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="efi"/>
-
- <element name="PRE.PROCESS" optional="yes"/>
- <element name="POST.PROCESS" optional="yes"/>
-
- <sequential>
- <OnDependency>
- <sourcefiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"/>
- </targetfiles>
-
- <sequential>
- <PRE.PROCESS/>
-
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
- sectiontype="EFI_SECTION_PE32"/>
-
- <POST.PROCESS/>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <!--
- EFI_SECTION_VERSION
- -->
- <macrodef name="EFI_SECTION_VERSION">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="" />
- <attribute name="VERSION" default="0000"/>
-
- <element name="PRE.PROCESS" optional="yes"/>
- <element name="POST.PROCESS" optional="yes"/>
-
- <sequential>
- <if>
- <not>
- <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"/>
- </not>
-
- <then>
- <PRE.PROCESS/>
- <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
- versionnum="@{VERSION}"
- sectiontype="EFI_SECTION_VERSION"/>
- <POST.PROCESS/>
- </then>
- </if>
- </sequential>
- </macrodef>
-
- <!--
- EFI_SECTION_USER_INTERFACE
- -->
- <macrodef name="EFI_SECTION_USER_INTERFACE">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="" />
- <attribute name="UI" default="${BASE_NAME}"/>
-
- <element name="PRE.PROCESS" optional="yes"/>
- <element name="POST.PROCESS" optional="yes"/>
-
- <sequential>
- <if>
- <not>
- <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"/>
- </not>
-
- <then>
- <PRE.PROCESS/>
- <gensection interfacestring="@{UI}"
- outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
- sectiontype="EFI_SECTION_USER_INTERFACE"/>
- <POST.PROCESS/>
- </then>
- </if>
- </sequential>
- </macrodef>
-
- <!--
- EFI_SECTION_DXE_DEPEX
- -->
- <macrodef name="EFI_SECTION_DXE_DEPEX">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="dxs"/>
-
- <element name="PRE.PROCESS" optional="yes"/>
- <element name="POST.PROCESS" optional="yes"/>
-
- <sequential>
- <PRE.PROCESS/>
-
- <if>
- <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
- <then>
- <OnDependency>
- <sourcefiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
- </targetfiles>
- <sequential>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
- sectiontype="EFI_SECTION_DXE_DEPEX"/>
- </sequential>
- </OnDependency>
- </then>
- <else>
- <if>
- <not>
- <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
- </not>
- <then>
- <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
- </then>
- </if>
- </else>
- </if>
-
- <POST.PROCESS/>
- </sequential>
- </macrodef>
-
- <!--
- EFI_SECTION_PEI_DEPEX
- -->
- <macrodef name="EFI_SECTION_PEI_DEPEX">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="dxs"/>
-
- <element name="PRE.PROCESS" optional="yes"/>
- <element name="POST.PROCESS" optional="yes"/>
- <sequential>
- <PRE.PROCESS/>
- <if>
- <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
- <then>
- <OnDependency>
- <sourcefiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
- </targetfiles>
-
- <sequential>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
- sectiontype="EFI_SECTION_PEI_DEPEX"/>
- </sequential>
- </OnDependency>
-
- </then>
- <else>
- <if>
- <not>
- <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
- </not>
- <then>
- <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
- </then>
- </if>
- </else>
- </if>
- <POST.PROCESS/>
- </sequential>
- </macrodef>
-
-
- <!--
- EFI_SECTION_RAW
- -->
- <macrodef name="EFI_SECTION_RAW">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="bin"/>
-
- <element name="PRE.PROCESS" optional="yes"/>
- <element name="POST.PROCESS" optional="yes"/>
-
- <sequential>
- <OnDependency>
- <sourcefiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
- </targetfiles>
-
- <sequential>
- <PRE.PROCESS/>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
- sectiontype="EFI_SECTION_RAW"/>
- <POST.PROCESS/>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <!--
- EFI_SECTION_RAW_SEC
- -->
- <macrodef name="EFI_SECTION_RAW_SEC">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="cat"/>
-
- <element name="PRE.PROCESS" optional="yes"/>
- <element name="POST.PROCESS" optional="yes"/>
-
- <sequential>
- <OnDependency>
- <sourcefiles>
- <file name="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"/>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.te"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
- </targetfiles>
-
- <sequential>
- <PRE.PROCESS/>
- <secfixup secexefile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" resetvectorDatafile="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"/>
-
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
- sectiontype="EFI_SECTION_RAW"/>
- <POST.PROCESS/>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
- <!--
- EFI_SECTION_FIRMWARE_VOLUME_IMAGE
- -->
- <macrodef name="EFI_SECTION_FIRMWARE_VOLUME_IMAGE">
- <attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
- <attribute name="FILEEXT" default="fv"/>
-
- <element name="PRE.PROCESS" optional="yes"/>
- <element name="POST.PROCESS" optional="yes"/>
-
- <sequential>
- <OnDependency>
- <sourcefiles>
- <file name="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
- </sourcefiles>
- <targetfiles>
- <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"/>
- </targetfiles>
-
- <sequential>
- <PRE.PROCESS/>
-
- <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- overwrite="true"/>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
- sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
-
- <POST.PROCESS/>
- </sequential>
- </OnDependency>
- </sequential>
- </macrodef>
-
-</project>
diff --git a/Tools/Conf/FrameworkDatabase.template b/Tools/Conf/FrameworkDatabase.template
deleted file mode 100644
index 13194252b3..0000000000
--- a/Tools/Conf/FrameworkDatabase.template
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<FrameworkDatabase xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <FdbHeader>
- <DatabaseName>FrameworkDatabase</DatabaseName>
- <GuidValue>5ce32c23-6448-43ab-b509-a9deae3aae65</GuidValue>
- <Version>0.5</Version>
- <Abstract>The Framework Module Development Packaging System Database</Abstract>
- <Description>This Database tracks all packages and platforms installed in this workspace.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </FdbHeader>
- <PackageList>
- <Filename>OldMdePkg/MdePkg.spd</Filename>
- <Filename>Tools/Tools.spd</Filename>
- <!--<Filename>Tools/Java/JavaTools.spd</Filename>-->
- <Filename>EdkModulePkg/EdkModulePkg.spd</Filename>
- <Filename>EdkNt32Pkg/EdkNt32Pkg.spd</Filename>
- <Filename>EdkFatBinPkg/EdkFatBinPkg.spd</Filename>
- <Filename>EdkShellBinPkg/EdkShellBinPkg.spd</Filename>
- <Filename>EdkUnixPkg/EdkUnixPkg.spd</Filename>
- </PackageList>
- <PlatformList>
- <Filename>OldMdePkg/MdePkg.fpd</Filename>
- <Filename>EdkModulePkg/EdkModulePkg.fpd</Filename>
- <Filename>EdkNt32Pkg/Nt32.fpd</Filename>
- <Filename>EdkUnixPkg/Unix.fpd</Filename>
- </PlatformList>
- <FarList>
- <Filename FarGuid="91062dfe-0bce-45b1-b3ad-3387d8d29d3f">Dummy</Filename>
- </FarList>
-</FrameworkDatabase>
diff --git a/Tools/Conf/Migration/Guid.csv b/Tools/Conf/Migration/Guid.csv
deleted file mode 100644
index 5816a8e060..0000000000
--- a/Tools/Conf/Migration/Guid.csv
+++ /dev/null
@@ -1,102 +0,0 @@
-Name,R8.5 Cname,R9 Cname,Guid Value,Package
-GenericPlatformVariable,gEfiGenericVariableGuid,gEfiGenericPlatformVariableGuid,59d1c24f-50f1-401a-b101-f33e0daed443,MdeModulePkg
-Apriori,gAprioriGuid,gAprioriGuid,FC510EE7-FFDC-11D4-BD41-0080C73C8881,MdePkg
-BootObjectAuthorizationParmset,gBootObjectAuthorizationParmsetGuid,gBootObjectAuthorizationParmsetGuid,EDD35E31-07B9-11D2-83A3-00A0C91FADCF,MdePkg
-Acpi10Table,gEfiAcpi10TableGuid,gEfiAcpi10TableGuid,EB9D2D30-2D88-11D3-9A16-0090273FC14D,MdePkg
-Acpi20Table,gEfiAcpi20TableGuid,gEfiAcpi20TableGuid,8868E871-E4F1-11D3-BC22-0080C73C8881,MdePkg
-Acpi30Table,gEfiAcpi30TableGuid,gEfiAcpi30TableGuid,8868E871-E4F1-11D3-BC22-0080C73C8881,MdePkg
-AcpiTableStorage,gEfiAcpiTableStorageGuid,gEfiAcpiTableStorageGuid,7E374E25-8E01-4FEE-87F2-390C23C606CD,MdePkg
-AuthenticationChapLocal,gEfiAuthenticationChapLocalGuid,gEfiAuthenticationChapLocalGuid,C280C73E-15CA-11DA-B0CA-001083FFCA4D,MdePkg
-AuthenticationChapRadius,gEfiAuthenticationChapRadiusGuid,gEfiAuthenticationChapRadiusGuid,D6062B50-15CA-11DA-9219-001083FFCA4D,MdePkg
-CacheSubClass,gCacheSubClassName,gEfiCacheSubClassGuid,7F0013A7-DC79-4B22-8099-11F75FDC829D,MdePkg
-Capsule,gEfiCapsuleGuid,gEfiCapsuleGuid,3B6686BD-0D76-4030-B70E-B5519E2FC5A0,MdePkg
-ConfigFileName,gEfiConfigFileNameGuid,gEfiConfigFileNameGuid,98B8D59B-E8BA-48EE-98DD-C295392F1EDB,MdePkg
-DebugImageInfoTable,gEfiDebugImageInfoTableGuid,gEfiDebugImageInfoTableGuid,49152E77-1ADA-4764-B7A2-7AFEFED95E8B,MdePkg
-DxeServicesTable,gEfiDxeServicesTableGuid,gEfiDxeServicesTableGuid,05AD34BA-6F02-4214-952E-4DA0398E2BB9,MdePkg
-EventExitBootServices,gEfiEventExitBootServicesGuid,gEfiEventExitBootServicesGuid,27ABF055-B1B8-4C26-8048-748F37BAA2DF,MdePkg
-EventLegacyBoot,gEfiEventLegacyBootGuid,gEfiEventLegacyBootGuid,2A571201-4966-47F6-8B86-F31E41F32F10,MdePkg
-EventMemoryMapChange,gEfiEventMemoryMapChangeGuid,gEfiEventMemoryMapChangeGuid,78BEE926-692F-48FD-9EDB-01422EF0D7AB,MdePkg
-EventReadyToBoot,gEfiEventReadyToBootGuid,gEfiEventReadyToBootGuid,7CE88FB3-4BD7-4679-87A8-A8D8DEE50D2B,MdePkg
-EventVirtualAddressChange,gEfiEventVirtualAddressChangeGuid,gEfiEventVirtualAddressChangeGuid,13FA7698-C831-49C7-87EA-8F43FCC25196,MdePkg
-FileInfo,gEfiFileInfoGuid,gEfiFileInfoGuid,09576E92-6D3F-11D2-8E39-00A0C969723B,MdePkg
-FileSystemInfo,gEfiFileSystemInfoGuid,gEfiFileSystemInfoGuid,09576E93-6D3F-11D2-8E39-00A0C969723B,MdePkg
-FileSystemVolumeLabelInfoId,gEfiFileSystemVolumeLabelInfoIdGuid,gEfiFileSystemVolumeLabelInfoIdGuid,DB47D7D3-FE81-11D3-9A35-0090273FC14D,MdePkg
-FirmwareFileSystem,gEfiFirmwareFileSystemGuid,gEfiFirmwareFileSystemGuid,7A9354D9-0468-444A-81CE-0BF617D890DF,MdePkg
-FirmwareVolumeTopFile,gEfiFirmwareVolumeTopFileGuid,gEfiFirmwareVolumeTopFileGuid,1BA0062E-C779-4582-8566-336AE8F78F09,MdePkg
-FrameworkDevicePath,gEfiFrameworkDevicePathGuid,gEfiFrameworkDevicePathGuid,B7084E63-46B7-4D1A-8677-E30B53DBF050,MdePkg
-GlobalVariable,gEfiGlobalVariableGuid,gEfiGlobalVariableGuid,8BE4DF61-93CA-11D2-AA0D-00E098032B8C,MdePkg
-HashAlgorithmMD5,gEfiHashAlgorithmMD5Guid,gEfiHashAlgorithmMD5Guid,0AF7C79C-65B5-4319-B0AE-44EC484E4AD7,MdePkg
-HashAlgorithmSha1,gEfiHashAlgorithmSha1Guid,gEfiHashAlgorithmSha1Guid,2AE9D80F-3FB2-4095-B7B1-E93157B946B6,MdePkg
-HashAlgorithmSha224,gEfiHashAlgorithmSha224Guid,gEfiHashAlgorithmSha224Guid,8DF01A06-9BD5-4BF7-B021-DB4FD9CCF45B,MdePkg
-HashAlgorithmSha256,gEfiHashAlgorithmSha256Guid,gEfiHashAlgorithmSha256Guid,51AA59DE-FDF2-4EA3-BC63-875FB7842EE9,MdePkg
-HashAlgorithmSha384,gEfiHashAlgorithmSha384Guid,gEfiHashAlgorithmSha384Guid,EFA96432-DE33-4DD2-AEE6-328C33DF777A,MdePkg
-HashAlgorithmSha512,gEfiHashAlgorithmSha512Guid,gEfiHashAlgorithmSha512Guid,CAA4381E-750C-4770-B870-7A23B4E42130,MdePkg
-HobList,gEfiHobListGuid,gEfiHobListGuid,7739F24C-93D7-11D4-9A3A-0090273FC14D,MdePkg
-HobMemoryAllocBspStore,gEfiHobMemoryAllocBspStoreGuid,gEfiHobMemoryAllocBspStoreGuid,564B33CD-C92A-4593-90BF-2473E43C6322,MdePkg
-HobMemoryAllocModule,gEfiHobMemoryAllocModuleGuid,gEfiHobMemoryAllocModuleGuid,F8E21975-0899-4F58-A4BE-5525A9C6D77A,MdePkg
-HobMemoryAllocStack,gEfiHobMemoryAllocStackGuid,gEfiHobMemoryAllocStackGuid,4ED4BF27-4092-42E9-807D-527B1D00C9BD,MdePkg
-MdePkgTokenSpace,gEfiMdePkgTokenSpaceGuid,gEfiMdePkgTokenSpaceGuid,914AEBE7-4635-459b-AA1C-11E219B03A10,MdePkg
-MemoryProducer,gMemoryProducerGuid,gEfiMemoryProducerGuid,772484B2-7482-4B91-9F9A-AD43F81C5881,MdePkg
-MemorySubClass,gMemorySubClassGuid,gEfiMemorySubClassGuid,4E8F4EBB-64B9-4E05-9B18-4CFE49235097,MdePkg
-MiscProducer,gMiscProducerGuid,gEfiMiscProducerGuid,62512C92-63C4-4D80-82B1-C1A4DC4480E5,MdePkg
-MiscSubClass,gMiscSubClassGuid,gEfiMiscSubClassGuid,772484B2-7482-4B91-9F9A-AD43F81C5881,MdePkg
-MpsTable,gEfiMpsTableGuid,gEfiMpsTableGuid,EB9D2D2F-2D88-11D3-9A16-0090273FC14D,MdePkg
-PartTypeLegacyMbr,gEfiPartTypeLegacyMbrGuid,gEfiPartTypeLegacyMbrGuid,024DEE41-33E7-11D3-9D69-0008C781F39F,MdePkg
-PartTypeSystemPart,gEfiPartTypeSystemPartGuid,gEfiPartTypeSystemPartGuid,C12A7328-F81F-11D2-BA4B-00A0C93EC93B,MdePkg
-PartTypeUnused,gEfiPartTypeUnusedGuid,gEfiPartTypeUnusedGuid,00000000-0000-0000-0000-000000000000,MdePkg
-PcAnsi,gEfiPcAnsiGuid,gEfiPcAnsiGuid,E0C14753-F9BE-11D2-9A0C-0090273FC14D,MdePkg
-ProcessorProducer,gProcessorProducerGuid,gEfiProcessorProducerGuid,1BF06AEA-5BEC-4A8D-9576-749B09562D30,MdePkg
-ProcessorSubClass,gProcessorSubClassName,gEfiProcessorSubClassGuid,26FDEB7E-B8AF-4CCF-AA97-02633CE48CA7,MdePkg
-SalSystemTable,gEfiSalSystemTableGuid,gEfiSalSystemTableGuid,EB9D2D32-2D88-11D3-9A16-0090273FC14D,MdePkg
-SmbiosTable,gEfiSmbiosTableGuid,gEfiSmbiosTableGuid,EB9D2D31-2D88-11D3-9A16-0090273FC14D,MdePkg
-SmmCpuIo,gEfiSmmCpuIoGuid,gEfiSmmCpuIoGuid,5F439A0B-45D8-4682-A4F4-F0576B513441,MdePkg
-SmmPeiSmramMemoryReserve,gEfiSmmPeiSmramMemoryReserve,gEfiSmmPeiSmramMemoryReserve,6DADF1D1-D4CC-4910-BB6E-82B1FD80FF3D,MdePkg
-StatusCodeDataTypeAssert,gEfiStatusCodeDataTypeAssertGuid,gEfiStatusCodeDataTypeAssertGuid,DA571595-4D99-487C-827C-2622677D3307,MdePkg
-StatusCodeDataTypeDebug,gEfiStatusCodeDataTypeDebugGuid,gEfiStatusCodeDataTypeDebugGuid,9A4E9246-D553-11D5-87E2-00062945C3B9,MdePkg
-StatusCodeDataTypeError,gEfiStatusCodeDataTypeErrorGuid,gEfiStatusCodeDataTypeErrorGuid,AB359CE3-99B3-AE18-C89D-95D3B072E19B,MdePkg
-StatusCodeDataTypeExceptionHandler,gEfiStatusCodeDataTypeExceptionHandlerGuid,gEfiStatusCodeDataTypeExceptionHandlerGuid,3BC2BD12-AD2E-11D5-87DD-00062945C3B9,MdePkg
-StatusCodeDataTypeProgressCode,gEfiStatusCodeDataTypeProgressCodeGuid,gEfiStatusCodeDataTypeProgressCodeGuid,A356AB39-35C4-35DA-B37A-F8EA9E8B36A3,MdePkg
-StatusCodeDataTypeString,gEfiStatusCodeDataTypeStringGuid,gEfiStatusCodeDataTypeStringGuid,92D11080-496F-4D95-BE7E-037488382B0A,MdePkg
-StatusCodeSpecificData,gEfiStatusCodeSpecificDataGuid,gEfiStatusCodeSpecificDataGuid,335984BD-E805-409A-B8F8-D27ECE5FF7A6,MdePkg
-VT100,gEfiVT100Guid,gEfiVT100Guid,DFA66065-B419-11D3-9A2D-0090273FC14D,MdePkg
-VT100Plus,gEfiVT100PlusGuid,gEfiVT100PlusGuid,7BAEC70B-57E0-4C76-8E87-2F9E28088343,MdePkg
-VTUTF8,gEfiVTUTF8Guid,gEfiVTUTF8Guid,AD15A0D6-8BEC-4ACF-A073-D01DE77E2D88,MdePkg
-SmmCommunicateHeader,gSmmCommunicateHeaderGuid,gSmmCommunicateHeaderGuid,F328E36C-23B6-4A95-854B-32E19534CD75,MdePkg
-GenericPlatformTokenSpace,gEfiGenericPlatformTokenSpaceGuid,gEfiGenericPlatformTokenSpaceGuid,18D15EA6-9E14-40a1-B39C-59C44DA9D891,EdkModulePkg
-EdkModulePkgTokenSpace,gEfiEdkModulePkgTokenSpaceGuid,gEfiEdkModulePkgTokenSpaceGuid,8CC4092F-F60E-46d1-B41C-1E761DF50582,EdkModulePkg
-PcdDataBaseHob,gPcdDataBaseHobGuid,gPcdDataBaseHobGuid,EA296D92-0B69-423C-8C28-33B4E0A91268,EdkModulePkg
-PcdPeiCallbackFnTable,gPcdPeiCallbackFnTableHobGuid,gPcdPeiCallbackFnTableHobGuid,C625F4B2-EA09-4675-82D7-BA3682157A14,EdkModulePkg
-PeiPeCoffLoader,gEfiPeiPeCoffLoaderGuid,gEfiPeiPeCoffLoaderGuid,D8117CFF-94A6-11D4-9A3A-0090273FC14D,EdkModulePkg
-FlashMapHob,gEfiFlashMapHobGuid,gEfiFlashMapHobGuid,B091E7D2-05A0-4198-94F0-74B7B8C55459,EdkModulePkg
-StatusCodeDataTypeString,gEfiStatusCodeDataTypeStringGuid,gEfiStatusCodeDataTypeStringGuid,92D11080-496F-4D95-BE7E-037488382B0A,EdkModulePkg
-StatusCodeDataTypeDebug,gEfiStatusCodeDataTypeDebugGuid,gEfiStatusCodeDataTypeDebugGuid,9A4E9246-D553-11D5-87E2-00062945C3B9,EdkModulePkg
-StatusCodeDataTypeAssert,gEfiStatusCodeDataTypeAssertGuid,gEfiStatusCodeDataTypeAssertGuid,DA571595-4D99-487C-827C-2622677D3307,EdkModulePkg
-StatusCodeDataTypeExceptionHandler,gEfiStatusCodeDataTypeExceptionHandlerGuid,gEfiStatusCodeDataTypeExceptionHandlerGuid,3BC2BD12-AD2E-11D5-87DD-00062945C3B9,EdkModulePkg
-StatusCodeDataTypeError,gEfiStatusCodeDataTypeErrorGuid,gEfiStatusCodeDataTypeErrorGuid,AB359CE3-99B3-AE18-C89D-95D3B072E19B,EdkModulePkg
-StatusCodeDataTypeProgressCode,gEfiStatusCodeDataTypeProgressCodeGuid,gEfiStatusCodeDataTypeProgressCodeGuid,A356AB39-35C4-35DA-B37A-F8EA9E8B36A3,EdkModulePkg
-StatusCodeSpecificData,gEfiStatusCodeSpecificDataGuid,gEfiStatusCodeSpecificDataGuid,335984BD-E805-409A-B8F8-D27ECE5FF7A6,EdkModulePkg
-SystemNvDataHob,gEfiSystemNvDataHobGuid,gEfiSystemNvDataHobGuid,D6E5092D-C7B2-4872-AF66-FDC0E6F95E78,EdkModulePkg
-SystemNvDataFv,gEfiSystemNvDataFvGuid,gEfiSystemNvDataFvGuid,FFF12B8D-7696-4C8B-A985-2747075B4F50,EdkModulePkg
-DiskInfoIde,gEfiDiskInfoIdeInterfaceGuid,gEfiDiskInfoIdeInterfaceGuid,5E948FE3-26D3-42B5-AF17-610287188DEC,EdkModulePkg
-DiskInfoScsi,gEfiDiskInfoScsiInterfaceGuid,gEfiDiskInfoScsiInterfaceGuid,08F74BAA-EA36-41D9-9521-21A70F8780BC,EdkModulePkg
-DiskInfoUsb,gEfiDiskInfoUsbInterfaceGuid,gEfiDiskInfoUsbInterfaceGuid,CB871572-C11A-47B5-B492-675EAFA77727,EdkModulePkg
-AlternateFvBlock,gEfiAlternateFvBlockGuid,gEfiAlternateFvBlockGuid,F496922D-172F-4BBC-A1EB-0EEB949C3486,EdkModulePkg
-ConsoleInDevice,gEfiConsoleInDeviceGuid,gEfiConsoleInDeviceGuid,D3B36F2B-D551-11D4-9A46-0090273FC14D,EdkModulePkg
-ConsoleOutDevice,gEfiConsoleOutDeviceGuid,gEfiConsoleOutDeviceGuid,D3B36F2C-D551-11D4-9A46-0090273FC14D,EdkModulePkg
-StandardErrorDevice,gEfiStandardErrorDeviceGuid,gEfiStandardErrorDeviceGuid,D3B36F2D-D551-11D4-9A46-0090273FC14D,EdkModulePkg
-HotPlugDevice,gEfiHotPlugDeviceGuid,gEfiHotPlugDeviceGuid,220AC432-1D43-49E5-A74F-4C9DA67AD23B,EdkModulePkg
-PrimaryStandardErrorDevice,gEfiPrimaryStandardErrorDeviceGuid,gEfiPrimaryStandardErrorDeviceGuid,5A68191B-9B97-4752-9946-E36A5DA942B1,EdkModulePkg
-PrimaryConsoleInDevice,gEfiPrimaryConsoleInDeviceGuid,gEfiPrimaryConsoleInDeviceGuid,E451DCBE-96A1-4729-A5CF-6B9C2CFF47FD,EdkModulePkg
-PrimaryConsoleOutDevice,gEfiPrimaryConsoleOutDeviceGuid,gEfiPrimaryConsoleOutDeviceGuid,62BDF38A-E3D5-492C-950C-23A7F66E672E,EdkModulePkg
-Bmp,gEfiDefaultBmpLogoGuid,gEfiDefaultBmpLogoGuid,7BB28B99-61BB-11D5-9A5D-0090273FC14D,EdkModulePkg
-BootState,gEfiBootStateGuid,gEfiBootStateGuid,60B5E939-0FCF-4227-BA83-6BBED45BC0E3,EdkModulePkg
-ShellFile,gEfiShellFileGuid,gEfiShellFileGuid,C57AD6B7-0515-40A8-9D21-551652854E37,EdkModulePkg
-MiniShellFile,gEfiMiniShellFileGuid,gEfiMiniShellFileGuid,86AD232B-D33A-465C-BF5F-41370BA92FE2,EdkModulePkg
-StatusCode,gEfiStatusCodeGuid,gEfiStatusCodeGuid,D083E94C-6560-42E4-B6D4-2DF75ADF6A2A,EdkModulePkg
-PciOptionRomTable,gEfiPciOptionRomTableGuid,gEfiPciOptionRomTableGuid,7462660F-1CBD-48DA-AD11-91717913831C,EdkModulePkg
-PciHotplugDevice,gEfiPciHotplugDeviceGuid,gEfiPciHotplugDeviceGuid,0B280816-52E7-4E51-AA57-11BD41CBEFC3,EdkModulePkg
-MemoryTypeInformation,gEfiMemoryTypeInformationGuid,gEfiMemoryTypeInformationGuid,4C19049F-4137-4DD3-9C10-8B97A83FFDFA,EdkModulePkg
-CapsuleVendor,gEfiCapsuleVendorGuid,gEfiCapsuleVendorGuid,711C703F-C285-4B10-A3B0-36ECBD3C8BE2,EdkModulePkg
-CompatibleMemoryTested,gEfiCompatibleMemoryTestedGuid,gEfiCompatibleMemoryTestedGuid,64C475EF-344B-492C-93AD-AB9EB4395004,EdkModulePkg
-PeiPerformanceHob,gPeiPerformanceHobGuid,gPeiPerformanceHobGuid,EC4DF5AF-4395-4CC9-94DE-77506D12C7B8,EdkModulePkg
-MemoryStatusCodeRecord,gMemoryStatusCodeRecordGuid,gMemoryStatusCodeRecordGuid,060CC026-4C0D-4DDA-8F41-595FEF00A502,EdkModulePkg
diff --git a/Tools/Conf/Migration/Library.csv b/Tools/Conf/Migration/Library.csv
deleted file mode 100644
index 758393fa05..0000000000
--- a/Tools/Conf/Migration/Library.csv
+++ /dev/null
@@ -1,189 +0,0 @@
-R8.5LibClass,R8.5Lib,R9Lib,R9LibClass,Package
-EfiDriverLib,EfiCopyMem,CopyMem,BaseMemoryLib,MdePkg
-EfiDriverLib,EfiSetMem,SetMem,BaseMemoryLib,MdePkg
-EfiDriverLib,EfiZeroMem,ZeroMem,BaseMemoryLib,MdePkg
-EfiDriverLib,EfiLibInstallDriverBinding,EfiLibInstallDriverBinding,UefiLib,MdePkg
-EfiDriverLib,EfiLibInstallAllDriverProtocols,EfiLibInstallAllDriverProtocols,UefiLib,MdePkg
-EfiDriverLib,EfiLibCompareLanguage,R8_EfiLibCompareLanguage,%,MdePkg
-EfiDriverLib,EfiDevicePathSize,GetDevicePathSize,DevicePathLib,MdePkg
-EfiDriverLib,EfiDuplicateDevicePath,DuplicateDevicePath,DevicePathLib,MdePkg
-EfiDriverLib,EfiAppendDevicePath,AppendDevicePath,DevicePathLib,MdePkg
-EfiDriverLib,EfiAppendDevicePathNode,AppendDevicePathNode,DevicePathLib,MdePkg
-EfiDriverLib,EfiAppendDevicePathInstance,AppendDevicePathInstance,DevicePathLib,MdePkg
-EfiDriverLib,EfiDevicePathInstance,GetNextDevicePathInstance,DevicePathLib,MdePkg
-EfiDriverLib,EfiIsDevicePathMultiInstance,IsDevicePathMultiInstance,DevicePathLib,MdePkg
-EfiDriverLib,EfiDevicePathFromHandle,DevicePathFromHandle,DevicePathLib,MdePkg
-EfiDriverLib,EfiFileDevicePath,FileDevicePath,DevicePathLib,MdePkg
-EfiDriverLib,EfiLibGetSystemConfigurationTable,EfiGetSystemConfigurationTable,UefiLib,MdePkg
-EfiDriverLib,EfiLibCreateProtocolNotifyEvent,EfiCreateProtocolNotifyEvent,UefiLib,MdePkg
-EfiDriverLib,EfiLibNamedEventListen,EfiNamedEventListen,UefiLib,MdePkg
-EfiDriverLib,EfiLibNamedEventSignal,EfiNamedEventSignal,UefiLib,MdePkg
-EfiDriverLib,EfiLibLookupUnicodeString,LookupUnicodeString,UefiLib,MdePkg
-EfiDriverLib,EfiLibAddUnicodeString,AddUnicodeString,UefiLib,MdePkg
-EfiDriverLib,EfiLibFreeUnicodeStringTable,FreeUnicodeStringTable,UefiLib,MdePkg
-EfiDriverLib,EfiLibGetSystemConfigurationTable,EfiGetSystemConfigurationTable,UefiLib,MdePkg
-EfiDriverLib,EfiAcquireLock,EfiAcquireLock,UefiLib,MdePkg
-EfiDriverLib,EfiInitializeLock,EfiInitializeLock,UefiLib,MdePkg
-EfiDriverLib,EFI_INITIALIZE_LOCK_VARIABLE,EFI_INITIALIZE_LOCK_VARIABLE,UefiLib,MdePkg
-EfiDriverLib,EfiAcquireLockOrFail,EfiAcquireLockOrFail,UefiLib,MdePkg
-EfiDriverLib,EfiReleaseLock,EfiReleaseLock,UefiLib,MdePkg
-EfiDriverLib,EfiLibAllocateCopyPool,AllocateCopyPool,MemoryAllocationLib,MdePkg
-EfiDriverLib,EfiLibAllocatePool,AllocatePool,MemoryAllocationLib,MdePkg
-EfiDriverLib,EfiLibAllocateRuntimeCopyPool,AllocateRuntimeCopyPool,MemoryAllocationLib,MdePkg
-EfiDriverLib,EfiLibAllocateRuntimePool,AllocateRuntimePool,MemoryAllocationLib,MdePkg
-EfiDriverLib,EfiLibAllocateRuntimeZeroPool,AllocateRuntimeZeroPool,MemoryAllocationLib,MdePkg
-EfiDriverLib,EfiLibAllocateZeroPool,AllocateZeroPool,MemoryAllocationLib,MdePkg
-EfiDriverLib,EfiLibSafeFreePool,SafeFreePool,MemoryAllocationLib,MdePkg
-EfiDriverLib,EfiCreateEventReadyToBoot,EfiCreateEventReadyToBootEx,UefiLib,MdePkg
-EfiDriverLib,EfiCreateEventLegacyBoot,EfiCreateEventLegacyBootEx,UefiLib,MdePkg
-EfiDriverLib,EfiInitializeFwVolDevicepathNode,EfiInitializeFwVolDevicepathNode,UefiLib,MdePkg
-EfiDriverLib,EfiGetNameGuidFromFwVolDevicePathNode,EfiGetNameGuidFromFwVolDevicePathNode,UefiLib,MdePkg
-EfiDriverLib,ReportStatusCodeWithDevicePath,ReportStatusCodeWithDevicePath,ReportStatusCodeLib,MdePkg
-EfiDriverLib,EFI_FIELD_OFFSET,EFI_FIELD_OFFSET,BaseLib,MdePkg
-EfiDriverLib,EFI_LIST,LIST_ENTRY,BaseLib,MdePkg
-EfiDriverLib,EFI_LIST_ENTRY,LIST_ENTRY ,BaseLib,MdePkg
-EfiDriverLib,EFI_LIST_NODE,LIST_ENTRY ,BaseLib,MdePkg
-EfiDriverLib,FLOCK,EFI_LOCK,UefiLib,MdePkg
-EfiDriverLib,GetFirstNode,GetFirstNode,BaseLib,MdePkg
-EfiDriverLib,GetNextNode,GetNextNode,BaseLib,MdePkg
-EfiDriverLib,InitializeListHead,InitializeListHead,BaseLib,MdePkg
-EfiDriverLib,INITIALIZE_LIST_HEAD_VARIABLE,INITIALIZE_LIST_HEAD_VARIABLE,BaseLib,MdePkg
-EfiDriverLib,InsertHeadList,InsertHeadList,BaseLib,MdePkg
-EfiDriverLib,InsertTailList,InsertTailList,BaseLib,MdePkg
-EfiDriverLib,IsListEmpty,IsListEmpty,BaseLib,MdePkg
-EfiDriverLib,IsNodeAtEnd,IsNodeAtEnd,BaseLib,MdePkg
-EfiDriverLib,IsNull,IsNull,BaseLib,MdePkg
-EfiDriverLib,RemoveEntryList,RemoveEntryList,BaseLib,MdePkg
-EfiDriverLib,SwapListEntries,SwapListEntries,BaseLib,MdePkg
-EfiDriverLib,GetCpuHobInfo,R8_GetCpuHobInfo,%,MdePkg
-EfiDriverLib,GetDxeCoreHobInfo,R8_GetDxeCoreHobInfo,%,MdePkg
-EfiDriverLib,GetHob,R8_GetHob,%,MdePkg
-EfiDriverLib,GetHobBootMode,R8_GetHobBootMode,%,MdePkg
-EfiDriverLib,GetHobListSize,R8_GetHobListSize,%,MdePkg
-EfiDriverLib,GetHobVersion,R8_GetHobVersion,%,MdePkg
-EfiDriverLib,GetIoPortSpaceAddressHobInfo,R8_GetIoPortSpaceAddressHobInfo,%,MdePkg
-EfiDriverLib,GetNextFirmwareVolumeHob,R8_GetNextFirmwareVolumeHob,%,MdePkg
-EfiDriverLib,GetNextGuidHob,R8_GetNextGuidHob,%,MdePkg
-EfiDriverLib,GetPalEntryHobInfo,R8_GetPalEntryHobInfo,%,MdePkg
-EfiCommonLib,ASPrint,AsciiSPrint,PrintLib,MdePkg
-EfiCommonLib,AvSPrint,AsciiVSPrint,PrintLib,MdePkg
-EfiCommonLib,BufToHexString,R8_BufToHexString,%,MdePkg
-EfiCommonLib,CHARACTER_NUMBER_FOR_VALUE,MAXIMUM_VALUE_CHARACTERS,PrintLib,MdePkg
-EfiCommonLib,CodeTypeToPostCode,CodeTypeToPostCode,ReportStatusCodeLib,MdePkg
-EfiCommonLib,COMMA_TYPE,COMMA_TYPE,PrintLib,MdePkg
-EfiCommonLib,DivU64x32,DivU64x64Remainder,BaseLib,MdePkg
-EfiCommonLib,EfiAsciiStrCpy,AsciiStrCpy,BaseLib,MdePkg
-EfiCommonLib,EfiAsciiStrLen,AsciiStrLen,BaseLib,MdePkg
-EfiCommonLib,EfiAsciiStrCmp,AsciiStrCmp,BaseLib,MdePkg
-EfiCommonLib,EfiCommonIoRead,n/a,n/a,MdePkg
-EfiCommonLib,EfiCommonIoWrite,n/a,n/a,MdePkg
-EfiCommonLib,EfiCommonLibCopyMem,CopyMem,BaseMemoryLib,MdePkg
-EfiCommonLib,EfiCommonLibSetMem,SetMem,BaseMemoryLib,MdePkg
-EfiCommonLib,EfiCommonLibZeroMem,ZeroMem,BaseMemoryLib,MdePkg
-EfiCommonLib,EfiCommonPciRead,n/a,n/a,MdePkg
-EfiCommonLib,EfiCommonPciWrite,n/a,n/a,MdePkg
-EfiCommonLib,EfiCompareGuid,CompareGuid,BaseMemoryLib,MdePkg
-EfiCommonLib,EfiCompareMem,CompareMem,BaseMemoryLib,MdePkg
-EfiCommonLib,EfiConstructStatusCodeData,n/a,n/a,MdePkg
-EfiCommonLib,EfiDebugAssertWorker,n/a,n/a,MdePkg
-EfiCommonLib,EfiDebugVPrintWorker,n/a,n/a,MdePkg
-EfiCommonLib,EfiInitializeCommonDriverLib,n/a,n/a,MdePkg
-EfiCommonLib,EfiLibGetSystemConfigurationTable,EfiGetSystemConfigurationTable,UefiLib,MdePkg
-EfiCommonLib,EfiAsciiStrSize,AsciiStrSize,BaseLib,MdePkg
-EfiCommonLib,EfiStrCat,StrCat,BaseLib,MdePkg
-EfiCommonLib,EfiStrCmp,StrCmp,BaseLib,MdePkg
-EfiCommonLib,EfiStrCpy,StrCpy,BaseLib,MdePkg
-EfiCommonLib,EfiStrLen,StrLen,BaseLib,MdePkg
-EfiCommonLib,EfiStrnCmp,StrnCmp,BaseLib,MdePkg
-EfiCommonLib,EfiStrSize,StrSize,BaseLib,MdePkg
-EfiCommonLib,EfiStrStr,StrStr,BaseLib,MdePkg
-EfiCommonLib,EfiStrTrim,R8_EfiStrTrim,%,MdePkg
-EfiCommonLib,EfiValueToHexStr,R8_EfiValueToHexStr,%,MdePkg
-EfiCommonLib,EFI_ALIGN,ALIGN_POINTER,BaseLib,MdePkg
-EfiCommonLib,GetPowerOfTwo,GetPowerOfTwo64,BaseLib,MdePkg
-EfiCommonLib,HexStringToBuf,R8_HexStringToBuf,%,MdePkg
-EfiCommonLib,IsHexDigit,R8_IsHexDigit,%,MdePkg
-EfiCommonLib,LEFT_JUSTIFY,n/a,n/a,MdePkg
-EfiCommonLib,Log2,(UINT8)HighBitSet64,BaseLib,MdePkg
-EfiCommonLib,LONG_TYPE,n/a,n/a,MdePkg
-EfiCommonLib,LShiftU64,LShiftU64,BaseLib,MdePkg
-EfiCommonLib,MultU64x32,MultU64x32,BaseLib,MdePkg
-EfiCommonLib,NibbleToHexChar,R8_NibbleToHexChar,%,MdePkg
-EfiCommonLib,Power10U64,n/a,n/a,MdePkg
-EfiCommonLib,PREFIX_BLANK,n/a,n/a,MdePkg
-EfiCommonLib,PREFIX_SIGN,n/a,n/a,MdePkg
-EfiCommonLib,PREFIX_ZERO,PREFIX_ZERO,PrintLib,MdePkg
-EfiCommonLib,ReportStatusCodeExtractAssertInfo,ReportStatusCodeExtractAssertInfo,ReportStatusCodeLib,MdePkg
-EfiCommonLib,ReportStatusCodeExtractDebugInfo,ReportStatusCodeExtractDebugInfo,ReportStatusCodeLib,MdePkg
-EfiCommonLib,RShiftU64,RShiftU64,BaseLib,MdePkg
-EfiCommonLib,ASSERT,ASSERT,DebugLib,MdePkg
-EfiCommonLib,ASSERT_EFI_ERROR,ASSERT_EFI_ERROR,DebugLib,MdePkg
-EfiCommonLib,ASSERT_LOCKED,ASSERT_LOCKED,DebugLib,MdePkg
-EfiCommonLib,ASSERT_PROTOCOL_ALREADY_INSTALLED,ASSERT_PROTOCOL_ALREADY_INSTALLED,DebugLib,MdePkg
-EfiCommonLib,CR,CR,DebugLib,MdePkg
-EfiCommonLib,DEBUG,DEBUG,DebugLib,MdePkg
-EfiCommonLib,DEBUG_CODE,DEBUG_CODE,DebugLib,MdePkg
-EfiCommonLib,DEBUG_SET_MEMORY,DEBUG_CLEAR_MEMORY,DebugLib,MdePkg
-EfiCommonLib,EfiDebugAssert,DebugAssert,DebugLib,MdePkg
-EfiCommonLib,EfiDebugPrint,DebugPrint,DebugLib,MdePkg
-EfiCommonLib,EfiDebugVPrint,DebugVPrint,DebugLib,MdePkg
-EfiCommonLib,EFI_D_INIT,DEBUG_INIT,DebugLib,MdePkg
-EfiCommonLib,EFI_D_WARN,DEBUG_WARN,DebugLib,MdePkg
-EfiCommonLib,EFI_D_LOAD,DEBUG_LOAD,DebugLib,MdePkg
-EfiCommonLib,EFI_D_FS,DEBUG_FS,DebugLib,MdePkg
-EfiCommonLib,EFI_D_POOL,DEBUG_POOL,DebugLib,MdePkg
-EfiCommonLib,EFI_D_PAGE,DEBUG_PAGE,DebugLib,MdePkg
-EfiCommonLib,EFI_D_INFO,DEBUG_INFO,DebugLib,MdePkg
-EfiCommonLib,EFI_D_VARIABLE,DEBUG_VARIABLE,DebugLib,MdePkg
-EfiCommonLib,EFI_D_BM,DEBUG_BM,DebugLib,MdePkg
-EfiCommonLib,EFI_D_BLKIO,DEBUG_BLKIO,DebugLib,MdePkg
-EfiCommonLib,EFI_D_NET,DEBUG_NET,DebugLib,MdePkg
-EfiCommonLib,EFI_D_UNDI,DEBUG_UNDI,DebugLib,MdePkg
-EfiCommonLib,EFI_D_LOADFILE,DEBUG_LOADFILE,DebugLib,MdePkg
-EfiCommonLib,EFI_D_EVENT,DEBUG_EVENT,DebugLib,MdePkg
-EfiCommonLib,EFI_D_ERROR,DEBUG_ERROR,DebugLib,MdePkg
-EfiCommonLib,EFI_D_GENERIC,(DEBUG_ERROR | DEBUG_INIT | DEBUG_WARN | DEBUG_INFO | DEBUG_BLKIO | DEBUG_NET | DEBUG_UNDI),DebugLib,MdePkg
-EfiCommonLib,EFI_D_INTRINSIC,(DEBUG_EVENT | DEBUG_POOL | DEBUG_PAGE | DEBUG_LOAD | DEBUG_BM | DEBUG_VARIABLE),DebugLib,MdePkg
-EfiCommonLib,EFI_D_RESERVED,((DEBUG_ERROR | DEBUG_INIT | DEBUG_WARN | DEBUG_INFO | DEBUG_BLKIO | DEBUG_NET | DEBUG_UNDI) | (DEBUG_EVENT | DEBUG_POOL | DEBUG_PAGE | DEBUG_LOAD | DEBUG_BM | DEBUG_VARIABLE)),DebugLib,MdePkg
-EfiCommonLib,EFI_DBUG_MASK,DEBUG_ERROR,DebugLib,MdePkg
-EfiPrintLib,VSPrint,UnicodeVSPrint,PrintLib,MdePkg
-EfiPrintLib,SPrint,UnicodeSPrint,PrintLib,MdePkg
-PeiLib,ASPrint,AsciiSPrint,PrintLib,MdePkg
-PeiLib,AvSPrint,AsciiVSPrint,PrintLib,MdePkg
-PeiLib,CompareGuid,CompareGuid,BaseMemoryLib,MdePkg
-PeiLib,CopyMem,CopyMem,BaseMemoryLib,MdePkg
-PeiLib,DivU64x32,DivU64x32Remainder ,BaseLib,MdePkg
-PeiLib,FindFv,n/a,n/a,MdePkg
-PeiLib,GetNativeCpuIo,n/a,n/a,MdePkg
-PeiLib,GetTimerValue,n/a,n/a,MdePkg
-PeiLib,InstallEfiDecompress,n/a,n/a,MdePkg
-PeiLib,InstallEfiPeiPeCoffLoader,n/a,n/a,MdePkg
-PeiLib,InstallEfiPeiPeCoffLoader64,n/a,n/a,MdePkg
-PeiLib,InstallTianoDecompress,n/a,n/a,MdePkg
-PeiLib,LShiftU64,LShiftU64,BaseLib,MdePkg
-PeiLib,MultU64x32,MultU64x32,BaseLib,MdePkg
-PeiLib,PeiBuildHobModule,BuildModuleHob#%,HobLib,MdePkg
-PeiLib,PeiBuildHobResourceDescriptor,BuildResourceDescriptorHob#%,HobLib,MdePkg
-PeiLib,PeiBuildHobGuid,R8_PeiBuildHobGuid#%,%,MdePkg
-PeiLib,PeiBuildHobGuidData,BuildGuidDataHob#%,HobLib,MdePkg
-PeiLib,PeiBuildHobFv,BuildFvHob#%,HobLib,MdePkg
-PeiLib,PeiBuildHobCpu,BuildCpuHob#%,HobLib,MdePkg
-PeiLib,PeiBuildHobStack,BuildStackHob#%,HobLib,MdePkg
-PeiLib,PeiBuildHobBspStore,BuildBspStoreHob#%,HobLib,MdePkg
-PeiLib,PeiBuildHobMemoryAllocation,BuildMemoryAllocationHob#%,HobLib,MdePkg
-PeiLib,PeiCopyMem,CopyMem,BaseMemoryLib,MdePkg
-PeiLib,PeiPerfMeasure,n/a,n/a,MdePkg
-PeiLib,PEI_PERF_END,n/a,n/a,MdePkg
-PeiLib,PEI_PERF_START,n/a,n/a,MdePkg
-PeiLib,RegisterNativeCpuIo,n/a,n/a,MdePkg
-PeiLib,RShiftU64,RShiftU64,BaseLib,MdePkg
-PeiLib,ZeroMem,ZeroMem,BaseMemoryLib,MdePkg
-PeiLib,PeiDebugAssert,DebugAssert#%,DebugLib,MdePkg
-PeiLib,PeiDebugPrint,DebugPrint#%,DebugLib,MdePkg
-PeiLib,ASSERT_PEI_ERROR,ASSERT_EFI_ERROR#%,DebugLib,MdePkg
-PeiLib,PEI_ASSERT,ASSERT#%,DebugLib,MdePkg
-PeiLib,PEI_ASSERT_LOCKED,ASSERT_LOCKED#%,UefiLib,MdePkg
-PeiLib,PEI_CR,CR,DebugLib,MdePkg
-PeiLib,PEI_DEBUG,DEBUG#%%,DebugLib,MdePkg
-PeiLib,PEI_DEBUG_CODE,DEBUG_CODE#%%,DebugLib,MdePkg
-PeiLib,PEI_DEBUG_SET_MEMORY,DEBUG_CLEAR_MEMORY,DebugLib,MdePkg
diff --git a/Tools/Conf/Migration/Macro.csv b/Tools/Conf/Migration/Macro.csv
deleted file mode 100644
index 71c70b5c8c..0000000000
--- a/Tools/Conf/Migration/Macro.csv
+++ /dev/null
@@ -1,178 +0,0 @@
-R8.5 Name,R9 Name,Package
-MEDIA_FV_DP,MEDIA_PIWG_FW_VOL_DP,MdePkg
-MEDIA_FV_FILEPATH_DP,MEDIA_PIWG_FW_FILE_DP,MdePkg
-BBS_TYPE_DEV,BBS_TYPE_BEV,MdePkg
-BOOT_OBJECT_AUTHORIZATION_PARMSET_GUIDVALUE,BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID,MdePkg
-CONTROLLER_DEVICE_PATH.Controller,CONTROLLER_DEVICE_PATH.ControllerNumber,MdePkg
-EFI_FX_SAVE_STATE,EFI_FX_SAVE_STATE_IA32,MdePkg
-EFI_VOLUME_OPEN,EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME,MdePkg
-PXE_CPB_START,PXE_CPB_START_30,MdePkg
-PEI_CPU_IO_PPI_GUID,EFI_PEI_CPU_IO_PPI_INSTALLED_GUID,MdePkg
-PEI_PCI_CFG_PPI_GUID,EFI_PEI_PCI_CFG_PPI_INSTALLED_GUID,MdePkg
-EFI_INTERNAL_FUNCTION,0x0,MdePkg
-EFI_INTERNAL_POINTER,0x0,MdePkg
-EFI_IPF_GP_POINTER,0x0,MdePkg
-EFI_TPL_DRIVER,EFI_TPL_APPLICATION,MdePkg
-EFI_ACPI_TABLE_GUID,EFI_ACPI_10_TABLE_GUID,MdePkg
-EFI_ACPI_20_TABLE_GUID,EFI_ACPI_TABLE_GUID,MdePkg
-EFI_GLOBAL_VARIABLE_GUID,EFI_GLOBAL_VARIABLE,MdePkg
-EFI_MPS_TABLE_GUID,MPS_TABLE_GUID,MdePkg
-EFI_SAL_SYSTEM_TABLE_GUID,SAL_SYSTEM_TABLE_GUID,MdePkg
-EFI_SMBIOS_TABLE_GUID,SMBIOS_TABLE_GUID,MdePkg
-EFI_EBC_INTERPRETER_PROTOCOL_GUID,EFI_EBC_PROTOCOL_GUID,MdePkg
-EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID_GUID,EFI_FILE_SYSTEM_VOLUME_LABEL_ID,MdePkg
-EFI_LOADED_IMAGE_INFORMATION_REVISION,EFI_LOADED_IMAGE_PROTOCOL_REVISION,MdePkg
-LOAD_FILE_PROTOCOL_GUID,EFI_LOAD_FILE_PROTOCOL_GUID,MdePkg
-EFI_PXE_BASE_CODE_INTERFACE_REVISION,EFI_PXE_BASE_CODE_PROTOCOL_REVISION,MdePkg
-EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION,EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION,MdePkg
-SERIAL_IO_INTERFACE_REVISION,EFI_SERIAL_IO_PROTOCOL_REVISION,MdePkg
-EFI_FILE_HANDLE_REVISION,EFI_FILE_PROTOCOL_REVISION,MdePkg
-EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID,EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID,MdePkg
-EFI_SIMPLE_TEXT_IN_PROTOCOL,EFI_SIMPLE_TEXT_INPUT_PROTOCOL,MdePkg
-EFI_SIMPLE_TEXT_OUT_PROTOCOL,EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL,MdePkg
-EFI_OPTIONAL_POINTER,EFI_OPTIONAL_PTR,MdePkg
-PXE_FRAME_TYPE_MULTICAST,PXE_FRAME_TYPE_FILTERED_MULTICAST,MdePkg
-EFI_IMAGE_MACHINE_IA32,IMAGE_FILE_MACHINE_I386,MdePkg
-EFI_IMAGE_MACHINE_IA64,IMAGE_FILE_MACHINE_IA64,MdePkg
-EFI_IMAGE_MACHINE_EBC,IMAGE_FILE_MACHINE_EBC,MdePkg
-EFI_IMAGE_MACHINE_X64,IMAGE_FILE_MACHINE_X64,MdePkg
-EFI_TEXT_OUTPUT_STRING,EFI_TEXT_STRING,MdePkg
-EFI_EVENT_TIMER,EVT_TIMER,MdePkg
-EFI_EVENT_RUNTIME,EVT_RUNTIME,MdePkg
-EFI_EVENT_NOTIFY_WAIT,EVT_NOTIFY_WAIT,MdePkg
-EFI_EVENT_NOTIFY_SIGNAL,EVT_NOTIFY_SIGNAL,MdePkg
-EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,EVT_SIGNAL_EXIT_BOOT_SERVICES,MdePkg
-EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,MdePkg
-EFI_TPL_APPLICATION,TPL_APPLICATION,MdePkg
-EFI_TPL_CALLBACK,TPL_CALLBACK,MdePkg
-EFI_TPL_NOTIFY,TPL_NOTIFY,MdePkg
-EFI_TPL_HIGH_LEVEL,TPL_HIGH_LEVEL,MdePkg
-UEFI_2_00_SYSTEM_TABLE_REVISION,EFI_2_00_SYSTEM_TABLE_REVISION,MdePkg
-PEI_STATUS_CODE_PPI_GUID,EFI_PEI_REPORT_PROGRESS_CODE_PPI_GUID,MdePkg
-PEI_STATUS_CODE_PPI,EFI_PEI_PROGRESS_CODE_PPI,MdePkg
-PEI_REPORT_STATUS_CODE,EFI_PEI_REPORT_STATUS_CODE,MdePkg
-PEI_BOOT_IN_RECOVERY_MODE_PEIM_PPI,EFI_PEI_BOOT_IN_RECOVERY_MODE_PEIM_PPI,MdePkg
-PEI_CPU_IO_PPI,EFI_PEI_CPU_IO_PPI,MdePkg
-PEI_CPU_IO_PPI_WIDTH,EFI_ PEI_CPU_IO_PPI_WIDTH,MdePkg
-PEI_CPU_IO_PPI_ACCESS,EFI_PEI_CPU_IO_PPI_ACCESS,MdePkg
-PEI_CPU_IO_PPI_IO_MEM,EFI_PEI_CPU_IO_PPI_IO_MEM,MdePkg
-PEI_CPU_IO_PPI_IO_READ8,EFI_PEI_CPU_IO_PPI_IO_READ8,MdePkg
-PEI_CPU_IO_PPI_IO_READ16,EFI_PEI_CPU_IO_PPI_IO_READ16,MdePkg
-PEI_CPU_IO_PPI_IO_READ32,EFI_PEI_CPU_IO_PPI_IO_READ32,MdePkg
-PEI_CPU_IO_PPI_IO_READ64,EFI_PEI_CPU_IO_PPI_IO_READ64,MdePkg
-PEI_CPU_IO_PPI_IO_WRITE8,EFI_PEI_CPU_IO_PPI_IO_WRITE8,MdePkg
-PEI_CPU_IO_PPI_IO_WRITE16,EFI_PEI_CPU_IO_PPI_IO_WRITE16,MdePkg
-PEI_CPU_IO_PPI_IO_WRITE32,EFI_PEI_CPU_IO_PPI_IO_WRITE32,MdePkg
-PEI_CPU_IO_PPI_IO_WRITE64,EFI_PEI_CPU_IO_PPI_IO_WRITE64,MdePkg
-PEI_CPU_IO_PPI_MEM_READ8,EFI_PEI_CPU_IO_PPI_MEM_READ8,MdePkg
-PEI_CPU_IO_PPI_MEM_READ16,EFI_PEI_CPU_IO_PPI_MEM_READ16,MdePkg
-PEI_CPU_IO_PPI_MEM_READ32,EFI_PEI_CPU_IO_PPI_MEM_READ32,MdePkg
-PEI_CPU_IO_PPI_MEM_READ64,EFI_PEI_CPU_IO_PPI_MEM_READ64,MdePkg
-PEI_CPU_IO_PPI_MEM_WRITE8,EFI_PEI_CPU_IO_PPI_MEM_WRITE8,MdePkg
-PEI_CPU_IO_PPI_MEM_WRITE16,EFI_PEI_CPU_IO_PPI_MEM_WRITE16,MdePkg
-PEI_CPU_IO_PPI_MEM_WRITE32,EFI_PEI_CPU_IO_PPI_MEM_WRITE32,MdePkg
-PEI_CPU_IO_PPI_MEM_WRITE64,EFI_PEI_CPU_IO_PPI_MEM_WRITE64,MdePkg
-PEI_END_OF_PEI_PHASE_PPI_GUID,EFI_PEI_END_OF_PEI_PHASE_PPI_GUID,MdePkg
-PEI_MASTER_BOOT_MODE_PEIM_PPI,EFI_PEI_MASTER_BOOT_MODE_PEIM_PPI,MdePkg
-PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID,EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID,MdePkg
-PEI_PCI_CFG_PPI,EFI_PEI_PCI_CFG_PPI,MdePkg
-PEI_PCI_CFG_PPI_WIDTH,EFI_PEI_PCI_CFG_PPI_WIDTH,MdePkg
-PEI_PCI_CFG_PPI_PCI_ADDRESS,EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS,MdePkg
-PEI_PCI_CFG_PPI_IO,EFI_PEI_PCI_CFG_PPI_IO,MdePkg
-PEI_PCI_CFG_PPI_RW,EFI_PEI_PCI_CFG_PPI_RW,MdePkg
-PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID,EFI_PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID,MdePkg
-PEI_READ_ONLY_VARIABLE_PPI,EFI_PEI_READ_ONLY_VARIABLE_PPI,MdePkg
-PEI_GET_VARIABLE,EFI_PEI_GET_VARIABLE,MdePkg
-PEI_GET_NEXT_VARIABLE_NAME,EFI_PEI_GET_NEXT_VARIABLE_NAME,MdePkg
-PEI_RECOVERY_MODULE_INTERFACE_PPI,EFI_PEI_RECOVERY_MODULE_PPI_GUID,MdePkg
-PEI_RECOVERY_MODULE_INTERFACE,EFI_PEI_RECOVERY_MODULE_PPI,MdePkg
-PEI_LOAD_RECOVERY_CAPSULE,EFI_PEI_LOAD_RECOVERY_CAPSULE,MdePkg
-PEI_RESET_PPI_GUID,EFI_PEI_RESET_PPI_GUID,MdePkg
-PEI_RESET_PPI,EFI_PEI_RESET_PPI,MdePkg
-PEI_S3_RESUME_PPI_GUID,EFI_PEI_S3_RESUME_PPI_GUID,MdePkg
-PEI_S3_RESUME_PPI,EFI_PEI_S3_RESUME_PPI,MdePkg
-PEI_S3_RESUME_PPI_RESTORE_CONFIG,EFI_PEI_S3_RESUME_PPI_RESTORE_CONFIG,MdePkg
-SEC_PLATFORM_INFORMATION_RECORD,EFI_SEC_PLATFORM_INFORMATION_RECORD,MdePkg
-SEC_PLATFORM_INFORMATION,EFI_SEC_PLATFORM_INFORMATION,MdePkg
-PEI_SECURITY_PPI_GUID,EFI_PEI_SECURITY_PPI_GUID,MdePkg
-PEI_SECURITY_PPI,EFI_PEI_SECURITY_PPI,MdePkg
-PEI_SECURITY_AUTHENTICATION_STATE,EFI_PEI_SECURITY_AUTHENTICATION_STATE,MdePkg
-PEI_STALL_PPI_GUID,EFI_PEI_STALL_PPI_GUID,MdePkg
-PEI_STALL_PPI,EFI_PEI_STALL_PPI,MdePkg
-PEI_STALL,EFI_PEI_STALL,MdePkg
-GLYPH_NON_SPACING,EFI_GLYPH_NON_SPACING,MdePkg
-GLYPH_NON_BREAKING,EFI_GLYPH_WIDE,MdePkg
-SCREEN_DESCRIPTOR,EFI_SCREEN_DESCRIPTOR,MdePkg
-EFI_IFR_CHECK_BOX,EFI_IFR_CHECKBOX,MdePkg
-EFI_IFR_GRAYOUT,EFI_IFR_GRAY_OUT,MdePkg
-EFI_IFR_END_IF,EFI_IFR_END_EXPR,MdePkg
-EFI_STRING_TOKEN,STRING_REF,MdePkg
-EFI_MEMORY_ARRAY_START_ADDRESS,EFI_MEMORY_ARRAY_START_ADDRESS_DATA,MdePkg
-EFI_MEMORY_DEVICE_START_ADDRESS,EFI_MEMORY_DEVICE_START_ADDRESS_DATA,MdePkg
-EFI_MISC_LAST_PCI_BUS,EFI_MISC_LAST_PCI_BUS_DATA,MdePkg
-EFI_MISC_BIOS_VENDOR,EFI_MISC_BIOS_VENDOR_DATA,MdePkg
-EFI_MISC_SYSTEM_MANUFACTURER,EFI_MISC_SYSTEM_MANUFACTURER_DATA,MdePkg
-EFI_MISC_BASE_BOARD_MANUFACTURER,EFI_MISC_BASE_BOARD_MANUFACTURER_DATA,MdePkg
-EFI_MISC_CHASSIS_MANUFACTURER,EFI_MISC_CHASSIS_MANUFACTURER_DATA,MdePkg
-EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR,EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,MdePkg
-EFI_MISC_SYSTEM_SLOT_DESIGNATION,EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA,MdePkg
-EFI_MISC_ONBOARD_DEVICE,EFI_MISC_ONBOARD_DEVICE_DATA,MdePkg
-EFI_MISC_ONBOARD_DEVICE_TYPE_DATA,EFI_MISC_PORTING_DEVICE_TYPE_DATA,MdePkg
-EFI_MISC_OEM_STRING,EFI_MISC_OEM_STRING_DATA,MdePkg
-EFI_MISC_SYSTEM_OPTION_STRING,EFI_MISC_SYSTEM_OPTION_STRING_DATA,MdePkg
-EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES,EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA,MdePkg
-EFI_MISC_SYSTEM_LANGUAGE_STRING,EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA,MdePkg
-EFI_MISC_BIS_ENTRY_POINT,EFI_MISC_BIS_ENTRY_POINT_DATA,MdePkg
-EFI_MISC_BOOT_INFORMATION_STATUS,EFI_MISC_BOOT_INFORMATION_STATUS_DATA,MdePkg
-EFI_MISC_SYSTEM_POWER_SUPPLY,EFI_MISC_SYSTEM_POWER_SUPPLY_DATA,MdePkg
-EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION,EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION_DATA,MdePkg
-EFI_EXP_DATA,EFI_EXP_BASE10_DATA,MdePkg
-PEI_SMBUS_PPI_GUID,EFI_PEI_SMBUS_PPI_GUID,MdePkg
-PEI_SMBUS_PPI,EFI_PEI_SMBUS_PPI,MdePkg
-PEI_SMBUS_PPI_EXECUTE_OPERATION,EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION,MdePkg
-PEI_SMBUS_NOTIFY_FUNCTION,EFI_PEI_SMBUS_NOTIFY_FUNCTION,MdePkg
-PEI_SMBUS_PPI_ARP_DEVICE,EFI_PEI_SMBUS_PPI_ARP_DEVICE,MdePkg
-PEI_SMBUS_PPI_GET_ARP_MAP,EFI_PEI_SMBUS_PPI_GET_ARP_MAP,MdePkg
-PEI_SMBUS_PPI_NOTIFY,EFI_PEI_SMBUS_PPI_NOTIFY,MdePkg
-PEI_BOOT_SCRIPT_EXECUTER_PPI_GUID,EFI_PEI_BOOT_SCRIPT_EXECUTER_PPI_GUID,MdePkg
-PEI_BOOT_SCRIPT_EXECUTE,EFI_PEI_BOOT_SCRIPT_EXECUTE,MdePkg
-PEI_BOOT_SCRIPT_EXECUTER_PPI,EFI_PEI_BOOT_SCRIPT_EXECUTER_PPI,MdePkg
-EFI_TO_LEGACY16_INIT_TABLE,EFI_TO_COMPATIBILITY16_INIT_TABLE,MdePkg
-DISPATCH_OPROM_TABLE,EFI_DISPATCH_OPROM_TABLE,MdePkg
-EFI_STATUS_CODE_ARCH_PROTOCOL,EFI_STATUS_CODE_PROTOCOL,MdePkg
-DXE_REPORT_STATUS_CODE,EFI_REPORT_STATUS_CODE,MdePkg
-EFI_FIND_FV_PPI_GUID,EFI_PEI_FIND_FV_PPI_GUID,MdePkg
-EFI_FIND_FV_FINDFV,EFI_PEI_FIND_FV_FINDFV,MdePkg
-EFI_FIND_FV_PPI,EFI_PEI_FIND_FV_PPI,MdePkg
-PEI_BLOCK_IO_PPI_GUID,EFI_PEI_VIRTUAL_BLOCK_IO_PPI,MdePkg
-PEI_RECOVERY_BLOCK_IO_INTERFACE,EFI_PEI_RECOVERY_BLOCK_IO_PPI,MdePkg
-PEI_LBA,EFI_PEI_LBA,MdePkg
-PEI_BLOCK_IO_MEDIA,EFI_PEI_BLOCK_IO_MEDIA,MdePkg
-PEI_BLOCK_DEVICE_TYPE,EFI_PEI_BLOCK_DEVICE_TYPE,MdePkg
-PEI_GET_NUMBER_BLOCK_DEVICES,EFI_PEI_GET_NUMBER_BLOCK_DEVICES,MdePkg
-PEI_GET_DEVICE_MEDIA_INFORMATION,EFI_PEI_GET_DEVICE_MEDIA_INFORMATION,MdePkg
-PEI_READ_BLOCKS,EFI_PEI_READ_BLOCKS,MdePkg
-PEI_DEVICE_RECOVERY_MODULE_INTERFACE_PPI,EFI_PEI_DEVICE_RECOVERY_MODULE_PPI_GUID,MdePkg
-PEI_DEVICE_RECOVERY_MODULE_INTERFACE,EFI_PEI_DEVICE_RECOVERY_MODULE_PPI,MdePkg
-PEI_DEVICE_GET_NUMBER_RECOVERY_CAPSULE,EFI_PEI_DEVICE_GET_NUMBER_RECOVERY_CAPSULE,MdePkg
-PEI_DEVICE_GET_RECOVERY_CAPSULE_INFO,EFI_PEI_DEVICE_GET_RECOVERY_CAPSULE_INFO,MdePkg
-PEI_DEVICE_LOAD_RECOVERY_CAPSULE,EFI_PEI_DEVICE_LOAD_RECOVERY_CAPSULE,MdePkg
-PeiCpuIoWidthUint8,EfiPeiCpuIoWidthUint8,MdePkg
-PeiCpuIoWidthUint16,EfiPeiCpuIoWidthUint16,MdePkg
-PeiCpuIoWidthUint32,EfiPeiCpuIoWidthUint32,MdePkg
-PeiCpuIoWidthUint64,EfiPeiCpuIoWidthUint64,MdePkg
-PeiCpuIoWidthFifoUint8,EfiPeiCpuIoWidthFifoUint8,MdePkg
-PeiCpuIoWidthFifoUint16,EfiPeiCpuIoWidthFifoUint16,MdePkg
-PeiCpuIoWidthFifoUint32,EfiPeiCpuIoWidthFifoUint32,MdePkg
-PeiCpuIoWidthFifoUint64,EfiPeiCpuIoWidthFifoUint64,MdePkg
-PeiCpuIoWidthFillUint8,EfiPeiCpuIoWidthFillUint8,MdePkg
-PeiCpuIoWidthFillUint16,EfiPeiCpuIoWidthFillUint16,MdePkg
-PeiCpuIoWidthFillUint32,EfiPeiCpuIoWidthFillUint32,MdePkg
-PeiCpuIoWidthFillUint64,EfiPeiCpuIoWidthFillUint64,MdePkg
-PeiCpuIoWidthMaximum,EfiPeiCpuIoWidthMaximum,MdePkg
-PeiPciCfgWidthUint8,EfiPeiPciCfgWidthUint8,MdePkg
-PeiPciCfgWidthUint16,EfiPeiPciCfgWidthUint16,MdePkg
-PeiPciCfgWidthUint32,EfiPeiPciCfgWidthUint32,MdePkg
-PeiPciCfgWidthUint64,EfiPeiPciCfgWidthUint64,MdePkg
-PeiPciCfgWidthMaximum,EfiPeiPciCfgWidthMaximum,MdePkg
-PEI_PCI_CFG_PPI_PCI_ADDRESS,EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS,MdePkg
diff --git a/Tools/Conf/Migration/PkgGuid.csv b/Tools/Conf/Migration/PkgGuid.csv
deleted file mode 100644
index 5ad3f90a4d..0000000000
--- a/Tools/Conf/Migration/PkgGuid.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-PackageName,GuidValue
-MdePkg,5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec
-EdkModulePkg,68169ab0-d41b-4009-9060-292c253ac43d
diff --git a/Tools/Conf/Migration/Ppi.csv b/Tools/Conf/Migration/Ppi.csv
deleted file mode 100644
index 62deebd72a..0000000000
--- a/Tools/Conf/Migration/Ppi.csv
+++ /dev/null
@@ -1,28 +0,0 @@
-Name,R8.5 Cname,R9 Cname,Guid Value,Package
-BootInRecoveryMode,gPeiBootInRecoveryModePpiGuid,gEfiPeiBootInRecoveryModePpiGuid,17EE496A-D8E4-4B9A-94D1-CE8272300850,MdePkg
-CpuIo,gEfiPeiCpuIoPpiInServiceTableGuid,gEfiPeiCpuIoPpiInstalledGuid,E6AF1F7B-FC3F-46DA-A828-A3B457A44282,MdePkg
-DxeIpl,gEfiDxeIplPpiGuid,gEfiDxeIplPpiGuid,0AE8CE5D-E448-4437-A8D7-EBF5F194F731,MdePkg
-EndOfPeiSignal,gEfiEndOfPeiSignalPpiGuid,gEfiEndOfPeiSignalPpiGuid,605EA650-C65C-42E1-BA80-91A52AB618C6,MdePkg
-FindFv,gEfiFindFvPpiGuid,gEfiFindFvPpiGuid,36164812-A023-44E5-BD85-05BF3C7700AA,MdePkg
-FvFileLoader,gPeiFvFileLoaderPpiGuid,gEfiPeiFvFileLoaderPpiGuid,7E1F0D85-04FF-4BB2-866A-31A2996A48A8,MdePkg
-MasterBootMode,gPeiMasterBootModePpiGuid,gEfiPeiMasterBootModePpiGuid,7408D748-FC8C-4EE6-9288-C4BEC092A410,MdePkg
-MemoryDiscovered,gEfiPeiMemoryDiscoveredPpiGuid,gEfiPeiMemoryDiscoveredPpiGuid,F894643D-C449-42D1-8EA8-85BDD8C65BDE,MdePkg
-PciCfg,gEfiPciCfgPpiInServiceTableGuid,gEfiPciCfgPpiInServiceTableGuid,E1F2EBA0-F7B9-4A26-8620-131221642A90,MdePkg
-ReadOnlyVariable,gEfiPeiReadOnlyVariablePpiGuid,gEfiPeiReadOnlyVariablePpiGuid,3CDC90C6-13FB-4A75-9E79-59E9DD78B9FA,MdePkg
-RecoveryModule,gPeiRecoveryModulePpiGuid,gEfiPeiRecoveryModulePpiGuid,FB6D9542-612D-4F45-872F-5CFF52E93DCF,MdePkg
-Reset,gEfiPeiResetPpiGuid,gEfiPeiResetPpiGuid,EF398D58-9DFD-4103-BF94-78C6F4FE712F,MdePkg
-S3Resume,gEfiPeiS3ResumePpiGuid,gEfiPeiS3ResumePpiGuid,4426CCB2-E684-4A8A-AE40-20D4B025B710,MdePkg
-SecPlatformInformation,gEfiSecPlatformInformationPpiGuid,gEfiSecPlatformInformationPpiGuid,6F8C2B35-FEF4-448D-8256-E11B19D61077,MdePkg
-SectionExtraction,gPeiSectionExtractionPpiGuid,gEfiPeiSectionExtractionPpiGuid,4F89E208-E144-4804-9EC8-0F894F7E36D7,MdePkg
-Security,gPeiSecurityPpiGuid,gEfiPeiSecurityPpiGuid,1388066E-3A57-4EFA-98F3-C12F3A958A29,MdePkg
-StatusCode,gEfiPeiStatusCodePpiGuid,gEfiPeiStatusCodePpiGuid,229832D3-7A30-4B36-B827-F40CB7D45436,MdePkg
-PcdPpi,gPcdPpiGuid,gPcdPpiGuid,06E81C58-4AD7-44BC-8390-F10265F72480,MdePkg
-BootScriptExecuter,gPeiBootScriptExecuterPpiGuid,gEfiPeiBootScriptExecuterPpiGuid,ABD42895-78CF-4872-8444-1B5C180BFBFF,MdePkg
-Smbus,gPeiSmbusPpiGuid,gEfiPeiSmbusPpiGuid,ABD42895-78CF-4872-8444-1B5C180BFBDA,MdePkg
-BlockIo,gPeiBlockIoPpiGuid,gEfiPeiBlockIoPpiGuid,695D8AA1-42EE-4C46-805C-6EA6BCE799E3,MdePkg
-DeviceRecoveryModule,gPeiDeviceRecoveryModulePpiGuid,gEfiPeiDeviceRecoveryModulePpiGuid,0DE2CE25-446A-45A7-BFC9-37DA26344B37,MdePkg
-Stall,gPeiStallPpiGuid,gEfiPeiStallPpiGuid,1F4C6F90-B06B-48D8-A201-BAE5F1CD7D56,MdePkg
-PeiInMemory,gPeiInMemoryGuid,gPeiInMemoryGuid,643B8786-B417-48D2-8F5E-7819931CAED8,EdkModulePkg
-FlashMap,gPeiFlashMapPpiGuid,gPeiFlashMapPpiGuid,F34C2FA0-DE88-4270-8414-961222F4521C,EdkModulePkg
-BaseMemoryTest,gPeiBaseMemoryTestPpiGuid,gPeiBaseMemoryTestPpiGuid,B6EC423C-21D2-490D-85C6-DD5864EAA674,EdkModulePkg
-StatusCodeMemory,gPeiStatusCodeMemoryPpiGuid,gPeiStatusCodeMemoryPpiGuid,26F8AB01-D3CD-489C-984F-DFDEF768395B,EdkModulePkg
diff --git a/Tools/Conf/Migration/Protocol.csv b/Tools/Conf/Migration/Protocol.csv
deleted file mode 100644
index 77d27dba1e..0000000000
--- a/Tools/Conf/Migration/Protocol.csv
+++ /dev/null
@@ -1,154 +0,0 @@
-Name,R8.5 Cname,R9 Cname,Guid Value,Package
-FirmwareVolume2,gEfiFirmwareVolume2ProtocolGuid,gEfiFirmwareVolume2ProtocolGuid,220e73b6-6bdb-4413-8405-b974b108619a,MdePkg
-HiiConfigAccess,gEfiHiiConfigAccessProtocolGuid,gEfiHiiConfigAccessProtocolGuid,330d4706-f2a0-4e4f-a369-b66fa8d54385,MdePkg
-HiiConfigRouting,gEfiHiiConfigRoutingProtocolGuid,gEfiHiiConfigRoutingProtocolGuid,587e72d7-cc50-4f79-8209-ca291fc1a10f,MdePkg
-HiiDatabase,gEfiHiiDatabaseProtocolGuid,gEfiHiiDatabaseProtocolGuid,ef9fc172-a1b2-4693-b327-6d32fc416042,MdePkg
-HiiFont,gEfiHiiFontProtocolGuid,gEfiHiiFontProtocolGuid,e9ca4775-8657-47fc-97e7-7ed65a084324,MdePkg
-HiiImage,gEfiHiiImageProtocolGuid,gEfiHiiImageProtocolGuid,31a6406a-6bdf-4e46-b2a2-ebaa89c40920,MdePkg
-HiiString,gEfiHiiStringProtocolGuid,gEfiHiiStringProtocolGuid,0fd96974-23aa-4cdc-b9cb-98d17750322a,MdePkg
-FormBrowser2,gEfiFormBrowser2ProtocolGuid,gEfiFormBrowser2ProtocolGuid,b9d4c360-bcfb-4f9b-9298-53c136982258,MdePkg
-Bds,gEfiBdsArchProtocolGuid,gEfiBdsArchProtocolGuid,665E3FF6-46CC-11D4-9A38-0090273FC14D,MdePkg
-Cpu,gEfiCpuArchProtocolGuid,gEfiCpuArchProtocolGuid,26BACCB1-6F42-11D4-BCE7-0080C73C8881,MdePkg
-Metronome,gEfiMetronomeArchProtocolGuid,gEfiMetronomeArchProtocolGuid,26BACCB2-6F42-11D4-BCE7-0080C73C8881,MdePkg
-MonotonicCounter,gEfiMonotonicCounterArchProtocolGuid,gEfiMonotonicCounterArchProtocolGuid,1DA97072-BDDC-4B30-99F1-72A0B56FFF2A,MdePkg
-RealTimeClock,gEfiRealTimeClockArchProtocolGuid,gEfiRealTimeClockArchProtocolGuid,27CFAC87-46CC-11D4-9A38-0090273FC14D,MdePkg
-Reset,gEfiResetArchProtocolGuid,gEfiResetArchProtocolGuid,27CFAC88-46CC-11D4-9A38-0090273FC14D,MdePkg
-Runtime,gEfiRuntimeArchProtocolGuid,gEfiRuntimeArchProtocolGuid,96D08253-8483-11D4-BCF1-0080C73C8881,MdePkg
-Security,gEfiSecurityArchProtocolGuid,gEfiSecurityArchProtocolGuid,A46423E3-4617-49F1-B9FF-D1BFA9115839,MdePkg
-StatusCode,gEfiStatusCodeArchProtocolGuid,gEfiStatusCodeRuntimeProtocolGuid,D2B2B828-0826-48A7-B3DF-983C006024F0,MdePkg
-Timer,gEfiTimerArchProtocolGuid,gEfiTimerArchProtocolGuid,26BACCB3-6F42-11D4-BCE7-0080C73C8881,MdePkg
-Variable,gEfiVariableArchProtocolGuid,gEfiVariableArchProtocolGuid,1E5668E2-8481-11D4-BCF1-0080C73C8881,MdePkg
-VariableWrite,gEfiVariableWriteArchProtocolGuid,gEfiVariableWriteArchProtocolGuid,6441F818-6362-4E44-B570-7DBA31DD2453,MdePkg
-WatchdogTimer,gEfiWatchdogTimerArchProtocolGuid,gEfiWatchdogTimerArchProtocolGuid,665E3FF5-46CC-11D4-9A38-0090273FC14D,MdePkg
-CpuIo,gEfiCpuIoProtocolGuid,gEfiCpuIoProtocolGuid,B0732526-38C8-4B40-8877-61C7B06AAC45,MdePkg
-DataHub,gEfiDataHubProtocolGuid,gEfiDataHubProtocolGuid,AE80D021-618E-11D4-BCD7-0080C73C8881,MdePkg
-FirmwareVolume,gEfiFirmwareVolumeProtocolGuid,gEfiFirmwareVolumeProtocolGuid,389F751F-1838-4388-8390-CD8154BD27F8,MdePkg
-FirmwareVolumeBlock,gEfiFirmwareVolumeBlockProtocolGuid,gEfiFirmwareVolumeBlockProtocolGuid,DE28BC59-6228-41BD-BDF6-A3B9ADB58DA1,MdePkg
-FirmwareVolumeDispatch,gEfiFirmwareVolumeDispatchProtocolGuid,gEfiFirmwareVolumeDispatchProtocolGuid,7AA35A69-506C-444F-A7AF-694BF56F71C8,MdePkg
-FormBrowser,gEfiFormBrowserProtocolGuid,gEfiFormBrowserProtocolGuid,E5A1333E-E1B4-4D55-CEEB-35C3EF133443,MdePkg
-FormCallback,gEfiFormCallbackProtocolGuid,gEfiFormCallbackProtocolGuid,F3E4543D-CF35-6CEF-35C4-4FE6344DFC54,MdePkg
-Crc32GuidedSectionExtraction,gEfiCrc32GuidedSectionExtractionProtocolGuid,gEfiCrc32GuidedSectionExtractionProtocolGuid,FC1BCDB0-7D31-49AA-936A-A4600D9DD083,MdePkg
-Hii,gEfiHiiProtocolGuid,gEfiHiiProtocolGuid,EA816D2C-CEE5-4F02-99B5-D3905CBBD077,MdePkg
-PcdProtocol,gPcdProtocolGuid,gPcdProtocolGuid,11B34006-D85B-4D0A-A290-D5A571310EF7,MdePkg
-SectionExtraction,gEfiSectionExtractionProtocolGuid,gEfiSectionExtractionProtocolGuid,448F5DA4-6DD7-4FE1-9307-69224192215D,MdePkg
-Bis,gEfiBisProtocolGuid,gEfiBisProtocolGuid,0B64AAB0-5429-11D4-9816-00A0C91FADCF,MdePkg
-BlockIo,gEfiBlockIoProtocolGuid,gEfiBlockIoProtocolGuid,964E5B21-6459-11D2-8E39-00A0C969723B,MdePkg
-BusSpecificDriverOverride,gEfiBusSpecificDriverOverrideProtocolGuid,gEfiBusSpecificDriverOverrideProtocolGuid,3BC1B285-8A15-4A82-AABF-4D7D13FB3265,MdePkg
-ComponentName,gEfiComponentNameProtocolGuid,gEfiComponentNameProtocolGuid,107A772C-D5E1-11D4-9A46-0090273FC14D,MdePkg
-DebugPort,gEfiDebugPortProtocolGuid,gEfiDebugPortProtocolGuid,EBA4E8D2-3858-41EC-A281-2647BA9660D0,MdePkg
-DebugSupport,gEfiDebugSupportProtocolGuid,gEfiDebugSupportProtocolGuid,2755590C-6F3C-42FA-9EA4-A3BA543CDA25,MdePkg
-Decompress,gEfiDecompressProtocolGuid,gEfiDecompressProtocolGuid,D8117CFE-94A6-11D4-9A3A-0090273FC14D,MdePkg
-DevicePath,gEfiDevicePathProtocolGuid,gEfiDevicePathProtocolGuid,09576E91-6D3F-11D2-8E39-00A0C969723B,MdePkg
-DiskIo,gEfiDiskIoProtocolGuid,gEfiDiskIoProtocolGuid,CE345171-BA0B-11D2-8E4F-00A0C969723B,MdePkg
-DriverBinding,gEfiDriverBindingProtocolGuid,gEfiDriverBindingProtocolGuid,18A031AB-B443-4D1A-A5C0-0C09261E9F71,MdePkg
-DriverConfiguration,gEfiDriverConfigurationProtocolGuid,gEfiDriverConfigurationProtocolGuid,107A772B-D5E1-11D4-9A46-0090273FC14D,MdePkg
-UefiDriverConfiguration,gUefiDriverConfigurationProtocolGuid,gUefiDriverConfigurationProtocolGuid,BFD7DC1D-24F1-40D9-82E7-2E09BB6B4EBE,MdePkg
-DriverDiagnostics,gEfiDriverDiagnosticsProtocolGuid,gEfiDriverDiagnosticsProtocolGuid,0784924F-E296-11D4-9A49-0090273FC14D,MdePkg
-UefiDriverDiagnostics,gUefiDriverDiagnosticsProtocolGuid,gUefiDriverDiagnosticsProtocolGuid,4D330321-025F-4AAC-90D8-5ED900173B63,MdePkg
-Ebc,gEfiEbcProtocolGuid,gEfiEbcProtocolGuid,13AC6DD1-73D0-11D4-B06B-00AA00BD6DE7,MdePkg
-NetworkInterfaceIdentifier,gEfiNetworkInterfaceIdentifierProtocolGuid,gEfiNetworkInterfaceIdentifierProtocolGuid,E18541CD-F755-4F73-928D-643C8A79B229,MdePkg
-NetworkInterfaceIdentifier31,gEfiNetworkInterfaceIdentifierProtocolGuid_31,gEfiNetworkInterfaceIdentifierProtocolGuid_31,1ACED566-76ED-4218-BC81-767F1F977A89,MdePkg
-NetworkInterfaceIdentifier2,gEfiNetworkInterfaceIdentifierProtocolGuid_31,gEfiNetworkInterfaceIdentifierProtocolGuid_31,1ACED566-76ED-4218-BC81-767F1F977A89,MdePkg
-LoadedImage,gEfiLoadedImageProtocolGuid,gEfiLoadedImageProtocolGuid,5B1B31A1-9562-11D2-8E3F-00A0C969723B,MdePkg
-LoadFile,gEfiLoadFileProtocolGuid,gEfiLoadFileProtocolGuid,56EC3091-954C-11D2-8E3F-00A0C969723B,MdePkg
-PciIo,gEfiPciIoProtocolGuid,gEfiPciIoProtocolGuid,4CF5B200-68B8-4CA5-9EEC-B23E3F50029A,MdePkg
-PciRootBridgeIo,gEfiPciRootBridgeIoProtocolGuid,gEfiPciRootBridgeIoProtocolGuid,2F707EBB-4A1A-11D4-9A38-0090273FC14D,MdePkg
-PlatformDriverOverride,gEfiPlatformDriverOverrideProtocolGuid,gEfiPlatformDriverOverrideProtocolGuid,6B30C738-A391-11D4-9A3B-0090273FC14D,MdePkg
-PxeBaseCode,gEfiPxeBaseCodeProtocolGuid,gEfiPxeBaseCodeProtocolGuid,03C4E603-AC28-11D3-9A2D-0090273FC14D,MdePkg
-PxeBaseCodeCallBack,gEfiPxeBaseCodeCallbackProtocolGuid,gEfiPxeBaseCodeCallbackProtocolGuid,245DCA21-FB7B-11D3-8F01-00A0C969723B,MdePkg
-ScsiPassThru,gEfiScsiPassThruProtocolGuid,gEfiScsiPassThruProtocolGuid,A59E8FCF-BDA0-43BB-90B1-D3732ECAA877,MdePkg
-SerialIo,gEfiSerialIoProtocolGuid,gEfiSerialIoProtocolGuid,BB25CF6F-F1D4-11D2-9A0C-0090273FC1FD,MdePkg
-SimpleFileSystem,gEfiSimpleFileSystemProtocolGuid,gEfiSimpleFileSystemProtocolGuid,964E5B22-6459-11D2-8E39-00A0C969723B,MdePkg
-SimpleNetwork,gEfiSimpleNetworkProtocolGuid,gEfiSimpleNetworkProtocolGuid,A19832B9-AC25-11D3-9A2D-0090273FC14D,MdePkg
-SimplePointer,gEfiSimplePointerProtocolGuid,gEfiSimplePointerProtocolGuid,31878C87-0B75-11D5-9A4F-0090273FC14D,MdePkg
-SimpleTextIn,gEfiSimpleTextInProtocolGuid,gEfiSimpleTextInProtocolGuid,387477C1-69C7-11D2-8E39-00A0C969723B,MdePkg
-SimpleTextInputEx,gEfiSimpleTextInputExProtocolGuid,gEfiSimpleTextInputExProtocolGuid,dd9e7534-7762-4698-8c14-f58517a625aa,MdePkg
-SimpleTextOut,gEfiSimpleTextOutProtocolGuid,gEfiSimpleTextOutProtocolGuid,387477C2-69C7-11D2-8E39-00A0C969723B,MdePkg
-UgaDraw,gEfiUgaDrawProtocolGuid,gEfiUgaDrawProtocolGuid,982C298B-F4FA-41CB-B838-77AA688FB839,MdePkg
-UnicodeCollation,gEfiUnicodeCollationProtocolGuid,gEfiUnicodeCollationProtocolGuid,1D85CD7F-F43D-11D2-9A0C-0090273FC14D,MdePkg
-UsbHc,gEfiUsbHcProtocolGuid,gEfiUsbHcProtocolGuid,F5089266-1AA0-4953-97D8-562F8A73B519,MdePkg
-PciPlatform,gEfiPciPlatformProtocolGuid,gEfiPciPlatformProtocolGuid,07D75280-27D4-4D69-90D0-5643E238B341,MdePkg
-IncompatiblePciDeviceSupport,gEfiIncompatiblePciDeviceSupportProtocolGuid,gEfiIncompatiblePciDeviceSupportProtocolGuid,EB23F55A-7863-4AC2-8D3D-956535DE0375,MdePkg
-PciHotPlugInit,gEfiPciHotPlugInitProtocolGuid,gEfiPciHotPlugInitProtocolGuid,AA0E8BC1-DABC-46B0-A844-37B8169B2BEA,MdePkg
-PciHostBridgeResourceAllocation,gEfiPciHostBridgeResourceAllocationProtocolGuid,gEfiPciHostBridgeResourceAllocationProtocolGuid,CF8034BE-6768-4D8B-B739-7CCE683A9FBE,MdePkg
-IdeControllerInit,gEfiIdeControllerInitProtocolGuid,gEfiIdeControllerInitProtocolGuid,A1E37052-80D9-4E65-A317-3E9A55C43EC9,MdePkg
-UsbIo,gEfiUsbIoProtocolGuid,gEfiUsbIoProtocolGuid,2B2F68D6-0CD2-44CF-8E8B-BBA20B1B5B75,MdePkg
-Arp,gEfiArpProtocolGuid,gEfiArpProtocolGuid,F4B427BB-BA21-4F16-BC4E-43E416AB619C,MdePkg
-ArpServiceBinding,gEfiArpServiceBindingProtocolGuid,gEfiArpServiceBindingProtocolGuid,F44C00EE-1F2C-4A00-AA09-1C9F3E0800A3,MdePkg
-Dhcp4,gEfiDhcp4ProtocolGuid,gEfiDhcp4ProtocolGuid,8A219718-4EF5-4761-91C8-C0F04BDA9E56,MdePkg
-Dhcp4ServiceBinding,gEfiDhcp4ServiceBindingProtocolGuid,gEfiDhcp4ServiceBindingProtocolGuid,9D9A39D8-BD42-4A73-A4D5-8EE94BE11380,MdePkg
-Ip4,gEfiIp4ProtocolGuid,gEfiIp4ProtocolGuid,41D94CD2-35B6-455A-8258-D4E51334AADD,MdePkg
-Ip4ServiceBinding,gEfiIp4ServiceBindingProtocolGuid,gEfiIp4ServiceBindingProtocolGuid,C51711E7-B4BF-404A-BFB8-0A048EF1FFE4,MdePkg
-Ip4Config,gEfiIp4ConfigProtocolGuid,gEfiIp4ConfigProtocolGuid,3B95AA31-3793-434B-8667-C8070892E05E,MdePkg
-ManagedNetwork,gEfiManagedNetworkProtocolGuid,gEfiManagedNetworkProtocolGuid,3B95AA31-3793-434B-8667-C8070892E05E,MdePkg
-ManagedNetworkServiceBinding,gEfiManagedNetworkServiceBindingProtocolGuid,gEfiManagedNetworkServiceBindingProtocolGuid,F36FF770-A7E1-42CF-9ED2-56F0F271F44C,MdePkg
-Mtftp4,gEfiMtftp4ProtocolGuid,gEfiMtftp4ProtocolGuid,3AD9DF29-4501-478D-B1F8-7F7FE70E50F3,MdePkg
-Mtftp4ServiceBinding,gEfiMtftp4ServiceBindingProtocolGuid,gEfiMtftp4ServiceBindingProtocolGuid,2FE800BE-8F01-4AA6-946B-D71388E1833F,MdePkg
-Tcp4,gEfiTcp4ProtocolGuid,gEfiTcp4ProtocolGuid,65530BC7-A359-410F-B010-5AADC7EC2B62,MdePkg
-Tcp4ServiceBinding,gEfiTcp4ServiceBindingProtocolGuid,gEfiTcp4ServiceBindingProtocolGuid,00720665-67EB-4A99-BAF7-D3C33A1C7CC9,MdePkg
-Udp4,gEfiUdp4ProtocolGuid,gEfiUdp4ProtocolGuid,3AD9DF29-4501-478D-B1F8-7F7FE70E50F3,MdePkg
-Udp4ServiceBinding,gEfiUdp4ServiceBindingProtocolGuid,gEfiUdp4ServiceBindingProtocolGuid,83F01464-99BD-45E5-B383-AF6305D8E9E6,MdePkg
-AuthenticationInfo,gEfiAuthenticationInfoProtocolGuid,gEfiAuthenticationInfoProtocolGuid,7671D9D0-53DB-4173-AA69-2327F21F0BC7,MdePkg
-DevicePathFromText,gEfiDevicePathFromTextProtocolGuid,gEfiDevicePathFromTextProtocolGuid,05C99A21-C70F-4AD2-8A5F-35DF3343F51E,MdePkg
-DevicePathToText,gEfiDevicePathToTextProtocolGuid,gEfiDevicePathToTextProtocolGuid,8B843E20-8132-4852-90CC-551A4E4A7F1C,MdePkg
-DevicePathUtilities,gEfiDevicePathUtilitiesProtocolGuid,gEfiDevicePathUtilitiesProtocolGuid,0379BE4E-D706-437D-B037-EDB82FB772A4,MdePkg
-EdidActive,gEfiEdidActiveProtocolGuid,gEfiEdidActiveProtocolGuid,BD8C1056-9F36-44EC-92A8-A6337F817986,MdePkg
-EdidDiscovered,gEfiEdidDiscoveredProtocolGuid,gEfiEdidDiscoveredProtocolGuid,1C0C34F6-D380-41FA-A049-8AD06C1A66AA,MdePkg
-EdidOverride,gEfiEdidOverrideProtocolGuid,gEfiEdidOverrideProtocolGuid,48ECB431-FB72-45C0-A922-F458FE040BD5,MdePkg
-GraphicsOutput,gEfiGraphicsOutputProtocolGuid,gEfiGraphicsOutputProtocolGuid,9042A9DE-23DC-4A38-96FB-7ADED080516A,MdePkg
-Hash,gEfiHashProtocolGuid,gEfiHashProtocolGuid,C5184932-DBA5-46DB-A5BA-CC0BDA9C1435,MdePkg
-HashServiceBinding,gEfiHashServiceBindingProtocolGuid,gEfiHashServiceBindingProtocolGuid,42881C98-A4F3-44B0-A39D-DFA18667D8CD,MdePkg
-IScsiInitiatorName,gEfiIScsiInitiatorNameProtocolGuid,gEfiIScsiInitiatorNameProtocolGuid,A6A72875-2962-4C18-9F46-8DA644CCFE00,MdePkg
-ScsiIoExt,gEfiScsiIoProtocolGuid,gEfiScsiIoProtocolGuid,932F4736-2362-4002-803E-3CD54B138F85,MdePkg
-ExtScsiPassThru,gEfiExtScsiPassThruProtocolGuid,gEfiExtScsiPassThruProtocolGuid,1D3DE7F0-0807-424F-AA69-11A54E19A46F,MdePkg
-TapeIo,gEfiTapeIoProtocolGuid,gEfiTapeIoProtocolGuid,1E93E633-D65A-459E-AB84-93D9EC266D18,MdePkg
-Usb2Hc,gEfiUsb2HcProtocolGuid,gEfiUsb2HcProtocolGuid,3E745226-9818-45B6-A2AC-D7CD0E8BA2BC,MdePkg
-SecurityPolicy,gEfiSecurityPolicyProtocolGuid,gEfiSecurityPolicyProtocolGuid,78E4D245-CD4D-4A05-A2BA-4743E86CFCAB,MdePkg
-AcpiSupport,gEfiAcpiSupportProtocolGuid,gEfiAcpiSupportProtocolGuid,DBFF9D55-89B7-46DA-BDDF-677D3DC0241D,MdePkg
-BootScriptSave,gEfiBootScriptSaveProtocolGuid,gEfiBootScriptSaveProtocolGuid,470E1529-B79E-4E32-A0FE-6A156D29F9B2,MdePkg
-Smbus,gEfiSmbusProtocolGuid,gEfiSmbusProtocolGuid,E49D33ED-513D-4634-B698-6F55AA751C1B,MdePkg
-LegacyBios,gEfiLegacyBiosProtocolGuid,gEfiLegacyBiosProtocolGuid,DB9A1E3D-45CB-4ABB-853B-E5387FDB2E2D,MdePkg
-Legacy8259,gEfiLegacy8259ProtocolGuid,gEfiLegacy8259ProtocolGuid,38321DBA-4FE0-4E17-8AEC-413055EAEDC1,MdePkg
-LegacyBiosPlatform,gEfiLegacyBiosPlatformProtocolGuid,gEfiLegacyBiosPlatformProtocolGuid,783658A3-4172-4421-A299-E009079C0CB4,MdePkg
-LegacyInterrupt,gEfiLegacyInterruptProtocolGuid,gEfiLegacyInterruptProtocolGuid,31CE593D-108A-485D-ADB2-78F21F2966BE,MdePkg
-LegacyRegion,gEfiLegacyRegionProtocolGuid,gEfiLegacyRegionProtocolGuid,0FC9013A-0568-4BA9-9B7E-C9C390A6609B,MdePkg
-SmmAccess,gEfiSmmAccessProtocolGuid,gEfiSmmAccessProtocolGuid,3792095A-E309-4C1E-AA01-85F5655A17F1,MdePkg
-SmmBase,gEfiSmmBaseProtocolGuid,gEfiSmmBaseProtocolGuid,1390954D-DA95-4227-9328-7282C217DAA8,MdePkg
-SmmControl,gEfiSmmControlProtocolGuid,gEfiSmmControlProtocolGuid,8D12E231-C667-4FD1-98F2-2449A7E7B2E5,MdePkg
-SmmGpiDispatch,gEfiSmmGpiDispatchProtocolGuid,gEfiSmmGpiDispatchProtocolGuid,E0744B81-9513-49CD-8CEA-E9245E7039DA,MdePkg
-SmmIchnDispatch,gEfiSmmIchnDispatchProtocolGuid,gEfiSmmIchnDispatchProtocolGuid,C50B323E-9075-4F2A-AC8E-D2596A1085CC,MdePkg
-SmmPeriodicTimerDispatch,gEfiSmmPeriodicTimerDispatchProtocolGuid,gEfiSmmPeriodicTimerDispatchProtocolGuid,9CCA03FC-4C9E-4A19-9B06-ED7B479BDE55,MdePkg
-SmmPowerButtonDispatch,gEfiSmmPowerButtonDispatchProtocolGuid,gEfiSmmPowerButtonDispatchProtocolGuid,B709EFA0-47A6-4B41-B931-12ECE7A8EE56,MdePkg
-SmmStandbyButtonDispatch,gEfiSmmStandbyButtonDispatchProtocolGuid,gEfiSmmStandbyButtonDispatchProtocolGuid,78965B98-B0BF-449E-8B22-D2914E498A98,MdePkg
-SmmStatusCode,gEfiSmmStatusCodeProtocolGuid,gEfiSmmStatusCodeProtocolGuid,6AFD2B77-98C1-4ACD-A6F9-8A9439DE0FB1,MdePkg
-SmmSwDispatch,gEfiSmmSwDispatchProtocolGuid,gEfiSmmSwDispatchProtocolGuid,E541B773-DD11-420C-B026-DF993653F8BF,MdePkg
-SmmSxDispatch,gEfiSmmSxDispatchProtocolGuid,gEfiSmmSxDispatchProtocolGuid,14FC52BE-01DC-426C-91AE-A23C3E220AE8,MdePkg
-SmmUsbDispatch,gEfiSmmUsbDispatchProtocolGuid,gEfiSmmUsbDispatchProtocolGuid,A05B6FFD-87AF-4E42-95C9-6228B63CF3F3,MdePkg
-DeviceIo,gEfiDeviceIoProtocolGuid,gEfiDeviceIoProtocolGuid,AF6AC311-84C3-11D2-8E3C-00A0C969723B,MdePkg
-Capsule,gEfiCapsuleArchProtocolGuid,gEfiCapsuleArchProtocolGuid,5053697E-2EBC-4819-90D9-0580DEEE5754,MdePkg
-CustomizedDecompress,gEfiCustomizedDecompressProtocolGuid,gEfiCustomizedDecompressProtocolGuid,9A44198E-A4A2-44E6-8A1F-39BEFDAC896F,MdeModulePkg
-TianoDecompress,gEfiTianoDecompressProtocolGuid,gEfiTianoDecompressProtocolGuid,E84CF29C-191F-4EAE-96E1-F46AECEAEA0B,MdeModulePkg
-LoadPeImage,gEfiLoadPeImageProtocolGuid,gEfiLoadPeImageProtocolGuid,5CB5C776-60D5-45EE-883C-452708CD743F,MdeModulePkg
-Print,gEfiPrintProtocolGuid,gEfiPrintProtocolGuid,DF2D868E-32FC-4CF0-8E6B-FFD95D1343D0,EdkModulePkg
-GenericMemTest,gEfiGenericMemTestProtocolGuid,gEfiGenericMemTestProtocolGuid,309DE7F1-7F5E-4ACE-B49C-531BE5AA95EF,EdkModulePkg
-DiskInfo,gEfiDiskInfoProtocolGuid,gEfiDiskInfoProtocolGuid,D432A67F-14DC-484B-B3BB-3F0291849327,EdkModulePkg
-FvbExtension,gEfiFvbExtensionProtocolGuid,gEfiFvbExtensionProtocolGuid,53A4C71B-B581-4170-91B3-8DB87A4B5C46,EdkModulePkg
-FaultTolerantWriteLite,gEfiFaultTolerantWriteLiteProtocolGuid,gEfiFaultTolerantWriteLiteProtocolGuid,3F557189-8DAE-45AE-A0B3-2B99CA7AA7A0,EdkModulePkg
-ConsoleControl,gEfiConsoleControlProtocolGuid,gEfiConsoleControlProtocolGuid,F42F7782-012E-4C12-9956-49F94304F721,EdkModulePkg
-OEMBadging,gEfiOEMBadgingProtocolGuid,gEfiOEMBadgingProtocolGuid,170E13C0-BF1B-4218-871D-2ABDC6F887BC,EdkModulePkg
-UgaSplash,gEfiUgaSplashProtocolGuid,gEfiUgaSplashProtocolGuid,A45B3A0D-2E55-4C03-AD9C-27D4820B507E,EdkModulePkg
-AcpiS3Save,gEfiAcpiS3SaveGuid,gEfiAcpiS3SaveProtocolGuid,125F2DE1-FB85-440C-A54C-4D99358A8D38,IntelFrameworkPkg
-PxeDhcp4,gEfiPxeDhcp4ProtocolGuid,gEfiPxeDhcp4ProtocolGuid,03C4E624-AC28-11D3-9A2D-0090293FC14D,EdkModulePkg
-PxeDhcp4Callback,gEfiPxeDhcp4CallbackProtocolGuid,gEfiPxeDhcp4CallbackProtocolGuid,C1544C01-92A4-4198-8A84-778583C23621,EdkModulePkg
-UgaIo,gEfiUgaIoProtocolGuid,gEfiUgaIoProtocolGuid,61A4D49E-6F68-4F1B-B922-A86EED0B07A2,EdkModulePkg
-DebugAssert,gEfiDebugAssertProtocolGuid,gEfiDebugAssertProtocolGuid,BE499C92-7D4B-11D4-BCEE-0080C73C8881,EdkModulePkg
-UsbAtapi,gEfiUsbAtapiProtocolGuid,gEfiUsbAtapiProtocolGuid,2B2F68DA-0CD2-44CF-8E8B-BBA20B1B5B75,EdkModulePkg
-PciHotPlugRequest,gEfiPciHotPlugRequestProtocolGuid,gEfiPciHotPlugRequestProtocolGuid,19CB87AB-2CB9-4665-8360-DDCF6054F79D,EdkModulePkg
-ExtendedSalBootService,gEfiExtendedSalBootServiceProtocolGuid,gEfiExtendedSalBootServiceProtocolGuid,DE0EE9A4-3C7A-44F2-B78B-E3CCD69C3AF7,EdkModulePkg
-ExtendedSalVariableServices,gEfiExtendedSalVariableServicesProtocolGuid,gEfiExtendedSalVariableServicesProtocolGuid,4ECB6C53-C641-4370-8CB2-3B0E496E8378,EdkModulePkg
-ExtendedSalStatusCodeServices,gEfiExtendedSalStatusCodeServicesProtocolGuid,gEfiExtendedSalStatusCodeServicesProtocolGuid,00DBD91D-55E9-420F-9639-5E9F8437B44F,EdkModulePkg
-IsaIo,gEfiIsaIoProtocolGuid,gEfiIsaIoProtocolGuid,7EE2BD44-3DA0-11D4-9A38-0090273FC14D,EdkModulePkg
-IsaAcpi,gEfiIsaAcpiProtocolGuid,gEfiIsaAcpiProtocolGuid,64A892DC-5561-4536-92C7-799BFC183355,EdkModulePkg
-Performance,gPerformanceProtocolGuid,gPerformanceProtocolGuid,76B6BDFA-2ACD-4462-9E3F-CB58C969D937,EdkModulePkg
-ScsiIo,gEfiScsiIoProtocolGuid,gEfiScsiIoProtocolGuid,403CD195-F233-48EC-8455-B2E52F1D9E02,EdkModulePkg
-ApciSupport,gEfiAcpiSupportGuid,gEfiAcpiSupportProtocolGuid,DBFF9D55-89B7-46DA-BDDF-677D3DC0241D,MdePkg
diff --git a/Tools/Conf/Migration/R8Lib.c b/Tools/Conf/Migration/R8Lib.c
deleted file mode 100644
index 6ef5f9100e..0000000000
--- a/Tools/Conf/Migration/R8Lib.c
+++ /dev/null
@@ -1,980 +0,0 @@
-/** @file
- Obsolete library interfaces.
-
- This file contains part of obsolete library interfaces in EDK.
- User is recommended to follow the porting Guide in R8Lib.c to elimante them.
-
- Copyright (c) 2006, 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.
-
-**/
-
-////
-BOOLEAN
-R8_EfiLibCompareLanguage (
- IN CHAR8 *Language1,
- IN CHAR8 *Language2
- )
-/*++
-
-Routine Description:
-
- Compare whether two names of languages are identical.
-
-Arguments:
-
- Language1 - Name of language 1
- Language2 - Name of language 2
-
-Returns:
-
- TRUE - same
- FALSE - not same
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
- UINTN Index;
-
- for (Index = 0; Index < 3; Index++) {
- if (Language1[Index] != Language2[Index]) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-////~
-
-////#BaseLib
-EFI_STATUS
-R8_BufToHexString (
- IN OUT CHAR16 *Str,
- IN OUT UINTN *HexStringBufferLength,
- IN UINT8 *Buf,
- IN UINTN Len
- )
-/*++
-
- Routine Description:
- Converts binary buffer to Unicode string.
- At a minimum, any blob of data could be represented as a hex string.
-
- Arguments:
- Str - Pointer to the string.
- HexStringBufferLength - Length in bytes of buffer to hold the hex string. Includes tailing '\0' character.
- If routine return with EFI_SUCCESS, containing length of hex string buffer.
- If routine return with EFI_BUFFER_TOO_SMALL, containg length of hex string buffer desired.
- Buf - Buffer to be converted from.
- Len - Length in bytes of the buffer to be converted.
-
- Returns:
- EFI_SUCCESS - Routine success.
- EFI_BUFFER_TOO_SMALL - The hex string buffer is too small.
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
- UINTN Idx;
- UINT8 Byte;
- UINTN StrLen;
-
- //
- // Make sure string is either passed or allocate enough.
- // It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer.
- // Plus the Unicode termination character.
- //
- StrLen = Len * 2;
- if (StrLen > ((*HexStringBufferLength) - 1)) {
- *HexStringBufferLength = StrLen + 1;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- *HexStringBufferLength = StrLen + 1;
- //
- // Ends the string.
- //
- Str[StrLen] = L'\0';
-
- for (Idx = 0; Idx < Len; Idx++) {
-
- Byte = Buf[Idx];
- Str[StrLen - 1 - Idx * 2] = NibbleToHexChar (Byte);
- Str[StrLen - 2 - Idx * 2] = NibbleToHexChar ((UINT8)(Byte >> 4));
- }
-
- return EFI_SUCCESS;
-}
-////~
-
-////
-VOID
-R8_EfiStrTrim (
- IN OUT CHAR16 *str,
- IN CHAR16 CharC
- )
-/*++
-
-Routine Description:
-
- Removes (trims) specified leading and trailing characters from a string.
-
-Arguments:
-
- str - Pointer to the null-terminated string to be trimmed. On return,
- str will hold the trimmed string.
- CharC - Character will be trimmed from str.
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
- CHAR16 *p1;
- CHAR16 *p2;
-
- if (*str == 0) {
- return;
- }
-
- //
- // Trim off the leading and trailing characters c
- //
- for (p1 = str; *p1 && *p1 == CharC; p1++) {
- ;
- }
-
- p2 = str;
- if (p2 == p1) {
- while (*p1) {
- p2++;
- p1++;
- }
- } else {
- while (*p1) {
- *p2 = *p1;
- p1++;
- p2++;
- }
- *p2 = 0;
- }
-
-
- for (p1 = str + StrLen(str) - 1; p1 >= str && *p1 == CharC; p1--) {
- ;
- }
- if (p1 != str + StrLen(str) - 1) {
- *(p1 + 1) = 0;
- }
-}
-////~
-
-////#PrintLib
-UINTN
-R8_EfiValueToHexStr (
- IN OUT CHAR16 *Buffer,
- IN UINT64 Value,
- IN UINTN Flags,
- IN UINTN Width
- )
-/*++
-
-Routine Description:
-
- VSPrint worker function that prints a Value as a hex number in Buffer
-
-Arguments:
-
- Buffer - Location to place ascii hex string of Value.
- Value - Hex value to convert to a string in Buffer.
- Flags - Flags to use in printing Hex string, see file header for details.
- Width - Width of hex value.
-
-Returns:
-
- Number of characters printed.
-
---*/
-{
- //
- // Porting Guide:
- // Edk II BasePrintLib function UnicodeValueToString does not support
- // to convert Value to Hex String.
- // Include the source code to user code or use the full PrintLib funtion
- // UnicodeVSPrintAsciiFormat (Buffer, MAXIMUM_VALUE_CHARACTERS, "%x", Value) instead.
- //
-
- CHAR16 TempBuffer[MAXIMUM_VALUE_CHARACTERS];
- CHAR16 *TempStr;
- CHAR16 Prefix;
- CHAR16 *BufferPtr;
- UINTN Count;
- UINTN Index;
-
- TempStr = TempBuffer;
- BufferPtr = Buffer;
-
- //
- // Count starts at one since we will null terminate. Each iteration of the
- // loop picks off one nibble. Oh yea TempStr ends up backwards
- //
- Count = 0;
-
- if (Width > MAXIMUM_VALUE_CHARACTERS - 1) {
- Width = MAXIMUM_VALUE_CHARACTERS - 1;
- }
-
- do {
- //
- // If Width == 0, it means no limit.
- //
- if ((Width != 0) && (Count >= Width)) {
- break;
- }
-
- Index = ((UINTN)Value & 0xf);
- *(TempStr++) = mHexStr[Index];
- Value = RShiftU64 (Value, 4);
- Count++;
- } while (Value != 0);
-
- if (Flags & PREFIX_ZERO) {
- Prefix = '0';
- } else {
- Prefix = ' ';
- }
-
- Index = Count;
- if (!(Flags & LEFT_JUSTIFY)) {
- for (; Index < Width; Index++) {
- *(TempStr++) = Prefix;
- }
- }
-
- //
- // Reverse temp string into Buffer.
- //
- while (TempStr != TempBuffer) {
- *(BufferPtr++) = *(--TempStr);
- }
-
- *BufferPtr = 0;
- return Index;
-}
-////~
-
-
-
-////
-EFI_STATUS
-R8_HexStringToBuf (
- IN OUT UINT8 *Buf,
- IN OUT UINTN *Len,
- IN CHAR16 *Str,
- OUT UINTN *ConvertedStrLen OPTIONAL
- )
-/*++
-
- Routine Description:
- Converts Unicode string to binary buffer.
- The conversion may be partial.
- The first character in the string that is not hex digit stops the conversion.
- At a minimum, any blob of data could be represented as a hex string.
-
- Arguments:
- Buf - Pointer to buffer that receives the data.
- Len - Length in bytes of the buffer to hold converted data.
- If routine return with EFI_SUCCESS, containing length of converted data.
- If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired.
- Str - String to be converted from.
- ConvertedStrLen - Length of the Hex String consumed.
-
- Returns:
- EFI_SUCCESS - Routine Success.
- EFI_BUFFER_TOO_SMALL - The buffer is too small to hold converted data.
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
-
- UINTN HexCnt;
- UINTN Idx;
- UINTN BufferLength;
- UINT8 Digit;
- UINT8 Byte;
-
- //
- // Find out how many hex characters the string has.
- //
- for (Idx = 0, HexCnt = 0; R8_IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++);
-
- if (HexCnt == 0) {
- *Len = 0;
- return EFI_SUCCESS;
- }
- //
- // Two Unicode characters make up 1 buffer byte. Round up.
- //
- BufferLength = (HexCnt + 1) / 2;
-
- //
- // Test if buffer is passed enough.
- //
- if (BufferLength > (*Len)) {
- *Len = BufferLength;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- *Len = BufferLength;
-
- for (Idx = 0; Idx < HexCnt; Idx++) {
-
- R8_IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]);
-
- //
- // For odd charaters, write the lower nibble for each buffer byte,
- // and for even characters, the upper nibble.
- //
- if ((Idx & 1) == 0) {
- Byte = Digit;
- } else {
- Byte = Buf[Idx / 2];
- Byte &= 0x0F;
- Byte = (UINT8) (Byte | Digit << 4);
- }
-
- Buf[Idx / 2] = Byte;
- }
-
- if (ConvertedStrLen != NULL) {
- *ConvertedStrLen = HexCnt;
- }
-
- return EFI_SUCCESS;
-}
-////~
-
-////
-BOOLEAN
-R8_IsHexDigit (
- OUT UINT8 *Digit,
- IN CHAR16 Char
- )
-/*++
-
- Routine Description:
- Determines if a Unicode character is a hexadecimal digit.
- The test is case insensitive.
-
- Arguments:
- Digit - Pointer to byte that receives the value of the hex character.
- Char - Unicode character to test.
-
- Returns:
- TRUE - If the character is a hexadecimal digit.
- FALSE - Otherwise.
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
-
- if ((Char >= L'0') && (Char <= L'9')) {
- *Digit = (UINT8) (Char - L'0');
- return TRUE;
- }
-
- if ((Char >= L'A') && (Char <= L'F')) {
- *Digit = (UINT8) (Char - L'A' + 0x0A);
- return TRUE;
- }
-
- if ((Char >= L'a') && (Char <= L'f')) {
- *Digit = (UINT8) (Char - L'a' + 0x0A);
- return TRUE;
- }
-
- return FALSE;
-}
-////~
-
-////
-CHAR16
-R8_NibbleToHexChar (
- IN UINT8 Nibble
- )
-/*++
-
- Routine Description:
- Converts the low nibble of a byte to hex unicode character.
-
- Arguments:
- Nibble - lower nibble of a byte.
-
- Returns:
- Hex unicode character.
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
-
- Nibble &= 0x0F;
- if (Nibble <= 0x9) {
- return (CHAR16)(Nibble + L'0');
- }
-
- return (CHAR16)(Nibble - 0xA + L'A');
-}
-////~
-
-////#HobLib
-VOID *
-R8_GetHob (
- IN UINT16 Type,
- IN VOID *HobStart
- )
-/*++
-
-Routine Description:
-
- This function returns the first instance of a HOB type in a HOB list.
-
-Arguments:
-
- Type - The HOB type to return.
- HobStart - The first HOB in the HOB list.
-
-Returns:
-
- HobStart - There were no HOBs found with the requested type.
- Other - The first HOB with the matching type.
-
---*/
-{
- //
- // Porting Guide:
- // Edk II HobLib GetNextHob () is an equivelent function with the following exceptions:
- // 1. GetNextHob () does not allow NULL value as the argument of HobStart by ASSERT ()
- // 2. GetNextHob () will return NULL instead of returning HobStart when such kind of
- // HOB can be retrieved, so caller does not need to re-check the return HOB type any longer.
- //
-
- VOID *Hob;
- //
- // Return input if not found
- //
- if (HobStart == NULL) {
- return HobStart;
- }
- Hob = GetNextHob (Type, HobStart);
- if (Hob == NULL) {
- return HobStart;
- }
-
- return Hob;
-}
-////~
-
-////
-UINTN
-R8_GetHobListSize (
- IN VOID *HobStart
- )
-/*++
-
-Routine Description:
-
- Get size of hob list.
-
-Arguments:
-
- HobStart - Start pointer of hob list
-
-Returns:
-
- Size of hob list.
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
- EFI_PEI_HOB_POINTERS Hob;
- UINTN Size;
-
- Hob.Raw = HobStart;
- Size = 0;
-
- while (Hob.Header->HobType != EFI_HOB_TYPE_END_OF_HOB_LIST) {
- Size += Hob.Header->HobLength;
- Hob.Raw += Hob.Header->HobLength;
- }
-
- Size += Hob.Header->HobLength;
-
- return Size;
-}
-////~
-
-////
-UINT32
-R8_GetHobVersion (
- IN VOID *HobStart
- )
-/*++
-
-Routine Description:
-
- Get hob version.
-
-Arguments:
-
- HobStart - Start pointer of hob list
-
-Returns:
-
- Hob version.
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
-
- EFI_PEI_HOB_POINTERS Hob;
-
- Hob.Raw = HobStart;
- return Hob.HandoffInformationTable->Version;
-}
-////~
-
-////
-EFI_STATUS
-R8_GetHobBootMode (
- IN VOID *HobStart,
- OUT EFI_BOOT_MODE *BootMode
- )
-/*++
-
-Routine Description:
-
- Get current boot mode.
-
-Arguments:
-
- HobStart - Start pointer of hob list
- BootMode - Current boot mode recorded in PHIT hob
-
-Returns:
-
- EFI_NOT_FOUND - Invalid hob header
- EFI_SUCCESS - Boot mode found
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- // In fact, since EFI_HANDOFF_HOB must be the first Hob,
- // the following code can retrieve boot mode.
- //
- // EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
- //
- // HandOffHob = GetHobList ();
- // ASSERT (HandOffHob->Header.HobType == EFI_HOB_TYPE_HANDOFF);
- //
- // BootMode = HandOffHob->BootMode;
- //
- EFI_PEI_HOB_POINTERS Hob;
-
- Hob.Raw = HobStart;
- if (Hob.Header->HobType != EFI_HOB_TYPE_HANDOFF) {
- return EFI_NOT_FOUND;
- }
-
- *BootMode = Hob.HandoffInformationTable->BootMode;
- return EFI_SUCCESS;
-}
-////~
-
-
-////#HobLib
-EFI_STATUS
-R8_GetCpuHobInfo (
- IN VOID *HobStart,
- OUT UINT8 *SizeOfMemorySpace,
- OUT UINT8 *SizeOfIoSpace
- )
-/*++
-
-Routine Description:
-
- Get information recorded in CPU hob (Memory space size, Io space size)
-
-Arguments:
-
- HobStart - Start pointer of hob list
- SizeOfMemorySpace - Size of memory size
- SizeOfIoSpace - Size of IO size
-
-Returns:
-
- EFI_NOT_FOUND - CPU hob not found
- EFI_SUCCESS - CPU hob found and information got.
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- // If Cpu HOB info is indispensable, user is able to ASSERT ()
- // first to save error handling code
- // For example:
- //
- // EFI_HOB_CPU *CpuHob;
- //
- // CpuHob = GetHob (EFI_HOB_TYPE_CPU, HobStart);
- // ASSERT (CpuHob != NULL);
- //
- // ...
- //
- EFI_HOB_CPU *CpuHob;
-
- CpuHob = GetHob (EFI_HOB_TYPE_CPU, HobStart);
- if (CpuHob == NULL) {
- return EFI_NOT_FOUND;
- }
-
- *SizeOfMemorySpace = CpuHob->SizeOfMemorySpace;
- *SizeOfIoSpace = CpuHob->SizeOfIoSpace;
- return EFI_SUCCESS;
-}
-////~
-
-////#HobLib
-EFI_STATUS
-R8_GetDxeCoreHobInfo (
- IN VOID *HobStart,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length,
- OUT VOID **EntryPoint,
- OUT EFI_GUID **FileName
- )
-/*++
-
-Routine Description:
-
- Get memory allocation hob created for DXE core and extract its information
-
-Arguments:
-
- HobStart - Start pointer of the hob list
- BaseAddress - Start address of memory allocated for DXE core
- Length - Length of memory allocated for DXE core
- EntryPoint - DXE core file name
- FileName - File Name
-
-Returns:
-
- EFI_NOT_FOUND - DxeCoreHob not found
- EFI_SUCCESS - DxeCoreHob found and information got
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
- EFI_PEI_HOB_POINTERS DxeCoreHob;
-
- for (DxeCoreHob.Raw = HobStart;
- (DxeCoreHob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, DxeCoreHob.Raw)) != NULL;
- DxeCoreHob.Raw = GET_NEXT_HOB (DxeCoreHob)) {
- if (CompareGuid (&DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.Name,
- &gEfiHobMemeryAllocModuleGuid)) {
- *BaseAddress = DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.MemoryBaseAddress;
- *Length = DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.MemoryLength;
- *EntryPoint = (VOID *) (UINTN) DxeCoreHob.MemoryAllocationModule->EntryPoint;
- *FileName = &DxeCoreHob.MemoryAllocationModule->ModuleName;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-////~
-
-////#HobLib
-EFI_STATUS
-R8_GetNextFirmwareVolumeHob (
- IN OUT VOID **HobStart,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- )
-/*++
-
-Routine Description:
-
- Get next firmware volume hob from HobStart
-
-Arguments:
-
- HobStart - Start pointer of hob list
- BaseAddress - Start address of next firmware volume
- Length - Length of next firmware volume
-
-Returns:
-
- EFI_NOT_FOUND - Next firmware volume not found
- EFI_SUCCESS - Next firmware volume found with address information
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- // Pay attention that caller is REQUIRED to update HobStart with:
- // *HobStart = GET_NEXT_HOB (FirmwareVolumeHob)
- //
- // If FV HOB info is indispensable, user is able to ASSERT ()
- // first to save error handling code
- // For example:
- //
- // EFI_HOB_FIRMWARE_VOLUME *FirmwareVolumeHob;
- //
- // FirmwareVolumeHob = GetHob (EFI_HOB_TYPE_FV, HobStart);
- // ASSERT (FirmwareVolumeHob != NULL);
- //
- // ...
- //
-
- EFI_PEI_HOB_POINTERS FirmwareVolumeHob;
-
- FirmwareVolumeHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, *HobStart);
- if (FirmwareVolumeHob.Raw != NULL) {
- return EFI_NOT_FOUND;
- }
-
- *BaseAddress = FirmwareVolumeHob.FirmwareVolume->BaseAddress;
- *Length = FirmwareVolumeHob.FirmwareVolume->Length;
-
- *HobStart = GET_NEXT_HOB (FirmwareVolumeHob);
-
- return EFI_SUCCESS;
-}
-////~
-
-////#HobLib
-EFI_STATUS
-R8_GetNextGuidHob (
- IN OUT VOID **HobStart,
- IN EFI_GUID * Guid,
- OUT VOID **Buffer,
- OUT UINTN *BufferSize OPTIONAL
- )
-/*++
-
-Routine Description:
- Get the next guid hob.
-
-Arguments:
- HobStart - A pointer to the start hob.
- Guid - A pointer to a guid.
- Buffer - A pointer to the buffer.
- BufferSize - Buffer size.
-
-Returns:
- EFI_NOT_FOUND - Next Guid hob not found
- EFI_SUCCESS - Next Guid hob found and data for this Guid got
- EFI_INVALID_PARAMETER - invalid parameter
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is changed substantially with R9 counerpart GetNextGuidHob ().
- // 1. R9 GetNextGuidHob has two parameters and returns the matched GUID HOB from the StartHob.
- // 2. R9 GetNextGuidHob does not strip the HOB header, so caller is required to apply
- // GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () to extract the data section and its
- // size info respectively.
- // 3. this function does not skip the starting HOB pointer unconditionally:
- // it returns HobStart back if HobStart itself meets the requirement;
- // caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
- //
- EFI_PEI_HOB_POINTERS GuidHob;
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- GuidHob.Raw = GetNextGuidHob (Guid, *HobStart);
- if (GuidHob.Raw == NULL) {
- return EFI_NOT_FOUND;
- }
-
- *Buffer = GET_GUID_HOB_DATA (GuidHob.Guid);
- if (BufferSize != NULL) {
- *BufferSize = GET_GUID_HOB_DATA_SIZE (GuidHob.Guid);
- }
-
- *HobStart = GET_NEXT_HOB (GuidHob);
-
- return EFI_SUCCESS;
-}
-////~
-
-////#HobLib
-EFI_STATUS
-R8_GetPalEntryHobInfo (
- IN VOID *HobStart,
- OUT EFI_PHYSICAL_ADDRESS *PalEntry
- )
-/*++
-
-Routine Description:
-
- Get PAL entry from PalEntryHob
-
-Arguments:
-
- HobStart - Start pointer of hob list
- PalEntry - Pointer to PAL entry
-
-Returns:
-
- Status code.
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetNextGuidHob (&gPalEntryHob, HobStart);
-
- if (GuidHob == NULL) {
- return EFI_NOT_FOUND;
- }
-
- *PalEntry = *((EFI_PHYSICAL_ADDRESS *) GET_GUID_HOB_DATA (GuidHob));
- return EFI_SUCCESS;
-}
-////~
-
-////#HobLib
-EFI_STATUS
-R8_GetIoPortSpaceAddressHobInfo (
- IN VOID *HobStart,
- OUT EFI_PHYSICAL_ADDRESS *IoPortSpaceAddress
- )
-/*++
-
-Routine Description:
-
- Get IO port space address from IoBaseHob.
-
-Arguments:
-
- HobStart - Start pointer of hob list
- IoPortSpaceAddress - IO port space address
-
-Returns:
-
- Status code
-
---*/
-{
- //
- // Porting Guide:
- // This library interface is simply obsolete.
- // Include the source code to user code.
- //
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetNextGuidHob (&gEfiIoBaseHobGuid, HobStart);
-
- if (GuidHob == NULL) {
- return EFI_NOT_FOUND;
- }
-
- *IoPortSpaceAddress = *((EFI_PHYSICAL_ADDRESS *) GET_GUID_HOB_DATA (GuidHob));
- return EFI_SUCCESS;
-}
-////~
-
-////#HobLib
-EFI_STATUS
-R8_PeiBuildHobGuid (
- IN EFI_GUID *Guid,
- IN UINTN DataLength,
- OUT VOID **Hob
- )
-/*++
-
-Routine Description:
-
- Builds a custom HOB that is tagged with a GUID for identification
-
-Arguments:
-
- Guid - The GUID of the custome HOB type
- DataLength - The size of the data payload for the GUIDed HOB
- Hob - Pointer to pointer to the created Hob
-
-Returns:
-
- EFI_SUCCESS - Hob is successfully built.
- Others - Errors occur while creating new Hob
-
---*/
-{
- //
- // Porting Guide: Apply the new interface of BuildGuidHob in R9 HobLib.
- // Pay attention that the return value has been changed to the start address of
- // GUID HOB data so that caller can fill the customized data.
- // For BuildGuidHob (), the HOB Header and Name field is already stripped..
- //
- VOID *HobData;
-
- HobData = BuildGuidHob (Guid, DataLength);
- //
- // This step is necessary to be compatible with R8 interface!
- //
- *Hob = (VOID *) ((UINT8 *) HobData - sizeof (EFI_HOB_GUID_TYPE));
-
- return EFI_SUCCESS;
-}
-////~
diff --git a/Tools/Conf/target.template b/Tools/Conf/target.template
deleted file mode 100644
index 907a717fb9..0000000000
--- a/Tools/Conf/target.template
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-#
-# Filename: target.template
-#
-# 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 FPD 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 FPD files.
-ACTIVE_PLATFORM = EdkNt32Pkg/Nt32.fpd
-
-# TARGET List Optional Zero or more of the following: DEBUG, RELEASE,
-# UserDefined; separated by a space character.
-# If the line is missing or no value is specified, all
-# valid targets specified in the FPD file will attempt
-# to be built. The following line will build all platform
-# targets.
-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 or ARM.
-# Multiple values can be specified on a single line, using
-# space charaters to separate the values. These are used
-# during the parsing of an FPD file, restricting the build
-# output target(s.)
-# The Build Target ARCH is determined by a logical AND of:
-# FPD BuildOptions: <SupportedArchitectures> tag
-# If not specified, then all valid architectures specified
-# in the FPD file, for which tools are available, will be
-# built.
-# TARGET_ARCH =
-
-# 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,
-# tools_def.txt will be used for the build. This file
-# MUST be located in the WORKSPACE/Tools/Conf directory.
-TOOL_CHAIN_CONF = Tools/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 = MYTOOLS
-
-# MULTIPLE_THREAD FLAG Optional Flag to enable multi-thread build. If not specified, default
-# is "Disable". If your computer is multi-core or multiple CPUs,
-# enabling this feature will bring much benefit. For multi-thread
-# built, the log will write to ${BUILD_DIR}/build.log.
-# This feature is only for PLATFORM build, and clean, cleanall or
-# stand-alone module build is still using the normal way.
-MULTIPLE_THREAD = Enable
-
-# MAX_CONCURRENT_THREAD_NUMBER NUMBER Optional The number of concurrent threads. Default is 2. Recommend to
-# set this value to one more than the number of your compurter
-# cores or CPUs.
-MAX_CONCURRENT_THREAD_NUMBER = 2 \ No newline at end of file
diff --git a/Tools/Conf/tools_def.template b/Tools/Conf/tools_def.template
deleted file mode 100644
index 6ed4344042..0000000000
--- a/Tools/Conf/tools_def.template
+++ /dev/null
@@ -1,715 +0,0 @@
-#
-# Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-#
-# 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.
-#
-
-IDENTIFIER = Default TOOL_CHAIN_CONF
-
-####################################################################################
-#
-# format: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE = <string>
-# priorty:
-# 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
-# =====================
-# VS2003 - Microsoft Visual Studio .NET 2003
-# VS2005EXP - Microsoft Visual Studio 2005 Express Edition
-# VS2005STD - Microsoft Visual Studio 2005 Standard Edition
-# VS2005PRO - Microsoft Visual Studio 2005 Professional Edition
-# VS2005TEAMSUITE - Microsoft Visual Studio 2005 Team Suite Edition
-# WINDDK3790x1830 - Microsoft Windows DDK 3790.1830
-# UNIXGCC - UNIX GCC
-# ELFGCC - GCC for Unix Package to produce elf binary.
-# CYGWINGCC - CygWin GCC
-# UNIXPKGCYGWINGCC - CygWin GCC for Unix Package.
-# ICC - Intel C Compiler V9.1
-# MYTOOLS - Settings compatible with previous versions of tools_def.template
-#
-####################################################################################
-
-####################################################################################
-#
-# Microsoft Visual Studio .NET 2003 (IA-32 only, with Link Time Code Generation)
-#
-####################################################################################
-
-*_VS2003_IA32_*_FAMILY = MSFT
-
-*_VS2003_IA32_CC_NAME = cl.exe
-*_VS2003_IA32_VFRPP_NAME = cl.exe
-*_VS2003_IA32_SLINK_NAME = lib.exe
-*_VS2003_IA32_DLINK_NAME = link.exe
-*_VS2003_IA32_ASMLINK_NAME = link.exe
-*_VS2003_IA32_APP_NAME = cl.exe
-*_VS2003_IA32_PP_NAME = cl.exe
-*_VS2003_IA32_ASM_NAME = ml.exe
-*_VS2003_IA32_ASM_EXT = .asm
-*_VS2003_IA32_PCH_NAME = cl.exe
-
-##################
-# IA32 definitions
-##################
-*_VS2003_IA32_*_PATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
-*_VS2003_IA32_*_DPATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE
-
-*_VS2003_IA32_APP_FLAGS = /nologo /P /TC
-*_VS2003_IA32_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-*_VS2003_IA32_VFRPP_FLAGS = /nologo /P /TC /DVFRCOMPILE
-DEBUG_VS2003_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi /Gm
-RELEASE_VS2003_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_VS2003_IA32_PCH_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi /Gm
-RELEASE_VS2003_IA32_PCH_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC
-DEBUG_VS2003_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
-RELEASE_VS2003_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0
-*_VS2003_IA32_SLINK_FLAGS = /nologo /LTCG
-DEBUG_VS2003_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
-RELEASE_VS2003_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
-
-####################################################################################
-#
-# Microsoft Device Driver Kit 3790.1830 (IA-32, X64, Itanium, with Link Time Code Generation)
-#
-####################################################################################
-
-*_WINDDK3790x1830_*_*_FAMILY = MSFT
-
-*_WINDDK3790x1830_*_CC_NAME = cl.exe
-*_WINDDK3790x1830_*_VFRPP_NAME = cl.exe
-*_WINDDK3790x1830_*_SLINK_NAME = lib.exe
-*_WINDDK3790x1830_*_DLINK_NAME = link.exe
-*_WINDDK3790x1830_*_ASMLINK_NAME = link.exe
-*_WINDDK3790x1830_*_PP_NAME = cl.exe
-*_WINDDK3790x1830_*_APP_NAME = cl.exe
-*_WINDDK3790x1830_*_PCH_NAME = cl.exe
-
-*_WINDDK3790x1830_*_APP_FLAGS = /nologo /P /TC
-*_WINDDK3790x1830_*_SLINK_FLAGS = /nologo /LTCG
-*_WINDDK3790x1830_*_VFRPP_FLAGS = /nologo /P /TC /DVFRCOMPILE
-##################
-# IA32 definitions
-##################
-*_WINDDK3790x1830_IA32_ASM_NAME = ml.exe
-*_WINDDK3790x1830_IA32_ASM_EXT = .asm
-*_WINDDK3790x1830_IA32_*_PATH = C:\WINDDK\3790.1830\bin\x86
-*_WINDDK3790x1830_IA32_*_DPATH = C:\WINDDK\3790.1830\bin\x86
-*_WINDDK3790x1830_IA32_ASMLINK_PATH = C:\WINDDK\3790.1830\bin\bin16\
-
-*_WINDDK3790x1830_IA32_PP_FLAGS = /nologo /P /E /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_WINDDK3790x1830_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi /Gm
-RELEASE_WINDDK3790x1830_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_WINDDK3790x1830_IA32_PCH_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi /Gm
-RELEASE_WINDDK3790x1830_IA32_PCH_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC
-DEBUG_WINDDK3790x1830_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
-RELEASE_WINDDK3790x1830_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0
-DEBUG_WINDDK3790x1830_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
-RELEASE_WINDDK3790x1830_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
-*_WINDDK3790x1830_IA32_ASMLINK_FLAGS = /link /nologo /tiny
-
-##################
-# x64 definitions
-##################
-*_WINDDK3790x1830_X64_ASM_NAME = ml64.exe
-*_WINDDK3790x1830_X64_ASM_EXT = .asm
-*_WINDDK3790x1830_X64_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86\amd64
-*_WINDDK3790x1830_X64_ASMLINK_PATH = C:\WINDDK\3790.1830\bin\bin16\
-
-*_WINDDK3790x1830_X64_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_WINDDK3790x1830_X64_CC_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi /Gm /EHs-c- /GF
-RELEASE_WINDDK3790x1830_X64_CC_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF
-DEBUG_WINDDK3790x1830_X64_PCH_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi /Gm /EHs-c- /GF
-RELEASE_WINDDK3790x1830_X64_PCH_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /EHs-c- /GF
-DEBUG_WINDDK3790x1830_X64_ASM_FLAGS = /nologo /W3 /WX /c /Cx /Zd /Zi
-RELEASE_WINDDK3790x1830_X64_ASM_FLAGS = /nologo /W3 /WX /c /Cx /Zd
-DEBUG_WINDDK3790x1830_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
-RELEASE_WINDDK3790x1830_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
-
-##################
-# IPF definitions
-##################
-*_WINDDK3790x1830_IPF_ASM_NAME = ias.exe
-*_WINDDK3790x1830_IPF_ASM_EXT = .s
-*_WINDDK3790x1830_IPF_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86
-
-*_WINDDK3790x1830_IPF_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_WINDDK3790x1830_IPF_CC_FLAGS = /GS- /nologo /QIPF_fr32 /W4 /WX /EHs-c- /Gy /c /Os /GL /X /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi
-RELEASE_WINDDK3790x1830_IPF_CC_FLAGS = /GS- /nologo /QIPF_fr32 /W4 /WX /EHs-c- /Gy /c /Os /GL /X /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_WINDDK3790x1830_IPF_PCH_FLAGS = /GS- /nologo /QIPF_fr32 /W4 /WX /EHs-c- /Gy /c /Os /GL /X /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi
-RELEASE_WINDDK3790x1830_IPF_PCH_FLAGS = /GS- /nologo /QIPF_fr32 /W4 /WX /EHs-c- /Gy /c /Os /GL /X /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC
-DEBUG_WINDDK3790x1830_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4 -d debug
-RELEASE_WINDDK3790x1830_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4
-DEBUG_WINDDK3790x1830_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:${DEST_DIR_DEBUG}/${BASE_NAME}.map /PDB:${DEST_DIR_DEBUG}/${BASE_NAME}.pdb /DEBUG
-RELEASE_WINDDK3790x1830_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:${DEST_DIR_DEBUG}/${BASE_NAME}.map /PDB:${DEST_DIR_DEBUG}/${BASE_NAME}.pdb
-
-##################
-# EBC definitions
-##################
-*_WINDDK3790x1830_EBC_*_FAMILY = INTEL
-*_WINDDK3790x1830_EBC_PP_NAME = iec.exe
-*_WINDDK3790x1830_EBC_CC_NAME = iec.exe
-*_WINDDK3790x1830_EBC_DLINK_NAME = link.exe
-*_WINDDK3790x1830_EBC_SLINK_NAME = link.exe
-*_WINDDK3790x1830_EBC_*_PATH = C:\Program Files\Intel\EBC\Bin
-*_WINDDK3790x1830_EBC_*_SPATH = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib"
-
-*_WINDDK3790x1830_EBC_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-*_WINDDK3790x1830_EBC_CC_FLAGS = /nologo /c /W3 /WX /FI${DEST_DIR_DEBUG}/AutoGen.h /DSTRING_ARRAY_NAME=${BASE_NAME}Strings
-*_WINDDK3790x1830_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
-*_WINDDK3790x1830_EBC_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
-
-##################
-# ASL definitions
-##################
-*_WINDDK3790x1830_*_ASL_FAMILY = INTEL
-*_WINDDK3790x1830_*_ASL_NAME = iasl.exe
-*_WINDDK3790x1830_*_ASL_PATH = C:\ASL
-
-####################################################################################
-#
-# Microsoft Visual Studio 2005 Express Edition (IA-32 Only, with no Link Time Code Generation)
-#
-####################################################################################
-
-####################################################################################
-#
-# Microsoft Visual Studio 2005 Standard Edition (IA-32 Only, with no Link Time Code Generation)
-#
-####################################################################################
-
-####################################################################################
-#
-# Microsoft Visual Studio 2005 Professional Edition (IA-32 and X64 Only, with Link Time Code Generation)
-#
-####################################################################################
-
-*_VS2005PRO_*_*_FAMILY = MSFT
-
-*_VS2005PRO_*_CC_NAME = cl.exe
-*_VS2005PRO_*_SLINK_NAME = lib.exe
-*_VS2005PRO_*_DLINK_NAME = link.exe
-*_VS2005PRO_*_ASMLINK_NAME = link.exe
-*_VS2005PRO_*_PP_NAME = cl.exe
-*_VS2005PRO_*_APP_NAME = cl.exe
-*_VS2005PRO_*_VFRPP_NAME = cl.exe
-*_VS2005PRO_*_PCH_NAME = cl.exe
-
-*_VS2005PRO_*_SLINK_FLAGS = /NOLOGO /LTCG
-*_VS2005PRO_*_APP_FLAGS = /nologo /P /TC
-*_VS2005PRO_*_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-*_VS2005PRO_*_VFRPP_FLAGS = /nologo /P /TC /DVFRCOMPILE
-
-##################
-# IA32 definitions
-##################
-*_VS2005PRO_IA32_ASM_NAME = ml.exe
-*_VS2005PRO_IA32_ASM_EXT = .asm
-*_VS2005PRO_IA32_*_PATH = C:\Program Files\Microsoft Visual Studio 8\Vc\bin
-*_VS2005PRO_IA32_*_DPATH = C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
-*_VS2005PRO_IA32_ASM_PATH = C:\WINDDK\3790.1830\bin\x86
-*_VS2005PRO_IA32_ASMLINK_PATH = C:\WINDDK\3790.1830\bin\bin16\
-
-DEBUG_VS2005PRO_IA32_CC_FLAGS = /GS- /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi /Gm
-RELEASE_VS2005PRO_IA32_CC_FLAGS = /GS- /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_VS2005PRO_IA32_PCH_FLAGS = /GS- /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi /Gm
-RELEASE_VS2005PRO_IA32_PCH_FLAGS = /GS- /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC
-DEBUG_VS2005PRO_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
-RELEASE_VS2005PRO_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0
-DEBUG_VS2005PRO_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
-RELEASE_VS2005PRO_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
-*_VS2005PRO_IA32_ASMLINK_FLAGS = /link /nologo /tiny
-
-##################
-# x64 definitions
-##################
-*_VS2005PRO_X64_ASM_NAME = ml64.exe
-*_VS2005PRO_X64_ASM_EXT = .asm
-*_VS2005PRO_X64_*_PATH = C:\Program Files\Microsoft Visual Studio 8\Vc\bin\x86_amd64
-*_VS2005PRO_X64_*_DPATH = C:\Program Files\Microsoft Visual Studio 8\VC\bin\x86_amd64;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
-*_VS2005PRO_X64_ASMLINK_PATH = C:\WINDDK\3790.1830\bin\bin16\
-
-DEBUG_VS2005PRO_X64_CC_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi /Gm
-RELEASE_VS2005PRO_X64_CC_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_VS2005PRO_X64_PCH_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi /Gm
-RELEASE_VS2005PRO_X64_PCH_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC
-DEBUG_VS2005PRO_X64_ASM_FLAGS = /nologo /W3 /WX /c /Cx /Zd /Zi
-RELEASE_VS2005PRO_X64_ASM_FLAGS = /nologo /W3 /WX /c /Cx /Zd
-DEBUG_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
-RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
-
-##################
-# EBC definitions
-##################
-*_VS2005PRO_EBC_*_FAMILY = INTEL
-*_VS2005PRO_EBC_PP_NAME = iec.exe
-*_VS2005PRO_EBC_CC_NAME = iec.exe
-*_VS2005PRO_EBC_DLINK_NAME = link.exe
-*_VS2005PRO_EBC_SLINK_NAME = link.exe
-*_VS2005PRO_EBC_*_PATH = C:\Program Files\Intel\EBC\Bin
-*_VS2005PRO_EBC_*_SPATH = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib"
-
-*_VS2005PRO_EBC_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-*_VS2005PRO_EBC_CC_FLAGS = /nologo /c /W3 /WX /FI${DEST_DIR_DEBUG}/AutoGen.h /DSTRING_ARRAY_NAME=${BASE_NAME}Strings
-*_VS2005PRO_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
-*_VS2005PRO_EBC_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
-
-##################
-# ASL definitions
-##################
-*_VS2005PRO_*_ASL_FAMILY = INTEL
-*_VS2005PRO_*_ASL_NAME = iasl.exe
-*_VS2005PRO_*_ASL_PATH = C:\ASL
-
-####################################################################################
-#
-# Microsoft Visual Studio 2005 Team Suite Edition (IA-32, X64, and Itanium, with Link Time Code Generation)
-#
-####################################################################################
-
-
-####################################################################################
-#
-# MINGW32
-#
-# You can build a mingw32 toolchain by downloading the script package called
-# x86-mingw32-build.sh from the mingw project home page. It will walk you through
-# some options and explain what to do.
-#
-####################################################################################
-
-*_MINGW_*_*_FAMILY = GCC
-
-*_MINGW_IA32_CC_NAME = gcc
-*_MINGW_IA32_SLINK_NAME = ar
-*_MINGW_IA32_DLINK_NAME = ld
-*_MINGW_IA32_ASM_NAME = gcc
-*_MINGW_IA32_PP_NAME = gcc
-*_MINGW_IA32_VFRPP_NAME = gcc
-
-*_MINGW_*_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -c -include ${DEST_DIR_DEBUG}/AutoGen.h
-*_MINGW_*_DLINK_FLAGS = -nostdlib -O2 --gc-sections --dll --export-all-symbols --entry _${ENTRYPOINT} --file-alignment 0x20 --section-alignment 0x20
-*_MINGW_*_ASM_FLAGS = -c -imacros ${DEST_DIR_DEBUG}/AutoGen.h -DASM_PFX(name)=_##name
-*_MINGW_*_PP_FLAGS = -E -x assembler-with-cpp -include ${DEST_DIR_DEBUG}/AutoGen.h
-*_MINGW_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE
-*_MINGW_*_ASM_EXT = .S
-
-*_MINGW_IA32_*_PATH = /opt/mingw/i386-mingw32/bin/
-
-####################################################################################
-#
-# Unix GCC
-#
-####################################################################################
-
-*_UNIXGCC_*_*_FAMILY = GCC
-*_UNIXGCC_*_*_FAMILY = GCC
-
-*_UNIXGCC_IA32_CC_NAME = gcc
-*_UNIXGCC_IA32_SLINK_NAME = ar
-*_UNIXGCC_IA32_DLINK_NAME = ld
-*_UNIXGCC_IA32_ASM_NAME = gcc
-*_UNIXGCC_IA32_PP_NAME = gcc
-*_UNIXGCC_IA32_VFRPP_NAME = gcc
-
-*_UNIXGCC_X64_CC_NAME = gcc
-*_UNIXGCC_X64_SLINK_NAME = ar
-*_UNIXGCC_X64_DLINK_NAME = ld
-*_UNIXGCC_X64_ASM_NAME = gcc
-*_UNIXGCC_X64_PP_NAME = gcc
-*_UNIXGCC_X64_VFRPP_NAME = gcc
-
-*_UNIXGCC_IA32_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include ${DEST_DIR_DEBUG}/AutoGen.h
-*_UNIXGCC_X64_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include ${DEST_DIR_DEBUG}/AutoGen.h -D_EFI_P64
-*_UNIXGCC_*_DLINK_FLAGS = -nostdlib -O2 --gc-sections --dll --export-all-symbols --entry _${ENTRYPOINT} --file-alignment 0x20 --section-alignment 0x20 -Map ${DEST_DIR_DEBUG}/${BASE_NAME}.map
-*_UNIXGCC_*_ASM_FLAGS = -c -imacros ${DEST_DIR_DEBUG}/AutoGen.h -DASM_PFX(name)=_##name
-*_UNIXGCC_*_PP_FLAGS = -E -x assembler-with-cpp -include ${DEST_DIR_DEBUG}/AutoGen.h
-*_UNIXGCC_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE
-*_UNIXGCC_*_ASM_EXT = .S
-
-*_UNIXGCC_IA32_*_PATH = /opt/tiano/i386-tiano-pe/i386-tiano-pe/bin
-*_UNIXGCC_X64_*_PATH = /opt/tiano/x86_64-pc-mingw64/x86_64-pc-mingw64/bin
-
-
-####################################################################################
-#
-# Cygwin GCC
-#
-####################################################################################
-
-*_CYGWINGCC_X64_*_FAMILY = GCC
-*_CYGWINGCC_IA32_*_FAMILY = GCC
-
-*_CYGWINGCC_IA32_CC_NAME = gcc
-*_CYGWINGCC_IA32_SLINK_NAME = ar
-*_CYGWINGCC_IA32_DLINK_NAME = ld
-*_CYGWINGCC_IA32_ASM_NAME = gcc
-*_CYGWINGCC_IA32_PP_NAME = gcc
-*_CYGWINGCC_IA32_VFRPP_NAME = gcc
-
-*_CYGWINGCC_X64_CC_NAME = gcc
-*_CYGWINGCC_X64_SLINK_NAME = ar
-*_CYGWINGCC_X64_DLINK_NAME = ld
-*_CYGWINGCC_X64_ASM_NAME = gcc
-*_CYGWINGCC_X64_PP_NAME = gcc
-*_CYGWINGCC_X64_VFRPP_NAME = gcc
-
-*_CYGWINGCC_IA32_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -c -include ${DEST_DIR_DEBUG}/AutoGen.h
-*_CYGWINGCC_X64_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -c -include ${DEST_DIR_DEBUG}/AutoGen.h -D_EFI_P64
-*_CYGWINGCC_*_DLINK_FLAGS = -nostdlib -O2 --gc-sections --dll --export-all-symbols --entry _${ENTRYPOINT} --file-alignment 0x20 --section-alignment 0x20 -Map ${DEST_DIR_DEBUG}/${BASE_NAME}.map
-*_CYGWINGCC_*_ASM_FLAGS = -c -imacros ${DEST_DIR_DEBUG}/AutoGen.h -DASM_PFX(name)=_##name
-*_CYGWINGCC_*_PP_FLAGS = -E -x assembler-with-cpp -include ${DEST_DIR_DEBUG}/AutoGen.h
-*_CYGWINGCC_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE
-*_CYGWINGCC_*_ASM_EXT = .S
-
-*_CYGWINGCC_IA32_*_PATH = c:/Cygwin/opt/tiano/i386-tiano-pe/i386-tiano-pe/bin
-*_CYGWINGCC_X64_*_PATH = c:/Cygwin/opt/tiano/x86_64-pc-mingw64/x86_64-pc-mingw64/bin
-*_CYGWINGCC_*_*_DPATH = c:/Cygwin/bin
-
-####################################################################################
-#
-# Elf GCC - This configuration is used to compile on Linux boxes to produce elf
-# binaries.
-#
-####################################################################################
-
-
-*_ELFGCC_*_*_FAMILY = GCC
-
-*_ELFGCC_IA32_CC_NAME = gcc
-*_ELFGCC_IA32_SLINK_NAME = ar
-*_ELFGCC_IA32_DLINK_NAME = ld
-*_ELFGCC_IA32_ASM_NAME = gcc
-*_ELFGCC_IA32_PP_NAME = gcc
-*_ELFGCC_IA32_VFRPP_NAME = gcc
-
-*_ELFGCC_IA32_CC_FLAGS = -m32 -malign-double -g -fshort-wchar -Wall -Werror -c -include ${DEST_DIR_DEBUG}/AutoGen.h -DSTRING_ARRAY_NAME=${BASE_NAME}Strings
-*_ELFGCC_IA32_DLINK_FLAGS = -melf_i386 -nostdlib -n -q -Ttext 0x220 --entry ${ENTRYPOINT} -u ${ENTRYPOINT} -Map ${DEST_DIR_DEBUG}/${BASE_NAME}.map
-*_ELFGCC_IA32_ASM_FLAGS = -m32 -c -imacros ${DEST_DIR_DEBUG}/AutoGen.h -DASM_PFX(name)=name
-*_ELFGCC_IA32_PP_FLAGS = -m32 -E -x assembler-with-cpp -include ${DEST_DIR_DEBUG}/AutoGen.h
-
-*_ELFGCC_*_DLINK_FLAGS = -nostdlib -n -q -Ttext 0x220 --entry ${ENTRYPOINT} -u ${ENTRYPOINT} -Map ${DEST_DIR_DEBUG}/${BASE_NAME}.map
-*_ELFGCC_*_ASM_FLAGS = -c -imacros ${DEST_DIR_DEBUG}/AutoGen.h -DASM_PFX(name)=name
-*_ELFGCC_*_PP_FLAGS = -E -x assembler-with-cpp -include ${DEST_DIR_DEBUG}/AutoGen.h
-*_ELFGCC_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE
-*_ELFGCC_*_ASM_EXT = .S
-
-*_ELFGCC_IA32_*_PATH = /usr/bin
-
-####################################################################################
-#
-# UnixPkg CYGWIN GCC - This configuration is used to compile on CYGWIN environment for UnixPkg.
-#
-####################################################################################
-
-
-*_UNIXPKGCYGWINGCC_*_*_FAMILY = GCC
-
-*_UNIXPKGCYGWINGCC_IA32_CC_NAME = gcc
-*_UNIXPKGCYGWINGCC_IA32_SLINK_NAME = ar
-*_UNIXPKGCYGWINGCC_IA32_DLINK_NAME = ld
-*_UNIXPKGCYGWINGCC_IA32_ASM_NAME = gcc
-*_UNIXPKGCYGWINGCC_IA32_PP_NAME = gcc
-*_UNIXPKGCYGWINGCC_IA32_VFRPP_NAME = gcc
-
-*_UNIXPKGCYGWINGCC_IA32_CC_FLAGS = -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -c -include ${DEST_DIR_DEBUG}/AutoGen.h -DSTRING_ARRAY_NAME=${BASE_NAME}Strings -IC:/cygwin/usr/X11R6/include
-*_UNIXPKGCYGWINGCC_*_DLINK_FLAGS = -nostdlib -n -q -Ttext 0x220 --entry ${ENTRYPOINT} -u ${ENTRYPOINT} -Map ${DEST_DIR_DEBUG}/${BASE_NAME}.map
-*_UNIXPKGCYGWINGCC_*_ASM_FLAGS = -c -imacros ${DEST_DIR_DEBUG}/AutoGen.h -DASM_PFX(name)=_##name
-*_UNIXPKGCYGWINGCC_*_PP_FLAGS = -E -x assembler-with-cpp -include ${DEST_DIR_DEBUG}/AutoGen.h
-*_UNIXPKGCYGWINGCC_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE
-*_UNIXPKGCYGWINGCC_*_ASM_EXT = .S
-
-*_UNIXPKGCYGWINGCC_IA32_*_PATH = C:/cygwin/bin
-
-####################################################################################
-#
-# Mixed x64 - This configuration is used to compile C code with gcc and assemble
-# with the Microsoft assembler.
-#
-####################################################################################
-
-*_MIXED_X64_CC_FAMILY = GCC
-*_MIXED_X64_SLINK_FAMILY = GCC
-*_MIXED_X64_DLINK_FAMILY = GCC
-*_MIXED_X64_ASM_FAMILY = MSFT
-*_MIXED_X64_PP_FAMILY = MSFT
-
-*_MIXED_X64_CC_NAME = gcc
-*_MIXED_X64_SLINK_NAME = ar
-*_MIXED_X64_DLINK_NAME = ld
-*_MIXED_X64_ASM_NAME = gcc
-*_MIXED_X64_PP_NAME = cl.exe
-
-*_MIXED_X64_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -c -include ${DEST_DIR_DEBUG}/AutoGen.h -D_EFI_P64
-*_MIXED_*_DLINK_FLAGS = -nostdlib -O2 --gc-sections --dll --export-all-symbols --entry _${ENTRYPOINT} --file-alignment 0x20 --section-alignment 0x20 -Map ${DEST_DIR_DEBUG}/${BASE_NAME}.map
-*_MIXED_X64_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-
-*_MIXED_X64_ASM_NAME = ml64.exe
-*_MIXED_X64_ASM_PATH = C:/WINDDK/3790.1830/bin/win64/x86/amd64
-*_MIXED_X64_CC_PATH = C:/cygwin/opt/tiano/x86_64-pc-mingw64/x86_64-pc-mingw64/bin
-*_MIXED_X64_PP_PATH = C:/WINDDK/3790.1830/bin/win64/x86/amd64
-*_MIXED_X64_SLINK_PATH = C:/cygwin/opt/tiano/x86_64-pc-mingw64/x86_64-pc-mingw64/bin
-*_MIXED_X64_DLINK_PATH = C:/cygwin/opt/tiano/x86_64-pc-mingw64/x86_64-pc-mingw64/bin
-*_MIXED_X64_ASMLINK_PATH = C:/WINDDK/3790.1830/bin/bin16/
-
-DEBUG_MIXED_X64_ASM_FLAGS = /nologo /W3 /WX /c /Cx /Zd /Zi
-RELEASE_MIXED_X64_ASM_FLAGS = /nologo /W3 /WX /c /Cx /Zd
-
-####################################################################################
-#
-# Intel EFI Byte Code Compiler (Template)
-#
-####################################################################################
-#
-# *_*_EBC_*_FAMILY = INTEL
-# *_*_EBC_PP_NAME = iec.exe
-# *_*_EBC_CC_NAME = iec.exe
-# *_*_EBC_SLINK_NAME = link.exe
-# *_*_EBC_*_PATH = C:\Program Files\Intel\EBC\Bin
-# *_*_EBC_*_SPATH = C:\Program Files\Intel\EBC\Lib\EbcLib.lib
-#
-# *_*_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
-# *_*_EBC_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-# *_*_EBC_CC_FLAGS = /nologo /FAcs /c /W3 /WX /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h
-# *_*_EBC_DLINK_FLAGS = /NOLOGO /MACHINE:EBC /OPT:REF /NODEFAULTLIB /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
-#
-####################################################################################
-#
-# Intel ACPI Source Language Compiler (Template)
-#
-####################################################################################
-#
-# *_*_*_ASL_FAMILY = INTEL
-# *_*_*_ASL_NAME = iasl.exe
-# *_*_*_ASL_PATH = C:\ASL
-#
-####################################################################################
-#
-# Microsoft ACPI Source Language Compiler (Template)
-#
-####################################################################################
-#
-# *_*_*_ASL_FAMILY = MSFT
-# *_*_*_ASL_NAME = asl.exe
-# *_*_*_ASL_PATH = C:\ASL
-#
-
-
-####################################################################################
-#
-# Intel(R) C++ Compiler Version 9.1
-#
-# IPF - Intel(R) C++ Compiler for Itanium(R)Version 9.1 Build 20060928 Package ID: W_CC_C_9.1.032
-# ASL - Intel ACPI Source Language COmpiler
-#
-####################################################################################
-*_ICC_*_*_FAMILY = MSFT
-
-*_ICC_*_CC_NAME = cl.exe
-*_ICC_*_SLINK_NAME = lib.exe
-*_ICC_*_DLINK_NAME = link.exe
-*_ICC_*_ASMLINK_NAME = link.exe
-*_ICC_*_PP_NAME = cl.exe
-*_ICC_*_VFRPP_NAME = cl.exe
-*_ICC_*_APP_NAME = cl.exe
-*_ICC_*_ASM_NAME = ml.exe
-
-*_ICC_*_VFRPP_FLAGS = /nologo /P /TC /DVFRCOMPILE
-##################
-# IA32 definitions
-##################
-*_ICC_IA32_PCH_NAME = cl.exe
-*_ICC_IA32_ASM_EXT = .asm
-
-*_ICC_IA32_*_PATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
-*_ICC_IA32_*_DPATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE
-*_ICC_IA32_ASMLINK_PATH = C:\WINDDK\3790.1830\bin\bin16\
-
-*_ICC_IA32_APP_FLAGS = /nologo /P /TC
-*_ICC_IA32_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_ICC_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DEFI_FIRMWARE_VENDOR=L\"INTEL\" /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi /Gm
-RELEASE_ICC_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DEFI_FIRMWARE_VENDOR=L\"INTEL\" /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_ICC_IA32_PCH_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DEFI_FIRMWARE_VENDOR=L\"INTEL\" /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi /Gm
-RELEASE_ICC_IA32_PCH_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DEFI_FIRMWARE_VENDOR=L\"INTEL\" /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC
-DEBUG_ICC_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
-RELEASE_ICC_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0
-*_ICC_IA32_SLINK_FLAGS = /nologo /LTCG
-DEBUG_ICC_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
-RELEASE_ICC_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
-
-
-##################
-# IPF definitions
-##################
-*_ICC_IPF_*_FAMILY = INTEL
-
-*_ICC_IPF_CC_NAME = icl.exe
-*_ICC_IPF_SLINK_NAME = xilib.exe
-*_ICC_IPF_DLINK_NAME = xilink.exe
-*_ICC_IPF_ASMLINK_NAME = xilink.exe
-*_ICC_IPF_PP_NAME = icl.exe
-*_ICC_IPF_VFRPP_NAME = icl.exe
-
-#*_ICC_IPF_PCH_NAME = icl.exe
-*_ICC_IPF_APP_NAME = icl.exe
-*_ICC_IPF_ASM_NAME = ias.exe
-*_ICC_IPF_ASM_EXT = .s
-
-
-
-*_ICC_IPF_*_PATH = C:\Program Files\Intel\Compiler\C++\9.1\Itanium\Bin
-
-*_ICC_IPF_APP_FLAGS = /nologo /P /TC
-*_ICC_IPF_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_ICC_IPF_CC_FLAGS = /nologo /QIA64_fr32 /W4 /WX /Qwd981 /Qwd1418 /GX /Gy /c /O1 -mP3OPT_ecg_gcs_control=0x800 /Qserialize-volatile /Fa /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Zi
-RELEASE_ICC_IPF_CC_FLAGS = /nologo /QIA64_fr32 /W4 /WX /Qwd981 /Qwd1418 /GX /Gy /c /O1 -mP3OPT_ecg_gcs_control=0x800 /Qserialize-volatile /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h
-#DEBUG_ICC_IPF_PCH_FLAGS = /nologo /QIA64_fr32 /W4 /WX /Qwd981 /Qwd1418 /GX /Gy /c /O1 -mP3OPT_ecg_gcs_control=0x800 /Qserialize-volatile /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Yc /TC /Zi
-#RELEASE_ICC_IPF_PCH_FLAGS = /nologo /QIA64_fr32 /W4 /WX /Qwd981 /Qwd1418 /GX /Gy /c /O1 -mP3OPT_ecg_gcs_control=0x800 /Qserialize-volatile /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Yc /TC
-DEBUG_ICC_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W3 -d debug -F COFF32
-RELEASE_ICC_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W3 -F COFF32
-DEBUG_ICC_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:${DEST_DIR_DEBUG}/${BASE_NAME}.map /PDB:${DEST_DIR_DEBUG}/${BASE_NAME}.pdb /DEBUG
-RELEASE_ICC_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:${DEST_DIR_DEBUG}/${BASE_NAME}.map /PDB:${DEST_DIR_DEBUG}/${BASE_NAME}.pdb
-*_ICC_IPF_SLINK_FLAGS = /nologo /LTCG
-
-
-##################
-# ASL definitions
-##################
-*_ICC_*_ASL_FAMILY = INTEL
-*_ICC_*_ASL_NAME = iasl.exe
-*_ICC_*_ASL_PATH = C:\ASL
-
-####################################################################################
-#
-# MYTOOLS
-# IA32 - Microsoft Visual Studio .NET 2003 and Microsoft Windows DDK 3790.1830 for 16-bit linker
-# X64 - Microsoft Windows DDK 3790.1830
-# IPF - Microsoft Windows DDK 3790.1830
-# EBC - Intel EFI Byte Code Compiler
-# ASL - Intel ACPI Source Language COmpiler
-#
-####################################################################################
-*_MYTOOLS_*_*_FAMILY = MSFT
-
-*_MYTOOLS_*_CC_NAME = cl.exe
-*_MYTOOLS_*_SLINK_NAME = lib.exe
-*_MYTOOLS_*_DLINK_NAME = link.exe
-*_MYTOOLS_*_ASMLINK_NAME = link.exe
-*_MYTOOLS_*_PP_NAME = cl.exe
-*_MYTOOLS_*_VFRPP_NAME = cl.exe
-*_MYTOOLS_*_APP_NAME = cl.exe
-*_MYTOOLS_*_ASM_NAME = ml.exe
-
-*_MYTOOLS_*_VFRPP_FLAGS = /nologo /P /TC /DVFRCOMPILE
-##################
-# IA32 definitions
-##################
-*_MYTOOLS_IA32_PCH_NAME = cl.exe
-*_MYTOOLS_IA32_ASM_EXT = .asm
-
-*_MYTOOLS_IA32_*_PATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
-*_MYTOOLS_IA32_*_DPATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE
-*_MYTOOLS_IA32_ASMLINK_PATH = C:\WINDDK\3790.1830\bin\bin16\
-
-*_MYTOOLS_IA32_APP_FLAGS = /nologo /P /TC
-*_MYTOOLS_IA32_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_MYTOOLS_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi /Gm
-RELEASE_MYTOOLS_IA32_CC_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_MYTOOLS_IA32_PCH_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi /Gm
-RELEASE_MYTOOLS_IA32_PCH_FLAGS = /nologo /W4 /WX /Gy /c /D UNICODE /D EFI32 /O1ib2 /GL /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF /Gs8192 /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC
-DEBUG_MYTOOLS_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
-RELEASE_MYTOOLS_IA32_ASM_FLAGS = /nologo /W3 /WX /c /coff /Cx /Zd /W0
-*_MYTOOLS_IA32_ASMLINK_FLAGS = /link /nologo /tiny
-*_MYTOOLS_IA32_SLINK_FLAGS = /nologo /LTCG
-DEBUG_MYTOOLS_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
-RELEASE_MYTOOLS_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
-
-##################
-# x64 definitions
-##################
-*_MYTOOLS_X64_PCH_NAME = cl.exe
-*_MYTOOLS_X64_ASM_NAME = ml64.exe
-*_MYTOOLS_X64_ASM_EXT = .asm
-
-*_MYTOOLS_X64_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86\amd64
-*_MYTOOLS_X64_ASMLINK_PATH = C:\WINDDK\3790.1830\bin\bin16\
-
-*_MYTOOLS_X64_SLINK_FLAGS = /nologo /LTCG
-*_MYTOOLS_X64_APP_FLAGS = /nologo /P /TC
-*_MYTOOLS_X64_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_MYTOOLS_X64_CC_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi /Gm /EHs-c- /GF
-RELEASE_MYTOOLS_X64_CC_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF
-DEBUG_MYTOOLS_X64_PCH_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi /Gm /EHs-c- /GF
-RELEASE_MYTOOLS_X64_PCH_FLAGS = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /EHs-c- /GF
-DEBUG_MYTOOLS_X64_ASM_FLAGS = /nologo /W3 /WX /c /Cx /Zd /Zi
-RELEASE_MYTOOLS_X64_ASM_FLAGS = /nologo /W3 /WX /c /Cx /Zd
-DEBUG_MYTOOLS_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
-RELEASE_MYTOOLS_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
-
-##################
-# IPF definitions
-##################
-*_MYTOOLS_IPF_PCH_NAME = cl.exe
-*_MYTOOLS_IPF_ASM_NAME = ias.exe
-*_MYTOOLS_IPF_ASM_EXT = .s
-
-*_MYTOOLS_IPF_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86
-
-*_MYTOOLS_IPF_APP_FLAGS = /nologo /P /TC
-*_MYTOOLS_IPF_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_MYTOOLS_IPF_CC_FLAGS = /GS- /nologo /QIPF_fr32 /W4 /WX /EHs-c- /Gy /c /Os /GL /X /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi
-RELEASE_MYTOOLS_IPF_CC_FLAGS = /GS- /nologo /QIPF_fr32 /W4 /WX /EHs-c- /Gy /c /Os /GL /X /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h
-DEBUG_MYTOOLS_IPF_PCH_FLAGS = /GS- /nologo /QIPF_fr32 /W4 /WX /EHs-c- /Gy /c /Os /GL /X /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC /Zi
-RELEASE_MYTOOLS_IPF_PCH_FLAGS = /GS- /nologo /QIPF_fr32 /W4 /WX /EHs-c- /Gy /c /Os /GL /X /D EFI64 /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC
-DEBUG_MYTOOLS_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4 -d debug
-RELEASE_MYTOOLS_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4
-DEBUG_MYTOOLS_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:${DEST_DIR_DEBUG}/${BASE_NAME}.map /PDB:${DEST_DIR_DEBUG}/${BASE_NAME}.pdb /DEBUG
-RELEASE_MYTOOLS_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:${DEST_DIR_DEBUG}/${BASE_NAME}.map /PDB:${DEST_DIR_DEBUG}/${BASE_NAME}.pdb
-*_MYTOOLS_IPF_SLINK_FLAGS = /nologo /LTCG
-
-##################
-# EBC definitions
-##################
-*_MYTOOLS_EBC_*_FAMILY = INTEL
-*_MYTOOLS_EBC_PP_NAME = iec.exe
-*_MYTOOLS_EBC_CC_NAME = iec.exe
-*_MYTOOLS_EBC_DLINK_NAME = link.exe
-*_MYTOOLS_EBC_SLINK_NAME = link.exe
-
-*_MYTOOLS_EBC_*_PATH = C:\Program Files\Intel\EBC\Bin
-*_MYTOOLS_EBC_*_SPATH = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib"
-
-*_MYTOOLS_EBC_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
-*_MYTOOLS_EBC_CC_FLAGS = /nologo /c /W3 /WX /FI${DEST_DIR_DEBUG}/AutoGen.h /DSTRING_ARRAY_NAME=${BASE_NAME}Strings
-*_MYTOOLS_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
-*_MYTOOLS_EBC_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:${ENTRYPOINT} /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
-
-##################
-# ASL definitions
-##################
-*_MYTOOLS_*_ASL_FAMILY = INTEL
-*_MYTOOLS_*_ASL_NAME = iasl.exe
-*_MYTOOLS_*_ASL_PATH = C:\ASL
diff --git a/Tools/Java/Source/CheckTools/CheckTools.msa b/Tools/Java/Source/CheckTools/CheckTools.msa
deleted file mode 100644
index bcda84307e..0000000000
--- a/Tools/Java/Source/CheckTools/CheckTools.msa
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Check Tool Definitions</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>015250d4-e7e2-452f-a6aa-c8be46acbfc7</GuidValue>
- <Version>0.1</Version>
- <Abstract>The tool checks the active tool definition file to verify tools exists</Abstract>
- <Description>
-This tool will verify the tool chain configuration file to verify that the directories and programs exist.
-It will also check to see if an ACPI compiler has been defined for tool chain tag names - if not, then it prints a warning.
-It also checks the assembler to see if it exists, and where.
-The quiet option will not print anything.
-The return values are:
- 0 - PASS
- 1 - FAIL
-
-USAGE:
-checkTools [-h] [-d] [-i] [-v] [-s | -scan] [-t | -test] [-q | -quiet] [[-f | -filename] filename.txt]</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation All rights reserved.</Copyright>
- <License URL="http://opensource.org/licenses/bsd-license.php">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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>EBC IA32 X64 IPF ARM PPC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Merge</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>src/org/tianocore/CheckTools/ToolChecks.java</Filename>
- <Filename>src/org/tianocore/CheckTools/ToolInfo.java</Filename>
- <Filename>src/org/tianocore/CheckTools/CheckTools.java</Filename>
- <Filename>build.xml</Filename>
- <Filename>readme.txt</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/CheckTools/build.xml b/Tools/Java/Source/CheckTools/build.xml
deleted file mode 100644
index b1a592b116..0000000000
--- a/Tools/Java/Source/CheckTools/build.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="CheckTools" default="CheckTools" basedir=".">
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/bin"/>
- <target name="CheckTools" depends="install"/>
-
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="src" destdir="${buildDir}"/>
- </target>
-
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false" quiet="true">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/CheckTools" includes="${buildDir}"/>
- </delete>
- </target>
-
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: CheckTools.jar"/>
- <delete file="${installLocation}/CheckTools.jar"/>
- </target>
-
- <target name="install" depends="source">
- <jar destfile="${installLocation}/CheckTools.jar">
- <fileset dir="${buildDir}"/>
- </jar>
- </target>
-
-</project>
diff --git a/Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/CheckTools.java b/Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/CheckTools.java
deleted file mode 100644
index 7c0a26be8d..0000000000
--- a/Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/CheckTools.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/** @file
- Verify the tool configuration file for location of the correct tools.
-
- Copyright (c) 2006, 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.
-
- **/
-
-/**
- * This tool checks to see if specified tool chain paths exist.
- * It will check all specified paths, as indicated by the last field of the
- * tool property line equal to _PATH
- *
- * no option = check 1) the file specified in target.txt or 2) tools_def.txt
- * if neither is found, we check the tools_def.template file.
- * -i = INTERACTIVE checks the "active" tools_def.txt file and lets the
- * user modify invalid entries.
- *
- * -s = SCAN will check all standard locations for tool chains
- * C:\Program Files\Microsoft Visual Studio *
- * C:\WINDDK
- * C:\Bin
- * C:\ASL
- * C:\MASM*
- * /opt/tiano
- *
- * -f = FILE check the tools in this file instead of tools_def.txt, or
- * a file that was specified in target.txt
- *
- * -t = TEST can be used with -f or -s, not with -i.
- *
- * -d = DUMP can be used with -f, not with -i
- *
- * -q = QUIET - turns off all System.out.print statements, the return code
- * is the only thing that will determine PASS or FAIL
- *
- */
-package org.tianocore.CheckTools;
-
-import java.io.*;
-
-public class CheckTools {
- private static int DEBUG = 0;
-
- private static final String copyright = "Copyright (c) 2006, Intel Corporation All rights reserved.";
-
- private static final String version = "Version 0.1";
-
- private int VERBOSE = 0;
-
- private boolean QUIET = false;
-
- // private String argv[];
-
- private final int DEFAULT = 1;
-
- private final int TEST = 2;
-
- private final int SCAN = 4;
-
- private final int DUMP = 8;
-
- private final int INTERACTIVE = 16;
-
- private boolean USERFILE = false;
-
- private String inFile = "";
-
- private final int PASS = 0;
-
- private final int FAIL = 1;
-
- private String SEP = System.getProperty("file.separator");
-
- public static void main(String[] argv) {
- CheckTools cts = new CheckTools();
- int exitCode = cts.checkTool(argv);
- if (DEBUG > 10)
- System.out.println("Exit Code: " + exitCode);
- if (exitCode == -1) {
- new CheckTools().usage();
- System.exit(1);
- }
- System.exit(exitCode);
- }
-
- private int checkTool(String[] arguments) {
- if ((DEBUG > 1) && (arguments.length > 0))
- System.out.println("Arguments: ");
- int cmdCode = DEFAULT;
- if (arguments.length > 0) {
- cmdCode = DEFAULT;
- for (int i = 0; i < arguments.length; i++)
- if (arguments[i].toLowerCase().startsWith("-q"))
- QUIET = true;
- for (int i = 0; i < arguments.length; i++) {
- String arg = arguments[i];
- if (DEBUG > 1)
- System.out.println(" [" + i + "] " + arg);
- if (!(arg.toLowerCase().startsWith("-t") || arg.toLowerCase().startsWith("-s")
- || arg.toLowerCase().startsWith("-d") || arg.toLowerCase().startsWith("-i")
- || arg.toLowerCase().startsWith("-v") || arg.toLowerCase().startsWith("-q")
- || arg.toLowerCase().startsWith("-h") || arg.toLowerCase().startsWith("-f"))) {
- // Only allow valid option flags
- if (QUIET == false) {
- System.out.println("Invalid argument: " + arg);
- usage();
- }
- System.exit(FAIL);
- }
-
- if (arg.toLowerCase().startsWith("-d")) {
- if (cmdCode == DEFAULT) {
- cmdCode = DUMP;
- } else {
- if (QUIET == false)
- System.out.println("Invalid Options");
- usage();
- System.exit(FAIL);
- }
- }
- if (arg.toLowerCase().startsWith("-f")) {
- i++;
- inFile = arguments[i];
- USERFILE = true;
- }
- if (arg.toLowerCase().startsWith("-h")) {
- usage();
- System.exit(PASS);
- }
- if (arg.toLowerCase().startsWith("-i")) {
- // Interactive can be specified with any
- // other option - it turns on the query
- // on fail mode.
- cmdCode = cmdCode | INTERACTIVE;
- }
- if (arg.toLowerCase().startsWith("-q")) {
- QUIET = true;
- }
- if (arg.toLowerCase().startsWith("-s")) {
- if (cmdCode == DEFAULT) {
- cmdCode = SCAN;
- } else {
- if (!QUIET) {
- System.out.println("Invalid Options");
- usage();
- }
- System.exit(FAIL);
- }
- }
- if (arg.toLowerCase().startsWith("-t")) {
- if (cmdCode == DEFAULT) {
- cmdCode = TEST;
- } else {
- if (!QUIET) {
- System.out.println("Invalid Options");
- usage();
- }
- System.exit(FAIL);
- }
- }
- if (arg.startsWith("-v")) {
- // Verbose level can be increased to print
- // more INFO messages.
- VERBOSE += 1;
- }
- if (arg.startsWith("-V")) {
- if (!QUIET) {
- System.out.println(copyright);
- System.out.println("CheckTools, " + version);
- }
- System.exit(PASS);
- }
- }
- }
- if (QUIET)
- VERBOSE = 0;
-
- String WORKSPACE = System.getenv("WORKSPACE");
- if ((DEBUG > 0) || (VERBOSE > 0))
- System.out.println("Verifying Tool Chains for WORKSPACE: " + WORKSPACE);
- int returnCode = 0;
-
- if (WORKSPACE == null) {
- if (QUIET == false)
- System.out.println("Please set the environment variable, WORKSPACE and run again.");
- System.exit(FAIL);
- }
- String targetTxt = WORKSPACE + SEP + "Tools" + SEP + "Conf" + SEP + "target.txt";
-
-
- if (inFile.length() < 1) {
- //
- // Check the target.txt file for a Tool Configuration File.
- // If not set, we use tools_def.txt, unless we are running with the
- // INTERACTIVE flag - where we check the template file before copying over to the
- // tools_def.txt file.
- //
- inFile = "tools_def.txt";
- File target = new File(targetTxt);
- String readLine = null;
- String fileLine[] = new String[2];
- if (target.exists()) {
- try {
- FileReader fileReader = new FileReader(targetTxt);
- BufferedReader bufReader = new BufferedReader(fileReader);
- while ((readLine = bufReader.readLine()) != null) {
- if (readLine.startsWith("TOOL_CHAIN_CONF")) {
- fileLine = readLine.trim().split("=");
- if (fileLine[1].trim().length() > 0) {
- if (fileLine[1].trim().contains("Tools/Conf/"))
- inFile = fileLine[1].replace("Tools/Conf/", "").trim();
- else
- inFile = fileLine[1].trim();
- }
- }
- }
- bufReader.close();
- } catch (IOException e) {
- if (QUIET == false)
- System.out.println(" [target.txt] Read Error: " + e);
- System.exit(FAIL);
- }
- }
- }
-
- // OK, now check the infile of we had one.
- String toolsDef = WORKSPACE + SEP + "Tools" + SEP + "Conf" + SEP + inFile;
- File toolsFile = new File(toolsDef);
- if (!toolsFile.exists()) {
- // use the template file
- if (USERFILE) {
- if (QUIET == false) {
- System.out.println("Could not locate the specified file: " + inFile);
- System.out.println(" It must be located in the WORKSPACE" + SEP + "Tools" + SEP + "Conf directory");
- }
- System.exit(FAIL);
- }
- toolsDef = WORKSPACE + SEP + "Tools" + SEP + "Conf" + SEP + "tools_def.template";
- File toolsTemplate = new File(toolsDef);
- if (!toolsTemplate.exists()) {
- if (QUIET == false)
- System.out.println("Your WORKSPACE is not properly configured!");
- System.exit(FAIL);
- } else {
- if (QUIET == false)
- System.out.println("**** WARNING: No Tool Configuration File was found, using the template file, "
- + toolsDef);
- }
- }
-
- //
- // at this point the file, toolsDef points to a tool configuration file of some sort.
- //
- // check tool configuration file
- if (DEBUG > 2)
- System.out.println("Calling checkTools(" + toolsDef + ", " + cmdCode + ", " + VERBOSE + ")");
- ToolChecks tc = new ToolChecks();
- returnCode = tc.checkTools(toolsDef, cmdCode, VERBOSE, QUIET);
-
- if (VERBOSE > 10)
- System.out.println(" checkTools returned: " + returnCode);
- return returnCode;
- }
-
- private void usage() {
- if (QUIET)
- return;
- System.out
- .println("Usage: checkTools [-h] [-d] [-i] [-v] [-s | -scan] [-t | -test] [-q | -quiet] [[-f | -filename] filename.txt]");
- System.out.println(" Where");
- System.out.println(" -h Help - display this screen.");
- System.out.println(" -d Dump - display the tool defintion file in user readable format");
- System.out.println(" -i Interactive query - not yet implemented!");
- System.out.println(" -v Verbose - add up to 3 -v options to increase info messages.");
- System.out.println(" -s Scan - search the usual places on your system for tools.");
- System.out.println(" The Scan feature not yet implemented!.");
- System.out.println(" -t Test - checks that PATH entries in the tool configuration file exist.");
- System.out
- .println(" -q Quiet - no messages get printed, the return value determines pass or fail.");
- System.out.println(" -f filename Use filename instead of the file specified in target.txt or");
- System.out.println(" tools_def.txt or tools_def.template.");
- System.out.println(" By Rule, all tool configuration files must reside in the");
- System.out.println(" WORKSPACE" + SEP + "Tools" + SEP + "Conf directory.");
- }
-}
diff --git a/Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/ToolChecks.java b/Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/ToolChecks.java
deleted file mode 100644
index 59cc336fd9..0000000000
--- a/Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/ToolChecks.java
+++ /dev/null
@@ -1,851 +0,0 @@
-/** @file
- Verify the tool configuration file for location of the correct tools.
-
- Copyright (c) 2006, 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.
-
- **/
-
-/**
- * This tool checks to see if specified tool chain paths exist.
- * It will check all specified paths, as indicated by the last field of the
- * tool property line equal to _PATH
- *
- * no option = check 1) the file specified in target.txt or 2) tools_def.txt
- * if neither is found, we check the tools_def.template file.
- * -i = INIT checks the tools_def.template file
- *
- * -s = SCAN will check all standard locations for tool chains
- * C:\Program Files\Microsoft Visual Studio *
- * C:\WINDDK
- * C:\Bin
- * C:\ASL
- * C:\MASM*
- * /opt/tiano
- *
- * -f = FILE check the tools in this file instead of tools_def.txt, or
- * a file that was specified in target.txt
- */
-package org.tianocore.CheckTools;
-
-import java.io.*;
-import java.util.*;
-
-public class ToolChecks {
- private static int DEBUG = 0;
-
- private final int DEFAULT = 1;
-
- private final int TEST = 2;
-
- private final int SCAN = 4;
-
- private final int DUMP = 8;
-
- private final int INTERACTIVE = 16;
-
- private final int PASS = 0;
-
- private final int FAIL = 1;
-
- private ArrayList<String> errLog = new ArrayList<String>();
-
- private ArrayList<String> goodLog = new ArrayList<String>();
-
- private ArrayList<String> warnLog = new ArrayList<String>();
-
- public int checkTools(String toolConfFile, int cmdCode, int VERBOSE, boolean QUIET) {
-
- int returnCode = FAIL;
- boolean interActive = false;
-
- if ((DEBUG > 0) || (VERBOSE > 0)) {
- if ((cmdCode & DUMP) == DUMP)
- System.out.print("Using Tool Configuration File: " + toolConfFile + " ");
- else
- System.out.println("Using Tool Configuration File: " + toolConfFile);
- }
-
- if (DEBUG > 2)
- System.out.println("The cmdCode: " + cmdCode);
-
- if ((cmdCode & INTERACTIVE) == INTERACTIVE) {
- interActive = true;
- if (QUIET == false)
- System.out.println("***** WARNING ***** The Interactive function has not been implemented yet!");
- }
-
- if ((cmdCode & DUMP) == DUMP) {
- returnCode = dumpFile(toolConfFile, VERBOSE, QUIET);
- if (DEBUG > 10)
- System.out.println("dumpFile returned: " + returnCode);
- }
-
- if ((cmdCode & SCAN) == SCAN) {
- returnCode = scanFile(toolConfFile, interActive, VERBOSE, QUIET);
- }
-
- if (((cmdCode & TEST) == TEST) || ((cmdCode & DEFAULT) == DEFAULT))
- returnCode = testFile(toolConfFile, interActive, VERBOSE, QUIET);
-
- if ((errLog.isEmpty() == false) && (QUIET == false)) {
- // We had ERRORS, not just Warnings.
- // System.out.println("Tool Configuration File: " + toolConfFile);
- System.out.println(" goodLog has: " + goodLog.size() + " entries");
- if ((goodLog.isEmpty() == false) && (VERBOSE > 1))
- for (int i = 0; i < goodLog.size(); i++)
- System.out.println("Tool Chain Tag Name: " + goodLog.get(i) + " is valid!");
- for (int i = 0; i < errLog.size(); i++)
- System.out.println(errLog.get(i));
- if (warnLog.isEmpty() == false)
- for (int i = 0; i < warnLog.size(); i++)
- System.out.println(" " + warnLog.get(i));
- if (VERBOSE > 0) {
- System.out.println();
- System.out.println("You can remove these WARNING messages by editing the file:");
- System.out.println(" " + toolConfFile);
- System.out.println("and commenting out out or deleting the entries for the tool");
- System.out.println("chain tag names that do not apply to your system.");
- }
- } else {
- if (QUIET == false) {
- if ((cmdCode & DUMP) == DUMP)
- System.out.println("");
- if (VERBOSE > 0) {
- System.out.print("Valid Tag Names:");
- for (int i = 0; i < goodLog.size(); i++)
- System.out.print(" " + goodLog.get(i));
- System.out.println("");
- }
- if (warnLog.isEmpty() == false)
- for (int i = 0; i < warnLog.size(); i++)
- System.out.println(" " + warnLog.get(i));
- if (returnCode == 0)
- if (warnLog.isEmpty())
- System.out.println(" Tool Configuration File: " + toolConfFile + " is valid!");
- else
- System.out.println(" Tool Configuration File: " + toolConfFile
- + " is valid! However, there are WARNINGS!");
- else
- System.out.println(" Tool Configuration File: " + toolConfFile
- + " contains INVALID tool tag names!");
- }
- }
-
- return returnCode;
- }
-
- private int scanFile(String testFile, boolean interActive, int VERBOSE, boolean QUIET) {
- if ((DEBUG > 0) || (VERBOSE > 0))
- System.out.println("Scanning the Normal Installation Locations ...");
- System.out.println("The Scan function has not been implemented yet!");
- return FAIL;
- }
-
- private int dumpFile(String testFile, int VERBOSE, boolean QUIET) {
- int retCode = PASS;
- try {
- //
- // initialize local variables
- //
- ArrayList<ToolInfo> info = new ArrayList<ToolInfo>();
- String readLine = "";
- String fileLine[] = new String[2];
- String property[] = new String[5];
- ToolInfo toolInf = null;
- String lastTagName = "arf";
- String lastFamily = "arf";
- String lastArch = "IA32";
- String lastCmdCode = "arf";
- // String lastFlags = "arf";
- boolean found = false;
- String tFamily = "arf";
- String tCmdName = "arf";
- String acpiPath = "";
- String cmdPath = "";
- String asmPath = "";
- int ctr = 0;
- //
- // Setup the reader
- //
- FileReader toolConfFile = new FileReader(testFile);
- BufferedReader bufReader = new BufferedReader(toolConfFile);
-
- while ((readLine = bufReader.readLine()) != null) {
- if (!readLine.startsWith("#")) {
- if (readLine.contains("IDENTIFIER")) {
- readLine = readLine.trim();
- fileLine = readLine.split("=");
- if (QUIET == false)
- System.out.println("IDENTIFIER: " + fileLine[1].trim());
- toolInf = new ToolInfo();
- toolInf.setValid();
- } else if (readLine.contains("_")) {
- /**
- * This section should complete array values
- * String TagName
- * String Family
- * boolean Valid
- * String Arch
- * ArrayList<String> Targets
- * ArrayList<String> CmdCode
- * ArrayList<String> Path
- * ArrayList<String> Arguments
- */
- if (DEBUG > 10)
- System.out.println("Processing: " + readLine.trim());
- readLine = readLine.trim();
- readLine = readLine.replaceFirst("=", "_SPLIT_HERE_");
- fileLine = readLine.split("_SPLIT_HERE_");
- fileLine[0] = fileLine[0].trim();
- fileLine[1] = fileLine[1].trim();
- property = fileLine[0].split("_");
-
- // Covert to simple string names
- String tTarget = property[0].trim();
- if (tTarget.contentEquals("*"))
- tTarget = "All Targets";
- String tTag = property[1].trim();
- String tArch = property[2].trim();
- String tCmdCode = property[3].trim();
- String tArg = property[4].trim();
- if (tArg.contentEquals("FAMILY"))
- tFamily = fileLine[1].trim();
- if (tArg.contentEquals("NAME")) {
- tCmdName = fileLine[1].trim();
- tCmdCode = tCmdCode + " (" + tCmdName + ")";
- }
-
- String tVal = fileLine[1].trim();
-
- // Process the TagName
- if ((!tTag.contentEquals(lastTagName))
- || ((!tArch.contentEquals(lastArch)) && (!tArch.contentEquals("*")))
- || (!tFamily.contentEquals(lastFamily))) {
- if (DEBUG > 10) {
- System.out.println(" LAST Tag: " + lastTagName + " Arch: " + lastArch + " Family: "
- + lastFamily);
- System.out.println(" NEXT Tag: " + tTag + " Arch: " + tArch + " Family: " + tFamily);
- }
- if ((!lastTagName.equals("arf")) && (!tTag.equals("*"))) {
- toolInf.setTagName(lastTagName);
- toolInf.setFamily(lastFamily);
- toolInf.setArch(lastArch);
- if (toolInf.getCmdCode().size() < 1)
- toolInf.addCmdCode(lastCmdCode);
- info.add(toolInf);
- toolInf = new ToolInfo();
- toolInf.setValid();
- if (DEBUG > 3)
- System.out.println(" ADDED " + ctr + " Tag: " + lastTagName + " Arch: " + lastArch
- + " Family: " + lastFamily + " CmdCode: " + lastCmdCode);
- ctr++;
-
- }
-
- if ((!tTag.contentEquals("*")) && (!tTag.contentEquals(lastTagName)))
- lastTagName = tTag;
-
- if ((!tArch.contentEquals(lastArch)) && (!tArch.contentEquals("*")))
- lastArch = tArch;
- if ((!tArch.contentEquals(lastArch)) && (tArch.contentEquals("*")))
- lastArch = "IA32";
-
- if (!tFamily.contentEquals(lastFamily))
- lastFamily = tFamily;
- if (DEBUG > 10)
- System.out.println(" Setting Tag: " + lastTagName + " Arch: " + lastArch
- + " Family: " + lastFamily);
- }
-
- // Set the Arch
- if ((!lastArch.contentEquals(tArch)) && (!tArch.contentEquals("*"))) {
- toolInf.setArch(tArch);
- lastArch = tArch;
- if (DEBUG > 10)
- System.out.println(" Setting Arch: " + tArch);
- }
-
- // Process Target field - making sure we add only unique values.
- if (!tTarget.contains("*")) {
- found = false;
- for (int k = 0; k < toolInf.getTargetName().size(); k++)
- if (toolInf.getTargetName(k).contentEquals(tTarget))
- found = true;
- if (!found) {
- toolInf.addTargetName(tTarget);
- if (DEBUG > 10)
- System.out.println(" Adding Target: " + tTarget);
- }
- }
-
- // Process Command Code Field - making sure we add only unique values.
- if (!tCmdCode.contentEquals("*")) {
- found = false;
- for (int k = 0; k < toolInf.getCmdCode().size(); k++)
- if (toolInf.getCmdCode(k).startsWith(tCmdCode))
- found = true;
- if (!found) {
- if (!tCmdCode.contains(" (")) {
- boolean nf = true;
- for (int m = toolInf.size(); m >= 0; --m) {
- if (nf) {
- ArrayList<String> lastCmdEntry = info.get(m).getCmdCode();
- for (int l = 0; l < lastCmdEntry.size(); l++) {
- if (lastCmdEntry.get(l).startsWith(tCmdCode)) {
- tCmdCode = lastCmdEntry.get(l).trim();
- if (DEBUG > 20)
- System.out.println("found tCmdCode here: " + tCmdCode);
- nf = false;
- }
- }
- }
- }
- if (nf == false) {
- toolInf.addCmdCode(tCmdCode);
- if (DEBUG > 10)
- System.out.println(" Adding previous CmdCode: " + tCmdCode);
- }
- } else {
- toolInf.addCmdCode(tCmdCode);
- lastCmdCode = tCmdCode;
- if (DEBUG > 10)
- System.out.println(" Adding first CmdCode: " + tCmdCode);
- }
- }
- }
-
- // Process Path Field - making sure we add only unique values.
- if (tArg.contentEquals("PATH")) {
- String prefix = "PATH_";
- if (tCmdCode.contentEquals("ASM"))
- prefix = "ASMPATH_";
- if (tCmdCode.contentEquals("ASMLINK"))
- prefix = "ALPATH_";
- if (tCmdCode.contentEquals("ASL"))
- prefix = "ASLPATH_";
- File path = new File(tVal);
- found = false;
- if (path.exists()) {
- for (int k = 0; k < toolInf.getPath().size(); k++)
- if (toolInf.getPath(k).startsWith(prefix))
- found = true;
- if (found == false) {
- toolInf.addPath(prefix + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding valid path: " + tVal);
- }
- if (prefix.contentEquals("ASLPATH_"))
- acpiPath = tVal;
- if (prefix.contentEquals("PATH_"))
- cmdPath = tVal;
- if (prefix.contentEquals("ASMPATH_"))
- asmPath = tVal;
- } else {
- toolInf.setInvalid();
- for (int k = 0; k < toolInf.getBadPath().size(); k++)
- if (toolInf.getBadPath(k).startsWith(prefix))
- found = true;
- if (!found) {
- toolInf.addBadPath(prefix + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding NOT valid Path: " + tVal);
- retCode = FAIL;
- }
- }
- }
-
- if (tArg.contentEquals("DPATH")) {
- found = false;
- File path = new File(tVal);
- if (path.exists()) {
- for (int k = 0; k < toolInf.getPath().size(); k++)
- if (toolInf.getPath(k).startsWith("DPATH_"))
- found = true;
- if (!found) {
- toolInf.addPath("DPATH_" + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding valid DPath: " + tVal);
- }
- } else {
- toolInf.setInvalid();
- for (int k = 0; k < toolInf.getBadPath().size(); k++)
- if (toolInf.getBadPath(k).contentEquals("DPATH_" + tVal))
- found = true;
- if (!found) {
- toolInf.addBadPath("DPATH_" + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding NOT valid DPath: " + tVal);
- retCode = FAIL;
- }
- }
- }
-
- if (tArg.contentEquals("SPATH")) {
- found = false;
- File path = new File(tVal);
- if (path.exists()) {
- for (int k = 0; k < toolInf.getPath().size(); k++)
- if (toolInf.getPath(k).contentEquals("SPATH_" + tVal))
- found = true;
- if (!found) {
- toolInf.addPath("SPATH_" + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding valid SPath: " + tVal);
- }
- } else {
- toolInf.setInvalid();
- for (int k = 0; k < toolInf.getBadPath().size(); k++)
- if (toolInf.getBadPath(k).contentEquals("SPATH_" + tVal))
- found = true;
- if (!found) {
- toolInf.addBadPath("SPATH_" + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding NOT valid SPath: " + tVal);
- retCode = FAIL;
- }
- }
- }
-
- if (tArg.equals("INCLUDEPATH")) {
- found = false;
- File path = new File(tVal);
- if (path.exists()) {
- for (int k = 0; k < toolInf.getPath().size(); k++)
- if (toolInf.getPath(k).contentEquals("INCLUDEPATH_" + tVal))
- found = true;
- if (!found) {
- toolInf.addPath("INCLUDEPATH_" + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding valid IPath: " + tVal);
- }
- } else {
- toolInf.setInvalid();
- for (int k = 0; k < toolInf.getBadPath().size(); k++)
- if (toolInf.getBadPath(k).contentEquals("INCLUDE_" + tVal))
- found = true;
- if (!found) {
- toolInf.addBadPath("INCLUDE_" + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding NOT valid IPath: " + tVal);
- retCode = FAIL;
- }
- }
- }
-
- if (tArg.equals("LIBPATH")) {
- found = false;
- File path = new File(tVal);
- if (path.exists()) {
- for (int k = 0; k < toolInf.getPath().size(); k++)
- if (toolInf.getPath(k).contentEquals("LIB_" + tVal))
- found = true;
- if (!found) {
- toolInf.addPath("LIB_" + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding valid LPath: " + tVal);
- }
- } else {
- toolInf.setInvalid();
- for (int k = 0; k < toolInf.getBadPath().size(); k++)
- if (toolInf.getBadPath(k).contentEquals("LIB_" + tVal))
- found = true;
- if (!found) {
- toolInf.addBadPath("LIB_" + tVal);
- if (DEBUG > 10)
- System.out.println(" Adding NOT valid LPath: " + tVal);
- retCode = FAIL;
- }
- }
- }
-
- if (tArg.equals("FLAGS")) {
- String flags = fileLine[1].trim();
- String fLine = tTarget + "_" + tCmdCode + "_FLAGS_" + flags;
- toolInf.addArguments(fLine);
- if (DEBUG > 10)
- System.out.println(" Adding flag line: " + fLine);
- }
- }
- }
- }
- toolInf.setArch(lastArch);
- toolInf.setFamily(lastFamily);
- toolInf.setTagName(lastTagName);
- info.add(toolInf);
- if (DEBUG > 2)
- System.out.println(" ADDED " + ctr + " LAST Tag: " + lastTagName + " Arch: " + lastArch + " Family: "
- + lastFamily + " Last CmdCode: " + lastCmdCode);
- //
- // Finished collecting data, print it out in Human Readable Format
- if (info.size() > 0) {
- if (QUIET == false)
- System.out.println(" **** TOOL CHAINS ****");
- if ((DEBUG > 0) || (VERBOSE > 1))
- System.out.println("There are " + info.size()
- + " different combinations of Tag Names and Architectures.");
- lastTagName = "arf";
-
- boolean asmExists = false;
- boolean asmPathDefined = false;
-
- boolean cmdPathDefined = false;
- boolean dPathDefined = false;
-
- boolean acpiPathDefined = false;
- boolean acpiDeclared = false;
- ArrayList<String> warnMsgs = null;
-
- for (int i = 0; i < info.size(); i++) {
- if (!lastTagName.contentEquals(info.get(i).getTagName())) {
- if ((acpiDeclared == false) && (!lastTagName.contentEquals("arf"))) {
- if (QUIET == false) {
- System.out
- .println(" ----WARNING: No ACPI assembler has been defined for "
- + lastTagName
- + ", you will not be able to successfully create a complete firmware image.");
- System.out.println("");
- }
- }
- if ((asmExists == false) && (!lastTagName.contentEquals("arf"))) {
- if (QUIET == false) {
- System.out.println(" ----WARNING: No Assembler has been defined for " + lastTagName
- + ", you will not be able to successfully compile all platforms.");
- System.out.println("");
- }
- }
- asmPath = "";
- asmPathDefined = false;
- cmdPath = "";
- cmdPathDefined = false;
- dPathDefined = false;
- acpiPath = "";
- acpiPathDefined = false;
- acpiDeclared = false;
- warnMsgs = new ArrayList<String>();
- lastTagName = info.get(i).getTagName();
- }
-
- if ((DEBUG > 0) || (VERBOSE > 1))
- System.out.print("Tool Chain " + i + " Tag Name: " + info.get(i).getTagName() + ", Family: "
- + info.get(i).getFamily());
- else if (QUIET == false)
- System.out.print("Tool Chain Tag Name: " + info.get(i).getTagName() + ", Family: "
- + info.get(i).getFamily());
-
- if (info.get(i).isValid()) {
- ToolInfo vTool = info.get(i);
- if (QUIET == false)
- System.out.println(" is Valid for Architecture: " + info.get(i).getArch());
- // OK, let's print out the command w/flags
-
- for (int m = 0; m < vTool.getPath().size(); m++) {
- String pathName[] = vTool.getPath(m).split("_");
- String prefix = " Tool Path: ";
- if (pathName[0].startsWith("DPATH")) {
- prefix = " Dynamic Linker Path: ";
- dPathDefined = true;
- }
- if (pathName[0].startsWith("PATH")) {
- cmdPathDefined = true;
- cmdPath = pathName[1].trim();
- }
- if (pathName[0].startsWith("APATH")) {
- asmPathDefined = true;
- asmPath = pathName[1].trim();
- }
- if (pathName[0].startsWith("ASLPATH")) {
- acpiPathDefined = true;
- acpiPath = pathName[1].trim();
- }
- if (VERBOSE > 0)
- System.out.println(prefix + pathName[1].trim());
- }
- if (acpiPathDefined == false) {
- if (VERBOSE > 0)
- warnMsgs.add(" ---- WARNING: " + vTool.getTagName() + "ACPI Path is not defined!");
- }
- if ((VERBOSE == 0) && (QUIET == false))
- System.out.print("Defined Targets: ");
- for (int k = 0; k < vTool.getTargetName().size(); k++) {
- String tTarget = vTool.getTargetName(k);
- if (tTarget.contentEquals("*"))
- break;
-
- if (VERBOSE > 0)
- System.out.println("+++ " + tTarget + " +++");
- else if (QUIET == false)
- System.out.print(" " + tTarget);
-
- for (int j = 0; j < vTool.getCmdCode().size(); j++) {
- String tCommand = vTool.getCmdCode(j);
- if (tCommand.contains("ASL ")) {
- acpiDeclared = true;
- if (acpiPathDefined) {
- // TODO: Check the acpi tool path
- }
- }
- if (vTool.getArguments().size() > 1) {
-
- if (!cmdPathDefined) {
- warnMsgs.add(" ---- ERROR: Command Path is not defined!");
- }
- if ((vTool.getFamily().contentEquals("MSFT")) && (!dPathDefined)) {
- warnMsgs
- .add(" ---- ERROR: Microsoft Tool Chains require a Path (DPATH) to the mspdbXX.dll file");
- }
-
- // Process Flag lines!
- for (int n = 0; n < vTool.getArguments().size(); n++) {
- String tFlags = vTool.getArguments(n);
- String aFlags[] = new String[2];
- aFlags = tFlags.split("FLAGS_");
- String tsCmd[] = tCommand.split(" ");
- tsCmd[0] = tsCmd[0].trim();
- if (DEBUG > 10)
- System.out.println(" tCmd: " + tsCmd[0] + ", aFlags[0]: " + aFlags[0]
- + ", tTarget: " + tTarget);
- if (aFlags[0].contains(tsCmd[0])) {
- if ((tFlags.contains("All")) || (aFlags[0].contains(tTarget))) {
- String flagLine = aFlags[1].trim();
- if (info.get(i).getFamily().contentEquals("MSFT")) {
- if (tCommand.startsWith("PP")) {
- if (QUIET == false)
- if ((!flagLine.contains("/P "))
- && (!flagLine.contains("/E "))) {
- System.out
- .println(" **** ERROR **** Pre-Processor Flags are NOT VALID!");
- }
- }
- }
- String cmdExe = "";
-
- if (tCommand.contains("ASM ")) {
- cmdExe = tCommand.replace("ASM (", "");
- cmdExe = cmdExe.replace(")", "");
- if (asmPathDefined)
- cmdExe = asmPath.trim() + File.separator + cmdExe.trim();
- else
- cmdExe = cmdPath.trim() + File.separator + cmdExe.trim();
- File testCmd = new File(cmdExe);
- // System.out.println("Check: " + cmdExe);
- if (!testCmd.exists()) {
- String errMsg = " **** ERROR **** Assembler Command Defined, but does not exist! "
- + cmdExe;
- if (VERBOSE > 0) {
- System.out.println(errMsg);
- }
- boolean nf = true;
- for (int r = 0; r < warnMsgs.size(); r++)
- if (warnMsgs.get(r).contentEquals(errMsg))
- nf = false;
- if (nf)
- warnMsgs.add(errMsg);
- } else
- asmExists = true;
-
- }
-
- if ((tCommand.contains("ASM ")) && (asmPathDefined == false)
- && (VERBOSE > 0))
- System.out
- .println(" --- WARNING: Assembler - "
- + tCommand
- + " defined, but a Separate Path to the Assembler was not defined, using: "
- + cmdExe);
- if ((asmPathDefined) && (tCommand.contains("ASM "))
- && (asmPathDefined == false) && (VERBOSE == 0)) {
- String msgIs = " --- WARNING: "
- + info.get(i).getTagName()
- + " Assembler "
- + info.get(i).getArch()
- + " - "
- + tCommand
- + " defined, but a Separate Path to the Assembler was not defined, using: "
- + cmdExe;
- boolean nf = true;
- for (int r = 0; r < warnMsgs.size(); r++)
- if (warnMsgs.get(r).contentEquals(msgIs))
- nf = false;
- if (nf)
- warnMsgs.add(msgIs);
- }
- if (VERBOSE > 0)
- System.out.println(" " + tCommand + " " + flagLine);
- }
- }
- }
- } else {
- if (VERBOSE > 0)
- System.out.println(" " + tCommand + " has no arguments defined.");
- }
- }
- }
-
- } else {
- if (QUIET == false)
- System.out.println(" is NOT VALID for Architecture: " + info.get(i).getArch());
- retCode = FAIL;
- for (int k = 0; k < info.get(i).getBadPath().size(); k++) {
- String failureString = "";
- String tempString = info.get(i).getBadPath(k);
- if (tempString.startsWith("PATH_"))
- failureString = "Common Command Path: " + tempString.replace("PATH_", "")
- + " is NOT Valid!";
- if (tempString.startsWith("SPATH"))
- failureString = "Static Linker Path: " + tempString.replace("SPATH_", "")
- + " is NOT valid!";
- if (tempString.startsWith("DPATH"))
- failureString = "Dynamic Linker Path: " + tempString.replace("DPATH_", "")
- + " is NOT valid!";
- if (tempString.startsWith("LIB_"))
- failureString = "System Lib Path: " + tempString.replace("LIB_", "")
- + " is NOT valid!";
- if (tempString.startsWith("INCLUDEPATH_"))
- failureString = "System include Path: " + tempString.replace("INCLUDEPATH_", "")
- + " is NOT valid!";
- if (tempString.startsWith("APATH"))
- failureString = "Assembler Path: " + tempString.replace("APATH_", "")
- + " is NOT valid!";
- if (tempString.startsWith("ALPATH"))
- failureString = "Assembler Link Path: " + tempString.replace("ALPATH_", "")
- + " is NOT valid!";
- if (tempString.startsWith("ASLPATH"))
- failureString = "ACPI Path: " + tempString.replace("ASLPATH_", "")
- + " is NOT valid!";
- if (QUIET == false)
- System.out.println(" --- " + failureString);
- }
-
- }
-
- if ((VERBOSE == 0) && (QUIET == false)) {
- System.out.println("");
- for (int p = 0; p < warnMsgs.size(); p++)
- System.out.println(warnMsgs.get(p));
- }
- if (QUIET == false)
- System.out.println("");
- }
-
- }
-
- } catch (IOException e) {
- if (QUIET == false)
- System.out.println("I/O Failure: " + e);
- retCode = FAIL;
- }
-
- return retCode;
- }
-
- private int testFile(String testFile, boolean interActive, int VERBOSE, boolean QUIET) {
-
- int retCode = PASS;
- String readLine = "";
- String fileLine[] = new String[2];
- boolean definedAsl = false;
-
- try {
- FileReader toolConfFile = new FileReader(testFile);
- BufferedReader reader = new BufferedReader(toolConfFile);
- String path = "";
- String props[] = new String[5];
- String lastErrTag = "barf";
- String lastTag = "barf";
- while ((readLine = reader.readLine()) != null) {
- if ((!readLine.startsWith("#")) && (readLine.contains("_PATH"))) {
- if (DEBUG > 2) {
- System.out.println(" PATH LINE: " + readLine);
- }
- readLine = readLine.trim();
- fileLine = readLine.split("=");
- path = fileLine[1].trim();
- props = fileLine[0].split("_");
- String tagName = props[1].trim();
- // System.out.println(" Testing TagName: " + tagName);
- String cmdTag = props[3].trim();
- if (!lastTag.contentEquals(tagName)) {
- // we have a new tagName
- // first past lastTag = barf, lastErrTag = barf, tagName = something other than BARF
- if (DEBUG > 0)
- System.out.println(" lastTag: " + lastTag + " this Tag: " + tagName + " lastErrTag: "
- + lastErrTag);
-
- if ((definedAsl == false) && (lastTag.contentEquals("barf") == false))
- warnLog.add(" -- WARNING: Tool Chain Tag Name: " + lastTag
- + " does not have an ACPI assembler defined!");
- definedAsl = false;
-
- if ((lastErrTag.contentEquals("barf")) || (!tagName.contentEquals(lastErrTag))) {
- if ((DEBUG > 2) || (VERBOSE > 3))
- System.out.println("Adding tag: " + tagName + " to the goodLog");
- goodLog.add(tagName);
- }
-
- lastTag = tagName;
-
- } // end of adding the new tag name to the goodLog and
- // checking if we had an ACPI compiler defined for the TagName
- File testPath = new File(path);
- if (cmdTag.contentEquals("ASL"))
- definedAsl = true;
- if (!testPath.exists()) {
- if (VERBOSE > 0)
- System.out.println(" Invalid path: " + path + ", path does not exist!");
- if (!tagName.contentEquals(lastErrTag)) {
- errLog.add(" -- WARNING: Tool Chain Tag Name: " + tagName + " is NOT valid!");
- errLog.add(" Tool Code: [" + cmdTag + "] Path: " + path + " does not exist!");
- }
- retCode = 1;
- lastErrTag = tagName;
-
- } else {
-
- if ((DEBUG > 0) || (VERBOSE > 0)) {
- if ((!tagName.contentEquals(lastTag)) && (!tagName.contentEquals(lastErrTag))
- && (!lastTag.contentEquals("barf"))) {
- String goodMsg = "Tool Chain: " + tagName + " is valid";
- System.out.println(goodMsg);
- }
- }
- } // end of path existence check
- } // end of parsing the PATH line
- } // end of reading file
- // Check the LAST Tag to see of ACPI has been defined.
- if (definedAsl == false)
- warnLog.add(" -- WARNING: Tool Chain Tag Name: " + lastTag
- + " does not have an ACPI assembler defined!");
- // CLEAN UP
- toolConfFile.close();
- } catch (IOException e) {
- if (QUIET == false)
- System.out.println(" [" + testFile + "] " + e);
- System.exit(FAIL);
- } // end of TRY-CATCH for reading file
-
- if ((errLog.isEmpty() == false) && (QUIET == false))
- for (int i = 0; i < goodLog.size(); i++) {
- for (int j = 0; j < errLog.size(); j++) {
- System.out.println(" Error Log [" + j + "] is " + errLog.get(j));
- if (errLog.get(j).contains(goodLog.get(i).trim())) {
- if (VERBOSE > 1)
- System.out.println(" Removing: " + goodLog.get(i).trim());
- goodLog.remove(i);
- break;
- }
- }
- }
- if (DEBUG > 0)
- System.out.println("Returning with goodLog having: " + goodLog.size());
- return retCode;
-
- }
-
-}
diff --git a/Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/ToolInfo.java b/Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/ToolInfo.java
deleted file mode 100644
index 3821c53dbd..0000000000
--- a/Tools/Java/Source/CheckTools/src/org/tianocore/CheckTools/ToolInfo.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/** @file
- Tool Definition Class for translating the tools_def.txt entries
-
- Copyright (c) 2006, 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.
-
- **/
-
-/**
- * This section should complete array values
- * this.TagName
- * this.Family
- * this.Valid
- * this.Arch
- * this.Targets[]
- * this.CmdCode[]
- * this.Path[]
- * this.Arguments[]
- *
- */
-
-package org.tianocore.CheckTools;
-
-import java.util.*;
-
-public class ToolInfo extends ArrayList {
-
- ///
- /// Define Class Serial Version UID
- ///
- private static final long serialVersionUID = 2513613555731096258L;
-
- private String sTagName;
-
- private String sFamily;
-
- private boolean bValid;
-
- private String sArch;
-
- private ArrayList<String> aTargetName = null;
-
- private ArrayList<String> aCmdCode = null;
-
- private ArrayList<String> aCmdName = null;
-
- private ArrayList<String> aPath = null;
-
- private ArrayList<String> aBadPath = null;
-
- private ArrayList<String> aArguments = null;
-
- public ToolInfo() {
- super();
- init();
- }
-
- private void init() {
- sTagName = "";
- sFamily = "";
- bValid = false;
- sArch = "";
- aTargetName = new ArrayList<String>();
- aCmdCode = new ArrayList<String>();
- aCmdName = new ArrayList<String>();
- aPath = new ArrayList<String>();
- aArguments = new ArrayList<String>();
- aBadPath = new ArrayList<String>();
- }
-
- public String getTagName() {
- return this.sTagName.trim();
- }
-
- public String getFamily() {
- return this.sFamily.trim();
- }
-
- public boolean isValid() {
- return this.bValid;
- }
-
- public String getArch() {
- return this.sArch.trim();
- }
-
- public ArrayList<String> getTargetName() {
- return this.aTargetName;
- }
-
- public String getTargetName(int id) {
- return this.aTargetName.get(id).trim();
- }
-
- public ArrayList<String> getCmdCode() {
- return this.aCmdCode;
- }
-
- public String getCmdCode(int id) {
- return this.aCmdCode.get(id).trim();
- }
-
- public ArrayList<String> getCmdName() {
- return this.aCmdName;
- }
-
- public String getCmdName(int id) {
- return this.aCmdName.get(id).trim();
- }
-
- public ArrayList<String> getPath() {
- return this.aPath;
- }
-
- public String getPath(int id) {
- return this.aPath.get(id).trim();
- }
-
- public ArrayList<String> getArguments() {
- return this.aArguments;
- }
-
- public String getArguments(int id) {
- return this.aArguments.get(id).trim();
- }
-
- public ArrayList<String> getBadPath() {
- return this.aBadPath;
- }
-
- public String getBadPath(int id) {
- return this.aBadPath.get(id).trim();
- }
-
- public void setTagName(String val) {
- this.sTagName = val.trim();
- }
-
- public void setFamily(String val) {
- this.sFamily = val.trim();
- }
-
- public void setValid() {
- this.bValid = true;
- }
-
- public void setInvalid() {
- this.bValid = false;
- }
-
- public void setArch(String val) {
- this.sArch = val.trim();
- }
-
- public void addTargetName(String val) {
- this.aTargetName.add(val.trim());
- }
-
- public void addCmdCode(String val) {
- this.aCmdCode.add(val.trim());
- }
-
- public void addCmdName(String val) {
- this.aCmdName.add(val.trim());
- }
-
- public void addPath(String val) {
- this.aPath.add(val.trim());
- }
-
- public void addArguments(String val) {
- this.aArguments.add(val.trim());
- }
-
- public void addBadPath(String val) {
- this.aBadPath.add(val.trim());
- }
-
-}
diff --git a/Tools/Java/Source/Common/Common.msa b/Tools/Java/Source/Common/Common.msa
deleted file mode 100644
index 6c07455b1f..0000000000
--- a/Tools/Java/Source/Common/Common.msa
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
- <MsaHeader>
- <ModuleName>Common Java Classes</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>9D0ACB3E-4CE1-4228-98FF-85E64B0A4EC8</GuidValue>
- <Version>2.0</Version>
- <Abstract>This is the EFI/Tiano Tool Resources Module</Abstract>
- <Description>
- This Module provides the EFI/Tiano Tools that are used to create EFI/Tiano
- Modules and Platform Binary Files (PBF)
- These tools require compilation only once if the Developer Workstation and
- the Developer's choice of HOST tool chain are stable. If the developer
- updates either the OS or the HOST tool chain, these tools should be rebuilt.
- </Description>
- <Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
- <License>
-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.
- </License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>build.xml</Filename>
- <Filename>org/tianocore/common/cache/FileTimeStamp.java</Filename>
-
- <Filename>org/tianocore/common/definitions/EdkDefinitions.java</Filename>
- <Filename>org/tianocore/common/definitions/ToolDefinitions.java</Filename>
-
- <Filename>org/tianocore/common/exception/EdkException.java</Filename>
-
- <Filename>org/tianocore/common/logger/DefaultLogger.java</Filename>
- <Filename>org/tianocore/common/logger/EdkLog.java</Filename>
- <Filename>org/tianocore/common/logger/LogMethod.java</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/Common/build.xml b/Tools/Java/Source/Common/build.xml
deleted file mode 100644
index f75db2fb71..0000000000
--- a/Tools/Java/Source/Common/build.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="Common" default="Common_Jar" basedir=".">
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>
-
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars">
- <include name="SurfaceArea.jar"/>
- </fileset>
- <fileset dir="${env.XMLBEANS_HOME}/lib">
- <include name="*.jar"/>
- </fileset>
- <pathelement path="${env.CLASSPATH}"/>
- </path>
-
- <target name="Common_Jar" depends="install"/>
-
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="." destdir="${buildDir}">
- <classpath refid="classpath"/>
- <compilerarg value="-Xlint"/>
- </javac>
- </target>
-
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/Common" includes="${buildDir}"/>
- </delete>
- </target>
-
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: Common.jar"/>
- <delete file="${installLocation}/Common.jar"/>
- <if>
- <available file="${installLocation}/Common.jar"/>
- <then>
- <echo message="You must manually remove the file: ${installLocation}/Common.jar"/>
- <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
- </then>
- </if>
- </target>
-
- <target name="install" depends="source">
- <jar destfile="${installLocation}/Common.jar"
- basedir="${buildDir}"
- includes="**"
- />
- </target>
-</project>
diff --git a/Tools/Java/Source/Common/org/tianocore/common/cache/FileTimeStamp.java b/Tools/Java/Source/Common/org/tianocore/common/cache/FileTimeStamp.java
deleted file mode 100644
index 968d31f15c..0000000000
--- a/Tools/Java/Source/Common/org/tianocore/common/cache/FileTimeStamp.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/** @file
-This file is to define the FileTimeStamp class for speeding up the dependency check.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.common.cache;
-
-import java.io.File;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.HashMap;
-
-/**
- FileTimeStamp class is used to cache the time stamp of accessing file, which
- will speed up the dependency check for build
- **/
-public class FileTimeStamp {
- //
- // cache the modified timestamp of files accessed, to speed up the depencey check
- //
- private static Map<String, Long> timeStampCache = new HashMap<String, Long>();
-
- /**
- Get the time stamp of given file. It will try the cache first and then
- get from file system if no time stamp of the file is cached.
-
- @param file File name
-
- @return long The time stamp of the file
- **/
- synchronized public static long get(String file) {
- long timeStamp = 0;
-
- Long value = timeStampCache.get(file);
- if (value != null) {
- timeStamp = value.longValue();
- } else {
- timeStamp = new File(file).lastModified();
- timeStampCache.put(file, new Long(timeStamp));
- }
-
- return timeStamp;
- }
-
- /**
- Force update the time stamp for the given file
-
- @param file File name
- @param timeStamp The time stamp of the file
- **/
- synchronized public static void update(String file, long timeStamp) {
- timeStampCache.put(file, new Long(timeStamp));
- }
-
- /**
- Force update the time stamp for the given file
-
- @param file File name
- **/
- synchronized public static void update(String file) {
- long timeStamp = new File(file).lastModified();
- timeStampCache.put(file, new Long(timeStamp));
- }
-
- /**
- Check if the time stamp of given file has been cached for not
-
- @param file The file name
-
- @return boolean
- **/
- synchronized public static boolean containsKey(String file) {
- return timeStampCache.containsKey(file);
- }
-}
diff --git a/Tools/Java/Source/Common/org/tianocore/common/definitions/EdkDefinitions.java b/Tools/Java/Source/Common/org/tianocore/common/definitions/EdkDefinitions.java
deleted file mode 100644
index e5f510a199..0000000000
--- a/Tools/Java/Source/Common/org/tianocore/common/definitions/EdkDefinitions.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/** @file
- EdkDefinitions Class.
-
- EdkDefinitions class incldes the common EDK definitions which are used
- by the Tools.
-
-Copyright (c) 2006, 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.
-
-**/
-
-package org.tianocore.common.definitions;
-
-/**
- This class includes the common EDK definitions.
- **/
-public class EdkDefinitions {
- ///
- /// MODULE_TYPE definitions
- ///
- public final static String MODULE_TYPE_BASE = "BASE";
- public final static String MODULE_TYPE_SEC = "SEC";
- public final static String MODULE_TYPE_PEI_CORE = "PEI_CORE";
- public final static String MODULE_TYPE_PEIM = "PEIM";
- public final static String MODULE_TYPE_DXE_CORE = "DXE_CORE";
- public final static String MODULE_TYPE_DXE_DRIVER = "DXE_DRIVER";
- public final static String MODULE_TYPE_DXE_RUNTIME_DRIVER = "DXE_RUNTIME_DRIVER";
- public final static String MODULE_TYPE_DXE_SMM_DRIVER = "DXE_SMM_DRIVER";
- public final static String MODULE_TYPE_DXE_SAL_DRIVER = "DXE_SAL_DRIVER";
- public final static String MODULE_TYPE_UEFI_DRIVER = "UEFI_DRIVER";
- public final static String MODULE_TYPE_UEFI_APPLICATION = "UEFI_APPLICATION";
- public final static String MODULE_TYPE_USER_DEFINED = "USER_DEFINED";
- public final static String MODULE_TYPE_TOOL = "TOOL";
-
- ///
- /// Extension definitions for each of module types
- ///
- public final static String ModuleTypeExtensions[][] = {
- { MODULE_TYPE_BASE, ".FFS" },
- { MODULE_TYPE_SEC, ".SEC" },
- { MODULE_TYPE_PEI_CORE, ".PEI" },
- { MODULE_TYPE_PEIM, ".PEI" },
- { MODULE_TYPE_DXE_CORE, ".DXE" },
- { MODULE_TYPE_DXE_DRIVER, ".DXE" },
- { MODULE_TYPE_DXE_RUNTIME_DRIVER, ".DXE" },
- { MODULE_TYPE_DXE_SMM_DRIVER, ".DXE" },
- { MODULE_TYPE_DXE_SAL_DRIVER, ".DXE" },
- { MODULE_TYPE_UEFI_DRIVER, ".DXE" },
- { MODULE_TYPE_UEFI_APPLICATION, ".APP" },
- { MODULE_TYPE_USER_DEFINED, ".FFS" },
- { MODULE_TYPE_TOOL, ".FFS" }
- };
-
- ///
- /// FFS_TYPE definitions
- ///
- public final static int EFI_FV_FILETYPE_ALL = 0x00;
- public final static int EFI_FV_FILETYPE_RAW = 0x01;
- public final static int EFI_FV_FILETYPE_FREEFORM = 0x02;
- public final static int EFI_FV_FILETYPE_SECURITY_CORE = 0x03;
- public final static int EFI_FV_FILETYPE_PEI_CORE = 0x04;
- public final static int EFI_FV_FILETYPE_DXE_CORE = 0x05;
- public final static int EFI_FV_FILETYPE_PEIM = 0x06;
- public final static int EFI_FV_FILETYPE_DRIVER = 0x07;
- public final static int EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER = 0x08;
- public final static int EFI_FV_FILETYPE_APPLICATION = 0x09;
- public final static int EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE = 0x0B;
- public final static int EFI_FV_FILETYPE_FFS_PAD = 0xF0;
-
- ///
- /// SECTION_TYPE definitions
- ///
- public final static String EFI_SECTION_COMPRESSION = "EFI_SECTION_COMPRESSION";
- public final static String EFI_SECTION_GUID_DEFINED = "EFI_SECTION_GUID_DEFINED";
- public final static String EFI_SECTION_PE32 = "EFI_SECTION_PE32";
- public final static String EFI_SECTION_PIC = "EFI_SECTION_PIC";
- public final static String EFI_SECTION_TE = "EFI_SECTION_TE";
- public final static String EFI_SECTION_DXE_DEPEX = "EFI_SECTION_DXE_DEPEX";
- public final static String EFI_SECTION_VERSION = "EFI_SECTION_VERSION";
- public final static String EFI_SECTION_USER_INTERFACE = "EFI_SECTION_USER_INTERFACE";
- public final static String EFI_SECTION_COMPATIBILITY16 = "EFI_SECTION_COMPATIBILITY16";
- public final static String EFI_SECTION_FIRMWARE_VOLUME_IMAGE = "EFI_SECTION_FIRMWARE_VOLUME_IMAGE";
- public final static String EFI_SECTION_FREEFORM_SUBTYPE_GUID = "EFI_SECTION_FREEFORM_SUBTYPE_GUID";
- public final static String EFI_SECTION_RAW = "EFI_SECTION_RAW";
- public final static String EFI_SECTION_PEI_DEPEX = "EFI_SECTION_PEI_DEPEX";
-
- ///
- /// Extension definitions for each of section types
- ///
- public final static String SectionTypeExtensions[][] = {
- { EFI_SECTION_COMPRESSION, ".sec" },
- { EFI_SECTION_GUID_DEFINED, ".sec" },
- { EFI_SECTION_PE32, ".pe32" },
- { EFI_SECTION_PIC, ".pic" },
- { EFI_SECTION_TE, ".tes" },
- { EFI_SECTION_DXE_DEPEX, ".dpx" },
- { EFI_SECTION_VERSION, ".ver" },
- { EFI_SECTION_USER_INTERFACE, ".ui" },
- { EFI_SECTION_COMPATIBILITY16, ".sec" },
- { EFI_SECTION_FIRMWARE_VOLUME_IMAGE, ".sec" },
- { EFI_SECTION_FREEFORM_SUBTYPE_GUID, ".sec" },
- { EFI_SECTION_RAW, ".sec" },
- { EFI_SECTION_PEI_DEPEX, ".dpx" }
- };
-}
diff --git a/Tools/Java/Source/Common/org/tianocore/common/definitions/ToolDefinitions.java b/Tools/Java/Source/Common/org/tianocore/common/definitions/ToolDefinitions.java
deleted file mode 100644
index dc6d9f772f..0000000000
--- a/Tools/Java/Source/Common/org/tianocore/common/definitions/ToolDefinitions.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/** @file
- ToolDefinitions Class.
-
- ToolDefinitions class incldes the common Tool definitions.
-
-Copyright (c) 2006, 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.
-
-**/
-
-package org.tianocore.common.definitions;
-
-import java.io.File;
-
-/**
- This class includes the common Tool definitions.
- **/
-public class ToolDefinitions {
- ///
- /// Line separator (carriage return-line feed, CRLF)
- ///
- public final static String LINE_SEPARATOR = "\r\n";
-
- ///
- /// Framework Database (FrameworkDatabase.db) file path
- ///
- public final static String FRAMEWORK_DATABASE_FILE_PATH =
- "Tools" + File.separatorChar + "Conf" + File.separatorChar + "FrameworkDatabase.db";
-
- ///
- /// Target (target.txt) file path
- ///
- public final static String TARGET_FILE_PATH =
- "Tools" + File.separatorChar + "Conf" + File.separatorChar + "target.txt";
-
- ///
- /// Default Tools Definition (tools_def.txt) file path
- ///
- public final static String DEFAULT_TOOLS_DEF_FILE_PATH =
- "Tools" + File.separatorChar + "Conf" + File.separatorChar + "tools_def.txt";
-
- ///
- /// Extension names for SPD, FPD, and MSA
- ///
- public final static String SPD_EXTENSION = ".spd";
- public final static String FPD_EXTENSION = ".fpd";
- public final static String MSA_EXTENSION = ".msa";
-
- ///
- /// Tool Chain Elements in the Tools Definition file
- ///
- public final static String TOOLS_DEF_ELEMENT_TARGET = "TARGET";
- public final static String TOOLS_DEF_ELEMENT_TOOLCHAIN = "TOOLCHAIN";
- public final static String TOOLS_DEF_ELEMENT_ARCH = "ARCH";
- public final static String TOOLS_DEF_ELEMENT_TOOLCODE = "TOOLCODE";
- public final static String TOOLS_DEF_ELEMENT_ATTRIBUTE = "ATTRIBUTE";
-
- ///
- /// Index of Tool Chain elements in the Tools Definition file
- ///
- public final static int TOOLS_DEF_ELEMENT_INDEX_TARGET = 0;
- public final static int TOOLS_DEF_ELEMENT_INDEX_TOOLCHAIN = 1;
- public final static int TOOLS_DEF_ELEMENT_INDEX_ARCH = 2;
- public final static int TOOLS_DEF_ELEMENT_INDEX_TOOLCODE = 3;
- public final static int TOOLS_DEF_ELEMENT_INDEX_ATTRIBUTE = 4;
- public final static int TOOLS_DEF_ELEMENT_INDEX_MAXIMUM = 5;
-
- ///
- /// Tool Chain Attributes in the Tools Definition file
- ///
- public final static String TOOLS_DEF_ATTRIBUTE_NAME = "NAME";
- public final static String TOOLS_DEF_ATTRIBUTE_PATH = "PATH";
- public final static String TOOLS_DEF_ATTRIBUTE_DPATH = "DPATH";
- public final static String TOOLS_DEF_ATTRIBUTE_SPATH = "SPATH";
- public final static String TOOLS_DEF_ATTRIBUTE_EXT = "EXT";
- public final static String TOOLS_DEF_ATTRIBUTE_FAMILY = "FAMILY";
- public final static String TOOLS_DEF_ATTRIBUTE_FLAGS = "FLAGS";
- public final static String TOOLS_DEF_ATTRIBUTE_LIBPATH = "LIBPATH";
- public final static String TOOLS_DEF_ATTRIBUTE_INCLUDEPATH= "INCLUDEPATH";
-
- ///
- /// Tool Chain Families in the Tools Definition file
- ///
- public final static String TOOLS_DEF_FAMILY_MSFT = "MSFT";
- public final static String TOOLS_DEF_FAMILY_INTEL = "INTEL";
- public final static String TOOLS_DEF_FAMILY_GCC = "GCC";
-
- ///
- /// Key name in the Target file
- ///
- public final static String TARGET_KEY_ACTIVE_PLATFORM = "ACTIVE_PLATFORM";
- public final static String TARGET_KEY_TARGET = "TARGET";
- public final static String TARGET_KEY_TOOLCHAIN = "TOOL_CHAIN_TAG";
- public final static String TARGET_KEY_ARCH = "TARGET_ARCH";
- public final static String TARGET_KEY_TOOLS_DEF = "TOOL_CHAIN_CONF";
- public final static String TARGET_KEY_MULTIPLE_THREAD = "MULTIPLE_THREAD";
- public final static String TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER
- = "MAX_CONCURRENT_THREAD_NUMBER";
-}
diff --git a/Tools/Java/Source/Common/org/tianocore/common/exception/EdkException.java b/Tools/Java/Source/Common/org/tianocore/common/exception/EdkException.java
deleted file mode 100644
index 6d4fc52dae..0000000000
--- a/Tools/Java/Source/Common/org/tianocore/common/exception/EdkException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*++
-
-Copyright (c) 2006, 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.
-
-Module Name:
- EdkException.java
-
-Abstract:
-
---*/
-
-package org.tianocore.common.exception;
-
-public class EdkException extends Exception {
- static final long serialVersionUID = -8494188017252114029L;
-
- public static boolean isPrintStack = false;
-
- public EdkException(String message) {
- super("[EdkException]:" + message);
- }
-
- public EdkException(String message, boolean traceStack) {
- super(message);
-
- }
-
- public EdkException(){
- super();
- }
-
- public EdkException(Exception e, String message){
- super("[EdkException]:" + message);
- if (isPrintStack){
- this.setStackTrace(e.getStackTrace());
- }
- e.printStackTrace();
- }
- public static void setIsprintStack (boolean flag){
- isPrintStack = flag;
- }
-}
diff --git a/Tools/Java/Source/Common/org/tianocore/common/logger/DefaultLogger.java b/Tools/Java/Source/Common/org/tianocore/common/logger/DefaultLogger.java
deleted file mode 100644
index b1d9d6de85..0000000000
--- a/Tools/Java/Source/Common/org/tianocore/common/logger/DefaultLogger.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*++
-
-Copyright (c) 2006, 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.
-
-Module Name:
- DefaultLogger.java
-
-Abstract:
-
---*/
-
-package org.tianocore.common.logger;
-
-import java.io.File;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-class DefaultLogger implements LogMethod {
- private Logger logger = Logger.global;
- private static Level[] levelMap = {
- Level.SEVERE, Level.WARNING, Level.INFO, Level.FINE, Level.ALL
- };
-
- public DefaultLogger() {
- }
-
- public void putMessage(Object msgSource, int msgLevel, String msg) {
- if (msgLevel < 0 || msgLevel > levelMap.length) {
- msgLevel = 2;
- }
- logger.log(levelMap[msgLevel], msg);
- }
-
- public void flushToFile(File file){
-
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Common/org/tianocore/common/logger/EdkLog.java b/Tools/Java/Source/Common/org/tianocore/common/logger/EdkLog.java
deleted file mode 100644
index 6b3ed95471..0000000000
--- a/Tools/Java/Source/Common/org/tianocore/common/logger/EdkLog.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*++
-
- Copyright (c) 2006, 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.
-
- Module Name:
- EdkLogger.java
-
- Abstract:
-
- --*/
-package org.tianocore.common.logger;
-
-import java.io.File;
-
-public class EdkLog {
- public static final String always = "ALWAYS";
-
- public static final String error = "ERROR";
-
- public static final String warning = "WARNING";
-
- public static final String info = "INFO";
-
- public static final String verbose = "VERBOSE";
-
- public static final String debug = "DEBUG";
-
- public static final int EDK_ALWAYS = -1;
-
- public static final int EDK_ERROR = 0;
-
- public static final int EDK_WARNING = 1;
-
- public static final int EDK_INFO = 2;
-
- public static final int EDK_VERBOSE = 3;
-
- public static final int EDK_DEBUG = 4;
-
- private static int logLevel = EDK_INFO;
-
- private static LogMethod logger = new DefaultLogger();
-
- public static void log(int level, String message) {
- if (level <= logLevel) {
- logger.putMessage(null, level, message);
- }
- }
-
- public static void log(String message) {
- if (EDK_INFO <= logLevel) {
- logger.putMessage(null, EDK_INFO, message);
- }
- }
-
- public static void log(Object o, int level, String message) {
- if (level <= logLevel) {
- logger.putMessage(o, level, message);
- }
- }
-
- public static void log(Object o, String message) {
- if (EDK_INFO <= logLevel) {
- logger.putMessage(o, EDK_INFO, message);
- }
- }
-
- public static void flushLogToFile(File file) {
- logger.flushToFile(file);
- }
-
- public static void setLogger(LogMethod l) {
- logger = l;
- }
-
- public static void setLogLevel(int level) {
- logLevel = level;
- }
-
- public static void setLogLevel(String level) {
- if (level == null) {
- return;
- }
- String levelStr = level.trim();
- if (levelStr.equalsIgnoreCase(error)) {
- logLevel = EDK_ERROR;
- }
- if (levelStr.equalsIgnoreCase(debug)) {
- logLevel = EDK_DEBUG;
- }
- if (levelStr.equalsIgnoreCase(info)) {
- logLevel = EDK_INFO;
- }
- if (levelStr.equalsIgnoreCase(verbose)) {
- logLevel = EDK_VERBOSE;
- }
- if (levelStr.equalsIgnoreCase(warning)) {
- logLevel = EDK_WARNING;
- }
- }
-
- public static int getLogLevel() {
- return logLevel;
- }
-}
diff --git a/Tools/Java/Source/Common/org/tianocore/common/logger/LogMethod.java b/Tools/Java/Source/Common/org/tianocore/common/logger/LogMethod.java
deleted file mode 100644
index f9a6802430..0000000000
--- a/Tools/Java/Source/Common/org/tianocore/common/logger/LogMethod.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++
-
- Copyright (c) 2006, 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.
-
- Module Name:
- LogMethod.java
-
- Abstract:
-
- --*/
-
-package org.tianocore.common.logger;
-
-import java.io.File;
-
-public interface LogMethod {
- public void putMessage(Object msgSource, int msgLevel, String msg);
-
- public void flushToFile(File file);
-}
diff --git a/Tools/Java/Source/ContextTool/ContextTool.msa b/Tools/Java/Source/ContextTool/ContextTool.msa
deleted file mode 100644
index 6135d21431..0000000000
--- a/Tools/Java/Source/ContextTool/ContextTool.msa
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Context Tool</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>893c2f79-1d84-495a-a9c5-f7c1e8a58b31</GuidValue>
- <Version>0.1</Version>
- <Abstract>The tool manipulates the Tools/Conf/target.txt file.</Abstract>
- <Description>This tool is used to manipulate the target.txt file attributes from the command line.
-USAGE:
-ContextTool [-option1] [args] [-option2] [args] ...</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation All rights reserved.</Copyright>
- <License URL="http://opensource.org/licenses/bsd-license.php">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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>ContextTool</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>org/tianocore/context/ContextMain.java</Filename>
- <Filename>org/tianocore/context/HelpInfo.java</Filename>
- <Filename>org/tianocore/context/ParseParameter.java</Filename>
- <Filename>org/tianocore/context/TargetFile.java</Filename>
- <Filename>build.xml</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/ContextTool/build.xml b/Tools/Java/Source/ContextTool/build.xml
deleted file mode 100644
index 3779dbe257..0000000000
--- a/Tools/Java/Source/ContextTool/build.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="ContextTool" default="ContextTool" basedir=".">
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="SurfaceArea.jar"/>
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="Common.jar"/>
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
- </path>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>
- <target name="ContextTool" depends="install"/>
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="." destdir="${buildDir}">
- <classpath refid="classpath"/>
- <compilerarg value="-Xlint"/>
- </javac>
- </target>
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false" quiet="true">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/ContextTool" includes="${buildDir}"/>
- </delete>
- </target>
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: ContextTool.jar"/>
- <delete file="${installLocation}/ContextTool.jar"/>
- <if>
- <available file="${installLocation}/ContextTool.jar"/>
- <then>
- <echo message="You must manually remove the file: ${installLocation}/ContextTool.jar"/>
- <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
- </then>
- </if>
- </target>
- <target name="install" depends="source">
- <jar destfile="${installLocation}/ContextTool.jar"
- basedir="${buildDir}"
- includes="**"
- />
- </target>
-</project>
-
diff --git a/Tools/Java/Source/ContextTool/org/tianocore/context/ContextMain.java b/Tools/Java/Source/ContextTool/org/tianocore/context/ContextMain.java
deleted file mode 100644
index 94ea56a5c7..0000000000
--- a/Tools/Java/Source/ContextTool/org/tianocore/context/ContextMain.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
- File is ContextMain class .
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.context;
-
-public class ContextMain {
-
- public static void main(String[] args) {
-
- if (TargetFile.validateFilename("target.txt") == false) {
- String workspacePath = System.getenv("WORKSPACE");
- System.out.printf("%n%s%n", "target.txt can't be found. Please check it in " + workspacePath + "\\Tool\\Conf");
- System.exit(0);
- }
-
- if(ParseParameter.checkParameter(args) == false){
- System.exit(0);
- }
-
- if (TargetFile.readFile() == false){
- System.exit(0);
- }
-
- if (ParseParameter.standardizeParameter(args) > 0){
- System.exit(0);
- }
-
- if (TargetFile.createTempFile("target.txt") == false){
- System.exit(0);
- }
-
- if (TargetFile.readwriteFile() == false){
- System.exit(0);
- }
-
- String workspacePath = System.getenv("WORKSPACE");
- System.out.printf("%n%s%n", workspacePath + "\\Tool\\Conf\\target.txt is updated successfully!");
- }
-}
diff --git a/Tools/Java/Source/ContextTool/org/tianocore/context/HelpInfo.java b/Tools/Java/Source/ContextTool/org/tianocore/context/HelpInfo.java
deleted file mode 100644
index af2b653016..0000000000
--- a/Tools/Java/Source/ContextTool/org/tianocore/context/HelpInfo.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/** @file
- File is HelpInfo class which is used to output the usage info.
-
-Copyright (c) 2006, 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.
-**/
-
-package org.tianocore.context;
-
-import java.util.LinkedList;
-
-public class HelpInfo {
-
-
- /**
- * output the tools usage guide
- * @param no input parameter
- * @return no return value
- **/
- public static void outputUsageInfo() {
- System.out.printf("\n%s", DescripationString);
- System.out.printf("\n%s", UsageInfoString);
- System.out.printf("\n%s", DetailOfOptionString);
-
- for (int i = 0; i < settingnum; i++) {
- outputSubUsageInfo(UsageString[i], UsageStringInfo[i]);
- }
-
- System.out.printf("\n%s", ExampleString);
- System.out.printf("\n%s", str1);
- System.out.printf("\n%s", str2);
- System.out.printf("\n%s", str3);
- System.out.printf("\n%s", str4);
- }
-
- /**
- * output the usage info which bases on cmd option
- * @param String str1 : the cmd option
- * String str2 : the detail of cmd option
- * @return no return value
- **/
- private static void outputSubUsageInfo(String str1, String str2) {
-
- splitString(str2);
- System.out.printf("\n%4s %-30s %s", "", str1, List.get(0));
- for (int i=1; i<List.size(); i++){
- System.out.printf("\n%4s %-30s %s", "", "", List.get(i));
- }
- List.clear();
- }
-
- /**
- * according to the output width, split the detail info
- * @param String str :the detail info
- * @return no return value
- **/
- private static void splitString(String str) {
- int strlength = str.length();
- if (strlength > MaxSrtingLength) {
- String[] tokens = str.split("[ ]", 0);
- String tempstr = null;
- int templength = 0;
- int start = 0;
- int end = 0;
- for (int i = 0; i < tokens.length; i++) {
- if ((templength = end + tokens[i].length() + 1) < (MaxSrtingLength + start)) {
- end = templength;
- } else {
- tempstr = str.substring(start, end);
- List.add(tempstr);
- start = end;
- i = i - 1;
- }
- }
- tempstr = str.substring(start, end - 1);
- List.add(tempstr);
- } else {
- List.add(str);
- }
- }
-
-
- private static LinkedList<String> List = new LinkedList<String>();
-
- private static final int MaxSrtingLength = 40;
-
- private static final int settingnum = 7;
-
- private static final String DescripationString = "The purpose of this tool is modifying the settings in target.txt";
-
- private static final String UsageInfoString = "Usage: ContextTool [-option1] [args] [-option2] [args] ...";
-
- private static final String DetailOfOptionString = "Where options include:";
-
- private static final String ExampleString = "Example: ContextTool -a IA32 IA64 EBC -c Tools/Conf/tools_def.txt -t DEBUG -n GCC -p EdkNt32Pkg/Nt32.fpd -m 2\n";
-
- private static final String str1 = "show current sub setting: ContextTool -x";
-
- private static final String str2 = "show possible sub setting: ContextTool -x ?";
-
- private static final String str3 = "clean current sub setting: ContextTool -x 0";
-
- private static final String str4 = "x is the sub setting option, such as p, a, n, m, t, c.\n";
-
- private static final String HString = "-h";
-
- private static final String HStringInfo = "print usage info";
-
- private static final String AString = "-a <list of Arch>";
-
- private static final String AStringInfo = "What kind of architechure is the binary target, such as IA32, IA64, X64, EBC, or ARM. Multiple values can be specified on a single line, using space to separate the values.";
-
- private static final String CString = "-c <tool_definition_file.txt>";
-
- private static final String CStringInfo = "Assign a txt file with the relative path to WORKSPACE, which specify the tools to use for the build and must be located in the path: WORKSPACE/Tools/Conf/. If no file is specified, the default filename is \"tools_def.txt\"";
-
- private static final String NString = "-n <list of TagNames>";
-
- private static final String NStringInfo = "Specify the TagName, such as GCC, MSFT, which are defined in the \"tool_definition_file.txt\"";
-
- private static final String PString = "-p <*.fpd>";
-
- private static final String PStringInfo = "Specify the WORKSPACE relative Path and Filename of platform FPD file that will be used for the build.";
-
- private static final String TString = "-t <list of Build Targets>";
-
- private static final String TStringInfo = "What kind of the version is the binary target, such as DEBUG, RELEASE. Multiple values can be specified on a single line, using space to separate the values.";
-
- private static final String MString = "-m <num of Threads>";
-
- private static final String MStringInfo = "The number of concurrent threads. Default is 2. Recommend to set this value to one more than the number of your compurter cores or CPUs. 0 will disable MULTIPLE_THREAD and clean MAX_CONCURRENT_THREAD_NUMBER.";
-
- private static final String[] UsageString = { HString, AString, CString,
- NString, PString, TString, MString };
-
- private static final String[] UsageStringInfo = { HStringInfo, AStringInfo,
- CStringInfo, NStringInfo, PStringInfo, TStringInfo, MStringInfo };
-}
diff --git a/Tools/Java/Source/ContextTool/org/tianocore/context/ParseParameter.java b/Tools/Java/Source/ContextTool/org/tianocore/context/ParseParameter.java
deleted file mode 100644
index 4d9c6de3a0..0000000000
--- a/Tools/Java/Source/ContextTool/org/tianocore/context/ParseParameter.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/** @file
- File is ParseParameter class which is used to parse the validity of user's input args
- and standardize them.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.context;
-
-public class ParseParameter {
-
-
- /**
- * check the validity of user's input args
- * @param args -- user's input
- * @return true or false
- **/
- public static boolean checkParameter(String[] args) {
-
- if(args.length == 0){
- TargetFile.readFile();
- outputCurSetting();
- return false;
- } else {
- if( (args[0].compareToIgnoreCase("-h") == 0) || (args[0].compareToIgnoreCase("/h") == 0) ||
- (args[0].compareToIgnoreCase("--help") == 0) || (args[0].compareToIgnoreCase("/help") == 0) ){
- HelpInfo.outputUsageInfo();
- return false;
- }
- if( args[0].charAt(0) != '-' ){
- System.out.printf("%s\n", "Error Parameters! Please type \"ContextTool -h\" for helpinfo.");
- return false;
- }
- for(int i=0; i<args.length; i++){
- if( (args[i].startsWith("-") &&
- ((args[i].compareTo("-a") != 0) && (args[i].compareTo("-c") != 0) &&
- (args[i].compareTo("-n") != 0) && (args[i].compareTo("-p") != 0) &&
- (args[i].compareTo("-t") != 0) && (args[i].compareTo("-m") != 0)))){
- System.out.printf("%s\n", "Error Parameters! Please type \"ContextTool -h\" for helpinfo.");
- return false;
- }
- }
- }
-
- return true;
- }
-
- /**
- * standardize user's input args
- * @param args -- user's input
- * @return no return value
- **/
- public static int standardizeParameter(String[] args) {
-
-
- StringBuffer InputData = new StringBuffer();
- for (int i = 0; i < args.length; i++) {
- InputData.append(args[i]);
- InputData.append(" ");
- }
-
- int i = 0;
- while (i < InputData.length()) {
- int j = InputData.indexOf("-", i + 1);
- if (j == -1)
- j = InputData.length();
-
- String argstr = InputData.substring(i, j);
- i = j;
- if (argstr.charAt(1) == 'p') {
- //
- // argstr is "-p ", display current setting
- //
- if(argstr.length() < 4 && argstr.charAt(2) == ' '){
- if (curpstr != null) {
- System.out.printf("%s\n", curpstr);
- } else {
- System.out.printf("No ACTIVE_PLATFORM defined \n");
- }
- return 1;
- }
- //
- //argstr is "-p ? ", display possible setting
- //
- if(argstr.length() < 6 && argstr.charAt(3) == '?'){
- String workspacePath = System.getenv("WORKSPACE");
- System.out.printf( "%s\n", "Assign a platform FPD file with relative path to " + workspacePath);
- return 2;
- }
- //
- //argstr is "-p 0 ", clean current setting
- //
- if(argstr.length() < 6 && argstr.charAt(3) == '0'){
- curpstr = pstr;
- npflag = true;
- continue;
- }
- String[] S = argstr.split(" ");
- if(S.length > 2){
- System.out.printf( "%s\n", "There should be none or only one ACTIVE_PLATFORM. Please check the number of value which follow \"-p\".");
- return 3;
- }
- curpstr = pstr.concat(argstr.substring(2));
- npflag = true;
- } else if (argstr.charAt(1) == 't') {
- if(argstr.length() < 4 && argstr.charAt(2) == ' '){
- if (curtstr != null) {
- System.out.printf("%s\n", curtstr);
- } else {
- System.out.printf("No TARGET defined\n");
- }
- return 1;
- }
- if(argstr.length() < 6 && argstr.charAt(3) == '?'){
- System.out.printf( "%s\n", "What kind of the version is the binary target, such as DEBUG, RELEASE." );
- return 2;
- }
- if(argstr.length() < 6 && argstr.charAt(3) == '0'){
- curtstr = tstr;
- ntflag = true;
- continue;
- }
- curtstr = tstr.concat(argstr.substring(2));
- ntflag = true;
- } else if (argstr.charAt(1) == 'a') {
- if(argstr.length() < 4 && argstr.charAt(2) == ' '){
- if (curastr != null) {
- System.out.printf("%s\n", curastr);
- } else {
- System.out.printf("No TARGET_ARCH defined\n");
- }
- return 1;
- }
- if(argstr.length() < 6 && argstr.charAt(3) == '?'){
- System.out.printf( "%s\n", "What kind of architechure is the binary target, such as IA32, IA64, X64, EBC, or ARM." );
- return 2;
- }
- if(argstr.length() < 6 && argstr.charAt(3) == '0'){
- curastr = astr;
- naflag = true;
- continue;
- }
- curastr = astr.concat(argstr.substring(2));
- naflag = true;
- } else if (argstr.charAt(1) == 'c') {
- if(argstr.length() < 4 && argstr.charAt(2) == ' '){
- if (curcstr != null) {
- System.out.printf("%s\n", curcstr);
- } else {
- System.out.printf("No TOOL_CHAIN_CONF defined\n");
- }
- return 1;
- }
- if(argstr.length() < 6 && argstr.charAt(3) == '?'){
- String workspacePath = System.getenv("WORKSPACE");
- System.out.printf( "%s\n", "Assign a txt file with relative path to " + workspacePath + ", which specify the tools to use for the build and must be located in the path:" + workspacePath + "\\Tools\\Conf" );
- return 2;
- }
- if(argstr.length() < 6 && argstr.charAt(3) == '0'){
- curcstr = cstr;
- ncflag = true;
- continue;
- }
- String[] S = argstr.split(" ");
- if(S.length > 2){
- System.out.printf( "%s\n", "There should be one and only one TOOL_CHAIN_CONF. Please check the number of value which follow \"-c\".");
- return 3;
- }
- curcstr = cstr.concat(argstr.substring(2));
- ncflag = true;
- } else if (argstr.charAt(1) == 'n') {
- if(argstr.length() < 4 && argstr.charAt(2) == ' '){
- if (curnstr != null) {
- System.out.printf("%s\n", curnstr);
- } else {
- System.out.printf("No TOOL_CHAIN_TAG defined\n");
- }
- return 1;
- }
- if(argstr.length() < 6 && argstr.charAt(3) == '?'){
- System.out.printf( "%s\n", "Specify the TagName, such as GCC, MSFT." );
- return 2;
- }
- if(argstr.length() < 6 && argstr.charAt(3) == '0'){
- curnstr = nstr;
- nnflag = true;
- continue;
- }
- curnstr = nstr.concat(argstr.substring(2));
- nnflag = true;
- } else if (argstr.charAt(1) == 'm') {
- if(argstr.length() < 4 && argstr.charAt(2) == ' '){
- if (curmstr != null) {
- System.out.printf("%s\n", curmstr);
- } else {
- System.out.printf("No MAX_CONCURRENT_THREAD_NUMBER defined\n");
- }
- return 1;
- }
- if(argstr.length() < 6 && argstr.charAt(3) == '?'){
- System.out.printf( "%s\n", "The number of concurrent threads. Default is 2. Recommend to set this value to one more than the number of your compurter cores or CPUs." );
- return 2;
- }
- String[] S = argstr.split(" ");
- if(S.length > 2){
- System.out.printf( "%s\n", "There should be one and only one integer, which doesn't include space.");
- return 3;
- }
- mstr += argstr.substring(2);
- curmstr = mstr;
- nmflag = true;
- if (argstr.charAt(3) == '0'){
- mestr += " Disable";
- } else {
- mestr += " Enable";
- }
- curmestr = mestr;
- nmeflag = true;
- }
-
- }
- return 0;
- }
-
-
- public static boolean outputCurSetting(){
-
- System.out.printf( "%s\n", "The current setting is:" );
- String[] A = { pstr, tstr, astr, cstr, nstr, mstr, mestr };
- String[] B = { curpstr, curtstr, curastr, curcstr, curnstr, curmstr, curmestr };
-
- for(int i=0; i<A.length; i++){
- if(B[i] != null){
- System.out.printf( "%s\n", B[i] );
- }
- else{
- System.out.printf( "%s\n", A[i] );
- }
-
- }
-
- return true;
- }
-
-
- public static String pstr = new String("ACTIVE_PLATFORM = ");
- public static String tstr = new String("TARGET = ");
- public static String astr = new String("TARGET_ARCH = ");
- public static String cstr = new String("TOOL_CHAIN_CONF = ");
- public static String nstr = new String("TOOL_CHAIN_TAG = ");
- public static String mstr = new String("MAX_CONCURRENT_THREAD_NUMBER = ");
- public static String mestr = new String("MULTIPLE_THREAD = ");
-
- public static String curpstr = null;
- public static String curtstr = null;
- public static String curastr = null;
- public static String curcstr = null;
- public static String curnstr = null;
- public static String curmstr = null;
- public static String curmestr = null;
-
- public static boolean npflag = false;
- public static boolean ntflag = false;
- public static boolean naflag = false;
- public static boolean ncflag = false;
- public static boolean nnflag = false;
- public static boolean nmflag = false;
- public static boolean nmeflag = false;
-
-}
diff --git a/Tools/Java/Source/ContextTool/org/tianocore/context/TargetFile.java b/Tools/Java/Source/ContextTool/org/tianocore/context/TargetFile.java
deleted file mode 100644
index 122adf03ce..0000000000
--- a/Tools/Java/Source/ContextTool/org/tianocore/context/TargetFile.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/** @file
- File is TargetFile class which is used to generate the new target.txt.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.context;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-
-public class TargetFile {
-
-
-
- /**
- * validate the filename
- * @param String filename : the name of target file
- *
- * @return true or false
- **/
- public static boolean validateFilename(String filename) {
-
- String workspacePath = System.getenv("WORKSPACE");
-
- Fd = new File(workspacePath + File.separator + "Tools" + File.separator + "Conf" + File.separator + filename);
-
- if (Fd.exists() == true && Fd.canRead() == true)
- return true;
- else
- return false;
- }
-
-
- /**
- * create a empty temp file, which is located at the same directory with target file
- * @param String filename : the name of target temp file
- * @return true or false
- **/
- public static boolean createTempFile(String filename) {
-
- String workspacePath = System.getenv("WORKSPACE");
-
- TempFd = new File(workspacePath + File.separator + "Tools" + File.separator + "Conf" + File.separator + filename + "tmp");
-
- if (TempFd.exists() == true) {
- if (TempFd.delete() == false) {
- System.out.printf("%n%s%n", "target.txttmp has been existed, and failed in deletion!");
- return false;
- }
- }
- try {
- TempFd.createNewFile();
- } catch (IOException e) {
- System.out.printf("%n%s%n", "Failed in creation of the temp file:target.txttmp!");
- return false;
- }
-
- return true;
- }
-
- /**
- * read from target.txt and write to target.txttmp, del target.txt, rename
- * @param no paremeter
- * @return true or false
- **/
- public static boolean readwriteFile() {
-
- if (Fd.canRead() != true)
- return false;
-
- BufferedReader br = null;
- BufferedWriter bw = null;
- String textLine = null;
-
- try {
- br = new BufferedReader(new FileReader(Fd));
- } catch (FileNotFoundException e) {
- System.out
- .println("\n# Creating BufferedReader fail!");
- return false;
- }
- try {
- bw = new BufferedWriter(new FileWriter(TempFd));
- } catch (IOException e) {
- System.out.println("\n# Creating the BufferedWriter fail!");
- return false;
- }
-
- //
- //TARGET_ARCH must be in front of TARGET!!! according to the target.txt
- //
- try {
- while ((textLine = br.readLine()) != null) {
- //
- // the line is composed of Space
- //
- if (textLine.trim().compareToIgnoreCase("") == 0) {
- bw.write(textLine);
- bw.newLine();
- }
- //
- // the line starts with "#", and no "="
- //
- else if ((textLine.trim().charAt(0) == '#') && (textLine.indexOf("=") == -1)){
- bw.write(textLine);
- bw.newLine();
- } else {
- //
- //modify at the first time, and there should be "*ACTIVE_PLATFORM*=*" in the line
- //
- if (textLine.indexOf("ACTIVE_PLATFORM") != -1) {
- if(pflag == true){
- if(textLine.trim().charAt(0) == '#'){
- if(ParseParameter.npflag == true) {
- bw.write(ParseParameter.curpstr);
- }else{
- bw.write(textLine);
- }
- bw.newLine();
- pflag = false;
- continue;
- }
- if(ParseParameter.npflag == true) {
- bw.write(ParseParameter.curpstr);
- } else {
- bw.write(textLine);
- }
- bw.newLine();
- pflag = false;
- }
- } else if (textLine.indexOf("TARGET_ARCH") != -1) {
- if(aflag == true){
- if(textLine.trim().charAt(0) == '#'){
- if(ParseParameter.naflag == true) {
- bw.write(ParseParameter.curastr);
- }else{
- bw.write(textLine);
- }
- bw.newLine();
- aflag = false;
- continue;
- }
- if(ParseParameter.naflag == true) {
- bw.write(ParseParameter.curastr);
- } else {
- bw.write(textLine);
- }
- bw.newLine();
- aflag = false;
- }
- } else if (textLine.indexOf("TARGET") != -1) {
- if(tflag == true){
- if(textLine.trim().charAt(0) == '#'){
- if(ParseParameter.ntflag == true) {
- bw.write(ParseParameter.curtstr);
- }else{
- bw.write(textLine);
- }
- bw.newLine();
- tflag = false;
- continue;
- }
- if(ParseParameter.ntflag == true) {
- bw.write(ParseParameter.curtstr);
- } else {
- bw.write(textLine);
- }
- bw.newLine();
- tflag = false;
- }
- } else if (textLine.indexOf("TOOL_CHAIN_CONF") != -1) {
- if(cflag == true){
- if(textLine.trim().charAt(0) == '#'){
- if(ParseParameter.ncflag == true) {
- bw.write(ParseParameter.curcstr);
- }else{
- bw.write(textLine);
- }
- bw.newLine();
- cflag = false;
- continue;
- }
- if(ParseParameter.ncflag == true) {
- bw.write(ParseParameter.curcstr);
- } else {
- bw.write(textLine);
- }
- bw.newLine();
- cflag = false;
- }
- } else if (textLine.indexOf("TOOL_CHAIN_TAG") != -1) {
- if(nflag == true){
- if(textLine.trim().charAt(0) == '#'){
- if(ParseParameter.nnflag == true) {
- bw.write(ParseParameter.curnstr);
- }else{
- bw.write(textLine);
- }
- bw.newLine();
- nflag = false;
- continue;
- }
- if(ParseParameter.nnflag == true) {
- bw.write(ParseParameter.curnstr);
- } else {
- bw.write(textLine);
- }
- bw.newLine();
- nflag = false;
- }
- } else if (textLine.indexOf("MAX_CONCURRENT_THREAD_NUMBER") != -1) {
- if(mflag == true){
- if(textLine.trim().charAt(0) == '#'){
- if(ParseParameter.nmflag == true) {
- bw.write(ParseParameter.curmstr);
- }else{
- bw.write(textLine);
- }
- bw.newLine();
- mflag = false;
- continue;
- }
- if(ParseParameter.nmflag == true) {
- bw.write(ParseParameter.curmstr);
- } else {
- bw.write(textLine);
- }
- bw.newLine();
- mflag = false;
- }
- }else if (textLine.indexOf("MULTIPLE_THREAD") != -1) {
- if(meflag == true){
- if(textLine.trim().charAt(0) == '#'){
- if(ParseParameter.nmeflag == true) {
- bw.write(ParseParameter.curmestr);
- }else{
- bw.write(textLine);
- }
- bw.newLine();
- meflag = false;
- continue;
- }
- if(ParseParameter.nmeflag == true) {
- bw.write(ParseParameter.curmestr);
- } else {
- bw.write(textLine);
- }
- bw.newLine();
- meflag = false;
- }
- }
- }
- }
- //
- //user maybe delete the line *ACTIVE_PLATFORM*=*
- //
- if( (pflag == true) && (ParseParameter.npflag == true) ){
- bw.write(ParseParameter.curpstr);
- bw.newLine();
- } else if ( (tflag == true) && (ParseParameter.ntflag == true) ){
- bw.write(ParseParameter.curtstr);
- bw.newLine();
- } else if ( (aflag == true) && (ParseParameter.naflag == true) ){
- bw.write(ParseParameter.curastr);
- bw.newLine();
- } else if ( (cflag == true) && (ParseParameter.ncflag == true) ){
- bw.write(ParseParameter.curcstr);
- bw.newLine();
- } else if ( (nflag == true) && (ParseParameter.nnflag == true) ){
- bw.write(ParseParameter.curnstr);
- bw.newLine();
- } else if ( (meflag == true) && (ParseParameter.nmeflag == true) ){
- bw.write(ParseParameter.curmestr);
- bw.newLine();
- } else if ( (mflag == true) && (ParseParameter.nmflag == true) ){
- bw.write(ParseParameter.curmstr);
- bw.newLine();
- }
- } catch (IOException e) {
- System.out.println("\n# Reading or Writing file fail!");
- return false;
- }
-
- try {
- br.close();
- bw.close();
- } catch (IOException e) {
- System.out
- .println("\n# Closing BufferedReader&BufferedWriter fail!");
- return false;
- }
-
- if (Fd.delete() == false) {
- System.out.println("\n# Deleting file fail!");
- return false;
- }
- if (TempFd.renameTo(Fd) == false) {
- System.out.println("\n# Renaming file failed!");
- return false;
- }
-
- return true;
- }
-
- /**
- * read the file and output the lines which include setting
- * @param File fd : the File of the target file
- * @return String: the current setting
- **/
- public static boolean readFile() {
-
- BufferedReader br = null;
- String textLine = null;
-
- try {
- br = new BufferedReader(new FileReader(Fd));
- } catch (FileNotFoundException e) {
- System.out
- .println("\n# Creating BufferedReader fail!");
- return false;
- }
- try {
- while ((textLine = br.readLine()) != null) {
- //
- // the line is composed of Space
- //
- if (textLine.trim().compareToIgnoreCase("") == 0) {
- continue;
- }
- //
- // the line starts with "#"
- //
- else if ((textLine.trim().charAt(0) == '#')){
- continue;
- } else {
- if (textLine.indexOf("ACTIVE_PLATFORM") != -1) {
- ParseParameter.curpstr = textLine;
- } else if (textLine.indexOf("TARGET_ARCH") != -1) {
- ParseParameter.curastr = textLine;
- } else if (textLine.indexOf("TARGET") != -1) {
- ParseParameter.curtstr = textLine;
- } else if (textLine.indexOf("TOOL_CHAIN_CONF") != -1) {
- ParseParameter.curcstr = textLine;
- } else if (textLine.indexOf("TOOL_CHAIN_TAG") != -1) {
- ParseParameter.curnstr = textLine;
- } else if (textLine.indexOf("MAX_CONCURRENT_THREAD_NUMBER") != -1) {
- ParseParameter.curmstr = textLine;
- } else if (textLine.indexOf("MULTIPLE_THREAD") != -1) {
- ParseParameter.curmestr = textLine;
- }
- }
- }
- } catch (IOException e) {
- System.out.println("\n# Reading file fail!");
- return false;
- }
-
- try {
- br.close();
- } catch (IOException e) {
- System.out
- .println("\n# Closing BufferedReader fail!");
- return false;
- }
- return true;
- }
-
-
- ///
- /// point to target.txttmp, a temp file, which is created and deleted during the tool's runtime.
- ///
- private static File TempFd;
-
- ///
- /// point to target.txt.
- ///
- private static File Fd;
-
- ///
- /// when the flag is true, the corresponding str should be add at the end of file.
- ///
- private static boolean pflag = true;
- private static boolean tflag = true;
- private static boolean aflag = true;
- private static boolean cflag = true;
- private static boolean nflag = true;
- private static boolean mflag = true;
- private static boolean meflag = true;
-
-
-}
diff --git a/Tools/Java/Source/Cpptasks/CppTasks.msa b/Tools/Java/Source/Cpptasks/CppTasks.msa
deleted file mode 100644
index 550f9e2182..0000000000
--- a/Tools/Java/Source/Cpptasks/CppTasks.msa
+++ /dev/null
@@ -1,219 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
- <MsaHeader>
- <ModuleName>CppTasks</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>A1DF0266-4962-478e-83C0-F84BE46F11FE</GuidValue>
- <Version>2.0</Version>
- <Abstract>This is the EFI/Tiano Tool CppTasks</Abstract>
- <Description>
- This is a customized cpptasks which includes EFI extensions for
- static and dynamic linking, assembly and acp compiles
- </Description>
- <Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
- <License>
-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.
- </License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>build.xml</Filename>
- <Filename>cpptasks.mf</Filename>
- <Filename>cpptasks.tasks</Filename>
- <Filename>cpptasks.types</Filename>
- <Filename>javadoc.xml</Filename>
- <Filename>net/sf/antcontrib/cpptasks/AboutCCTask.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ArchEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/arm/ADSCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/arm/ADSLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/arm/ADSLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/AslcompilerDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/AslcompilerEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/AssemblerDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/AssemblerEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/borland/BorlandCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/borland/BorlandCfgParser.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/borland/BorlandLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/borland/BorlandLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/borland/BorlandProcessor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/borland/BorlandResourceCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/borland/CfgFilenameState.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/borland/ConsumeToSpaceOrNewLine.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/borland/QuoteBranchState.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/CCTask.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/CCTaskProgressMonitor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/AbstractAslcompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/AbstractAssembler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/AbstractCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/Aslcompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/AslcompilerConfiguration.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/Assembler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/AssemblerConfiguration.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompilerConfiguration.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineAssembler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineAssemblerConfiguration.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineCompilerConfiguration.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineFortranCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CommandLineLinkerConfiguration.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/Compiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/CompilerConfiguration.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/Linker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/LinkerConfiguration.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/LinkType.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/PrecompilingCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/Processor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/ProcessorConfiguration.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/compiler/ProgressMonitor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/CompilerDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/CompilerEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/CompilerParam.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/CPUEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/CUtil.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/DependencyInfo.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/DependencyTable.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioAslcompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioAssembler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioProcessor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/DistributerDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/DistributerMap.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/DistributerProtocolEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/FileVisitor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/GccCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/GccLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/GccProcessor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/LdLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccProcessor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GppLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/GccAssembler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/GccLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/GccLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/GccProcessor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/GppLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/gcc/LdLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/hp/aCCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/hp/aCCLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ibm/VisualAgeLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelProcessor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelWin32Aslcompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelWin32CCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelWin32Librarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelWin32Linker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/intel/IntelWin64CCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/LinkerDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/LinkerEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/LinkerParam.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ObjectFileCollector.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/OptimizationEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/os390/OS390CCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/os390/OS390Linker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/os390/OS390Processor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/os400/IccCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/os400/IccLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/os400/IccProcessor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/OSFamilyEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/OutputTypeEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/AbstractParser.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/AbstractParserState.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/BranchState.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/CaseInsensitiveLetterState.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/CParser.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/FilenameState.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/FortranParser.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/LetterState.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/Parser.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/PostE.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/WhitespaceOrCaseInsensitiveLetterState.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/parser/WhitespaceOrLetterState.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/PrecompileDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/PrecompileExceptDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ProcessorDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ProcessorEnumValue.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ProcessorParam.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/RuntimeType.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/SourceHistory.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/SubsystemEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/sun/C89CCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/sun/C89Linker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/sun/C89Processor.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/TargetDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/TargetHistory.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/TargetHistoryTable.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/TargetInfo.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/TargetMatcher.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ti/ClxxCCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ti/ClxxLibrarian.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/ti/ClxxLinker.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/AslcompilerArgument.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/AssemblerArgument.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/CommandLineArgument.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/CompilerArgument.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/ConditionalFileSet.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/ConditionalPath.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/DefineArgument.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/DefineSet.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/FlexLong.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/IncludePath.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/LibrarySet.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/LibraryTypeEnum.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/LinkerArgument.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/SystemIncludePath.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/SystemLibrarySet.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/types/UndefineArgument.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/userdefine/UserDefineArgument.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/userdefine/UserDefineCompiler.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/userdefine/UserDefineMapping.java</Filename>
- <Filename>net/sf/antcontrib/cpptasks/VersionInfo.java</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/Cpptasks/build.xml b/Tools/Java/Source/Cpptasks/build.xml
deleted file mode 100644
index ce040e6ac7..0000000000
--- a/Tools/Java/Source/Cpptasks/build.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="CppTasks" default="CppTasks" basedir=".">
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>
- <target name="CppTasks" depends="install"/>
- <target name="init">
- <uptodate property="jar.newer" targetfile="${installLocation}/cpptasks.jar">
- <srcfiles dir="net" includes="**"/>
- </uptodate>
- </target>
- <target name="source" depends="init" unless="jar.newer">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="net" destdir="${buildDir}" source="1.4">
- <classpath>
- <fileset dir="${WORKSPACE}/Tools/Jars">
- <include name="*.jar"/>
- </fileset>
- </classpath>
- </javac>
- </target>
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false" quiet="true">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/Cpptasks" includes="${buildDir}"/>
- </delete>
- </target>
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: cpptasks.jar"/>
- <delete file="${installLocation}/cpptasks.jar"/>
- <if>
- <available file="${installLocation}/cpptasks.jar"/>
- <then>
- <echo message="You must manually remove the file: ${installLocation}/cpptasks.jar"/>
- <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
- </then>
- </if>
- </target>
- <target name="install" depends="source" unless="jar.newer">
- <copy file="cpptasks.tasks" toDir="${buildDir}"/>
- <copy file="cpptasks.types" toDir="${buildDir}"/>
- <jar destfile="${installLocation}/cpptasks.jar"
- basedir="${buildDir}"
- includes="**"
- />
- </target>
-</project>
diff --git a/Tools/Java/Source/Cpptasks/cpptasks.mf b/Tools/Java/Source/Cpptasks/cpptasks.mf
deleted file mode 100644
index a2bf638932..0000000000
--- a/Tools/Java/Source/Cpptasks/cpptasks.mf
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 2.0
-Main-Class: net.sf.antcontrib.cpptasks.AboutCCTask
-
-Name: CCTask
-Implementation-Vendor: Ant-Contrib project
-Implementation-Version: 1.0
-Implementation-Title: Compile and link tasks for Apache Ant
diff --git a/Tools/Java/Source/Cpptasks/cpptasks.tasks b/Tools/Java/Source/Cpptasks/cpptasks.tasks
deleted file mode 100644
index f34458374f..0000000000
--- a/Tools/Java/Source/Cpptasks/cpptasks.tasks
+++ /dev/null
@@ -1 +0,0 @@
-cc=net.sf.antcontrib.cpptasks.CCTask
diff --git a/Tools/Java/Source/Cpptasks/cpptasks.types b/Tools/Java/Source/Cpptasks/cpptasks.types
deleted file mode 100644
index 65af6e66c6..0000000000
--- a/Tools/Java/Source/Cpptasks/cpptasks.types
+++ /dev/null
@@ -1,9 +0,0 @@
-defineset=net.sf.antcontrib.cpptasks.types.DefineSet
-compiler=net.sf.antcontrib.cpptasks.CompilerDef
-linker=net.sf.antcontrib.cpptasks.LinkerDef
-assembler=net.sf.antcontrib.cpptasks.AssemblerDef
-aslcompiler=net.sf.antcontrib.cpptasks.AslcompilerDef
-targetplatform=net.sf.antcontrib.cpptasks.TargetDef
-versioninfo=net.sf.antcontrib.cpptasks.VersionInfo
-distributer=net.sf.antcontrib.cpptasks.DistributerDef
-command=net.sf.antcontrib.cpptasks.userdefine.UserDefineDef \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/javadoc.xml b/Tools/Java/Source/Cpptasks/javadoc.xml
deleted file mode 100644
index f0ca9648e9..0000000000
--- a/Tools/Java/Source/Cpptasks/javadoc.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="javadoc">
-<target name="javadoc">
-
- <javadoc packagenames="net.sf.antcontrib.*"
- useexternalfile="yes"
- sourcepath="."
- destdir="doc"
- author="true"
- version="true"
- source="1.3"
- locale="en_US"
- windowtitle="cpptasks API"
- doctitle="cpptasks">
- <group title="CCTasks" packages="net.sf.antcontrib.cpptasks" />
-
- <bottom>Copyright @2001-2005 Ant-Contrib project. All Rights Reserved.</bottom>
-</javadoc>
-</target>
-</project>
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AboutCCTask.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AboutCCTask.java
deleted file mode 100644
index 67757bbf87..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AboutCCTask.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-/**
- * The equivalent of a Help About
- * run "java -jar cpptasks.jar" to read
- *
- * @author Curt Arnold
- */
-public class AboutCCTask {
- /**
- * display identification message and exit
- *
- * @param args ignored
- */
- public static void main(String args[]) {
- System.out.println("CCTask: Compile and link task for Apache Ant 1.5 or later\n");
- System.out.println("Copyright (c) 2002-2004, The Ant-Contrib project.\n");
- System.out.println("http://sf.net/projects/ant-contrib\n");
- System.out.println("Licensed under the Apache Software License 2.0");
- System.out.println("available at http://www.apache.org/licenses/LICENSE-2.0\n");
- System.out.println("This software is not a product of the");
- System.out.println("of the Apache Software Foundation and no");
- System.out.println("endorsement or promotion is implied.\n");
- System.out.println("THIS SOFTWARE IS PROVIDED 'AS-IS', See");
- System.out.println("http://www.apache.org/LICENSE for additional");
- System.out.println("disclaimers.\n");
- System.out.println("To use:");
- System.out.println("\tPlace cpptasks.jar into lib directory of Ant 1.5 or later.");
- System.out.println("\tAdd <taskdef resource=\"cpptasks.tasks\"/> and");
- System.out.println("\t\t<typedef resource=\"cpptasks.types\"/> to build.xml");
- System.out.println("Add <cc/>, <compiler/>, <linker/>, <assembler/> and <aslcompiler> elements.");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ArchEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ArchEnum.java
deleted file mode 100644
index e219ad6871..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ArchEnum.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import org.apache.tools.ant.types.EnumeratedAttribute;
-
-/**
- * Enumeration of cpu architecture types.
- *
- * @author Curt Arnold
- *
- */
-public final class ArchEnum
- extends EnumeratedAttribute {
- /**
- * Constructor.
- *
- * Set by default to "pentium3"
- *
- * @see java.lang.Object#Object()
- */
- public ArchEnum() {
- setValue("pentium3");
- }
-
- /**
- * Gets list of acceptable values.
- *
- * @see org.apache.tools.ant.types.EnumeratedAttribute#getValues()
- */
- public String[] getValues() {
- /**
- * Class initializer.
- */
- return new String[] {
- "i386",
- "i486",
- "i586",
- "i686",
- "pentium",
- "pentium-mmx",
- "pentiumpro",
- "pentium2",
- "pentium3",
- "pentium4",
- "k6",
- "k6-2",
- "k6-3",
- "athlon",
- "athlon-tbird",
- "athlon-4",
- "athlon-xp",
- "athlon-mp",
- "winchip-c6",
- "winchip2",
- "c3"};
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerDef.java
deleted file mode 100644
index f69d3fde63..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerDef.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import net.sf.antcontrib.cpptasks.compiler.Aslcompiler;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.intel.IntelWin32Aslcompiler;
-import net.sf.antcontrib.cpptasks.types.AslcompilerArgument;
-
-import org.apache.tools.ant.BuildException;
-
-/**
- * A asl compiler definition. asl compiler elements may be placed either as
- * children of a cc element or the project element. A asl compiler element with
- * an id attribute may be referenced from asl compiler elements with refid or
- * extends attributes.
- *
- */
-public final class AslcompilerDef extends ProcessorDef {
-
- private Boolean defaultflag = new Boolean(true);
-
- public AslcompilerDef () {
- }
-
- /**
- * Adds a asl compiler command-line arg.
- */
- public void addConfiguredAslcompilerArg(AslcompilerArgument arg) {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- addConfiguredProcessorArg(arg);
- }
-
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-
- public final Boolean getDefaultflag(AslcompilerDef[] defaultProviders,
- int index) {
- if (isReference()) {
- return ((AslcompilerDef) getCheckedRef(AslcompilerDef.class,
- "AslcompilerDef")).getDefaultflag(defaultProviders,
- index);
- }
- return defaultflag;
- }
-
- public Processor getProcessor() {
- Processor processor = super.getProcessor();
- if (processor == null) {
- processor = IntelWin32Aslcompiler.getInstance();
- }
- return processor;
- }
-
- /**
- * Sets r type.
- *
- * <table width="100%" border="1"> <thead>Supported ASL Compilers</thead>
- * <tr>
- * <td>iasl (default)</td>
- * <td>Intel ACPI Source Language</td>
- * </tr>
- * <tr>
- * <td>asl</td>
- * <td>Microsoft ACPI Source Language</td>
- * </tr>
- * </table>
- *
- */
- public void setName(AslcompilerEnum name) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- Aslcompiler aslcompiler = name.getAslcompiler();
- setProcessor(aslcompiler);
- }
-
- protected void setProcessor(Processor proc) throws BuildException {
- try {
- super.setProcessor((Aslcompiler) proc);
- } catch (ClassCastException ex) {
- throw new BuildException(ex);
- }
- }
-
- /**
- * Enables or disables default flags.
- *
- * @param defaultflag
- * if true, default flags will add to command line.
- *
- */
- public void setDefaultflag(boolean defaultflag) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.defaultflag = booleanValueOf(defaultflag);
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerEnum.java
deleted file mode 100644
index fa9806916f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AslcompilerEnum.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import net.sf.antcontrib.cpptasks.compiler.Aslcompiler;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioAslcompiler;
-import net.sf.antcontrib.cpptasks.intel.IntelWin32Aslcompiler;
-
-import org.apache.tools.ant.types.EnumeratedAttribute;
-
-/**
- * Enumeration of supported ASL Compilers
- *
- * <table width="100%" border="1"> <thead>Supported ASL Compilers </thead>
- * <tr>
- * <td>iasl (default)</td>
- * <td>Intel ACPI Source Language</td>
- * </tr>
- * <tr>
- * <td>asl</td>
- * <td>Microsoft ACPI Source Language</td>
- * </tr>
- * </table>
- *
- */
-public class AslcompilerEnum extends EnumeratedAttribute {
- private final static ProcessorEnumValue[] aslcompiler = new ProcessorEnumValue[] {
- new ProcessorEnumValue("iasl", IntelWin32Aslcompiler
- .getInstance()),
- new ProcessorEnumValue("asl", DevStudioAslcompiler
- .getInstance()), };
-
- public Aslcompiler getAslcompiler() {
- return (Aslcompiler) aslcompiler[getIndex()].getProcessor();
- }
-
- public String[] getValues() {
- return ProcessorEnumValue.getValues(aslcompiler);
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AssemblerDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AssemblerDef.java
deleted file mode 100644
index aeae215780..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AssemblerDef.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.Assembler;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.gcc.GccAssembler;
-import net.sf.antcontrib.cpptasks.types.AssemblerArgument;
-import net.sf.antcontrib.cpptasks.types.ConditionalPath;
-import net.sf.antcontrib.cpptasks.types.IncludePath;
-import net.sf.antcontrib.cpptasks.types.SystemIncludePath;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-
-/**
- * A assembler definition. Assembler elements may be placed either as children
- * of a cc element or the project element. A assembler element with an id
- * attribute may be referenced from assembler elements with refid or extends
- * attributes.
- *
- */
-public final class AssemblerDef extends ProcessorDef {
-
- private final Vector includePaths = new Vector();
-
- private final Vector sysIncludePaths = new Vector();
-
- private Boolean defaultflag = new Boolean(true);
-
- public AssemblerDef () {
- }
-
- /**
- * Adds a assembler command-line arg.
- */
- public void addConfiguredAssemblerArg(AssemblerArgument arg) {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- addConfiguredProcessorArg(arg);
- }
-
- /**
- * Creates an include path.
- */
- public IncludePath createIncludePath() {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project must be set");
- }
- if (isReference()) {
- throw noChildrenAllowed();
- }
- IncludePath path = new IncludePath(p);
- includePaths.addElement(path);
- return path;
- }
-
- /**
- * Creates an include path.
- */
- public SystemIncludePath createSysIncludePath() {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project must be set");
- }
- if (isReference()) {
- throw noChildrenAllowed();
- }
- SystemIncludePath path = new SystemIncludePath(p);
- sysIncludePaths.addElement(path);
- return path;
- }
-
- /**
- * Add a <includepath>or <sysincludepath> if specify the file attribute
- *
- * @throws BuildException
- * if the specify file not exist
- */
- protected void loadFile(Vector activePath, File file) throws BuildException {
- FileReader fileReader;
- BufferedReader in;
- String str;
- if (!file.exists()) {
- throw new BuildException("The file " + file + " is not existed");
- }
- try {
- fileReader = new FileReader(file);
- in = new BufferedReader(fileReader);
- while ((str = in.readLine()) != null) {
- if (str.trim() == "") {
- continue;
- }
- str = getProject().replaceProperties(str);
- activePath.addElement(str.trim());
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-
- /**
- * Returns the assembler-specific include path.
- */
- public String[] getActiveIncludePaths() {
- if (isReference()) {
- return ((AssemblerDef) getCheckedRef(AssemblerDef.class,
- "AssemblerDef")).getActiveIncludePaths();
- }
- return getActivePaths(includePaths);
- }
-
- /**
- * Returns the assembler-specific sysinclude path.
- */
- public String[] getActiveSysIncludePaths() {
- if (isReference()) {
- return ((AssemblerDef) getCheckedRef(AssemblerDef.class,
- "AssemblerDef")).getActiveSysIncludePaths();
- }
- return getActivePaths(sysIncludePaths);
- }
-
- private String[] getActivePaths(Vector paths) {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project not set");
- }
- Vector activePaths = new Vector(paths.size());
- for (int i = 0; i < paths.size(); i++) {
- ConditionalPath path = (ConditionalPath) paths.elementAt(i);
- if (path.isActive(p)) {
- if (path.getFile() == null) {
- String[] pathEntries = path.list();
- for (int j = 0; j < pathEntries.length; j++) {
- activePaths.addElement(pathEntries[j]);
- }
- } else {
- loadFile(activePaths, path.getFile());
- }
- }
- }
- String[] pathNames = new String[activePaths.size()];
- activePaths.copyInto(pathNames);
- return pathNames;
- }
-
- public final Boolean getDefaultflag(AssemblerDef[] defaultProviders,
- int index) {
- if (isReference()) {
- return ((AssemblerDef) getCheckedRef(AssemblerDef.class,
- "AssemblerDef")).getDefaultflag(defaultProviders,
- index);
- }
- return defaultflag;
- }
-
- public Processor getProcessor() {
- Processor processor = super.getProcessor();
- if (processor == null) {
- processor = GccAssembler.getInstance();
- }
- return processor;
- }
-
- /**
- * Sets r type.
- *
- * <table width="100%" border="1"> <thead>Supported assemblers</thead>
- * <tr>
- * <td>gcc (default)</td>
- * <td>GAS assembler</td>
- * </tr>
- * <tr>
- * <td>masm</td>
- * <td>MASM assembler</td>
- * </tr>
- * </table>
- *
- */
- public void setName(AssemblerEnum name) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- Assembler assembler = name.getAssembler();
- setProcessor(assembler);
- }
-
- protected void setProcessor(Processor proc) throws BuildException {
- try {
- super.setProcessor((Assembler) proc);
- } catch (ClassCastException ex) {
- throw new BuildException(ex);
- }
- }
-
- /**
- * Enables or disables default flags.
- *
- * @param defaultflag
- * if true, default flags will add to command line.
- *
- */
- public void setDefaultflag(boolean defaultflag) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.defaultflag = booleanValueOf(defaultflag);
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AssemblerEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AssemblerEnum.java
deleted file mode 100644
index 9abf9f496d..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/AssemblerEnum.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import net.sf.antcontrib.cpptasks.compiler.Assembler;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioAssembler;
-import net.sf.antcontrib.cpptasks.gcc.GccAssembler;
-
-import org.apache.tools.ant.types.EnumeratedAttribute;
-
-/**
- * Enumeration of supported assemblers
- *
- * <table width="100%" border="1"> <thead>Supported assemblers </thead>
- * <tr>
- * <td>gas (default)</td>
- * <td>GAS assembler</td>
- * </tr>
- * <tr>
- * <td>masm</td>
- * <td>MASM assembler</td>
- * </tr>
- * </table>
- *
- */
-public class AssemblerEnum extends EnumeratedAttribute {
- private final static ProcessorEnumValue[] assemblers = new ProcessorEnumValue[] {
- new ProcessorEnumValue("gas", GccAssembler.getInstance()),
- new ProcessorEnumValue("masm", DevStudioAssembler
- .getInstance()), };
-
- public Assembler getAssembler() {
- return (Assembler) assemblers[getIndex()].getProcessor();
- }
-
- public String[] getValues() {
- return ProcessorEnumValue.getValues(assemblers);
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CCTask.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CCTask.java
deleted file mode 100644
index d044df1288..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CCTask.java
+++ /dev/null
@@ -1,1749 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.AslcompilerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.AssemblerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.CompilerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.LinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
-import net.sf.antcontrib.cpptasks.types.AslcompilerArgument;
-import net.sf.antcontrib.cpptasks.types.AssemblerArgument;
-import net.sf.antcontrib.cpptasks.types.CompilerArgument;
-import net.sf.antcontrib.cpptasks.types.ConditionalFileSet;
-import net.sf.antcontrib.cpptasks.types.DefineSet;
-import net.sf.antcontrib.cpptasks.types.IncludePath;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-import net.sf.antcontrib.cpptasks.types.LinkerArgument;
-import net.sf.antcontrib.cpptasks.types.SystemIncludePath;
-import net.sf.antcontrib.cpptasks.types.SystemLibrarySet;
-import net.sf.antcontrib.cpptasks.userdefine.UserDefineCompiler;
-import net.sf.antcontrib.cpptasks.userdefine.UserDefineDef;
-import net.sf.antcontrib.cpptasks.VersionInfo;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.Environment;
-
-/**
- * Compile, link, assembler and asl compile task.
- *
- * <p>
- * This task can compile various source languages and produce executables,
- * shared libraries (aka DLL's) and static libraries. Compiler adaptors are
- * currently available for several C/C++ compilers, FORTRAN, MIDL and Windows
- * Resource files. Assembler adaptors are currently available for MASM and GAS.
- * And aslcompiler support to ASL and IASL command.
- * </p>
- *
- *
- * <p>
- * Copyright (c) 2001-2005, The Ant-Contrib project.
- * </p>
- *
- * <p>
- * Licensed under the Apache Software License 2.0,
- * http://www.apache.org/licenses/LICENSE-2.0.
- * </p>
- *
- * <p>
- * For use with Apache Ant 1.5 or later. This software is not a product of the
- * of the Apache Software Foundation and no endorsement is implied.
- * </p>
- *
- * <p>
- * THIS SOFTWARE IS PROVIDED 'AS-IS', See
- * http://www.apache.org/licenses/LICENSE-2.0 for additional disclaimers.
- * </p>
- *
- * To use:
- * <ol>
- * <li>Place cpptasks.jar into the lib directory of Ant 1.5 or later.</li>
- * <li>Add &lt;taskdef resource="cpptasks.tasks"/&gt; and &lt;typedef
- * resource="cpptasks.types"/&gt; to build.xml.</li>
- * <li>Add &lt;cc/&gt;, &lt;compiler/&gt; &lt;linker/&gt; &lt;assembler/&gt;
- * and &lt;aslcompiler/&gt elements to project.</li>
- * <li>Set path and environment variables to be able to run compiler from
- * command line.</li>
- * <li>Build project.</li>
- * </ol>
- *
- * @author Adam Murdoch
- * @author Curt Arnold
- */
-public class CCTask extends Task {
- private class SystemLibraryCollector implements FileVisitor {
- private Hashtable libraries;
-
- private Linker linker;
-
- public SystemLibraryCollector (Linker linker, Hashtable libraries) {
- this.linker = linker;
- this.libraries = libraries;
- }
-
- public void visit(File basedir, String filename) {
- if (linker.bid(filename) > 0) {
- File libfile = new File(basedir, filename);
- String key = linker.getLibraryKey(libfile);
- libraries.put(key, libfile);
- }
- }
- }
-
- private static final ProcessorConfiguration[] EMPTY_CONFIG_ARRAY = new ProcessorConfiguration[0];
-
- /**
- * Builds a Hashtable to targets needing to be rebuilt keyed by compiler
- * configuration
- */
- public static Hashtable getTargetsToBuildByConfiguration(Hashtable targets) {
- Hashtable targetsByConfig = new Hashtable();
- Enumeration targetEnum = targets.elements();
- while (targetEnum.hasMoreElements()) {
- TargetInfo target = (TargetInfo) targetEnum.nextElement();
- if (target.getRebuild()) {
- Vector targetsForSameConfig = (Vector) targetsByConfig
- .get(target.getConfiguration());
- if (targetsForSameConfig != null) {
- targetsForSameConfig.addElement(target);
- } else {
- targetsForSameConfig = new Vector();
- targetsForSameConfig.addElement(target);
- targetsByConfig.put(target.getConfiguration(),
- targetsForSameConfig);
- }
- }
- }
- return targetsByConfig;
- }
-
- /** The userdefine definitions. */
- private Vector _userdefines = new Vector();
-
- /** The compiler definitions. */
- private Vector _compilers = new Vector();
-
- /** The output file type. */
- // private LinkType _linkType = LinkType.EXECUTABLE;
- /** The library sets. */
- private Vector _libsets = new Vector();
-
- /** The aslcompiler definitions. */
- private Vector _aslcompiler = new Vector();
-
- /** The assembler definitions. */
- private Vector _assemblers = new Vector();
-
- /** The linker definitions. */
- private Vector _linkers = new Vector();
-
- /** The object directory. */
- private File _objDir;
-
- /** The output file. */
- private File _outfile;
-
- private boolean userdefine = false;
- private String arch;
- private String os;
- private String vendor;
-
- /** the flag for assembler */
- private boolean assembler = true;
-
- /** the flag for aslcompiler */
- private boolean aslcompiler = true;
-
- /** The linker definitions. */
- private final Vector targetPlatforms = new Vector();
-
- /** The distributer definitions. */
- private Vector distributers = new Vector();
-
- /**
- * If true, stop build on compile failure.
- */
- protected boolean failOnError = true;
-
- /**
- * Content that appears in <cc>and also in <compiler>are maintained by a
- * captive CompilerDef instance
- */
- private final CompilerDef compilerDef = new CompilerDef();
-
- /**
- * Content that appears in <cc>and also in <aslcompiler>are maintained by a
- * captive AslcompilerDef instance
- */
- private final AslcompilerDef aslcompilerDef = new AslcompilerDef();
-
- /** The OS390 dataset to build to object to */
- private String dataset;
-
- /**
- *
- * Depth of dependency checking
- *
- * Values < 0 indicate full dependency checking Values >= 0 indicate partial
- * dependency checking and for superficial compilation checks. Will throw
- * BuildException before attempting link
- */
- private int dependencyDepth = -1;
-
- /**
- * Content that appears in <cc>and also in <assembler>are maintained by a
- * captive AssemblerDef instance
- */
- private final AssemblerDef assemblerDef = new AssemblerDef();
-
- /**
- * Content that appears in <cc>and also in <linker>are maintained by a
- * captive CompilerDef instance
- */
- private final LinkerDef linkerDef = new LinkerDef();
-
- /**
- * contains the subsystem, output type and
- *
- */
- private final LinkType linkType = new LinkType();
-
- /**
- * The property name which will be set with the physical filename of the
- * file that is generated by the linker
- */
- private String outputFileProperty;
-
- /**
- * if relentless = true, compilations should attempt to compile as many
- * files as possible before throwing a BuildException
- */
- private boolean relentless;
-
- public CCTask () {
- }
-
-
- public void addConfiguredCommand(UserDefineDef userdefineDef) {
- if (userdefineDef == null) {
- throw new NullPointerException("UserDefineDef");
- }
- userdefineDef.setProject(getProject());
- _userdefines.addElement(userdefineDef);
- }
- /**
- * Adds a asl compiler definition or reference.
- *
- * @param Aslcompiler
- * aslcompiler
- * @throws NullPointerException
- * if aslcompiler is null
- */
- public void addConfiguredAslcompiler(AslcompilerDef aslcompier) {
- if (aslcompier == null) {
- throw new NullPointerException("aslcompier");
- }
- aslcompier.setProject(getProject());
- _aslcompiler.addElement(aslcompier);
- }
-
- /**
- * Adds a asl command-line arg. Argument will be inherited by all nested
- * aslcompiler elements that do not have inherit="false".
- *
- */
- public void addConfiguredAslcompilerArg(AslcompilerArgument arg) {
- aslcompilerDef.addConfiguredAslcompilerArg(arg);
- }
-
- /**
- * Adds a assembler definition or reference.
- *
- * @param assembler
- * assemblera
- * @throws NullPointerException
- * if assembler is null
- */
- public void addConfiguredAssembler(AssemblerDef assembler) {
- if (assembler == null) {
- throw new NullPointerException("assembler");
- }
- assembler.setProject(getProject());
- _assemblers.addElement(assembler);
- }
-
- /**
- * Adds a assembler command-line arg. Argument will be inherited by all
- * nested assembler elements that do not have inherit="false".
- *
- */
- public void addConfiguredAssemblerArg(AssemblerArgument arg) {
- assemblerDef.addConfiguredAssemblerArg(arg);
- }
-
- /**
- * Adds a compiler definition or reference.
- *
- * @param compiler
- * compiler
- * @throws NullPointerException
- * if compiler is null
- */
- public void addConfiguredCompiler(CompilerDef compiler) {
- if (compiler == null) {
- throw new NullPointerException("compiler");
- }
- compiler.setProject(getProject());
- _compilers.addElement(compiler);
- }
-
- /**
- * Adds a compiler command-line arg. Argument will be inherited by all
- * nested compiler elements that do not have inherit="false".
- *
- */
- public void addConfiguredCompilerArg(CompilerArgument arg) {
- compilerDef.addConfiguredCompilerArg(arg);
- }
-
- /**
- * Adds a defineset. Will be inherited by all compiler elements that do not
- * have inherit="false".
- *
- * @param defs
- * Define set
- */
- public void addConfiguredDefineset(DefineSet defs) {
- compilerDef.addConfiguredDefineset(defs);
- }
-
- /**
- * Adds a linker definition. The first linker that is not disqualified by
- * its "if" and "unless" attributes will perform the link. If no child
- * linker element is active, the linker implied by the cc elements name or
- * classname attribute will be used.
- *
- * @param linker
- * linker
- * @throws NullPointerException
- * if linker is null
- */
- public void addConfiguredLinker(LinkerDef linker) {
- if (linker == null) {
- throw new NullPointerException("linker");
- }
- linker.setProject(getProject());
- _linkers.addElement(linker);
- }
-
- /**
- * Adds a linker command-line arg. Argument will be inherited by all nested
- * linker elements that do not have inherit="false".
- */
- public void addConfiguredLinkerArg(LinkerArgument arg) {
- linkerDef.addConfiguredLinkerArg(arg);
- }
-
- /**
- * Add an environment variable to the launched process.
- */
- public void addEnv(Environment.Variable var) {
- compilerDef.addEnv(var);
- linkerDef.addEnv(var);
- assemblerDef.addEnv(var);
- aslcompilerDef.addEnv(var);
- }
-
- /**
- * Adds a source file set.
- *
- * Files in these filesets will be auctioned to the available compiler
- * configurations, with the default compiler implied by the cc element
- * bidding last. If no compiler is interested in the file, it will be passed
- * to the linker.
- *
- * To have a file be processed by a particular compiler configuration, add a
- * fileset to the corresponding compiler element.
- */
- public void addFileset(ConditionalFileSet srcSet) {
- compilerDef.addFileset(srcSet);
- }
-
- /**
- * Adds a library set.
- *
- * Library sets will be inherited by all linker elements that do not have
- * inherit="false".
- *
- * @param libset
- * library set
- * @throws NullPointerException
- * if libset is null.
- */
- public void addLibset(LibrarySet libset) {
- if (libset == null) {
- throw new NullPointerException("libset");
- }
- linkerDef.addLibset(libset);
- }
-
- /**
- * Adds a system library set. Timestamps and locations of system library
- * sets are not used in dependency analysis.
- *
- * Essential libraries (such as C Runtime libraries) should not be specified
- * since the task will attempt to identify the correct libraries based on
- * the multithread, debug and runtime attributes.
- *
- * System library sets will be inherited by all linker elements that do not
- * have inherit="false".
- *
- * @param libset
- * library set
- * @throws NullPointerException
- * if libset is null.
- */
- public void addSyslibset(SystemLibrarySet libset) {
- if (libset == null) {
- throw new NullPointerException("libset");
- }
- linkerDef.addSyslibset(libset);
- }
-
- /**
- * Checks all targets that are not forced to be rebuilt or are missing
- * object files to be checked for modified include files
- *
- * @returns total number of targets to be rebuilt
- *
- */
- protected int checkForChangedIncludeFiles(Hashtable targets) {
- int potentialTargets = 0;
- int definiteTargets = 0;
- Enumeration targetEnum = targets.elements();
- while (targetEnum.hasMoreElements()) {
- TargetInfo target = (TargetInfo) targetEnum.nextElement();
- if (!target.getRebuild()) {
- potentialTargets++;
- } else {
- definiteTargets++;
- }
- }
- //
- // If there were remaining targets that
- // might be out of date
- //
- if (potentialTargets > 0) {
- log("Starting dependency analysis for "
- + Integer.toString(potentialTargets) + " files.");
- DependencyTable dependencyTable = new DependencyTable(_objDir);
- try {
- dependencyTable.load();
- } catch (Exception ex) {
- log("Problem reading dependencies.xml: " + ex.toString());
- }
- targetEnum = targets.elements();
- while (targetEnum.hasMoreElements()) {
- TargetInfo target = (TargetInfo) targetEnum.nextElement();
- if (!target.getRebuild()) {
- if (dependencyTable.needsRebuild(this, target,
- dependencyDepth)) {
- target.mustRebuild();
- }
- }
- }
- dependencyTable.commit(this);
- }
- //
- // count files being rebuilt now
- //
- int currentTargets = 0;
- targetEnum = targets.elements();
- while (targetEnum.hasMoreElements()) {
- TargetInfo target = (TargetInfo) targetEnum.nextElement();
- if (target.getRebuild()) {
- currentTargets++;
- }
- }
- if (potentialTargets > 0) {
- log(Integer.toString(potentialTargets - currentTargets
- + definiteTargets)
- + " files are up to date.");
- log(Integer.toString(currentTargets - definiteTargets)
- + " files to be recompiled from dependency analysis.");
- }
- log(Integer.toString(currentTargets) + " total files to be compiled.");
- return currentTargets;
- }
-
- protected LinkerConfiguration collectExplicitObjectFiles(
- Vector objectFiles, Vector sysObjectFiles) {
- //
- // find the first eligible linker
- //
- //
- ProcessorConfiguration linkerConfig = null;
- LinkerDef selectedLinkerDef = null;
- Linker selectedLinker = null;
- Hashtable sysLibraries = new Hashtable();
- TargetDef targetPlatform = getTargetPlatform();
- FileVisitor objCollector = null;
- FileVisitor sysLibraryCollector = null;
- for (int i = 0; i < _linkers.size(); i++) {
- LinkerDef currentLinkerDef = (LinkerDef) _linkers.elementAt(i);
- if (currentLinkerDef.isActive()) {
- selectedLinkerDef = currentLinkerDef;
- selectedLinker = currentLinkerDef.getProcessor().getLinker(
- linkType);
- //
- // skip the linker if it doesn't know how to
- // produce the specified link type
- if (selectedLinker != null) {
- linkerConfig = currentLinkerDef.createConfiguration(this,
- linkType, linkerDef, targetPlatform);
- if (linkerConfig != null) {
- //
- // create collectors for object files
- // and system libraries
- objCollector = new ObjectFileCollector(selectedLinker,
- objectFiles);
- sysLibraryCollector = new SystemLibraryCollector(
- selectedLinker, sysLibraries);
- //
- // if the <linker> has embedded <fileset>'s
- // (such as linker specific libraries)
- // add them as object files.
- //
- if (currentLinkerDef.hasFileSets()) {
- currentLinkerDef.visitFiles(objCollector);
- }
- //
- // user libraries are just a specialized form
- // of an object fileset
- selectedLinkerDef.visitUserLibraries(selectedLinker,
- objCollector);
- }
- break;
- }
- }
- }
- if (linkerConfig == null) {
- linkerConfig = linkerDef.createConfiguration(this, linkType, null,
- targetPlatform);
- selectedLinker = (Linker) linkerDef.getProcessor().getLinker(
- linkType);
- objCollector = new ObjectFileCollector(selectedLinker, objectFiles);
- sysLibraryCollector = new SystemLibraryCollector(selectedLinker,
- sysLibraries);
- }
- //
- // unless there was a <linker> element that
- // explicitly did not inherit files from
- // containing <cc> element
- if (selectedLinkerDef == null || selectedLinkerDef.getInherit()) {
- linkerDef.visitUserLibraries(selectedLinker, objCollector);
- linkerDef.visitSystemLibraries(selectedLinker, sysLibraryCollector);
- }
- //
- // if there was a <syslibset> in a nested <linker>
- // evaluate it last so it takes priority over
- // identically named libs from <cc> element
- //
- if (selectedLinkerDef != null) {
- //
- // add any system libraries to the hashtable
- // done in reverse order so the earliest
- // on the classpath takes priority
- selectedLinkerDef.visitSystemLibraries(selectedLinker,
- sysLibraryCollector);
- }
- //
- // copy over any system libraries to the
- // object files vector
- //
- Enumeration sysLibEnum = sysLibraries.elements();
- while (sysLibEnum.hasMoreElements()) {
- sysObjectFiles.addElement(sysLibEnum.nextElement());
- }
- return (LinkerConfiguration) linkerConfig;
- }
-
- /**
- * Adds an include path.
- *
- * Include paths will be inherited by nested compiler elements that do not
- * have inherit="false".
- */
- public IncludePath createIncludePath() {
- return compilerDef.createIncludePath();
- }
-
- /**
- * Specifies precompilation prototype file and exclusions. Inherited by all
- * compilers that do not have inherit="false".
- *
- */
- public PrecompileDef createPrecompile() throws BuildException {
- return compilerDef.createPrecompile();
- }
-
- /**
- * Adds a system include path. Locations and timestamps of files located
- * using the system include paths are not used in dependency analysis.
- *
- *
- * Standard include locations should not be specified. The compiler adapters
- * should recognized the settings from the appropriate environment variables
- * or configuration files.
- *
- * System include paths will be inherited by nested compiler elements that
- * do not have inherit="false".
- */
- public SystemIncludePath createSysIncludePath() {
- return compilerDef.createSysIncludePath();
- }
-
- /**
- * Executes the task. Compiles the given files.
- *
- * @throws BuildException
- * if someting goes wrong with the build
- */
- public void execute() throws BuildException {
- //
- // if link type allowed objdir to be defaulted
- // provide it from outfile
- if (_objDir == null) {
- if (_outfile != null) {
- _objDir = new File(_outfile.getParent());
- } else {
- _objDir = new File(".");
- }
- }
-
- //
- // if the object directory does not exist
- //
- if (!_objDir.exists()) {
- throw new BuildException("Object directory does not exist");
- }
-
- //
- // if userdefine is true, then run all user defined command
- //
- if (userdefine) {
- Iterator iter = _userdefines.iterator();
- while( iter.hasNext()) {
- UserDefineDef userdefineDef = (UserDefineDef)iter.next();
- UserDefineCompiler userdefineCompiler = new UserDefineCompiler(this, userdefineDef);
- userdefineCompiler.command(this, userdefineDef);
- }
- return ;
- }
-
- TargetHistoryTable objHistory = new TargetHistoryTable(this, _objDir);
- //
- // determine the eventual linker configuration
- // (may be null) and collect any explicit
- // object files or libraries
- Vector objectFiles = new Vector();
- Vector sysObjectFiles = new Vector();
- LinkerConfiguration linkerConfig = collectExplicitObjectFiles(
- objectFiles, sysObjectFiles);
- //
- // Assembler hashtable of all files
- // that we know how to compile (keyed by output file name)
- //
- Hashtable targets = getTargets(linkerConfig, objectFiles);
- Hashtable acpiTarget = new Hashtable();
- if (aslcompiler) {
- acpiTarget = getAcpiTargets(linkerConfig, new Vector());
- }
- Hashtable assemblerTarget = new Hashtable();
- if (assembler) {
- assemblerTarget = getAssemblerTargets(linkerConfig, objectFiles);
- }
- TargetInfo linkTarget = null;
- //
- // if output file is not specified,
- // then skip link step
- //
- if (_outfile != null) {
- linkTarget = getLinkTarget(linkerConfig, objectFiles,
- sysObjectFiles, targets, assemblerTarget);
- }
- //
- // If specify the aslcompiler, then call asl compiler
- //
- if (aslcompiler) {
- BuildException acpiException = null;
- Hashtable targetsByConfig = getTargetsToBuildByConfiguration(acpiTarget);
- Enumeration acpiTargetEnum = targetsByConfig.elements();
- Vector[] targetVectors = new Vector[targetsByConfig.size()];
- int index = 0;
- while (acpiTargetEnum.hasMoreElements()) {
- Vector targetsForConfig = (Vector) acpiTargetEnum.nextElement();
- targetVectors[index++] = targetsForConfig;
- }
- for (int i = 0; i < targetVectors.length; i++) {
- //
- // get the targets for this configuration
- //
- Vector targetsForConfig = targetVectors[i];
- //
- // get the configuration from the first entry
- //
- AslcompilerConfiguration config = (AslcompilerConfiguration) ((TargetInfo) targetsForConfig
- .elementAt(0)).getConfiguration();
- //
- // prepare the list of source files
- //
- String[] sourceFiles = new String[targetsForConfig.size()];
- Enumeration targetsEnum = targetsForConfig.elements();
- index = 0;
- while (targetsEnum.hasMoreElements()) {
- TargetInfo targetInfo = ((TargetInfo) targetsEnum
- .nextElement());
- sourceFiles[index++] = targetInfo.getSources()[0]
- .toString();
- }
- try {
- config.aslcompiler(this, _objDir, sourceFiles);
- log(sourceFiles.length
- + " total ACPI source files to be compiled.");
- } catch (BuildException ex) {
- if (acpiException == null) {
- acpiException = ex;
- }
- if (!relentless)
- break;
- }
- }
- }
- //
- // If specify the assembler, then call assembler
- //
- if (assembler) {
- BuildException assemblerException = null;
- Hashtable targetsByConfig = getTargetsToBuildByConfiguration(assemblerTarget);
- Enumeration assembleTargetEnum = targetsByConfig.elements();
- Vector[] targetVectors = new Vector[targetsByConfig.size()];
- int index = 0;
- while (assembleTargetEnum.hasMoreElements()) {
- Vector targetsForConfig = (Vector) assembleTargetEnum
- .nextElement();
- targetVectors[index++] = targetsForConfig;
- }
- for (int i = 0; i < targetVectors.length; i++) {
- //
- // get the targets for this configuration
- //
- Vector targetsForConfig = targetVectors[i];
- //
- // get the configuration from the first entry
- //
- AssemblerConfiguration config = (AssemblerConfiguration) ((TargetInfo) targetsForConfig
- .elementAt(0)).getConfiguration();
- //
- // prepare the list of source files
- //
- String[] sourceFiles = new String[targetsForConfig.size()];
- Enumeration targetsEnum = targetsForConfig.elements();
- index = 0;
- while (targetsEnum.hasMoreElements()) {
- TargetInfo targetInfo = ((TargetInfo) targetsEnum
- .nextElement());
- sourceFiles[index++] = targetInfo.getSources()[0]
- .toString();
- }
- try {
- config.assembler(this, _objDir, sourceFiles);
- log(sourceFiles.length + " total files to be assembled.");
- } catch (BuildException ex) {
- if (assemblerException == null) {
- assemblerException = ex;
- }
- if (!relentless)
- break;
- }
- }
- //
- // if we threw a assembler exception and
- // didn't throw it at the time because
- // we were relentless then
- // save the history and
- // throw the exception
- //
- if (assemblerException != null) {
- if (failOnError) {
- throw assemblerException;
- } else {
- log(assemblerException.getMessage(), Project.MSG_ERR);
- return;
- }
- }
- }
-
- //
- // mark targets that don't have a history record or
- // whose source last modification time is not
- // the same as the history to be rebuilt
- //
- objHistory.markForRebuild(targets);
- CCTaskProgressMonitor monitor = new CCTaskProgressMonitor(objHistory);
- //
- // check for changed include files
- //
- int rebuildCount = checkForChangedIncludeFiles(targets);
- if (rebuildCount > 0) {
- BuildException compileException = null;
- //
- // compile all targets with getRebuild() == true
- //
- Hashtable targetsByConfig = getTargetsToBuildByConfiguration(targets);
- //
- // build array containing Vectors with precompiled generation
- // steps going first
- //
- Vector[] targetVectors = new Vector[targetsByConfig.size()];
- int index = 0;
- Enumeration targetVectorEnum = targetsByConfig.elements();
- while (targetVectorEnum.hasMoreElements()) {
- Vector targetsForConfig = (Vector) targetVectorEnum
- .nextElement();
- //
- // get the configuration from the first entry
- //
- CompilerConfiguration config = (CompilerConfiguration) ((TargetInfo) targetsForConfig
- .elementAt(0)).getConfiguration();
- if (config.isPrecompileGeneration()) {
- targetVectors[index++] = targetsForConfig;
- }
- }
- targetVectorEnum = targetsByConfig.elements();
- while (targetVectorEnum.hasMoreElements()) {
- Vector targetsForConfig = (Vector) targetVectorEnum
- .nextElement();
- for (int i = 0; i < targetVectors.length; i++) {
- if (targetVectors[i] == targetsForConfig) {
- break;
- }
- if (targetVectors[i] == null) {
- targetVectors[i] = targetsForConfig;
- break;
- }
- }
- }
- for (int i = 0; i < targetVectors.length; i++) {
- //
- // get the targets for this configuration
- //
- Vector targetsForConfig = targetVectors[i];
- //
- // get the configuration from the first entry
- //
- CompilerConfiguration config = (CompilerConfiguration) ((TargetInfo) targetsForConfig
- .elementAt(0)).getConfiguration();
- //
- // prepare the list of source files
- //
- String[] sourceFiles = new String[targetsForConfig.size()];
- Enumeration targetsEnum = targetsForConfig.elements();
- index = 0;
- while (targetsEnum.hasMoreElements()) {
- TargetInfo targetInfo = ((TargetInfo) targetsEnum
- .nextElement());
- sourceFiles[index++] = targetInfo.getSources()[0]
- .toString();
- }
- try {
- config.compile(this, _objDir, sourceFiles, relentless,
- monitor);
- } catch (BuildException ex) {
- if (compileException == null) {
- compileException = ex;
- }
- if (!relentless)
- break;
- }
- }
- //
- // save the details of the object file compilation
- // settings to disk for dependency analysis
- //
- try {
- objHistory.commit();
- } catch (IOException ex) {
- this.log("Error writing history.xml: " + ex.toString());
- }
- //
- // if we threw a compile exception and
- // didn't throw it at the time because
- // we were relentless then
- // save the history and
- // throw the exception
- //
- if (compileException != null) {
- if (failOnError) {
- throw compileException;
- } else {
- log(compileException.getMessage(), Project.MSG_ERR);
- return;
- }
- }
- }
- //
- // if the dependency tree was not fully
- // evaluated, then throw an exception
- // since we really didn't do what we
- // should have done
- //
- //
- if (dependencyDepth >= 0) {
- throw new BuildException(
- "All files at depth "
- + Integer.toString(dependencyDepth)
- + " from changes successfully compiled.\n"
- + "Remove or change dependencyDepth to -1 to perform full compilation.");
- }
- //
- // if no link target then
- // commit the history for the object files
- // and leave the task
- if (linkTarget != null) {
- //
- // get the history for the link target (may be the same
- // as the object history)
- TargetHistoryTable linkHistory = getLinkHistory(objHistory);
- //
- // see if it needs to be rebuilt
- //
- linkHistory.markForRebuild(linkTarget);
- //
- // if it needs to be rebuilt, rebuild it
- //
- File output = linkTarget.getOutput();
- if (linkTarget.getRebuild()) {
- log("Starting link");
- LinkerConfiguration linkConfig = (LinkerConfiguration) linkTarget
- .getConfiguration();
- if (failOnError) {
- linkConfig.link(this, linkTarget);
- } else {
- try {
- linkConfig.link(this, linkTarget);
- } catch (BuildException ex) {
- log(ex.getMessage(), Project.MSG_ERR);
- return;
- }
- }
- if (outputFileProperty != null)
- getProject().setProperty(outputFileProperty,
- output.getAbsolutePath());
- linkHistory.update(linkTarget);
- try {
- linkHistory.commit();
- } catch (IOException ex) {
- log("Error writing link history.xml: " + ex.toString());
- }
- } else {
- if (outputFileProperty != null)
- getProject().setProperty(outputFileProperty,
- output.getAbsolutePath());
- }
- }
- }
-
- /**
- * Gets the dataset.
- *
- * @return Returns a String
- */
- public String getDataset() {
- return dataset;
- }
-
- protected TargetHistoryTable getLinkHistory(TargetHistoryTable objHistory) {
- File outputFileDir = new File(_outfile.getParent());
- //
- // if the output file is being produced in the link
- // directory, then we can use the same history file
- //
- if (_objDir.equals(outputFileDir)) {
- return objHistory;
- }
- return new TargetHistoryTable(this, outputFileDir);
- }
-
- protected TargetInfo getLinkTarget(LinkerConfiguration linkerConfig,
- Vector objectFiles, Vector sysObjectFiles,
- Hashtable compileTargets, Hashtable assemblerTargets) {
- //
- // walk the compile phase targets and
- // add those sources that have already been
- // assigned to the linker or
- // our output files the linker knows how to consume
- // files the linker knows how to consume
- //
- Enumeration compileTargetsEnum = compileTargets.elements();
- while (compileTargetsEnum.hasMoreElements()) {
- TargetInfo compileTarget = (TargetInfo) compileTargetsEnum
- .nextElement();
- //
- // output of compile tasks
- //
- int bid = linkerConfig.bid(compileTarget.getOutput().toString());
- if (bid > 0) {
- objectFiles.addElement(compileTarget.getOutput());
- }
- }
- //
- // walk the assembler phase targets and
- // add those sources that have already been
- // assigned to the linker or
- // our output files the linker knows how to consume
- // files the linker knows how to consume
- //
- Enumeration assembleTargetsEnum = assemblerTargets.elements();
- while (assembleTargetsEnum.hasMoreElements()) {
- TargetInfo assemblerTarget = (TargetInfo) assembleTargetsEnum
- .nextElement();
- //
- // output of assemble tasks
- //
- int bid = linkerConfig.bid(assemblerTarget.getOutput().toString());
- if (bid > 0) {
- objectFiles.addElement(assemblerTarget.getOutput());
- }
- }
- File[] objectFileArray = new File[objectFiles.size()];
- objectFiles.copyInto(objectFileArray);
- File[] sysObjectFileArray = new File[sysObjectFiles.size()];
- sysObjectFiles.copyInto(sysObjectFileArray);
- String baseName = _outfile.getName();
- String fullName = linkerConfig.getOutputFileName(baseName);
- File outputFile = new File(_outfile.getParent(), fullName);
- return new TargetInfo(linkerConfig, objectFileArray,
- sysObjectFileArray, outputFile, linkerConfig
- .getRebuild());
- }
-
- public File getObjdir() {
- return _objDir;
- }
-
- public File getOutfile() {
- return _outfile;
- }
-
- public TargetDef getTargetPlatform() {
- return null;
- }
-
- /**
- * This method collects a Hashtable, keyed by output file name, of
- * TargetInfo's for every source file that is specified in the filesets of
- * the <aslcompiler> elements. The TargetInfo's contain the appropriate ACPI
- * configurations for their possible acpi
- *
- */
- private Hashtable getAcpiTargets(LinkerConfiguration linkerConfig,
- Vector objectFiles) {
- Hashtable targets = new Hashtable(1000);
- TargetDef targetPlatform = getTargetPlatform();
- Vector biddingProcessors = new Vector(_aslcompiler.size());
- for (int i = 0; i < _aslcompiler.size(); i++) {
- AslcompilerDef currentAslDef = (AslcompilerDef) _aslcompiler
- .elementAt(i);
- if (currentAslDef.isActive()) {
- ProcessorConfiguration config = currentAslDef
- .createConfiguration(this, linkType,
- aslcompilerDef, targetPlatform);
- //
- // if the aslcompiler has a fileset
- // then allow it to add its files to
- // the set of potential targets
- //
- ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[] { config };
- if (currentAslDef.hasFileSets()) {
- TargetMatcher matcher = new TargetMatcher(this, _objDir,
- localConfigs, linkerConfig, objectFiles,
- targets);
- currentAslDef.visitFiles(matcher);
- }
- biddingProcessors.addElement(config);
- }
- }
- //
- // add fallback compiler at the end
- //
- ProcessorConfiguration config = aslcompilerDef.createConfiguration(
- this, linkType, null, targetPlatform);
- biddingProcessors.addElement(config);
- ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors
- .size()];
- biddingProcessors.copyInto(bidders);
- TargetMatcher matcher = new TargetMatcher(this, _objDir, bidders,
- linkerConfig, objectFiles, targets);
- aslcompilerDef.visitFiles(matcher);
- return targets;
- }
-
- /**
- * This method collects a Hashtable, keyed by output file name, of
- * TargetInfo's for every source file that is specified in the filesets of
- * the <assembler> elements. The TargetInfo's contain the appropriate
- * assembler configurations for their possible assembly
- *
- */
- private Hashtable getAssemblerTargets(LinkerConfiguration linkerConfig,
- Vector objectFiles) {
- Hashtable targets = new Hashtable(1000);
- TargetDef targetPlatform = getTargetPlatform();
- Vector biddingProcessors = new Vector(_assemblers.size());
- for (int i = 0; i < _assemblers.size(); i++) {
- AssemblerDef currentAssemblerDef = (AssemblerDef) _assemblers
- .elementAt(i);
- if (currentAssemblerDef.isActive()) {
- ProcessorConfiguration config = currentAssemblerDef
- .createConfiguration(this, linkType,
- assemblerDef, targetPlatform);
- //
- // if the assembler has a fileset
- // then allow it to add its files to
- // the set of potential targets
- //
- ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[] { config };
- if (currentAssemblerDef.hasFileSets()) {
- TargetMatcher matcher = new TargetMatcher(this, _objDir,
- localConfigs, linkerConfig, objectFiles,
- targets);
- currentAssemblerDef.visitFiles(matcher);
- }
- biddingProcessors.addElement(config);
- }
- }
- //
- // add fallback assembler at the end
- //
- ProcessorConfiguration config = assemblerDef.createConfiguration(this,
- linkType, null, targetPlatform);
- biddingProcessors.addElement(config);
- ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors
- .size()];
- biddingProcessors.copyInto(bidders);
- TargetMatcher matcher = new TargetMatcher(this, _objDir, bidders,
- linkerConfig, objectFiles, targets);
- assemblerDef.visitFiles(matcher);
- return targets;
- }
-
- /**
- * This method collects a Hashtable, keyed by output file name, of
- * TargetInfo's for every source file that is specified in the filesets of
- * the <cc>and nested <compiler>elements. The TargetInfo's contain the
- * appropriate compiler configurations for their possible compilation
- *
- */
- private Hashtable getTargets(LinkerConfiguration linkerConfig,
- Vector objectFiles) {
- Hashtable targets = new Hashtable(1000);
- TargetDef targetPlatform = getTargetPlatform();
- //
- // find active (specialized) compilers
- //
- Vector biddingProcessors = new Vector(_compilers.size());
- for (int i = 0; i < _compilers.size(); i++) {
- CompilerDef currentCompilerDef = (CompilerDef) _compilers
- .elementAt(i);
- if (currentCompilerDef.isActive()) {
- ProcessorConfiguration config = currentCompilerDef
- .createConfiguration(this, linkType,
- compilerDef, targetPlatform);
- //
- // see if this processor had a precompile child element
- //
- PrecompileDef precompileDef = currentCompilerDef
- .getActivePrecompile(compilerDef);
- ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[] { config };
- //
- // if it does then
- //
- if (precompileDef != null) {
- File prototype = precompileDef.getPrototype();
- //
- // will throw exceptions if prototype doesn't exist, etc
- //
- if (!prototype.exists()) {
- throw new BuildException("prototype ("
- + prototype.toString()
- + ") does not exist.");
- }
- if (prototype.isDirectory()) {
- throw new BuildException("prototype ("
- + prototype.toString()
- + ") is a directory.");
- }
- String[] exceptFiles = precompileDef.getExceptFiles();
- //
- // create a precompile building and precompile using
- // variants of the configuration
- // or return null if compiler doesn't support
- // precompilation
- CompilerConfiguration[] configs = ((CompilerConfiguration) config)
- .createPrecompileConfigurations(prototype,
- exceptFiles);
- if (configs != null && configs.length == 2) {
- //
- // visit the precompiled file to add it into the
- // targets list (just like any other file if
- // compiler doesn't support precompilation)
- TargetMatcher matcher = new TargetMatcher(
- this,
- _objDir,
- new ProcessorConfiguration[] { configs[0] },
- linkerConfig, objectFiles, targets);
- matcher.visit(new File(prototype.getParent()),
- prototype.getName());
- //
- // only the configuration that uses the
- // precompiled header gets added to the bidding list
- biddingProcessors.addElement(configs[1]);
- localConfigs = new ProcessorConfiguration[2];
- localConfigs[0] = configs[1];
- localConfigs[1] = config;
- }
- }
- //
- // if the compiler has a fileset
- // then allow it to add its files
- // to the set of potential targets
- if (currentCompilerDef.hasFileSets()) {
- TargetMatcher matcher = new TargetMatcher(this, _objDir,
- localConfigs, linkerConfig, objectFiles,
- targets);
- currentCompilerDef.visitFiles(matcher);
- }
- biddingProcessors.addElement(config);
- }
- }
- //
- // add fallback compiler at the end
- //
- ProcessorConfiguration config = compilerDef.createConfiguration(this,
- linkType, null, targetPlatform);
- biddingProcessors.addElement(config);
- ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors
- .size()];
- biddingProcessors.copyInto(bidders);
- //
- // bid out the <fileset>'s in the cctask
- //
- TargetMatcher matcher = new TargetMatcher(this, _objDir, bidders,
- linkerConfig, objectFiles, targets);
- compilerDef.visitFiles(matcher);
- return targets;
- }
-
- /**
- * Sets the default compiler adapter. Use the "name" attribute when the
- * compiler is a supported compiler.
- *
- * @param classname
- * fully qualified classname which implements CompilerAdapter
- */
- public void setClassname(String classname) {
- compilerDef.setClassname(classname);
- linkerDef.setClassname(classname);
- assemblerDef.setClassname(classname);
- aslcompilerDef.setClassname(classname);
- }
-
- /**
- * Sets the dataset for OS/390 builds.
- *
- * @param dataset
- * The dataset to set
- */
- public void setDataset(String dataset) {
- this.dataset = dataset;
- }
-
- /**
- * Enables or disables generation of debug info.
- */
- public void setDebug(boolean debug) {
- compilerDef.setDebug(debug);
- linkerDef.setDebug(debug);
- assemblerDef.setDebug(debug);
- aslcompilerDef.setDebug(debug);
- }
-
- /**
- * Deprecated.
- *
- * Controls the depth of the dependency evaluation. Used to do a quick check
- * of changes before a full build.
- *
- * Any negative value which will perform full dependency checking. Positive
- * values will truncate dependency checking. A value of 0 will cause only
- * those files that changed to be recompiled, a value of 1 which cause files
- * that changed or that explicitly include a file that changed to be
- * recompiled.
- *
- * Any non-negative value will cause a BuildException to be thrown before
- * attempting a link or completing the task.
- *
- */
- public void setDependencyDepth(int depth) {
- dependencyDepth = depth;
- }
-
- /**
- * Enables generation of exception handling code
- */
- public void setExceptions(boolean exceptions) {
- compilerDef.setExceptions(exceptions);
- }
-
- /**
- * Enables run-time type information.
- */
- public void setRtti(boolean rtti) {
- compilerDef.setRtti(rtti);
- }
-
- // public LinkType getLinkType() {
- // return linkType;
- // }
- /**
- * Enables or disables incremental linking.
- *
- * @param incremental
- * new state
- */
- public void setIncremental(boolean incremental) {
- linkerDef.setIncremental(incremental);
- }
-
- /**
- * Set use of libtool.
- *
- * If set to true, the "libtool " will be prepended to the command line for
- * compatible processors
- *
- * @param libtool
- * If true, use libtool.
- */
- public void setLibtool(boolean libtool) {
- compilerDef.setLibtool(libtool);
- linkerDef.setLibtool(libtool);
- assemblerDef.setLibtool(libtool);
- aslcompilerDef.setLibtool(libtool);
- }
-
- /**
- * Sets the output file type. Supported values "executable", "shared", and
- * "static". Deprecated, specify outtype instead.
- *
- * @deprecated
- */
- public void setLink(OutputTypeEnum outputType) {
- linkType.setOutputType(outputType);
- }
-
- /**
- * Enables or disables generation of multithreaded code
- *
- * @param multi
- * If true, generated code may be multithreaded.
- */
- public void setMultithreaded(boolean multi) {
- compilerDef.setMultithreaded(multi);
- }
-
- //
- // keep near duplicate comment at CompilerDef.setName in sync
- //
- /**
- * Sets type of the default compiler and linker.
- *
- * <table width="100%" border="1"> <thead>Supported compilers </thead>
- * <tr>
- * <td>gcc (default)</td>
- * <td>GCC C++ compiler</td>
- * </tr>
- * <tr>
- * <td>g++</td>
- * <td>GCC C++ compiler</td>
- * </tr>
- * <tr>
- * <td>c++</td>
- * <td>GCC C++ compiler</td>
- * </tr>
- * <tr>
- * <td>g77</td>
- * <td>GNU FORTRAN compiler</td>
- * </tr>
- * <tr>
- * <td>msvc</td>
- * <td>Microsoft Visual C++</td>
- * </tr>
- * <tr>
- * <td>bcc</td>
- * <td>Borland C++ Compiler</td>
- * </tr>
- * <tr>
- * <td>msrc</td>
- * <td>Microsoft Resource Compiler</td>
- * </tr>
- * <tr>
- * <td>brc</td>
- * <td>Borland Resource Compiler</td>
- * </tr>
- * <tr>
- * <td>df</td>
- * <td>Compaq Visual Fortran Compiler</td>
- * </tr>
- * <tr>
- * <td>midl</td>
- * <td>Microsoft MIDL Compiler</td>
- * </tr>
- * <tr>
- * <td>icl</td>
- * <td>Intel C++ compiler for Windows (IA-32)</td>
- * </tr>
- * <tr>
- * <td>ecl</td>
- * <td>Intel C++ compiler for Windows (IA-64)</td>
- * </tr>
- * <tr>
- * <td>icc</td>
- * <td>Intel C++ compiler for Linux (IA-32)</td>
- * </tr>
- * <tr>
- * <td>ecc</td>
- * <td>Intel C++ compiler for Linux (IA-64)</td>
- * </tr>
- * <tr>
- * <td>CC</td>
- * <td>Sun ONE C++ compiler</td>
- * </tr>
- * <tr>
- * <td>aCC</td>
- * <td>HP aC++ C++ Compiler</td>
- * </tr>
- * <tr>
- * <td>os390</td>
- * <td>OS390 C Compiler</td>
- * </tr>
- * <tr>
- * <td>os400</td>
- * <td>Icc Compiler</td>
- * </tr>
- * <tr>
- * <td>sunc89</td>
- * <td>Sun C89 C Compiler</td>
- * </tr>
- * <tr>
- * <td>xlC</td>
- * <td>VisualAge C Compiler</td>
- * </tr>
- * </table>
- *
- */
- public void setName(CompilerEnum name) {
- compilerDef.setName(name);
- Processor compiler = compilerDef.getProcessor();
- Linker linker = compiler.getLinker(linkType);
- linkerDef.setProcessor(linker);
- }
-
- /**
- * Do not propagate old environment when new environment variables are
- * specified.
- */
- public void setNewenvironment(boolean newenv) {
- compilerDef.setNewenvironment(newenv);
- linkerDef.setNewenvironment(newenv);
- assemblerDef.setNewenvironment(newenv);
- aslcompilerDef.setNewenvironment(newenv);
- }
-
- /**
- * Sets the destination directory for object files.
- *
- * Generally this should be a property expression that evaluates to distinct
- * debug and release object file directories.
- *
- * @param dir
- * object directory
- */
- public void setObjdir(File dir) {
- if (dir == null) {
- throw new NullPointerException("dir");
- }
- _objDir = dir;
- }
-
- /**
- * Sets the output file name. If not specified, the task will only compile
- * files and not attempt to link. If an extension is not specified, the task
- * may use a system appropriate extension and prefix, for example,
- * outfile="example" may result in "libexample.so" being created.
- *
- * @param outfile
- * output file name
- */
- public void setOutfile(File outfile) {
- //
- // if file name was empty, skip link step
- //
- if (outfile == null || outfile.toString().length() > 0) {
- _outfile = outfile;
- }
- }
-
- /**
- * Specifies the name of a property to set with the physical filename that
- * is produced by the linker
- */
- public void setOutputFileProperty(String outputFileProperty) {
- this.outputFileProperty = outputFileProperty;
- }
-
- /**
- * Sets the output file type. Supported values "executable", "shared", and
- * "static".
- */
- public void setOuttype(OutputTypeEnum outputType) {
- linkType.setOutputType(outputType);
- }
-
- /**
- * Sets the project.
- */
- public void setProject(Project project) {
- super.setProject(project);
- compilerDef.setProject(project);
- linkerDef.setProject(project);
- assemblerDef.setProject(project);
- aslcompilerDef.setProject(project);
- }
-
- /**
- * If set to true, all files will be rebuilt.
- *
- * @paran rebuildAll If true, all files will be rebuilt. If false, up to
- * date files will not be rebuilt.
- */
- public void setRebuild(boolean rebuildAll) {
- compilerDef.setRebuild(rebuildAll);
- linkerDef.setRebuild(rebuildAll);
- assemblerDef.setRebuild(rebuildAll);
- aslcompilerDef.setRebuild(rebuildAll);
- }
-
- /**
- * If set to true, compilation errors will not stop the task until all files
- * have been attempted.
- *
- * @param relentless
- * If true, don't stop on the first compilation error
- *
- */
- public void setRelentless(boolean relentless) {
- this.relentless = relentless;
- }
-
- /**
- * Sets the type of runtime library, possible values "dynamic", "static".
- */
- public void setRuntime(RuntimeType rtlType) {
- linkType.setStaticRuntime((rtlType.getIndex() == 1));
- }
-
- /**
- * Sets the nature of the subsystem under which that the program will
- * execute.
- *
- * <table width="100%" border="1"> <thead>Supported subsystems </thead>
- * <tr>
- * <td>gui</td>
- * <td>Graphical User Interface</td>
- * </tr>
- * <tr>
- * <td>console</td>
- * <td>Command Line Console</td>
- * </tr>
- * <tr>
- * <td>other</td>
- * <td>Other</td>
- * </tr>
- * </table>
- *
- * @param subsystem
- * subsystem
- * @throws NullPointerException
- * if subsystem is null
- */
- public void setSubsystem(SubsystemEnum subsystem) {
- if (subsystem == null) {
- throw new NullPointerException("subsystem");
- }
- linkType.setSubsystem(subsystem);
- }
-
- /**
- * Enumerated attribute with the values "none", "severe", "default",
- * "production", "diagnostic", and "failtask".
- */
- public void setWarnings(CompilerDef.WarningLevel level) {
- compilerDef.setWarnings(level);
- }
-
- /**
- * Indicates whether the build will continue even if there are compilation
- * errors; defaults to true.
- *
- * @param fail
- * if true halt the build on failure
- */
- public void setFailonerror(boolean fail) {
- failOnError = fail;
- }
-
- /**
- * Gets the failonerror flag.
- *
- * @return the failonerror flag
- */
- public boolean getFailonerror() {
- return failOnError;
- }
-
- /**
- * Adds descriptive version information to be included in the generated
- * file. The first active version info block will be used. (Non-functional
- * prototype)
- */
- public void addConfiguredVersioninfo(VersionInfo info) {
- linkerDef.addConfiguredVersioninfo(info);
- }
-
- /**
- * Adds a target definition or reference (Non-functional prototype).
- *
- * @param target
- * target
- * @throws NullPointerException
- * if compiler is null
- */
- public void addConfiguredTarget(TargetDef target) {
- if (target == null) {
- throw new NullPointerException("target");
- }
- target.setProject(getProject());
- targetPlatforms.addElement(target);
- }
-
- /**
- * Adds a distributer definition or reference (Non-functional prototype).
- *
- * @param distributer
- * distributer
- * @throws NullPointerException
- * if compiler is null
- */
- public void addConfiguredDistributer(DistributerDef distributer) {
- if (distributer == null) {
- throw new NullPointerException("distributer");
- }
- distributer.setProject(getProject());
- distributers.addElement(distributer);
- }
-
- /**
- * Sets optimization.
- * @param optimization
- */
- public void setOptimize(OptimizationEnum optimization) {
- compilerDef.setOptimize(optimization);
- }
-
- public boolean isAssembler() {
- return assembler;
- }
-
- public void setAssembler(boolean assembler) {
- this.assembler = assembler;
- }
-
- public boolean isAslcompiler() {
- return aslcompiler;
- }
-
- public void setAslcompiler(boolean aslcompiler) {
- this.aslcompiler = aslcompiler;
- }
-
- public boolean isUserdefine() {
- return userdefine;
- }
-
- public void setUserdefine(boolean userdefine) {
- this.userdefine = userdefine;
- }
-
- public String getArch() {
- return arch;
- }
-
- public void setArch(String arch) {
- this.arch = arch;
- }
-
- public String getOs() {
- return os;
- }
-
- public void setOs(String os) {
- this.os = os;
- }
-
- public String getVendor() {
- return vendor;
- }
-
- public void setVendor(String vendor) {
- this.vendor = vendor;
- }
-
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CCTaskProgressMonitor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CCTaskProgressMonitor.java
deleted file mode 100644
index 78192a5ba7..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CCTaskProgressMonitor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.IOException;
-
-import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.ProgressMonitor;
-public class CCTaskProgressMonitor implements ProgressMonitor {
- private ProcessorConfiguration config;
- private TargetHistoryTable history;
- private long lastCommit = -1;
- public CCTaskProgressMonitor(TargetHistoryTable history) {
- this.history = history;
- }
- public void finish(ProcessorConfiguration config, boolean normal) {
- long current = System.currentTimeMillis();
- if ((current - lastCommit) > 120000) {
- try {
- history.commit();
- lastCommit = System.currentTimeMillis();
- } catch (IOException ex) {
- }
- }
- }
- public void progress(String[] sources) {
- history.update(config, sources);
- long current = System.currentTimeMillis();
- if ((current - lastCommit) > 120000) {
- try {
- history.commit();
- lastCommit = current;
- } catch (IOException ex) {
- }
- }
- }
- public void start(ProcessorConfiguration config) {
- if (lastCommit < 0) {
- lastCommit = System.currentTimeMillis();
- }
- this.config = config;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CPUEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CPUEnum.java
deleted file mode 100644
index ba73902361..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CPUEnum.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import org.apache.tools.ant.types.EnumeratedAttribute;
-
-/**
- * Enumeration of cpu types.
- *
- * @author Curt Arnold
- *
- */
-public final class CPUEnum
- extends EnumeratedAttribute {
-
- /**
- * Constructor.
- *
- * Set by default to "pentium3"
- *
- * @see java.lang.Object#Object()
- */
- public CPUEnum() {
- setValue("pentium3");
- }
-
- /**
- * Gets list of acceptable values.
- *
- * @see org.apache.tools.ant.types.EnumeratedAttribute#getValues()
- */
- public String[] getValues() {
- return new String[] {
- "i386",
- "i486",
- "i586",
- "i686",
- "pentium",
- "pentium-mmx",
- "pentiumpro",
- "pentium2",
- "pentium3",
- "pentium4",
- "k6",
- "k6-2",
- "k6-3",
- "athlon",
- "athlon-tbird",
- "athlon-4",
- "athlon-xp",
- "athlon-mp",
- "winchip-c6",
- "winchip2",
- "c3" };
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CUtil.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CUtil.java
deleted file mode 100644
index 074e8b42f8..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CUtil.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-import org.apache.tools.ant.types.Environment;
-/**
- * Some utilities used by the CC and Link tasks.
- *
- * @author Adam Murdoch
- */
-public class CUtil {
- /**
- * A class that splits a white-space, comma-separated list into a String
- * array. Used for task attributes.
- */
- public static final class StringArrayBuilder {
- private String[] _value;
- public StringArrayBuilder(String value) {
- // Split the defines up
- StringTokenizer tokens = new StringTokenizer(value, ", ");
- Vector vallist = new Vector();
- while (tokens.hasMoreTokens()) {
- String val = tokens.nextToken().trim();
- if (val.length() == 0) {
- continue;
- }
- vallist.addElement(val);
- }
- _value = new String[vallist.size()];
- vallist.copyInto(_value);
- }
- public String[] getValue() {
- return _value;
- }
- }
- /**
- * Adds the elements of the array to the given vector
- */
- public static void addAll(Vector dest, Object[] src) {
- if (src == null) {
- return;
- }
- for (int i = 0; i < src.length; i++) {
- dest.addElement(src[i]);
- }
- }
- /**
- * Checks a array of names for non existent or non directory entries and
- * nulls them out.
- *
- * @return Count of non-null elements
- */
- public static int checkDirectoryArray(String[] names) {
- int count = 0;
- for (int i = 0; i < names.length; i++) {
- if (names[i] != null) {
- File dir = new File(names[i]);
- if (dir.exists() && dir.isDirectory()) {
- count++;
- } else {
- names[i] = null;
- }
- }
- }
- return count;
- }
- /**
- * Extracts the basename of a file, removing the extension, if present
- */
- public static String getBasename(File file) {
- String path = file.getPath();
- // Remove the extension
- String basename = file.getName();
- int pos = basename.lastIndexOf('.');
- if (pos != -1) {
- basename = basename.substring(0, pos);
- }
- return basename;
- }
- /**
- * Gets the parent directory for the executable file name using the current
- * directory and system executable path
- *
- * @param exeName
- * Name of executable such as "cl.exe"
- * @return parent directory or null if not located
- */
- public static File getExecutableLocation(String exeName) {
- //
- // must add current working directory to the
- // from of the path from the "path" environment variable
- File currentDir = new File(System.getProperty("user.dir"));
- if (new File(currentDir, exeName).exists()) {
- return currentDir;
- }
- File[] envPath = CUtil.getPathFromEnvironment("PATH",
- File.pathSeparator);
- for (int i = 0; i < envPath.length; i++) {
- if (new File(envPath[i], exeName).exists()) {
- return envPath[i];
- }
- }
- return null;
- }
- /**
- * Extracts the parent of a file
- */
- public static String getParentPath(String path) {
- int pos = path.lastIndexOf(File.separator);
- if (pos <= 0) {
- return null;
- }
- return path.substring(0, pos);
- }
- /**
- * Returns an array of File for each existing directory in the specified
- * environment variable
- *
- * @param envVariable
- * environment variable name such as "LIB" or "INCLUDE"
- * @param delim
- * delimitor used to separate parts of the path, typically ";"
- * or ":"
- * @return array of File's for each part that is an existing directory
- */
- public static File[] getPathFromEnvironment(String envVariable, String delim) {
- // OS/4000 does not support the env command.
- if (System.getProperty("os.name").equals("OS/400"))
- return new File[]{};
- Vector osEnv = Execute.getProcEnvironment();
- String match = envVariable.concat("=");
- for (Enumeration e = osEnv.elements(); e.hasMoreElements();) {
- String entry = ((String) e.nextElement()).trim();
- if (entry.length() > match.length()) {
- String entryFrag = entry.substring(0, match.length());
- if (entryFrag.equalsIgnoreCase(match)) {
- String path = entry.substring(match.length());
- return parsePath(path, delim);
- }
- }
- }
- File[] noPath = new File[0];
- return noPath;
- }
- /**
- * Returns a relative path for the targetFile relative to the base
- * directory.
- *
- * @param canonicalBase
- * base directory as returned by File.getCanonicalPath()
- * @param targetFile
- * target file
- * @return relative path of target file. Returns targetFile if there were
- * no commonalities between the base and the target
- *
- * @author Curt Arnold
- */
- public static String getRelativePath(String base, File targetFile) {
- try {
- //
- // remove trailing file separator
- //
- String canonicalBase = base;
- if (base.charAt(base.length() - 1) == File.separatorChar) {
- canonicalBase = base.substring(0, base.length() - 1);
- }
- //
- // get canonical name of target and remove trailing separator
- //
- String canonicalTarget;
- if (System.getProperty("os.name").equals("OS/400"))
- canonicalTarget = targetFile.getPath();
- else
- canonicalTarget = targetFile.getCanonicalPath();
- if (canonicalTarget.charAt(canonicalTarget.length() - 1) == File.separatorChar) {
- canonicalTarget = canonicalTarget.substring(0, canonicalTarget
- .length() - 1);
- }
- if (canonicalTarget.equals(canonicalBase)) {
- return ".";
- }
- //
- // see if the prefixes are the same
- //
- if (canonicalBase.substring(0, 2).equals("\\\\")) {
- //
- // UNC file name, if target file doesn't also start with same
- // server name, don't go there
- int endPrefix = canonicalBase.indexOf('\\', 2);
- String prefix1 = canonicalBase.substring(0, endPrefix);
- String prefix2 = canonicalTarget.substring(0, endPrefix);
- if (!prefix1.equals(prefix2)) {
- return canonicalTarget;
- }
- } else {
- if (canonicalBase.substring(1, 3).equals(":\\")) {
- int endPrefix = 2;
- String prefix1 = canonicalBase.substring(0, endPrefix);
- String prefix2 = canonicalTarget.substring(0, endPrefix);
- if (!prefix1.equals(prefix2)) {
- return canonicalTarget;
- }
- } else {
- if (canonicalBase.charAt(0) == '/') {
- if (canonicalTarget.charAt(0) != '/') {
- return canonicalTarget;
- }
- }
- }
- }
- char separator = File.separatorChar;
- int lastSeparator = -1;
- int minLength = canonicalBase.length();
- if (canonicalTarget.length() < minLength) {
- minLength = canonicalTarget.length();
- }
- int firstDifference = minLength + 1;
- //
- // walk to the shorter of the two paths
- // finding the last separator they have in common
- for (int i = 0; i < minLength; i++) {
- if (canonicalTarget.charAt(i) == canonicalBase.charAt(i)) {
- if (canonicalTarget.charAt(i) == separator) {
- lastSeparator = i;
- }
- } else {
- firstDifference = lastSeparator + 1;
- break;
- }
- }
- StringBuffer relativePath = new StringBuffer(50);
- //
- // walk from the first difference to the end of the base
- // adding "../" for each separator encountered
- //
- if (canonicalBase.length() > firstDifference) {
- relativePath.append("..");
- for (int i = firstDifference; i < canonicalBase.length(); i++) {
- if (canonicalBase.charAt(i) == separator) {
- relativePath.append(separator);
- relativePath.append("..");
- }
- }
- }
- if (canonicalTarget.length() > firstDifference) {
- //
- // append the rest of the target
- //
- //
- if (relativePath.length() > 0) {
- relativePath.append(separator);
- }
- relativePath.append(canonicalTarget.substring(firstDifference));
- }
- return relativePath.toString();
- } catch (IOException ex) {
- }
- return targetFile.toString();
- }
- public static boolean isActive(Project p, String ifCond, String unlessCond)
- throws BuildException {
- if (ifCond != null) {
- String ifValue = p.getProperty(ifCond);
- if (ifValue == null) {
- return false;
- } else {
- if (ifValue.equals("false") || ifValue.equals("no")) {
- throw new BuildException("if condition \"" + ifCond
- + "\" has suspicious value \"" + ifValue);
- }
- }
- }
- if (unlessCond != null) {
- String unlessValue = p.getProperty(unlessCond);
- if (unlessValue != null) {
- if (unlessValue.equals("false") || unlessValue.equals("no")) {
- throw new BuildException("unless condition \"" + unlessCond
- + "\" has suspicious value \"" + unlessValue);
- }
- return false;
- }
- }
- return true;
- }
- /**
- * Parse a string containing directories into an File[]
- *
- * @param path
- * path string, for example ".;c:\something\include"
- * @param delim
- * delimiter, typically ; or :
- */
- public static File[] parsePath(String path, String delim) {
- Vector libpaths = new Vector();
- int delimPos = 0;
- for (int startPos = 0; startPos < path.length(); startPos = delimPos
- + delim.length()) {
- delimPos = path.indexOf(delim, startPos);
- if (delimPos < 0) {
- delimPos = path.length();
- }
- //
- // don't add an entry for zero-length paths
- //
- if (delimPos > startPos) {
- String dirName = path.substring(startPos, delimPos);
- File dir = new File(dirName);
- if (dir.exists() && dir.isDirectory()) {
- libpaths.addElement(dir);
- }
- }
- }
- File[] paths = new File[libpaths.size()];
- libpaths.copyInto(paths);
- return paths;
- }
- /**
- * This method is exposed so test classes can overload and test the
- * arguments without actually spawning the compiler
- */
- public static int runCommand(CCTask task, File workingDir,
- String[] cmdline, boolean newEnvironment, Environment env)
- throws BuildException {
- try {
- task.log(Commandline.toString(cmdline), Project.MSG_VERBOSE);
- Execute exe = new Execute(new LogStreamHandler(task,
- Project.MSG_INFO, Project.MSG_ERR));
- if (System.getProperty("os.name").equals("OS/390"))
- exe.setVMLauncher(false);
- exe.setAntRun(task.getProject());
- exe.setCommandline(cmdline);
- exe.setWorkingDirectory(workingDir);
- if (env != null) {
- String[] environment = env.getVariables();
- if (environment != null) {
- for (int i = 0; i < environment.length; i++) {
- task.log("Setting environment variable: "
- + environment[i], Project.MSG_VERBOSE);
- }
- }
- exe.setEnvironment(environment);
- }
- exe.setNewenvironment(newEnvironment);
- return exe.execute();
- } catch (java.io.IOException exc) {
- throw new BuildException("Could not launch " + cmdline[0] + ": "
- + exc, task.getLocation());
- }
- }
- /**
- * Compares the contents of 2 arrays for equaliy.
- */
- public static boolean sameList(Object[] a, Object[] b) {
- if (a == null || b == null || a.length != b.length) {
- return false;
- }
- for (int i = 0; i < a.length; i++) {
- if (!a[i].equals(b[i])) {
- return false;
- }
- }
- return true;
- }
- /**
- * Compares the contents of an array and a Vector for equality.
- */
- public static boolean sameList(Vector v, Object[] a) {
- if (v == null || a == null || v.size() != a.length) {
- return false;
- }
- for (int i = 0; i < a.length; i++) {
- Object o = a[i];
- if (!o.equals(v.elementAt(i))) {
- return false;
- }
- }
- return true;
- }
- /**
- * Compares the contents of an array and a Vector for set equality. Assumes
- * input array and vector are sets (i.e. no duplicate entries)
- */
- public static boolean sameSet(Object[] a, Vector b) {
- if (a == null || b == null || a.length != b.size()) {
- return false;
- }
- if (a.length == 0) {
- return true;
- }
- // Convert the array into a set
- Hashtable t = new Hashtable();
- for (int i = 0; i < a.length; i++) {
- t.put(a[i], a[i]);
- }
- for (int i = 0; i < b.size(); i++) {
- Object o = b.elementAt(i);
- if (t.remove(o) == null) {
- return false;
- }
- }
- return (t.size() == 0);
- }
- /**
- * Converts a vector to a string array.
- */
- public static String[] toArray(Vector src) {
- String[] retval = new String[src.size()];
- src.copyInto(retval);
- return retval;
- }
- /**
- * Replaces any embedded quotes in the string so that the value can be
- * placed in an attribute in an XML file
- *
- * @param attrValue
- * value to be expressed
- * @return equivalent attribute literal
- *
- */
- public static String xmlAttribEncode(String attrValue) {
- int quotePos = attrValue.indexOf('\"');
- if (quotePos < 0) {
- return attrValue;
- }
- int startPos = 0;
- StringBuffer buf = new StringBuffer(attrValue.length() + 20);
- while (quotePos >= 0) {
- buf.append(attrValue.substring(startPos, quotePos));
- buf.append("&quot;");
- startPos = quotePos + 1;
- quotePos = attrValue.indexOf('\"', startPos);
- }
- buf.append(attrValue.substring(startPos));
- return buf.toString();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerDef.java
deleted file mode 100644
index 0a92a51512..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerDef.java
+++ /dev/null
@@ -1,556 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
-import net.sf.antcontrib.cpptasks.compiler.Compiler;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.gcc.GccCCompiler;
-import net.sf.antcontrib.cpptasks.types.CompilerArgument;
-import net.sf.antcontrib.cpptasks.types.ConditionalPath;
-import net.sf.antcontrib.cpptasks.types.DefineSet;
-import net.sf.antcontrib.cpptasks.types.IncludePath;
-import net.sf.antcontrib.cpptasks.types.SystemIncludePath;
-import net.sf.antcontrib.cpptasks.types.UndefineArgument;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.EnumeratedAttribute;
-import org.apache.tools.ant.*;
-/**
- * A compiler definition. compiler elements may be placed either as children of
- * a cc element or the project element. A compiler element with an id attribute
- * may be referenced from compiler elements with refid or extends attributes.
- *
- * @author Adam Murdoch
- */
-public final class CompilerDef extends ProcessorDef {
- /**
- * Enumerated attribute with the values "none", "severe", "default",
- * "production", "diagnostic", and "failtask".
- */
- public static class WarningLevel extends EnumeratedAttribute {
- public String[] getValues() {
- return new String[]{"none", "severe", "default", "production",
- "diagnostic", "aserror"};
- }
- }
- /** The source file sets. */
- private final Vector defineSets = new Vector();
- private Boolean exceptions;
- private Boolean rtti;
- private final Vector includePaths = new Vector();
- private Boolean multithreaded;
- private final Vector precompileDefs = new Vector();
- private final Vector sysIncludePaths = new Vector();
- private OptimizationEnum optimization;
- private int warnings = -1;
- private Boolean defaultflag = new Boolean(true);
- public CompilerDef() {
- }
- /**
- * Adds a compiler command-line arg.
- */
- public void addConfiguredCompilerArg(CompilerArgument arg) {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- addConfiguredProcessorArg(arg);
- }
- /**
- * Adds a compiler command-line arg.
- */
- public void addConfiguredCompilerParam(CompilerParam param) {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- addConfiguredProcessorParam(param);
- }
- /**
- * Adds a defineset.
- */
- public void addConfiguredDefineset(DefineSet defs) {
- if (defs == null) {
- throw new NullPointerException("defs");
- }
- if (isReference()) {
- throw noChildrenAllowed();
- }
- defineSets.addElement(defs);
- }
- /**
- * Creates an include path.
- */
- public IncludePath createIncludePath() {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project must be set");
- }
- if (isReference()) {
- throw noChildrenAllowed();
- }
- IncludePath path = new IncludePath(p);
- includePaths.addElement(path);
- return path;
- }
- /**
- * Add a <includepath>or <sysincludepath> if specify the file
- * attribute
- *
- * @throws BuildException
- * if the specify file not exist
- */
- protected void loadFile(Vector activePath,File file) throws BuildException {
- FileReader fileReader;
- BufferedReader in;
- String str;
- if (! file.exists()){
- throw new BuildException("The file " + file + " is not existed");
- }
- try {
- fileReader = new FileReader(file);
- in = new BufferedReader(fileReader);
- while ( (str = in.readLine()) != null ){
- if(str.trim() == ""){
- continue ;
- }
- str = getProject().replaceProperties(str);
- activePath.addElement(str.trim());
- }
- }
- catch(Exception e){
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- * Specifies precompilation prototype file and exclusions.
- *
- */
- public PrecompileDef createPrecompile() throws BuildException {
- Project p = getProject();
- if (isReference()) {
- throw noChildrenAllowed();
- }
- PrecompileDef precomp = new PrecompileDef();
- precomp.setProject(p);
- precompileDefs.addElement(precomp);
- return precomp;
- }
- /**
- * Creates a system include path. Locations and timestamps of files located
- * using the system include paths are not used in dependency analysis.
- *
- *
- * Standard include locations should not be specified. The compiler
- * adapters should recognized the settings from the appropriate environment
- * variables or configuration files.
- */
- public SystemIncludePath createSysIncludePath() {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project must be set");
- }
- if (isReference()) {
- throw noChildrenAllowed();
- }
- SystemIncludePath path = new SystemIncludePath(p);
- sysIncludePaths.addElement(path);
- return path;
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
- public UndefineArgument[] getActiveDefines() {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException(
- "project must be set before this call");
- }
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getActiveDefines();
- }
- Vector actives = new Vector();
- for (int i = 0; i < defineSets.size(); i++) {
- DefineSet currentSet = (DefineSet) defineSets.elementAt(i);
- UndefineArgument[] defines = currentSet.getDefines();
- for (int j = 0; j < defines.length; j++) {
- if (defines[j].isActive(p)) {
- actives.addElement(defines[j]);
- }
- }
- }
- UndefineArgument[] retval = new UndefineArgument[actives.size()];
- actives.copyInto(retval);
- return retval;
- }
- /**
- * Returns the compiler-specific include path.
- */
- public String[] getActiveIncludePaths() {
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getActiveIncludePaths();
- }
- return getActivePaths(includePaths);
- }
- private String[] getActivePaths(Vector paths) {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project not set");
- }
- Vector activePaths = new Vector(paths.size());
- for (int i = 0; i < paths.size(); i++) {
- ConditionalPath path = (ConditionalPath) paths.elementAt(i);
- if (path.isActive(p)) {
- if (path.getFile() == null) {
- String[] pathEntries = path.list();
- for (int j = 0; j < pathEntries.length; j++) {
- activePaths.addElement(pathEntries[j]);
- }
- }
- else {
- loadFile(activePaths, path.getFile());
- }
- }
- }
- String[] pathNames = new String[activePaths.size()];
- activePaths.copyInto(pathNames);
- return pathNames;
- }
- public PrecompileDef getActivePrecompile(CompilerDef ccElement) {
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getActivePrecompile(ccElement);
- }
- PrecompileDef current = null;
- Enumeration enumPrecompilerDef = precompileDefs.elements();
- while (enumPrecompilerDef.hasMoreElements()) {
- current = (PrecompileDef) enumPrecompilerDef.nextElement();
- if (current.isActive()) {
- return current;
- }
- }
- CompilerDef extendedDef = (CompilerDef) getExtends();
- if (extendedDef != null) {
- current = extendedDef.getActivePrecompile(null);
- if (current != null) {
- return current;
- }
- }
- if (ccElement != null && getInherit()) {
- return ccElement.getActivePrecompile(null);
- }
- return null;
- }
- public String[] getActiveSysIncludePaths() {
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getActiveSysIncludePaths();
- }
- return getActivePaths(sysIncludePaths);
- }
- public final boolean getExceptions(CompilerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getExceptions(defaultProviders, index);
- }
- if (exceptions != null) {
- return exceptions.booleanValue();
- } else {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getExceptions(defaultProviders,
- index + 1);
- }
- }
- return false;
- }
- public final Boolean getRtti(CompilerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getRtti(defaultProviders, index);
- }
- if (rtti != null) {
- return rtti;
- } else {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getRtti(defaultProviders,
- index + 1);
- }
- }
- return null;
- }
- public final Boolean getDefaultflag(CompilerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getDefaultflag(defaultProviders, index);
- }
- return defaultflag;
- }
- public final OptimizationEnum getOptimization(CompilerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getOptimization(defaultProviders, index);
- }
- if (optimization != null) {
- return optimization;
- } else {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getOptimization(defaultProviders,
- index + 1);
- }
- }
- return null;
- }
-
- public boolean getMultithreaded(CompilerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getMultithreaded(defaultProviders, index);
- }
- if (multithreaded != null) {
- return multithreaded.booleanValue();
- } else {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getMultithreaded(
- defaultProviders, index + 1);
- }
- }
- return true;
- }
- public Processor getProcessor() {
- Processor processor = super.getProcessor();
- if (processor == null) {
- processor = GccCCompiler.getInstance();
- }
- if (getLibtool() && processor instanceof CommandLineCompiler) {
- CommandLineCompiler compiler = (CommandLineCompiler) processor;
- processor = compiler.getLibtoolCompiler();
- }
- return processor;
- }
- public int getWarnings(CompilerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((CompilerDef) getCheckedRef(CompilerDef.class,
- "CompilerDef")).getWarnings(defaultProviders, index);
- }
- if (warnings == -1) {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getWarnings(defaultProviders,
- index + 1);
- }
- }
- return warnings;
- }
- /**
- * Sets the default compiler adapter. Use the "name" attribute when the
- * compiler is a supported compiler.
- *
- * @param classname
- * fully qualified classname which implements CompilerAdapter
- */
- public void setClassname(String classname) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- super.setClassname(classname);
- Processor proc = getProcessor();
- if (!(proc instanceof Compiler)) {
- throw new BuildException(classname + " does not implement Compiler");
- }
- }
- /**
- * Enables or disables exception support.
- *
- * @param exceptions
- * if true, exceptions are supported.
- *
- */
- public void setExceptions(boolean exceptions) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.exceptions = booleanValueOf(exceptions);
- }
-
- /**
- * Enables or disables run-time type information.
- *
- * @param rtti
- * if true, run-time type information is supported.
- *
- */
- public void setRtti(boolean rtti) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.rtti = booleanValueOf(rtti);
- }
-
- /**
- * Enables or disables generation of multithreaded code. Unless specified,
- * multithreaded code generation is enabled.
- *
- * @param multi
- * If true, generated code may be multithreaded.
- */
- public void setMultithreaded(boolean multithreaded) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.multithreaded = booleanValueOf(multithreaded);
- }
- /**
- * Sets compiler type.
- *
- *
- * <table width="100%" border="1"> <thead>Supported compilers </thead>
- * <tr>
- * <td>gcc (default)</td>
- * <td>GCC C++ compiler</td>
- * </tr>
- * <tr>
- * <td>g++</td>
- * <td>GCC C++ compiler</td>
- * </tr>
- * <tr>
- * <td>c++</td>
- * <td>GCC C++ compiler</td>
- * </tr>
- * <tr>
- * <td>g77</td>
- * <td>GNU Fortran compiler</td>
- * </tr>
- * <tr>
- * <td>msvc</td>
- * <td>Microsoft Visual C++</td>
- * </tr>
- * <tr>
- * <td>bcc</td>
- * <td>Borland C++ Compiler</td>
- * </tr>
- * <tr>
- * <td>msrc</td>
- * <td>Microsoft Resource Compiler</td>
- * </tr>
- * <tr>
- * <td>brc</td>
- * <td>Borland Resource Compiler</td>
- * </tr>
- * <tr>
- * <td>df</td>
- * <td>Compaq Visual Fortran Compiler</td>
- * </tr>
- * <tr>
- * <td>midl</td>
- * <td>Microsoft MIDL Compiler</td>
- * </tr>
- * <tr>
- * <td>icl</td>
- * <td>Intel C++ compiler for Windows (IA-32)</td>
- * </tr>
- * <tr>
- * <td>ecl</td>
- * <td>Intel C++ compiler for Windows (IA-64)</td>
- * </tr>
- * <tr>
- * <td>icc</td>
- * <td>Intel C++ compiler for Linux (IA-32)</td>
- * </tr>
- * <tr>
- * <td>ecc</td>
- * <td>Intel C++ compiler for Linux (IA-64)</td>
- * </tr>
- * <tr>
- * <td>CC</td>
- * <td>Sun ONE C++ compiler</td>
- * </tr>
- * <tr>
- * <td>aCC</td>
- * <td>HP aC++ C++ Compiler</td>
- * </tr>
- * <tr>
- * <td>os390</td>
- * <td>OS390 C Compiler</td>
- * </tr>
- * <tr>
- * <td>os400</td>
- * <td>Icc Compiler</td>
- * </tr>
- * <tr>
- * <td>sunc89</td>
- * <td>Sun C89 C Compiler</td>
- * </tr>
- * <tr>
- * <td>xlC</td>
- * <td>VisualAge C Compiler</td>
- * </tr>
- * </table>
- *
- */
- public void setName(CompilerEnum name) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- Compiler compiler = name.getCompiler();
- setProcessor(compiler);
- }
- protected void setProcessor(Processor proc) throws BuildException {
- try {
- super.setProcessor((Compiler) proc);
- } catch (ClassCastException ex) {
- throw new BuildException(ex);
- }
- }
- /**
- * Enumerated attribute with the values "none", "severe", "default",
- * "production", "diagnostic", and "failtask".
- */
- public void setWarnings(CompilerDef.WarningLevel level) {
- warnings = level.getIndex();
- }
- /**
- * Sets optimization level.
- *
- * @param value optimization level
- */
- public void setOptimize(OptimizationEnum value) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.optimization = value;
- }
- /**
- * Enables or disables default flags.
- *
- * @param defaultflag
- * if true, default flags will add to command line.
- *
- */
- public void setDefaultflag(boolean defaultflag) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.defaultflag = booleanValueOf(defaultflag);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerEnum.java
deleted file mode 100644
index a017243522..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerEnum.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import net.sf.antcontrib.cpptasks.arm.ADSCCompiler;
-import net.sf.antcontrib.cpptasks.borland.BorlandCCompiler;
-import net.sf.antcontrib.cpptasks.borland.BorlandResourceCompiler;
-import net.sf.antcontrib.cpptasks.compaq.CompaqVisualFortranCompiler;
-import net.sf.antcontrib.cpptasks.compiler.Compiler;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioCCompiler;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioMIDLCompiler;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioResourceCompiler;
-import net.sf.antcontrib.cpptasks.gcc.GccCCompiler;
-import net.sf.antcontrib.cpptasks.hp.aCCCompiler;
-import net.sf.antcontrib.cpptasks.ibm.VisualAgeCCompiler;
-import net.sf.antcontrib.cpptasks.intel.IntelLinux32CCompiler;
-import net.sf.antcontrib.cpptasks.intel.IntelLinux64CCompiler;
-import net.sf.antcontrib.cpptasks.intel.IntelWin32CCompiler;
-import net.sf.antcontrib.cpptasks.intel.IntelWin64CCompiler;
-import net.sf.antcontrib.cpptasks.os390.OS390CCompiler;
-import net.sf.antcontrib.cpptasks.os400.IccCompiler;
-import net.sf.antcontrib.cpptasks.sun.C89CCompiler;
-import net.sf.antcontrib.cpptasks.sun.ForteCCCompiler;
-import net.sf.antcontrib.cpptasks.ti.ClxxCCompiler;
-
-import org.apache.tools.ant.types.EnumeratedAttribute;
-/**
- * Enumeration of supported compilers
- *
- * <table width="100%" border="1"> <thead>Supported compilers </thead>
- * <tr>
- * <td>gcc (default)</td>
- * <td>GCC C++ compiler</td>
- * </tr>
- * <tr>
- * <td>g++</td>
- * <td>GCC C++ compiler</td>
- * </tr>
- * <tr>
- * <td>c++</td>
- * <td>GCC C++ compiler</td>
- * </tr>
- * <tr>
- * <td>g77</td>
- * <td>GNU FORTRAN compiler</td>
- * </tr>
- * <tr>
- * <td>msvc</td>
- * <td>Microsoft Visual C++</td>
- * </tr>
- * <tr>
- * <td>bcc</td>
- * <td>Borland C++ Compiler</td>
- * </tr>
- * <tr>
- * <td>msrc</td>
- * <td>Microsoft Resource Compiler</td>
- * </tr>
- * <tr>
- * <td>brc</td>
- * <td>Borland Resource Compiler</td>
- * </tr>
- * <tr>
- * <td>df</td>
- * <td>Compaq Visual Fortran Compiler</td>
- * </tr>
- * <tr>
- * <td>midl</td>
- * <td>Microsoft MIDL Compiler</td>
- * </tr>
- * <tr>
- * <td>icl</td>
- * <td>Intel C++ compiler for Windows (IA-32)</td>
- * </tr>
- * <tr>
- * <td>ecl</td>
- * <td>Intel C++ compiler for Windows (IA-64)</td>
- * </tr>
- * <tr>
- * <td>icc</td>
- * <td>Intel C++ compiler for Linux (IA-32)</td>
- * </tr>
- * <tr>
- * <td>ecc</td>
- * <td>Intel C++ compiler for Linux (IA-64)</td>
- * </tr>
- * <tr>
- * <td>CC</td>
- * <td>Sun ONE C++ compiler</td>
- * </tr>
- * <tr>
- * <td>aCC</td>
- * <td>HP aC++ C++ Compiler</td>
- * </tr>
- * <tr>
- * <td>os390</td>
- * <td>OS390 C Compiler</td>
- * </tr>
- * <tr>
- * <td>os400</td>
- * <td>Icc Compiler</td>
- * </tr>
- * <tr>
- * <td>sunc89</td>
- * <td>Sun C89 C Compiler</td>
- * </tr>
- * <tr>
- * <td>xlC</td>
- * <td>VisualAge C Compiler</td>
- * </tr>
- * <tr>
- * <td>cl6x</td>
- * <td>TI TMS320C6000 Optimizing Compiler</td>
- * </tr>
- * <tr>
- * <td>cl55</td>
- * <td>TI TMS320C55x Optimizing C/C++ Compiler</td>
- * </tr>
- * <tr>
- * <td>armcpp</td>
- * <td>ARM 32-bit C++ compiler</td>
- * </tr>
- * <tr>
- * <td>armcc</td>
- * <td>ARM 32-bit C compiler</td>
- * </tr>
- * <tr>
- * <td>tcpp</td>
- * <td>ARM 16-bit C++ compiler</td>
- * </tr>
- * <tr>
- * <td>tcc</td>
- * <td>ARM 16-bit C compiler</td>
- * </tr>
- * </table>
- *
- * @author Curt Arnold
- *
- */
-public class CompilerEnum extends EnumeratedAttribute {
- private final static ProcessorEnumValue[] compilers = new ProcessorEnumValue[]{
- new ProcessorEnumValue("gcc", GccCCompiler.getInstance()),
- new ProcessorEnumValue("g++", GccCCompiler.getGppInstance()),
- new ProcessorEnumValue("c++", GccCCompiler.getCppInstance()),
- new ProcessorEnumValue("g77", GccCCompiler.getG77Instance()),
- new ProcessorEnumValue("msvc", DevStudioCCompiler.getInstance()),
- new ProcessorEnumValue("bcc", BorlandCCompiler.getInstance()),
- new ProcessorEnumValue("msrc", DevStudioResourceCompiler
- .getInstance()),
- new ProcessorEnumValue("brc", BorlandResourceCompiler.getInstance()),
- new ProcessorEnumValue("df", CompaqVisualFortranCompiler
- .getInstance()),
- new ProcessorEnumValue("midl", DevStudioMIDLCompiler.getInstance()),
- new ProcessorEnumValue("icl", IntelWin32CCompiler.getInstance()),
- new ProcessorEnumValue("ecl", IntelWin64CCompiler.getInstance()),
- new ProcessorEnumValue("icc", IntelLinux32CCompiler.getInstance()),
- new ProcessorEnumValue("ecc", IntelLinux64CCompiler.getInstance()),
- new ProcessorEnumValue("CC", ForteCCCompiler.getInstance()),
- new ProcessorEnumValue("aCC", aCCCompiler.getInstance()),
- new ProcessorEnumValue("os390", OS390CCompiler.getInstance()),
- new ProcessorEnumValue("os400", IccCompiler.getInstance()),
- new ProcessorEnumValue("sunc89", C89CCompiler.getInstance()),
- new ProcessorEnumValue("xlC", VisualAgeCCompiler.getInstance()),
- new ProcessorEnumValue("cl6x", ClxxCCompiler.getCl6xInstance()),
- new ProcessorEnumValue("cl55", ClxxCCompiler.getCl55Instance()),
- new ProcessorEnumValue("armcc", ADSCCompiler.getArmCC()),
- new ProcessorEnumValue("armcpp", ADSCCompiler.getArmCpp()),
- new ProcessorEnumValue("tcc", ADSCCompiler.getThumbCC()),
- new ProcessorEnumValue("tcpp", ADSCCompiler.getThumbCpp()),
- // userdefined
- //new ProcessorEnumValue("userdefine", UserdefineCompiler.getInstance()),
- // GCC Cross Compilers
- new ProcessorEnumValue(
- "sparc-sun-solaris2-gcc",
- net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2.GccCCompiler
- .getInstance()),
- new ProcessorEnumValue(
- "sparc-sun-solaris2-g++",
- net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2.GccCCompiler
- .getGppInstance()),
- new ProcessorEnumValue(
- "sparc-sun-solaris2-c++",
- net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2.GccCCompiler
- .getCppInstance()),
- new ProcessorEnumValue(
- "sparc-sun-solaris2-g77",
- net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2.GccCCompiler
- .getG77Instance()),
- // GCC Cross Compilers
- new ProcessorEnumValue("gcc-cross",
- net.sf.antcontrib.cpptasks.gcc.cross.GccCCompiler
- .getInstance()),
- new ProcessorEnumValue("g++-cross",
- net.sf.antcontrib.cpptasks.gcc.cross.GccCCompiler
- .getGppInstance()),
- new ProcessorEnumValue("c++-cross",
- net.sf.antcontrib.cpptasks.gcc.cross.GccCCompiler
- .getCppInstance()),
- new ProcessorEnumValue("g77-cross",
- net.sf.antcontrib.cpptasks.gcc.cross.GccCCompiler
- .getG77Instance()),};
- public Compiler getCompiler() {
- return (Compiler) compilers[getIndex()].getProcessor();
- }
- public String[] getValues() {
- return ProcessorEnumValue.getValues(compilers);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerParam.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerParam.java
deleted file mode 100644
index 82eb6ee425..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CompilerParam.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-/*******************************************************************************
- * Place class description here.
- *
- * @author inger
- * @author <additional author>
- *
- * @since
- ******************************************************************************/
-public class CompilerParam extends ProcessorParam {
- public CompilerParam() {
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DependencyInfo.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DependencyInfo.java
deleted file mode 100644
index 429d2b0107..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DependencyInfo.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.util.Vector;
-/**
- * @author Curt Arnold
- */
-public final class DependencyInfo {
- /**
- * Last modified time of this file or anything that it depends on.
- *
- * Not persisted since almost any change could invalidate it. Initialized
- * to long.MIN_VALUE on construction.
- */
- private long compositeLastModified;
- private/* final */String includePathIdentifier;
- private/* final */String[] includes;
- private/* final */String source;
- private/* final */long sourceLastModified;
- private/* final */String[] sysIncludes;
- public DependencyInfo(String includePathIdentifier, String source,
- long sourceLastModified, Vector includes, Vector sysIncludes) {
- if (source == null) {
- throw new NullPointerException("source");
- }
- if (includePathIdentifier == null) {
- throw new NullPointerException("includePathIdentifier");
- }
- this.source = source;
- this.sourceLastModified = sourceLastModified;
- this.includePathIdentifier = includePathIdentifier;
- this.includes = new String[includes.size()];
- if (includes.size() == 0) {
- compositeLastModified = sourceLastModified;
- } else {
- includes.copyInto(this.includes);
- compositeLastModified = Long.MIN_VALUE;
- }
- this.sysIncludes = new String[sysIncludes.size()];
- sysIncludes.copyInto(this.sysIncludes);
- }
- /**
- * Returns the latest modification date of the source or anything that it
- * depends on.
- *
- * @returns the composite lastModified time, returns Long.MIN_VALUE if not
- * set
- */
- public long getCompositeLastModified() {
- return compositeLastModified;
- }
- public String getIncludePathIdentifier() {
- return includePathIdentifier;
- }
- public String[] getIncludes() {
- String[] includesClone = (String[]) includes.clone();
- return includesClone;
- }
- public String getSource() {
- return source;
- }
- public long getSourceLastModified() {
- return sourceLastModified;
- }
- public String[] getSysIncludes() {
- String[] sysIncludesClone = (String[]) sysIncludes.clone();
- return sysIncludesClone;
- }
- public void setCompositeLastModified(long lastMod) {
- compositeLastModified = lastMod;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DependencyTable.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DependencyTable.java
deleted file mode 100644
index 3cbee7a625..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DependencyTable.java
+++ /dev/null
@@ -1,609 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import net.sf.antcontrib.cpptasks.compiler.CompilerConfiguration;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-/**
- * @author Curt Arnold
- */
-public final class DependencyTable {
- /**
- * This class handles populates the TargetHistory hashtable in response to
- * SAX parse events
- */
- private class DependencyTableHandler extends DefaultHandler {
- private File baseDir;
- private final DependencyTable dependencyTable;
- private String includePath;
- private Vector includes;
- private String source;
- private long sourceLastModified;
- private Vector sysIncludes;
- /**
- * Constructor
- *
- * @param history
- * hashtable of TargetHistory keyed by output name
- * @param outputFiles
- * existing files in output directory
- */
- private DependencyTableHandler(DependencyTable dependencyTable,
- File baseDir) {
- this.dependencyTable = dependencyTable;
- this.baseDir = baseDir;
- includes = new Vector();
- sysIncludes = new Vector();
- source = null;
- }
- public void endElement(String namespaceURI, String localName,
- String qName) throws SAXException {
- //
- // if </source> then
- // create Dependency object and add to hashtable
- // if corresponding source file exists and
- // has the same timestamp
- //
- if (qName.equals("source")) {
- if (source != null && includePath != null) {
- File existingFile = new File(baseDir, source);
- //
- // if the file exists and the time stamp is right
- // preserve the dependency info
- if (existingFile.exists()) {
- //
- // would have expected exact matches
- // but was seeing some unexpected difference by
- // a few tens of milliseconds, as long
- // as the times are within a second
- long existingLastModified = existingFile.lastModified();
- long diff = existingLastModified - sourceLastModified;
- if (diff >= -500 && diff <= 500) {
- DependencyInfo dependInfo = new DependencyInfo(
- includePath, source, sourceLastModified,
- includes, sysIncludes);
- dependencyTable.putDependencyInfo(source,
- dependInfo);
- }
- }
- source = null;
- includes.setSize(0);
- }
- } else {
- //
- // this causes any <source> elements outside the
- // scope of an <includePath> to be discarded
- //
- if (qName.equals("includePath")) {
- includePath = null;
- }
- }
- }
- /**
- * startElement handler
- */
- public void startElement(String namespaceURI, String localName,
- String qName, Attributes atts) throws SAXException {
- //
- // if includes, then add relative file name to vector
- //
- if (qName.equals("include")) {
- includes.addElement(atts.getValue("file"));
- } else {
- if (qName.equals("sysinclude")) {
- sysIncludes.addElement(atts.getValue("file"));
- } else {
- //
- // if source then
- // capture source file name,
- // modification time and reset includes vector
- //
- if (qName.equals("source")) {
- source = atts.getValue("file");
- sourceLastModified = Long.parseLong(atts
- .getValue("lastModified"), 16);
- includes.setSize(0);
- sysIncludes.setSize(0);
- } else {
- if (qName.equals("includePath")) {
- includePath = atts.getValue("signature");
- }
- }
- }
- }
- }
- }
- public abstract class DependencyVisitor {
- /**
- * Previews all the children of this source file.
- *
- * May be called multiple times as DependencyInfo's for children are
- * filled in.
- *
- * @return true to continue towards recursion into included files
- */
- public abstract boolean preview(DependencyInfo parent,
- DependencyInfo[] children);
- /**
- * Called if the dependency depth exhausted the stack.
- */
- public abstract void stackExhausted();
- /**
- * Visits the dependency info.
- *
- * @returns true to continue towards recursion into included files
- */
- public abstract boolean visit(DependencyInfo dependInfo);
- }
- public class TimestampChecker extends DependencyVisitor {
- private boolean noNeedToRebuild;
- private long outputLastModified;
- private boolean rebuildOnStackExhaustion;
- public TimestampChecker(final long outputLastModified,
- boolean rebuildOnStackExhaustion) {
- this.outputLastModified = outputLastModified;
- noNeedToRebuild = true;
- this.rebuildOnStackExhaustion = rebuildOnStackExhaustion;
- }
- public boolean getMustRebuild() {
- return !noNeedToRebuild;
- }
- public boolean preview(DependencyInfo parent, DependencyInfo[] children) {
- int withCompositeTimes = 0;
- long parentCompositeLastModified = parent.getSourceLastModified();
- for (int i = 0; i < children.length; i++) {
- if (children[i] != null) {
- //
- // expedient way to determine if a child forces us to
- // rebuild
- //
- visit(children[i]);
- long childCompositeLastModified = children[i]
- .getCompositeLastModified();
- if (childCompositeLastModified != Long.MIN_VALUE) {
- withCompositeTimes++;
- if (childCompositeLastModified > parentCompositeLastModified) {
- parentCompositeLastModified = childCompositeLastModified;
- }
- }
- }
- }
- if (withCompositeTimes == children.length) {
- parent.setCompositeLastModified(parentCompositeLastModified);
- }
- //
- // may have been changed by an earlier call to visit()
- //
- return noNeedToRebuild;
- }
- public void stackExhausted() {
- if (rebuildOnStackExhaustion) {
- noNeedToRebuild = false;
- }
- }
- public boolean visit(DependencyInfo dependInfo) {
- if (noNeedToRebuild) {
- if (dependInfo.getSourceLastModified() > outputLastModified
- || dependInfo.getCompositeLastModified() > outputLastModified) {
- noNeedToRebuild = false;
- }
- }
- //
- // only need to process the children if
- // it has not yet been determined whether
- // we need to rebuild and the composite modified time
- // has not been determined for this file
- return noNeedToRebuild
- && dependInfo.getCompositeLastModified() == Long.MIN_VALUE;
- }
- }
- private/* final */File baseDir;
- private String baseDirPath;
- /**
- * a hashtable of DependencyInfo[] keyed by output file name
- */
- private final Hashtable dependencies = new Hashtable();
- /** The file the cache was loaded from. */
- private/* final */File dependenciesFile;
- /** Flag indicating whether the cache should be written back to file. */
- private boolean dirty;
- /**
- * Creates a target history table from dependencies.xml in the prject
- * directory, if it exists. Otherwise, initializes the dependencies empty.
- *
- * @param task
- * task used for logging history load errors
- * @param baseDir
- * output directory for task
- */
- public DependencyTable(File baseDir) {
- if (baseDir == null) {
- throw new NullPointerException("baseDir");
- }
- this.baseDir = baseDir;
- try {
- baseDirPath = baseDir.getCanonicalPath();
- } catch (IOException ex) {
- baseDirPath = baseDir.toString();
- }
- dirty = false;
- //
- // load any existing dependencies from file
- dependenciesFile = new File(baseDir, "dependencies.xml");
- }
- public void commit(CCTask task) {
- //
- // if not dirty, no need to update file
- //
- if (dirty) {
- //
- // walk through dependencies to get vector of include paths
- // identifiers
- //
- Vector includePaths = getIncludePaths();
- //
- //
- // write dependency file
- //
- try {
- FileOutputStream outStream = new FileOutputStream(
- dependenciesFile);
- OutputStreamWriter streamWriter;
- //
- // Early VM's may not have UTF-8 support
- // fallback to default code page which
- // "should" be okay unless there are
- // non ASCII file names
- String encodingName = "UTF-8";
- try {
- streamWriter = new OutputStreamWriter(outStream, "UTF-8");
- } catch (UnsupportedEncodingException ex) {
- streamWriter = new OutputStreamWriter(outStream);
- encodingName = streamWriter.getEncoding();
- }
- BufferedWriter writer = new BufferedWriter(streamWriter);
- writer.write("<?xml version='1.0' encoding='");
- writer.write(encodingName);
- writer.write("'?>\n");
- writer.write("<dependencies>\n");
- StringBuffer buf = new StringBuffer();
- Enumeration includePathEnum = includePaths.elements();
- while (includePathEnum.hasMoreElements()) {
- writeIncludePathDependencies((String) includePathEnum
- .nextElement(), writer, buf);
- }
- writer.write("</dependencies>\n");
- writer.close();
- dirty = false;
- } catch (IOException ex) {
- task.log("Error writing " + dependenciesFile.toString() + ":"
- + ex.toString());
- }
- }
- }
- /**
- * Returns an enumerator of DependencyInfo's
- */
- public Enumeration elements() {
- return dependencies.elements();
- }
- /**
- * This method returns a DependencyInfo for the specific source file and
- * include path identifier
- *
- */
- public DependencyInfo getDependencyInfo(String sourceRelativeName,
- String includePathIdentifier) {
- DependencyInfo dependInfo = null;
- DependencyInfo[] dependInfos = (DependencyInfo[]) dependencies
- .get(sourceRelativeName);
- if (dependInfos != null) {
- for (int i = 0; i < dependInfos.length; i++) {
- dependInfo = dependInfos[i];
- if (dependInfo.getIncludePathIdentifier().equals(
- includePathIdentifier)) {
- return dependInfo;
- }
- }
- }
- return null;
- }
- private Vector getIncludePaths() {
- Vector includePaths = new Vector();
- DependencyInfo[] dependInfos;
- Enumeration dependenciesEnum = dependencies.elements();
- while (dependenciesEnum.hasMoreElements()) {
- dependInfos = (DependencyInfo[]) dependenciesEnum.nextElement();
- for (int i = 0; i < dependInfos.length; i++) {
- DependencyInfo dependInfo = dependInfos[i];
- boolean matchesExisting = false;
- final String dependIncludePath = dependInfo
- .getIncludePathIdentifier();
- Enumeration includePathEnum = includePaths.elements();
- while (includePathEnum.hasMoreElements()) {
- if (dependIncludePath.equals(includePathEnum.nextElement())) {
- matchesExisting = true;
- break;
- }
- }
- if (!matchesExisting) {
- includePaths.addElement(dependIncludePath);
- }
- }
- }
- return includePaths;
- }
- public void load() throws IOException, ParserConfigurationException,
- SAXException {
- dependencies.clear();
- if (dependenciesFile.exists()) {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setValidating(false);
- SAXParser parser = factory.newSAXParser();
- parser.parse(dependenciesFile, new DependencyTableHandler(this,
- baseDir));
- dirty = false;
- }
- }
- /**
- * Determines if the specified target needs to be rebuilt.
- *
- * This task may result in substantial IO as files are parsed to determine
- * their dependencies
- */
- public boolean needsRebuild(CCTask task, TargetInfo target,
- int dependencyDepth) {
- // look at any files where the compositeLastModified
- // is not known, but the includes are known
- //
- boolean mustRebuild = false;
- CompilerConfiguration compiler = (CompilerConfiguration) target
- .getConfiguration();
- String includePathIdentifier = compiler.getIncludePathIdentifier();
- File[] sources = target.getSources();
- DependencyInfo[] dependInfos = new DependencyInfo[sources.length];
- long outputLastModified = target.getOutput().lastModified();
- //
- // try to solve problem using existing dependency info
- // (not parsing any new files)
- //
- DependencyInfo[] stack = new DependencyInfo[50];
- boolean rebuildOnStackExhaustion = true;
- if (dependencyDepth >= 0) {
- if (dependencyDepth < 50) {
- stack = new DependencyInfo[dependencyDepth];
- }
- rebuildOnStackExhaustion = false;
- }
- TimestampChecker checker = new TimestampChecker(outputLastModified,
- rebuildOnStackExhaustion);
- for (int i = 0; i < sources.length && !mustRebuild; i++) {
- File source = sources[i];
- String relative = CUtil.getRelativePath(baseDirPath, source);
- DependencyInfo dependInfo = getDependencyInfo(relative,
- includePathIdentifier);
- if (dependInfo == null) {
- task.log("Parsing " + relative, Project.MSG_VERBOSE);
- dependInfo = parseIncludes(task, compiler, source);
- }
- walkDependencies(task, dependInfo, compiler, stack, checker);
- mustRebuild = checker.getMustRebuild();
- }
- return mustRebuild;
- }
- public DependencyInfo parseIncludes(CCTask task,
- CompilerConfiguration compiler, File source) {
- DependencyInfo dependInfo = compiler.parseIncludes(task, baseDir,
- source);
- String relativeSource = CUtil.getRelativePath(baseDirPath, source);
- putDependencyInfo(relativeSource, dependInfo);
- return dependInfo;
- }
- private void putDependencyInfo(String key, DependencyInfo dependInfo) {
- //
- // optimistic, add new value
- //
- DependencyInfo[] old = (DependencyInfo[]) dependencies.put(key,
- new DependencyInfo[]{dependInfo});
- dirty = true;
- //
- // something was already there
- //
- if (old != null) {
- //
- // see if the include path matches a previous entry
- // if so replace it
- String includePathIdentifier = dependInfo
- .getIncludePathIdentifier();
- for (int i = 0; i < old.length; i++) {
- DependencyInfo oldDepend = old[i];
- if (oldDepend.getIncludePathIdentifier().equals(
- includePathIdentifier)) {
- old[i] = dependInfo;
- dependencies.put(key, old);
- return;
- }
- }
- //
- // no match prepend the new entry to the array
- // of dependencies for the file
- DependencyInfo[] combined = new DependencyInfo[old.length + 1];
- combined[0] = dependInfo;
- for (int i = 0; i < old.length; i++) {
- combined[i + 1] = old[i];
- }
- dependencies.put(key, combined);
- }
- return;
- }
- public void walkDependencies(CCTask task, DependencyInfo dependInfo,
- CompilerConfiguration compiler, DependencyInfo[] stack,
- DependencyVisitor visitor) throws BuildException {
- //
- // visit this node
- // if visit returns true then
- // visit the referenced include and sysInclude dependencies
- //
- if (visitor.visit(dependInfo)) {
- //
- // find first null entry on stack
- //
- int stackPosition = -1;
- for (int i = 0; i < stack.length; i++) {
- if (stack[i] == null) {
- stackPosition = i;
- stack[i] = dependInfo;
- break;
- } else {
- //
- // if we have appeared early in the calling history
- // then we didn't exceed the criteria
- if (stack[i] == dependInfo) {
- return;
- }
- }
- }
- if (stackPosition == -1) {
- visitor.stackExhausted();
- return;
- }
- //
- // locate dependency infos
- //
- String[] includes = dependInfo.getIncludes();
- String includePathIdentifier = compiler.getIncludePathIdentifier();
- DependencyInfo[] includeInfos = new DependencyInfo[includes.length];
- for (int i = 0; i < includes.length; i++) {
- DependencyInfo includeInfo = getDependencyInfo(includes[i],
- includePathIdentifier);
- includeInfos[i] = includeInfo;
- }
- //
- // preview with only the already available dependency infos
- //
- if (visitor.preview(dependInfo, includeInfos)) {
- //
- // now need to fill in the missing DependencyInfos
- //
- int missingCount = 0;
- for (int i = 0; i < includes.length; i++) {
- if (includeInfos[i] == null) {
- missingCount++;
- task.log("Parsing " + includes[i], Project.MSG_VERBOSE);
- // If the include is part of a UNC don't go building a
- // relative file name.
- File src = includes[i].startsWith("\\\\") ? new File(
- includes[i]) : new File(baseDir, includes[i]);
- DependencyInfo includeInfo = parseIncludes(task,
- compiler, src);
- includeInfos[i] = includeInfo;
- }
- }
- //
- // if it passes a review the second time
- // then recurse into all the children
- if (missingCount == 0
- || visitor.preview(dependInfo, includeInfos)) {
- //
- // recurse into
- //
- for (int i = 0; i < includeInfos.length; i++) {
- DependencyInfo includeInfo = includeInfos[i];
- walkDependencies(task, includeInfo, compiler, stack,
- visitor);
- }
- }
- }
- stack[stackPosition] = null;
- }
- }
- private void writeDependencyInfo(BufferedWriter writer, StringBuffer buf,
- DependencyInfo dependInfo) throws IOException {
- String[] includes = dependInfo.getIncludes();
- String[] sysIncludes = dependInfo.getSysIncludes();
- //
- // if the includes have not been evaluted then
- // it is not worth our time saving it
- // and trying to distiguish between files with
- // no dependencies and those with undetermined dependencies
- buf.setLength(0);
- buf.append(" <source file=\"");
- buf.append(CUtil.xmlAttribEncode(dependInfo.getSource()));
- buf.append("\" lastModified=\"");
- buf.append(Long.toHexString(dependInfo.getSourceLastModified()));
- buf.append("\">\n");
- writer.write(buf.toString());
- for (int i = 0; i < includes.length; i++) {
- buf.setLength(0);
- buf.append(" <include file=\"");
- buf.append(CUtil.xmlAttribEncode(includes[i]));
- buf.append("\"/>\n");
- writer.write(buf.toString());
- }
- for (int i = 0; i < sysIncludes.length; i++) {
- buf.setLength(0);
- buf.append(" <sysinclude file=\"");
- buf.append(CUtil.xmlAttribEncode(sysIncludes[i]));
- buf.append("\"/>\n");
- writer.write(buf.toString());
- }
- writer.write(" </source>\n");
- return;
- }
- private void writeIncludePathDependencies(String includePathIdentifier,
- BufferedWriter writer, StringBuffer buf) throws IOException {
- //
- // include path element
- //
- buf.setLength(0);
- buf.append(" <includePath signature=\"");
- buf.append(CUtil.xmlAttribEncode(includePathIdentifier));
- buf.append("\">\n");
- writer.write(buf.toString());
- Enumeration dependenciesEnum = dependencies.elements();
- while (dependenciesEnum.hasMoreElements()) {
- DependencyInfo[] dependInfos = (DependencyInfo[]) dependenciesEnum
- .nextElement();
- for (int i = 0; i < dependInfos.length; i++) {
- DependencyInfo dependInfo = dependInfos[i];
- //
- // if this is for the same include path
- // then output the info
- if (dependInfo.getIncludePathIdentifier().equals(
- includePathIdentifier)) {
- writeDependencyInfo(writer, buf, dependInfo);
- }
- }
- }
- writer.write(" </includePath>\n");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerDef.java
deleted file mode 100644
index ee4f656ccc..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerDef.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.Reference;
-import java.util.Vector;
-
-/**
- * Distributed build information (Non-functional prototype).
- *
- */
-public final class DistributerDef
- extends DataType {
- /**
- * if property.
- */
- private String ifCond;
-
- /**
- * unless property.
- */
- private String unlessCond;
-
- /**
- * hosts.
- *
- */
- private String hosts;
-
- /**
- * Protocol.
- *
- */
- private DistributerProtocolEnum protocol;
-
- /**
- * Not sure what this is.
- */
- private int tcpCork;
-
- /**
- * user name.
- */
- private String user;
-
- /**
- * local to remote file name maps.
- */
- private final Vector maps = new Vector();
-
- /**
- * Constructor.
- *
- */
- public DistributerDef() {
- }
-
- /**
- * Required by documentation generator.
- */
- public void execute() {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-
- /**
- * Returns true if the if and unless conditions (if any) are
- * satisfied.
- * @return true if definition is active.
- */
- public boolean isActive() {
- return CUtil.isActive(getProject(), ifCond, unlessCond);
- }
-
- /**
- * Sets an id that can be used to reference this element.
- *
- * @param id
- * id
- */
- public void setId(final String id) {
- //
- // this is actually accomplished by a different
- // mechanism, but we can document it
- //
- }
-
- /**
- * Sets the property name for the 'if' condition.
- *
- * The define will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- *
- * @param propName
- * property name
- */
- public void setIf(final String propName) {
- ifCond = propName;
- }
-
- /**
- * Specifies that this element should behave as if the content of the
- * element with the matching id attribute was inserted at this location. If
- * specified, no other attributes should be specified.
- * @param r reference name
- */
- public void setRefid(final Reference r) {
- super.setRefid(r);
- }
-
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the define will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public void setUnless(final String propName) {
- unlessCond = propName;
- }
-
- /**
- * Gets hosts.
- * @return hosts, may be null.
- *
- */
- public String getHosts() {
- if (isReference()) {
- DistributerDef refDistributer = (DistributerDef)
- getCheckedRef(DistributerDef.class,
- "DistributerDef");
- return refDistributer.getHosts();
- }
- return hosts;
- }
-
- /**
- * Gets tcp cork.
- * @return TCP_CORK value.
- *
- */
- public int getTcpcork() {
- if (isReference()) {
- DistributerDef refDistributer = (DistributerDef)
- getCheckedRef(DistributerDef.class,
- "DistributerDef");
- return refDistributer.getTcpcork();
- }
- return tcpCork;
- }
-
- /**
- * Gets protocol.
- * @return protocol, may be null.
- *
- */
- public DistributerProtocolEnum getProtocol() {
- if (isReference()) {
- DistributerDef refDistributer = (DistributerDef)
- getCheckedRef(DistributerDef.class,
- "DistributerDef");
- return refDistributer.getProtocol();
- }
- return protocol;
- }
-
- /**
- * Sets hosts.
- * @param value new value
- */
- public void setHosts(final String value) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- hosts = value;
- }
-
- /**
- * Sets TCP_CORK value.
- * @param value new value
- */
- public void setTcpcork(final int value) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- tcpCork = value;
- }
-
- /**
- * Sets protocol.
- * @param value new value
- */
- public void setProtocol(final DistributerProtocolEnum value) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- protocol = value;
- }
-
- /**
- * Local to remote filename maps.
- * @return new map
- */
- public DistributerMap createMap() {
- DistributerMap map = new DistributerMap();
- map.setProject(getProject());
- maps.addElement(map);
- return map;
- }
-
- /**
- * Sets remote user name.
- * @param value user name
- */
- public void setUser(final String value) {
- user = value;
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerMap.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerMap.java
deleted file mode 100644
index aeacf551fa..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerMap.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.DataType;
-
-/**
- * Local to remote filename mapping (Experimental).
- *
- */
-public final class DistributerMap
- extends DataType {
- /**
- * if property.
- */
- private String ifCond;
-
- /**
- * unless property.
- */
- private String unlessCond;
-
- /**
- * local directory name.
- *
- */
- private File localName;
-
- /**
- * Canonical local file name.
- */
- private String canonicalPath;
-
- /**
- * remote name.
- *
- */
- private String remoteName;
-
- /**
- * Separator (/ or \) character on remote system.
- */
- private char remoteSeparator = File.separatorChar;
-
- /**
- * hosts that for which this map is valid.
- *
- */
- private String hosts;
-
- /**
- * Constructor.
- *
- */
- public DistributerMap() {
- }
-
- /**
- * Required by documentation generator.
- */
- public void execute() {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-
- /**
- * Returns true if the if and unless conditions (if any) are
- * satisfied.
- *
- * @return true if this object is active.
- */
- public boolean isActive() {
- return CUtil.isActive(getProject(), ifCond, unlessCond);
- }
-
- /**
- * Sets the property name for the 'if' condition.
- *
- * This object will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- *
- * @param propName
- * property name
- */
- public void setIf(final String propName) {
- ifCond = propName;
- }
-
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the define will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public void setUnless(final String propName) {
- unlessCond = propName;
- }
-
- /**
- * Gets local directory.
- * @return local directory, may be null.
- *
- */
- public File getLocal() {
- return localName;
- }
-
- /**
- * Gets remote name for directory.
- * @return remote name, may be null.
- *
- */
- public String getRemote() {
- return remoteName;
- }
-
- /**
- * Converts the local file name to the remote name for the same file.
- *
- * @param host host
- * @param localFile local file
- * @return remote name for local file, null if unknown.
- */
- public String toRemote(final String host, final File localFile) {
- if (remoteName != null
- && (hosts == null || hosts.indexOf(host) >= 0)) {
- try {
- String canonical = localFile.getCanonicalPath();
- if (canonical.startsWith(canonicalPath)) {
- if (isActive()) {
- return remoteName
- + canonical.substring(canonicalPath.length()).replace(File.
- separatorChar, remoteSeparator);
- }
- }
- } catch (IOException ex) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * Sets local directory for base of mapping.
- *
- * @param value value
- */
- public void setLocal(final File value) {
- if (value == null) {
- throw new NullPointerException("value");
- }
- if (value.exists() && !value.isDirectory()) {
- throw new BuildException("local should be a directory");
- }
- localName = value;
- try {
- canonicalPath = localName.getCanonicalPath();
- } catch (IOException ex) {
- throw new BuildException(ex);
- }
- }
-
- /**
- * Sets remote name for directory.
- * @param value remote name for directory
- */
- public void setRemote(final String value) {
- remoteName = value;
- }
-
- /**
- * Sets the separator character (/ or \) for the remote system.
- * @param value separator character
- */
- public void setRemoteSeparator(final String value) {
- if (value != null && value.length() != 1) {
- throw new BuildException("remote separator must be a single character");
- }
- remoteSeparator = value.charAt(0);
- }
-
- /**
- * Sets hosts for which this mapping is valid.
- *
- * @param value hosts
- */
- public void setHosts(final String value) {
- hosts = value;
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerProtocolEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerProtocolEnum.java
deleted file mode 100644
index 5606d47a08..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/DistributerProtocolEnum.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import org.apache.tools.ant.types.EnumeratedAttribute;
-
-/**
- * Distributer prococol names (experimental).
- *
- * @author Curt Arnold
- *
- */
-public final class DistributerProtocolEnum
- extends EnumeratedAttribute {
- /**
- * Constructor.
- *
- * Set by default to "distcc"
- *
- * @see java.lang.Object#Object()
- */
- public DistributerProtocolEnum() {
- setValue("distcc");
- }
-
- /**
- * Gets list of acceptable values.
- *
- * @see org.apache.tools.ant.types.EnumeratedAttribute#getValues()
- */
- public String[] getValues() {
- return new String[] {
- "distcc",
- "ssh"};
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/FileVisitor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/FileVisitor.java
deleted file mode 100644
index 24aef25fb6..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/FileVisitor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-/**
- * An abstract class implemented to walk over the fileset members of a
- * ProcessorDef
- */
-public interface FileVisitor {
- abstract void visit(File parentDir, String filename) throws BuildException;
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerDef.java
deleted file mode 100644
index d997b2f992..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerDef.java
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.File;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
-import net.sf.antcontrib.cpptasks.gcc.GccLinker;
-import net.sf.antcontrib.cpptasks.types.FlexLong;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-import net.sf.antcontrib.cpptasks.types.LinkerArgument;
-import net.sf.antcontrib.cpptasks.types.SystemLibrarySet;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.FlexInteger;
-/**
- * A linker definition. linker elements may be placed either as children of a
- * cc element or the project element. A linker element with an id attribute may
- * be referenced by linker elements with refid or extends attributes.
- *
- * @author Adam Murdoch
- * @author Curt Arnold
- */
-public class LinkerDef extends ProcessorDef {
- private long base;
- private String entry;
- private Boolean fixed;
- private Boolean incremental;
- private final Vector librarySets = new Vector();
- private Boolean map;
- private int stack;
- private final Vector sysLibrarySets = new Vector();
- private final Vector versionInfos = new Vector();
- private Boolean defaultflag = new Boolean(true);
- /**
- * Default constructor
- *
- * @see java.lang.Object#Object()
- */
- public LinkerDef() {
- base = -1;
- stack = -1;
- }
- private void addActiveLibrarySet(Project project, Vector libsets,
- Vector srcSets) {
- Enumeration srcenum = srcSets.elements();
- while (srcenum.hasMoreElements()) {
- LibrarySet set = (LibrarySet) srcenum.nextElement();
- if (set.isActive(project)) {
- libsets.addElement(set);
- }
- }
- }
- private void addActiveSystemLibrarySets(Project project, Vector libsets) {
- addActiveLibrarySet(project, libsets, sysLibrarySets);
- }
- private void addActiveUserLibrarySets(Project project, Vector libsets) {
- addActiveLibrarySet(project, libsets, librarySets);
- }
- /**
- * Adds a linker command-line arg.
- */
- public void addConfiguredLinkerArg(LinkerArgument arg) {
- addConfiguredProcessorArg(arg);
- }
- /**
- * Adds a compiler command-line arg.
- */
- public void addConfiguredLinkerParam(LinkerParam param) {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- addConfiguredProcessorParam(param);
- }
- /**
- * Adds a system library set.
- */
- public void addLibset(LibrarySet libset) {
- if (isReference()) {
- throw super.noChildrenAllowed();
- }
- if (libset == null) {
- throw new NullPointerException("libset");
- }
- librarySets.addElement(libset);
- }
- /**
- * Adds a system library set.
- */
- public void addSyslibset(SystemLibrarySet libset) {
- if (isReference()) {
- throw super.noChildrenAllowed();
- }
- if (libset == null) {
- throw new NullPointerException("libset");
- }
- sysLibrarySets.addElement(libset);
- }
-
- /**
- * Adds desriptive version information to be included in the
- * generated file. The first active version info block will
- * be used.
- */
- public void addConfiguredVersioninfo(VersionInfo newVersionInfo) {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- newVersionInfo.setProject(this.getProject());
- versionInfos.addElement(newVersionInfo);
- }
-
- public ProcessorConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef baseDef, TargetDef targetPlatform) {
- //
- // must combine some local context (the linkType)
- // with the referenced element
- //
- // get a pointer to the definition (either local or referenced)
- ProcessorDef thisDef = this;
- if (isReference()) {
- thisDef = ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef"));
- }
- //
- // find the appropriate processor (combines local linkType
- // with possibly remote linker name)
- Processor proc = getProcessor();
- proc = proc.getLinker(linkType);
- ProcessorDef[] defaultProviders = getDefaultProviders(baseDef);
- return proc.createConfiguration(task, linkType, defaultProviders,
- thisDef, targetPlatform);
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
- /**
- * Returns an array of active library sets for this linker definition.
- */
- public LibrarySet[] getActiveLibrarySets(LinkerDef[] defaultProviders,
- int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
- .getActiveUserLibrarySets(defaultProviders, index);
- }
- Project p = getProject();
- Vector libsets = new Vector();
- for (int i = index; i < defaultProviders.length; i++) {
- defaultProviders[i].addActiveUserLibrarySets(p, libsets);
- defaultProviders[i].addActiveSystemLibrarySets(p, libsets);
- }
- addActiveUserLibrarySets(p, libsets);
- addActiveSystemLibrarySets(p, libsets);
- LibrarySet[] sets = new LibrarySet[libsets.size()];
- libsets.copyInto(sets);
- return sets;
- }
- /**
- * Returns an array of active library sets for this linker definition.
- */
- public LibrarySet[] getActiveSystemLibrarySets(
- LinkerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
- .getActiveUserLibrarySets(defaultProviders, index);
- }
- Project p = getProject();
- Vector libsets = new Vector();
- for (int i = index; i < defaultProviders.length; i++) {
- defaultProviders[i].addActiveSystemLibrarySets(p, libsets);
- }
- addActiveSystemLibrarySets(p, libsets);
- LibrarySet[] sets = new LibrarySet[libsets.size()];
- libsets.copyInto(sets);
- return sets;
- }
- /**
- * Returns an array of active library sets for this linker definition.
- */
- public LibrarySet[] getActiveUserLibrarySets(LinkerDef[] defaultProviders,
- int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
- .getActiveUserLibrarySets(defaultProviders, index);
- }
- Project p = getProject();
- Vector libsets = new Vector();
- for (int i = index; i < defaultProviders.length; i++) {
- defaultProviders[i].addActiveUserLibrarySets(p, libsets);
- }
- addActiveUserLibrarySets(p, libsets);
- LibrarySet[] sets = new LibrarySet[libsets.size()];
- libsets.copyInto(sets);
- return sets;
- }
- public long getBase(LinkerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
- .getBase(defaultProviders, index);
- }
- if (base <= 0) {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getBase(defaultProviders,
- index + 1);
- }
- }
- return base;
- }
- public Boolean getFixed(LinkerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
- .getFixed(defaultProviders, index);
- }
- if (fixed == null) {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getFixed(defaultProviders,
- index + 1);
- }
- }
- return fixed;
- }
- public boolean getIncremental(LinkerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
- .getIncremental(defaultProviders, index);
- }
- if (incremental != null) {
- return incremental.booleanValue();
- }
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getIncremental(defaultProviders, index + 1);
- }
- return false;
- }
- public boolean getMap(LinkerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
- .getMap(defaultProviders, index);
- }
- if (map != null) {
- return map.booleanValue();
- }
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getMap(defaultProviders, index + 1);
- }
- return false;
- }
- public final Boolean getDefaultflag(LinkerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class,
- "LinkerDef")).getDefaultflag(defaultProviders, index);
- }
- return defaultflag;
- }
- public String getEntry(LinkerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
- .getEntry(defaultProviders, index);
- }
- if (entry != null) {
- return entry;
- }
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getEntry(defaultProviders, index + 1);
- }
- return null;
- }
-
- public Processor getProcessor() {
- Linker linker = (Linker) super.getProcessor();
- if (linker == null) {
- linker = GccLinker.getInstance();
- }
- if (getLibtool() && linker instanceof CommandLineLinker) {
- CommandLineLinker cmdLineLinker = (CommandLineLinker) linker;
- linker = cmdLineLinker.getLibtoolLinker();
- }
- return linker;
- }
- public int getStack(LinkerDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
- .getStack(defaultProviders, index);
- }
- if (stack < 0) {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getStack(defaultProviders,
- index + 1);
- }
- }
- return stack;
- }
- /**
- * Sets the base address. May be specified in either decimal or hex.
- *
- * @param base
- * base address
- *
- */
- public void setBase(FlexLong base) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.base = base.longValue();
- }
- /**
- * Sets the starting address.
- *
- * @param name
- * function name
- */
- public void setEntry(String entry) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.entry = entry;
- }
- /**
- * If true, marks the file to be loaded only at its preferred address.
- */
- public void setFixed(boolean fixed) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.fixed = booleanValueOf(fixed);
- }
- /**
- * If true, allows incremental linking.
- *
- */
- public void setIncremental(boolean incremental) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.incremental = booleanValueOf(incremental);
- }
- /**
- * If set to true, a map file will be produced.
- */
- public void setMap(boolean map) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.map = booleanValueOf(map);
- }
- /**
- * Sets linker type.
- *
- *
- * <table width="100%" border="1"> <thead>Supported linkers </thead>
- * <tr>
- * <td>gcc</td>
- * <td>Gcc Linker</td>
- * </tr>
- * <tr>
- * <td>g++</td>
- * <td>G++ Linker</td>
- * </tr>
- * <tr>
- * <td>ld</td>
- * <td>Ld Linker</td>
- * </tr>
- * <tr>
- * <td>ar</td>
- * <td>Gcc Librarian</td>
- * </tr>
- * <tr>
- * <td>msvc</td>
- * <td>Microsoft Linker</td>
- * </tr>
- * <tr>
- * <td>bcc</td>
- * <td>Borland Linker</td>
- * </tr>
- * <tr>
- * <td>df</td>
- * <td>Compaq Visual Fortran Linker</td>
- * </tr>
- * <tr>
- * <td>icl</td>
- * <td>Intel Linker for Windows (IA-32)</td>
- * </tr>
- * <tr>
- * <td>ecl</td>
- * <td>Intel Linker for Windows (IA-64)</td>
- * </tr>
- * <tr>
- * <td>icc</td>
- * <td>Intel Linker for Linux (IA-32)</td>
- * </tr>
- * <tr>
- * <td>ecc</td>
- * <td>Intel Linker for Linux (IA-64)</td>
- * </tr>
- * <tr>
- * <td>CC</td>
- * <td>Sun ONE Linker</td>
- * </tr>
- * <tr>
- * <td>aCC</td>
- * <td>HP aC++ Linker</td>
- * </tr>
- * <tr>
- * <td>os390</td>
- * <td>OS390 Linker</td>
- * </tr>
- * <tr>
- * <td>os390batch</td>
- * <td>OS390 Linker</td>
- * </tr>
- * <tr>
- * <td>os400</td>
- * <td>IccLinker</td>
- * </tr>
- * <tr>
- * <td>sunc89</td>
- * <td>C89 Linker</td>
- * </tr>
- * <tr>
- * <td>xlC</td>
- * <td>VisualAge Linker</td>
- * </tr>
- * </table>
- *
- */
- public void setName(LinkerEnum name) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- Linker linker = name.getLinker();
- super.setProcessor(linker);
- }
- protected void setProcessor(Processor proc) throws BuildException {
- Linker linker = null;
- if (proc instanceof Linker) {
- linker = (Linker) proc;
- } else {
- LinkType linkType = new LinkType();
- linker = proc.getLinker(linkType);
- }
- super.setProcessor(linker);
- }
- /**
- * Sets stack size in bytes.
- */
- public void setStack(FlexInteger stack) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.stack = stack.intValue();
- }
- public void visitSystemLibraries(Linker linker, FileVisitor libraryVisitor) {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project must be set");
- }
- if (isReference()) {
- LinkerDef master = ((LinkerDef) getCheckedRef(LinkerDef.class,
- "Linker"));
- master.visitSystemLibraries(linker, libraryVisitor);
- } else {
- //
- // if this linker extends another,
- // visit its libraries first
- //
- LinkerDef extendsDef = (LinkerDef) getExtends();
- if (extendsDef != null) {
- extendsDef.visitSystemLibraries(linker, libraryVisitor);
- }
- if (sysLibrarySets.size() > 0) {
- File[] libpath = linker.getLibraryPath();
- for (int i = 0; i < sysLibrarySets.size(); i++) {
- LibrarySet set = (LibrarySet) sysLibrarySets.elementAt(i);
- if (set.isActive(p)) {
- set.visitLibraries(p, linker, libpath,
- libraryVisitor);
- }
- }
- }
- }
- }
- public void visitUserLibraries(Linker linker, FileVisitor libraryVisitor) {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project must be set");
- }
- if (isReference()) {
- LinkerDef master = ((LinkerDef) getCheckedRef(LinkerDef.class,
- "Linker"));
- master.visitUserLibraries(linker, libraryVisitor);
- } else {
- //
- // if this linker extends another,
- // visit its libraries first
- //
- LinkerDef extendsDef = (LinkerDef) getExtends();
- if (extendsDef != null) {
- extendsDef.visitUserLibraries(linker, libraryVisitor);
- }
- //
- // visit the user libraries
- //
- if (librarySets.size() > 0) {
- File[] libpath = linker.getLibraryPath();
- for (int i = 0; i < librarySets.size(); i++) {
- LibrarySet set = (LibrarySet) librarySets.elementAt(i);
- if (set.isActive(p)) {
- set.visitLibraries(p, linker, libpath,
- libraryVisitor);
- }
- }
- }
- }
- }
- /**
- * Enables or disables default flags.
- *
- * @param defaultflag
- * if true, default flags will add to command line.
- *
- */
- public void setDefaultflag(boolean defaultflag) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.defaultflag = booleanValueOf(defaultflag);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerEnum.java
deleted file mode 100644
index cfe8984c23..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerEnum.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import net.sf.antcontrib.cpptasks.arm.ADSLinker;
-import net.sf.antcontrib.cpptasks.borland.BorlandLinker;
-import net.sf.antcontrib.cpptasks.compaq.CompaqVisualFortranLinker;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioLinker;
-import net.sf.antcontrib.cpptasks.gcc.GccLibrarian;
-import net.sf.antcontrib.cpptasks.gcc.GccLinker;
-import net.sf.antcontrib.cpptasks.gcc.GppLinker;
-import net.sf.antcontrib.cpptasks.gcc.LdLinker;
-import net.sf.antcontrib.cpptasks.hp.aCCLinker;
-import net.sf.antcontrib.cpptasks.ibm.VisualAgeLinker;
-import net.sf.antcontrib.cpptasks.intel.IntelLinux32Linker;
-import net.sf.antcontrib.cpptasks.intel.IntelLinux64Linker;
-import net.sf.antcontrib.cpptasks.intel.IntelWin32Linker;
-import net.sf.antcontrib.cpptasks.os390.OS390Linker;
-import net.sf.antcontrib.cpptasks.os400.IccLinker;
-import net.sf.antcontrib.cpptasks.sun.C89Linker;
-import net.sf.antcontrib.cpptasks.sun.ForteCCLinker;
-import net.sf.antcontrib.cpptasks.ti.ClxxLinker;
-import org.apache.tools.ant.types.EnumeratedAttribute;
-/**
- * Enumeration of supported linkers
- *
- * @author Curt Arnold
- *
- */
-public class LinkerEnum extends EnumeratedAttribute {
- private final static ProcessorEnumValue[] linkers = new ProcessorEnumValue[]{
- new ProcessorEnumValue("gcc", GccLinker.getInstance()),
- new ProcessorEnumValue("g++", GppLinker.getInstance()),
- new ProcessorEnumValue("ld", LdLinker.getInstance()),
- new ProcessorEnumValue("ar", GccLibrarian.getInstance()),
- new ProcessorEnumValue("msvc", DevStudioLinker.getInstance()),
- new ProcessorEnumValue("bcc", BorlandLinker.getInstance()),
- new ProcessorEnumValue("df", CompaqVisualFortranLinker
- .getInstance()),
- new ProcessorEnumValue("icl", IntelWin32Linker.getInstance()),
- new ProcessorEnumValue("ecl", IntelWin32Linker.getInstance()),
- new ProcessorEnumValue("icc", IntelLinux32Linker.getInstance()),
- new ProcessorEnumValue("ecc", IntelLinux64Linker.getInstance()),
- new ProcessorEnumValue("CC", ForteCCLinker.getInstance()),
- new ProcessorEnumValue("aCC", aCCLinker.getInstance()),
- new ProcessorEnumValue("os390", OS390Linker.getInstance()),
- new ProcessorEnumValue("os390batch", OS390Linker
- .getDataSetInstance()),
- new ProcessorEnumValue("os400", IccLinker.getInstance()),
- new ProcessorEnumValue("sunc89", C89Linker.getInstance()),
- new ProcessorEnumValue("xlC", VisualAgeLinker.getInstance()),
- new ProcessorEnumValue("cl6x", ClxxLinker.getCl6xInstance()),
- new ProcessorEnumValue("cl55", ClxxLinker.getCl55Instance()),
- new ProcessorEnumValue("armcc", ADSLinker.getInstance()),
- new ProcessorEnumValue("armcpp", ADSLinker.getInstance()),
- new ProcessorEnumValue("tcc", ADSLinker.getInstance()),
- new ProcessorEnumValue("tcpp", ADSLinker.getInstance()),
- // gcc cross compilers
- new ProcessorEnumValue(
- "sparc-sun-solaris2-gcc",
- net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2.GccLinker
- .getInstance()),
- new ProcessorEnumValue(
- "sparc-sun-solaris2-g++",
- net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2.GppLinker
- .getInstance()),
- new ProcessorEnumValue(
- "sparc-sun-solaris2-ld",
- net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2.LdLinker
- .getInstance()),
- new ProcessorEnumValue(
- "sparc-sun-solaris2-ar",
- net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2.GccLibrarian
- .getInstance()),
- new ProcessorEnumValue("gcc-cross",
- net.sf.antcontrib.cpptasks.gcc.cross.GccLinker
- .getInstance()),
- new ProcessorEnumValue("g++-cross",
- net.sf.antcontrib.cpptasks.gcc.cross.GppLinker
- .getInstance()),
- new ProcessorEnumValue("ld-cross",
- net.sf.antcontrib.cpptasks.gcc.cross.LdLinker.getInstance()),
- new ProcessorEnumValue("ar-cross",
- net.sf.antcontrib.cpptasks.gcc.cross.GccLibrarian
- .getInstance()),};
- public Linker getLinker() {
- return (Linker) linkers[getIndex()].getProcessor();
- }
- public String[] getValues() {
- return ProcessorEnumValue.getValues(linkers);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerParam.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerParam.java
deleted file mode 100644
index 383bae55c9..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/LinkerParam.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-/*******************************************************************************
- * Place class description here.
- *
- * @author inger
- * @author <additional author>
- *
- * @since
- ******************************************************************************/
-public class LinkerParam extends ProcessorParam {
- public LinkerParam() {
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OSFamilyEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OSFamilyEnum.java
deleted file mode 100644
index 536d9922d3..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OSFamilyEnum.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import org.apache.tools.ant.types.EnumeratedAttribute;
-
-/**
- * Enumeration of cpu types.
- *
- * @author Curt Arnold
- *
- */
-public final class OSFamilyEnum
- extends EnumeratedAttribute {
- /**
- * Constructor.
- *
- * Set by default to "pentium3"
- *
- * @see java.lang.Object#Object()
- */
- public OSFamilyEnum() {
- setValue("windows");
- }
-
- /**
- * Gets list of acceptable values.
- *
- * @see org.apache.tools.ant.types.EnumeratedAttribute#getValues()
- */
- public String[] getValues() {
- return new String[] {
- "windows",
- "dos",
- "mac",
- "unix",
- "netware",
- "os/2",
- "tandem",
- "win9x",
- "z/os",
- "os/400",
- "openvms"};
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ObjectFileCollector.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ObjectFileCollector.java
deleted file mode 100644
index 3e97fa40af..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ObjectFileCollector.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-
-import org.apache.tools.ant.BuildException;
-/**
- * Collects object files for the link step.
- *
- *
- */
-public final class ObjectFileCollector implements FileVisitor {
- private final Vector files;
- private final Linker linker;
- public ObjectFileCollector(Linker linker, Vector files) {
- this.linker = linker;
- this.files = files;
- }
- public void visit(File parentDir, String filename) throws BuildException {
- int bid = linker.bid(filename);
- if (bid >= 1) {
- files.addElement(new File(parentDir, filename));
- }
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OptimizationEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OptimizationEnum.java
deleted file mode 100644
index 4a0d17953e..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OptimizationEnum.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import org.apache.tools.ant.types.EnumeratedAttribute;
-
-/**
- * Enumeration of optimization levels (experimental).
- *
- * @author Curt Arnold
- *
- */
-public final class OptimizationEnum
- extends EnumeratedAttribute {
- /**
- * Constructor.
- *
- * Set by default to "speed"
- *
- * @see java.lang.Object#Object()
- */
- public OptimizationEnum() {
- setValue("speed");
- }
-
- /**
- * Gets list of acceptable values.
- *
- * @see org.apache.tools.ant.types.EnumeratedAttribute#getValues()
- */
- public String[] getValues() {
- return new String[] {
- "none",
- "size",
- "minimal",
- "speed",
- "full",
- "aggressive",
- "extreme",
- "unsafe"
- };
- }
-
- /**
- * Is size optimized.
- * @return boolean true if size is optimized.
- */
- public boolean isSize() {
- return "speed".equals(getValue());
- }
-
- /**
- * Is speed optimized.
- * @return boolean true if speed is optimized.
- */
- public boolean isSpeed() {
- return !isSize() && !isNoOptimization();
- }
-
- /**
- * Is no optimization performed.
- * @return boolean true if no optimization is performed.
- */
- public boolean isNoOptimization() {
- return "none".equals(getValue());
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OutputTypeEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OutputTypeEnum.java
deleted file mode 100644
index fb37843fbc..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/OutputTypeEnum.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import org.apache.tools.ant.types.EnumeratedAttribute;
-/**
- * Enumeration of supported subsystems
- *
- * @author Curt Arnold
- *
- */
-public class OutputTypeEnum extends EnumeratedAttribute {
- /**
- * Constructor
- *
- * Set by default to "executable"
- *
- * @see java.lang.Object#Object()
- */
- public OutputTypeEnum() {
- setValue("executable");
- }
- /**
- * Gets list of acceptable values
- *
- * @see org.apache.tools.ant.types.EnumeratedAttribute#getValues()
- */
- public String[] getValues() {
- return new String[]{"executable", // executable program
- "plugin", // plugin module
- "shared", // dynamically linkable module
- "static" // convenience library
- };
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/PrecompileDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/PrecompileDef.java
deleted file mode 100644
index 828e2c2f48..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/PrecompileDef.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.File;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.types.ConditionalFileSet;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.types.DataType;
-/**
- * An element that specifies a prototype file and rules for source files that
- * should not use precompiled headers
- *
- * @author Curt Arnold
- */
-public final class PrecompileDef extends DataType {
- private final Vector exceptSets = new Vector();
- private String ifCond;
- /**
- * Directory of prototype file
- */
- private File prototype = new File("stdafx.cpp");
- private String unlessCond;
- /**
- * Constructor
- *
- */
- public PrecompileDef() {
- }
- /**
- * Method used by PrecompileExceptDef to add exception set to
- * PrecompileDef.
- */
- public void appendExceptFileSet(ConditionalFileSet exceptSet) {
- exceptSet.setProject(getProject());
- exceptSets.addElement(exceptSet);
- }
- /**
- * Adds filesets that specify files that should not be processed with
- * precompiled headers enabled.
- *
- * @param exceptSet
- * FileSet specify files that should not be processed with
- * precompiled headers enabled.
- */
- public PrecompileExceptDef createExcept() {
- return new PrecompileExceptDef(this);
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
- public String[] getExceptFiles() {
- PrecompileDef ref = getRef();
- if (ref != null) {
- return ref.getExceptFiles();
- }
- if (exceptSets.size() == 0) {
- return new String[0];
- }
- Project p = getProject();
- String[] exceptFiles = null;
- Enumeration setEnum = exceptSets.elements();
- while (setEnum.hasMoreElements()) {
- ConditionalFileSet exceptSet = (ConditionalFileSet) setEnum
- .nextElement();
- if (exceptSet.isActive()) {
- DirectoryScanner scanner = exceptSet
- .getDirectoryScanner(p);
- String[] scannerFiles = scanner.getIncludedFiles();
- if (exceptFiles == null) {
- exceptFiles = scannerFiles;
- } else {
- if (scannerFiles.length > 0) {
- String[] newFiles = new String[exceptFiles.length
- + scannerFiles.length];
- for (int i = 0; i < exceptFiles.length; i++) {
- newFiles[i] = exceptFiles[i];
- }
- int index = exceptFiles.length;
- for (int i = 0; i < scannerFiles.length; i++) {
- newFiles[index++] = scannerFiles[i];
- }
- exceptFiles = newFiles;
- }
- }
- }
- }
- if (exceptFiles == null) {
- exceptFiles = new String[0];
- }
- return exceptFiles;
- }
- /**
- * Gets prototype source file
- *
- */
- public File getPrototype() {
- PrecompileDef ref = getRef();
- if (ref != null) {
- return ref.getPrototype();
- }
- return prototype;
- }
- private PrecompileDef getRef() {
- if (isReference()) {
- return ((PrecompileDef) getCheckedRef(PrecompileDef.class,
- "PrecompileDef"));
- }
- return null;
- }
- public boolean isActive() {
- boolean isActive = CUtil.isActive(getProject(), ifCond, unlessCond);
- if (!isActive) {
- PrecompileDef ref = getRef();
- if (ref != null) {
- return ref.isActive();
- }
- }
- return isActive;
- }
- /**
- * Sets a description of the current data type.
- */
- public void setDescription(String desc) {
- super.setDescription(desc);
- }
- /**
- * Sets an id that can be used to reference this element.
- *
- * @param id
- * id
- */
- public void setId(String id) {
- //
- // this is actually accomplished by a different
- // mechanism, but we can document it
- //
- }
- /**
- * Set the 'if' condition.
- *
- * The processor will be ignored unless the property is defined.
- *
- * The value of property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * isActive() is evaluated.
- *
- * @param propName
- * name of property
- */
- public void setIf(String propName) {
- ifCond = propName;
- }
- /**
- * Sets file to precompile.
- *
- * Should be a source file that includes only one unguarded header file.
- * Default value is "stdafx.cpp".
- *
- * @param prototype
- * file path for prototype source file
- */
- public void setPrototype(File prototype) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- if (prototype == null) {
- throw new NullPointerException("prototype");
- }
- this.prototype = prototype;
- }
- /**
- * Specifies that this element should behave as if the content of the
- * element with the matching id attribute was inserted at this location.
- *
- * @param ref
- * Reference to other element
- *
- */
- public void setRefid(org.apache.tools.ant.types.Reference ref) {
- super.setRefid(ref);
- }
- /**
- * Set the 'unless' condition. If named property exists at execution time,
- * the processor will be ignored.
- *
- * Value of property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when isActive is called.
- *
- * @param propName
- * name of property
- */
- public void setUnless(String propName) {
- unlessCond = propName;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/PrecompileExceptDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/PrecompileExceptDef.java
deleted file mode 100644
index d6cdd6025f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/PrecompileExceptDef.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.types.ConditionalFileSet;
-
-import org.apache.tools.ant.BuildException;
-/**
- * Specifies files that should not be compiled using precompiled headers.
- *
- * @author Curt Arnold
- */
-public final class PrecompileExceptDef {
- private ConditionalFileSet localSet = null;
- /**
- * Collection of <fileset>contained by definition
- */
- private PrecompileDef owner;
- /**
- * Constructor
- *
- */
- public PrecompileExceptDef(PrecompileDef owner) {
- this.owner = owner;
- }
- /**
- * Adds filesets that specify files that should not be processed using
- * precompiled headers.
- *
- * @param exceptSet
- * FileSet specify files that should not be processed with
- * precompiled headers enabled.
- */
- public void addFileset(ConditionalFileSet exceptSet) {
- owner.appendExceptFileSet(exceptSet);
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
- /**
- * Sets the base-directory
- */
- public void setDir(File dir) throws BuildException {
- if (localSet == null) {
- localSet = new ConditionalFileSet();
- owner.appendExceptFileSet(localSet);
- }
- localSet.setDir(dir);
- }
- /**
- * Comma or space separated list of file patterns that should not be
- * compiled using precompiled headers.
- *
- * @param includes
- * the string containing the include patterns
- */
- public void setIncludes(String includes) {
- if (localSet == null) {
- localSet = new ConditionalFileSet();
- owner.appendExceptFileSet(localSet);
- }
- localSet.setIncludes(includes);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorDef.java
deleted file mode 100644
index 38faf427e7..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorDef.java
+++ /dev/null
@@ -1,714 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
-import net.sf.antcontrib.cpptasks.types.CommandLineArgument;
-import net.sf.antcontrib.cpptasks.types.ConditionalFileSet;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.Environment;
-import org.apache.tools.ant.types.Reference;
-/**
- * An abstract compiler/linker definition.
- *
- * @author Curt Arnold
- */
-public abstract class ProcessorDef extends DataType {
- /**
- * Returns the equivalent Boolean object for the specified value
- *
- * Equivalent to Boolean.valueOf in JDK 1.4
- *
- * @param val
- * boolean value
- * @return Boolean.TRUE or Boolean.FALSE
- */
- protected static Boolean booleanValueOf(boolean val) {
- if (val) {
- return Boolean.TRUE;
- }
- return Boolean.FALSE;
- }
- /**
- * if true, targets will be built for debugging
- */
- private Boolean debug;
- private Environment env = null;
- /**
- * Reference for "extends" processor definition
- */
- private Reference extendsRef = null;
- /**
- * Name of property that must be present or definition will be ignored. May
- * be null.
- */
- private String ifProp;
- /**
- * if true, processor definition inherits values from containing <cc>
- * element
- */
- private boolean inherit;
- private Boolean libtool = null;
- protected boolean newEnvironment = false;
- /**
- * Processor.
- */
- private Processor processor;
- /**
- * Collection of <compilerarg>or <linkerarg>contained by definition
- */
- private final Vector processorArgs = new Vector();
- /**
- * Collection of <compilerparam>or <linkerparam>contained by definition
- */
- private final Vector processorParams = new Vector();
- /**
- * if true, all targets will be unconditionally rebuilt
- */
- private Boolean rebuild;
- /**
- * Collection of <fileset>contained by definition
- */
- private final Vector srcSets = new Vector();
- /**
- * Name of property that if present will cause definition to be ignored.
- * May be null.
- */
- private String unlessProp;
- /**
- * Constructor
- *
- */
- protected ProcessorDef() throws NullPointerException {
- inherit = true;
- }
- /**
- * Adds a <compilerarg>or <linkerarg>
- *
- * @param arg
- * command line argument, must not be null
- * @throws NullPointerException
- * if arg is null
- * @throws BuildException
- * if this definition is a reference
- */
- protected void addConfiguredProcessorArg(CommandLineArgument arg)
- throws NullPointerException, BuildException {
- if (arg == null) {
- throw new NullPointerException("arg");
- }
- if (isReference()) {
- throw noChildrenAllowed();
- }
- if(arg.getFile() == null ) {
- processorArgs.addElement(arg);
- }
- else {
- loadFile(arg.getFile());
- }
- }
- /**
- * Add a <compilerarg>or <linkerarg> if specify the file attribute
- *
- * @param arg
- * command line argument, must not be null
- * @throws BuildException
- * if the specify file not exist
- */
- protected void loadFile(File file)
- throws BuildException {
- FileReader fileReader;
- BufferedReader in;
- String str;
- if (! file.exists()){
- throw new BuildException("The file " + file + " is not existed");
- }
- try {
- fileReader = new FileReader(file);
- in = new BufferedReader(fileReader);
- while ( (str = in.readLine()) != null ){
- if(str.trim() == ""){
- continue ;
- }
- str = getProject().replaceProperties(str);
- CommandLineArgument newarg = new CommandLineArgument();
- newarg.setValue(str.trim());
- processorArgs.addElement(newarg);
- }
- }
- catch(Exception e){
- throw new BuildException(e.getMessage());
- }
- }
- /**
- * Adds a <compilerarg>or <linkerarg>
- *
- * @param arg
- * command line argument, must not be null
- * @throws NullPointerException
- * if arg is null
- * @throws BuildException
- * if this definition is a reference
- */
- protected void addConfiguredProcessorParam(ProcessorParam param)
- throws NullPointerException, BuildException {
- if (param == null) {
- throw new NullPointerException("param");
- }
- if (isReference()) {
- throw noChildrenAllowed();
- }
- processorParams.addElement(param);
- }
- /**
- * Add an environment variable to the launched process.
- */
- public void addEnv(Environment.Variable var) {
- if (env == null) {
- env = new Environment();
- }
- env.addVariable(var);
- }
- /**
- * Adds a source file set.
- *
- * Files in these set will be processed by this configuration and will not
- * participate in the auction.
- *
- * @param srcSet
- * Fileset identifying files that should be processed by this
- * processor
- * @throws BuildException
- * if processor definition is a reference
- */
- public void addFileset(ConditionalFileSet srcSet) throws BuildException {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- srcSet.setProject(getProject());
- srcSets.addElement(srcSet);
- }
- /**
- * Creates a configuration
- *
- * @param baseDef
- * reference to def from containing <cc>element, may be null
- * @return configuration
- *
- */
- public ProcessorConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef baseDef, TargetDef targetPlatform) {
- if (isReference()) {
- return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).createConfiguration(task, linkType,
- baseDef, targetPlatform);
- }
- ProcessorDef[] defaultProviders = getDefaultProviders(baseDef);
- Processor proc = getProcessor();
- return proc.createConfiguration(task, linkType, defaultProviders, this, targetPlatform);
- }
- /**
- * Prepares list of processor arguments ( <compilerarg>, <linkerarg>) that
- * are active for the current project settings.
- *
- * @return active compiler arguments
- */
- public CommandLineArgument[] getActiveProcessorArgs() {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project must be set");
- }
- if (isReference()) {
- return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).getActiveProcessorArgs();
- }
- Vector activeArgs = new Vector(processorArgs.size());
- for (int i = 0; i < processorArgs.size(); i++) {
- CommandLineArgument arg = (CommandLineArgument) processorArgs
- .elementAt(i);
- if (arg.isActive(p)) {
- activeArgs.addElement(arg);
- }
- }
- CommandLineArgument[] array = new CommandLineArgument[activeArgs.size()];
- activeArgs.copyInto(array);
- return array;
- }
- /**
- * Prepares list of processor arguments ( <compilerarg>, <linkerarg>) that
- * are active for the current project settings.
- *
- * @return active compiler arguments
- */
- public ProcessorParam[] getActiveProcessorParams() {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException("project must be set");
- }
- if (isReference()) {
- return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).getActiveProcessorParams();
- }
- Vector activeParams = new Vector(processorParams.size());
- for (int i = 0; i < processorParams.size(); i++) {
- ProcessorParam param = (ProcessorParam) processorParams
- .elementAt(i);
- if (param.isActive(p)) {
- activeParams.addElement(param);
- }
- }
- ProcessorParam[] array = new ProcessorParam[activeParams.size()];
- activeParams.copyInto(array);
- return array;
- }
- /**
- * Gets boolean indicating debug build
- *
- * @param defaultProviders
- * array of ProcessorDef's in descending priority
- * @param index
- * index to first element in array that should be considered
- * @return if true, built targets for debugging
- */
- public boolean getDebug(ProcessorDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).getDebug(defaultProviders, index);
- }
- if (debug != null) {
- return debug.booleanValue();
- } else {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getDebug(defaultProviders,
- index + 1);
- }
- }
- return false;
- }
- /**
- * Creates an chain of objects which provide default values in descending
- * order of significance.
- *
- * @param baseDef
- * corresponding ProcessorDef from CCTask, will be last element
- * in array unless inherit = false
- * @return default provider array
- *
- */
- protected final ProcessorDef[] getDefaultProviders(ProcessorDef baseDef) {
- ProcessorDef extendsDef = getExtends();
- Vector chain = new Vector();
- while (extendsDef != null && !chain.contains(extendsDef)) {
- chain.addElement(extendsDef);
- extendsDef = extendsDef.getExtends();
- }
- if (baseDef != null && getInherit()) {
- chain.addElement(baseDef);
- }
- ProcessorDef[] defaultProviders = new ProcessorDef[chain.size()];
- chain.copyInto(defaultProviders);
- return defaultProviders;
- }
- /**
- * Gets the ProcessorDef specified by the extends attribute
- *
- * @return Base ProcessorDef, null if extends is not specified
- * @throws BuildException
- * if reference is not same type object
- */
- public ProcessorDef getExtends() throws BuildException {
- if (extendsRef != null) {
- Object obj = extendsRef.getReferencedObject(getProject());
- if (!getClass().isInstance(obj)) {
- throw new BuildException("Referenced object "
- + extendsRef.getRefId() + " not correct type, is "
- + obj.getClass().getName() + " should be "
- + getClass().getName());
- }
- return (ProcessorDef) obj;
- }
- return null;
- }
- /**
- * Gets the inherit attribute. If the inherit value is true, this processor
- * definition will inherit default values from the containing <cc>element.
- *
- * @return if true then properties from the containing <cc>element are
- * used.
- */
- public final boolean getInherit() {
- return inherit;
- }
- public boolean getLibtool() {
- if (libtool != null) {
- return libtool.booleanValue();
- }
- if (isReference()) {
- return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).getLibtool();
- }
- ProcessorDef extendsDef = getExtends();
- if (extendsDef != null) {
- return extendsDef.getLibtool();
- }
- return false;
- }
- /**
- * Obtains the appropriate processor (compiler, linker)
- *
- * @return processor
- */
- protected Processor getProcessor() {
- if (isReference()) {
- return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).getProcessor();
- }
- //
- // if a processor has not been explicitly set
- // then may be set by an extended definition
- if (processor == null) {
- ProcessorDef extendsDef = getExtends();
- if (extendsDef != null) {
- return extendsDef.getProcessor();
- }
- }
- return processor;
- }
- /**
- * Gets a boolean value indicating whether all targets must be rebuilt
- * regardless of dependency analysis.
- *
- * @param defaultProviders
- * array of ProcessorDef's in descending priority
- * @param index
- * index to first element in array that should be considered
- * @return true if all targets should be rebuilt.
- */
- public boolean getRebuild(ProcessorDef[] defaultProviders, int index) {
- if (isReference()) {
- return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).getRebuild(defaultProviders, index);
- }
- if (rebuild != null) {
- return rebuild.booleanValue();
- } else {
- if (defaultProviders != null && index < defaultProviders.length) {
- return defaultProviders[index].getRebuild(defaultProviders,
- index + 1);
- }
- }
- return false;
- }
- /**
- * Returns true if the processor definition contains embedded file set
- * definitions
- *
- * @return true if processor definition contains embedded filesets
- */
- public boolean hasFileSets() {
- if (isReference()) {
- return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).hasFileSets();
- }
- return srcSets.size() > 0;
- }
- /**
- * Determine if this def should be used.
- *
- * Definition will be active if the "if" variable (if specified) is set and
- * the "unless" variable (if specified) is not set and that all reference
- * or extended definitions are active
- *
- * @return true if processor is active
- * @throws IllegalStateException
- * if not properly initialized
- * @throws BuildException
- * if "if" or "unless" variable contains suspicious values
- * "false" or "no" which indicates possible confusion
- */
- public boolean isActive() throws BuildException, IllegalStateException {
- Project project = getProject();
- if (!CUtil.isActive(project, ifProp, unlessProp)) {
- return false;
- }
- if (isReference()) {
- if (!((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).isActive()) {
- return false;
- }
- }
- //
- // walk through any extended definitions
- //
- ProcessorDef[] defaultProviders = getDefaultProviders(null);
- for (int i = 0; i < defaultProviders.length; i++) {
- if (!defaultProviders[i].isActive()) {
- return false;
- }
- }
- return true;
- }
- /**
- * Sets the class name for the adapter. Use the "name" attribute when the
- * tool is supported.
- *
- * @param className
- * full class name
- *
- */
- public void setClassname(String className) throws BuildException {
- Object proc = null;
- try {
- Class implClass = ProcessorDef.class.getClassLoader().loadClass(
- className);
- try {
- Method getInstance = implClass.getMethod("getInstance",
- new Class[0]);
- proc = getInstance.invoke(null, new Object[0]);
- } catch (Exception ex) {
- proc = implClass.newInstance();
- }
- } catch (Exception ex) {
- throw new BuildException(ex);
- }
- setProcessor((Processor) proc);
- }
- /**
- * If set true, all targets will be built for debugging.
- *
- * @param debug
- * true if targets should be built for debugging
- * @throws BuildException
- * if processor definition is a reference
- */
- public void setDebug(boolean debug) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.debug = booleanValueOf(debug);
- }
- /**
- * Sets a description of the current data type.
- */
- public void setDescription(String desc) {
- super.setDescription(desc);
- }
- /**
- * Specifies that this element extends the element with id attribute with a
- * matching value. The configuration will be constructed from the settings
- * of this element, element referenced by extends, and the containing cc
- * element.
- *
- * @param extendsRef
- * Reference to the extended processor definition.
- * @throws BuildException
- * if this processor definition is a reference
- */
- public void setExtends(Reference extendsRef) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.extendsRef = extendsRef;
- }
- /**
- * Sets an id that can be used to reference this element.
- *
- * @param id
- * id
- */
- public void setId(String id) {
- //
- // this is actually accomplished by a different
- // mechanism, but we can document it
- //
- }
- /**
- * Sets the property name for the 'if' condition.
- *
- * The configuration will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- *
- * @param propName
- * name of property
- */
- public void setIf(String propName) {
- ifProp = propName;
- }
- /**
- * If inherit has the default value of true, defines, includes and other
- * settings from the containing <cc>element will be inherited.
- *
- * @param inherit
- * new value
- * @throws BuildException
- * if processor definition is a reference
- */
- public void setInherit(boolean inherit) throws BuildException {
- if (isReference()) {
- throw super.tooManyAttributes();
- }
- this.inherit = inherit;
- }
- /**
- * Set use of libtool.
- *
- * If set to true, the "libtool " will be prepended to the command line
- *
- * @param libtool
- * If true, use libtool.
- */
- public void setLibtool(boolean libtool) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.libtool = booleanValueOf(libtool);
- }
- /**
- * Do not propagate old environment when new environment variables are
- * specified.
- */
- public void setNewenvironment(boolean newenv) {
- newEnvironment = newenv;
- }
- /**
- * Sets the processor
- *
- * @param processor
- * processor, may not be null.
- * @throws BuildException
- * if ProcessorDef is a reference
- * @throws NullPointerException
- * if processor is null
- */
- protected void setProcessor(Processor processor) throws BuildException,
- NullPointerException {
- if (processor == null) {
- throw new NullPointerException("processor");
- }
- if (isReference()) {
- throw super.tooManyAttributes();
- }
- if (env == null && !newEnvironment) {
- this.processor = processor;
- } else {
- this.processor = processor.changeEnvironment(newEnvironment, env);
- }
- }
- /**
- * If set true, all targets will be unconditionally rebuilt.
- *
- * @param rebuild
- * if true, rebuild all targets.
- * @throws BuildException
- * if processor definition is a reference
- */
- public void setRebuild(boolean rebuild) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.rebuild = booleanValueOf(rebuild);
- }
- /**
- * Specifies that this element should behave as if the content of the
- * element with the matching id attribute was inserted at this location. If
- * specified, no other attributes or child content should be specified,
- * other than "if", "unless" and "description".
- *
- * @param ref
- * Reference to other element
- *
- */
- public void setRefid(org.apache.tools.ant.types.Reference ref) {
- super.setRefid(ref);
- }
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the configuration will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public void setUnless(String propName) {
- unlessProp = propName;
- }
- /**
- * This method calls the FileVistor's visit function for every file in the
- * processors definition
- *
- * @param visitor
- * object whose visit method is called for every file
- */
- public void visitFiles(FileVisitor visitor) {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException(
- "project must be set before this call");
- }
- if (isReference()) {
- ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef"))
- .visitFiles(visitor);
- }
- //
- // if this processor extends another,
- // visit its files first
- //
- ProcessorDef extendsDef = getExtends();
- if (extendsDef != null) {
- extendsDef.visitFiles(visitor);
- }
- for (int i = 0; i < srcSets.size(); i++) {
- ConditionalFileSet srcSet = (ConditionalFileSet) srcSets
- .elementAt(i);
- if (srcSet.isActive()) {
- // Find matching source files
- DirectoryScanner scanner = srcSet.getDirectoryScanner(p);
- // Check each source file - see if it needs compilation
- String[] fileNames = scanner.getIncludedFiles();
- File parentDir = scanner.getBasedir();
- for (int j = 0; j < fileNames.length; j++) {
- String currentFile = fileNames[j];
- visitor.visit(parentDir, currentFile);
- }
- }
- }
- }
- public Vector getSrcSets() {
- if (isReference()) {
- return ((ProcessorDef) getCheckedRef(ProcessorDef.class,
- "ProcessorDef")).getSrcSets();
- }
- return srcSets;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorEnumValue.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorEnumValue.java
deleted file mode 100644
index d028052232..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorEnumValue.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-/**
- * One entry in the arrays used by the CompilerEnum and LinkerEnum classes.
- *
- * @author Curt Arnold
- * @see CompilerEnum
- * @see LinkerEnum
- *
- */
-public class ProcessorEnumValue {
- public static String[] getValues(ProcessorEnumValue[] processors) {
- String[] values = new String[processors.length];
- for (int i = 0; i < processors.length; i++) {
- values[i] = processors[i].getName();
- }
- return values;
- }
- private String name;
- private Processor processor;
- public ProcessorEnumValue(String name, Processor processor) {
- this.name = name;
- this.processor = processor;
- }
- public String getName() {
- return name;
- }
- public Processor getProcessor() {
- return processor;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorParam.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorParam.java
deleted file mode 100644
index b2d47962ed..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorParam.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-/*******************************************************************************
- * Place class description here.
- *
- * @author inger
- * @author <additional author>
- *
- * @since
- ******************************************************************************/
-public class ProcessorParam {
- private String ifCond;
- private String name;
- private String unlessCond;
- private String value;
- public ProcessorParam() {
- }
- public String getName() {
- return name;
- }
- public String getValue() {
- return value;
- }
- /**
- * Returns true if the define's if and unless conditions (if any) are
- * satisfied.
- */
- public boolean isActive(org.apache.tools.ant.Project p) {
- if (value == null) {
- return false;
- }
- if (ifCond != null && p.getProperty(ifCond) == null) {
- return false;
- } else if (unlessCond != null && p.getProperty(unlessCond) != null) {
- return false;
- }
- return true;
- }
- /**
- * Sets the property name for the 'if' condition.
- *
- * The argument will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- */
- public void setIf(String propName) {
- ifCond = propName;
- }
- /**
- * Specifies relative location of argument on command line. "start" will
- * place argument at start of command line, "mid" will place argument after
- * all "start" arguments but before filenames, "end" will place argument
- * after filenames.
- *
- */
- public void setName(String name) {
- this.name = name;
- }
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the argument will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public void setUnless(String propName) {
- unlessCond = propName;
- }
- /**
- * Specifies the string that should appear on the command line. The
- * argument will be quoted if it contains embedded blanks. Use multiple
- * arguments to avoid quoting.
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/RuntimeType.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/RuntimeType.java
deleted file mode 100644
index 02da661917..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/RuntimeType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import org.apache.tools.ant.types.EnumeratedAttribute;
-/**
- * Enumerated attribute with the values "dynamic" and "static",
- */
-public class RuntimeType extends EnumeratedAttribute {
- public String[] getValues() {
- return new String[]{"dynamic", "static"};
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/SourceHistory.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/SourceHistory.java
deleted file mode 100644
index 0c608b4d87..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/SourceHistory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.File;
-import java.io.IOException;
-/**
- * The history of a source file used to build a target
- *
- * @author Curt Arnold
- */
-public final class SourceHistory {
- private/* final */long lastModified;
- private/* final */String relativePath;
- /**
- * Constructor
- */
- public SourceHistory(String relativePath, long lastModified) {
- if (relativePath == null) {
- throw new NullPointerException("relativePath");
- }
- this.relativePath = relativePath;
- this.lastModified = lastModified;
- }
- public String getAbsolutePath(File baseDir) {
- try {
- return new File(baseDir, relativePath).getCanonicalPath();
- } catch (IOException ex) {
- }
- return relativePath;
- }
- public long getLastModified() {
- return lastModified;
- }
- public String getRelativePath() {
- return relativePath;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/SubsystemEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/SubsystemEnum.java
deleted file mode 100644
index 3dc342a38a..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/SubsystemEnum.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import org.apache.tools.ant.types.EnumeratedAttribute;
-/**
- * Enumeration of supported subsystems
- *
- * @author Curt Arnold
- *
- */
-public final class SubsystemEnum extends EnumeratedAttribute {
- private final static String[] values = new String[]{"gui", "console",
- "other"};
- public SubsystemEnum() {
- setValue("gui");
- }
- public String[] getValues() {
- return (String[]) values.clone();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetDef.java
deleted file mode 100644
index 8e46cb7c6c..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetDef.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.Reference;
-
-/**
- * Information on the execution platforms for the generated code.
- * (Non-functional prototype)
- *
- */
-public final class TargetDef
- extends DataType {
- /**
- * if property.
- */
- private String ifCond;
-
- /**
- * unless property.
- */
- private String unlessCond;
-
- /**
- * cpu.
- *
- */
- private CPUEnum cpu;
-
- /**
- * architecture.
- *
- */
- private ArchEnum arch;
-
- /**
- * OS Family.
- *
- */
- private OSFamilyEnum osFamily;
-
- /**
- * Constructor.
- *
- */
- public TargetDef() {
- }
-
- /**
- * Bogus method required for documentation generation.
- */
- public void execute() {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-
- /**
- * Returns true if the define's if and unless conditions (if any) are
- * satisfied.
- * @return true if active
- */
- public boolean isActive() {
- return CUtil.isActive(getProject(), ifCond, unlessCond);
- }
-
- /**
- * Sets a description of the current data type.
- * @param desc description
- */
- public void setDescription(final String desc) {
- super.setDescription(desc);
- }
-
- /**
- * Sets an id that can be used to reference this element.
- *
- * @param id
- * id
- */
- public void setId(final String id) {
- //
- // this is actually accomplished by a different
- // mechanism, but we can document it
- //
- }
-
- /**
- * Sets the property name for the 'if' condition.
- *
- * The define will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- *
- * @param propName
- * property name
- */
- public void setIf(final String propName) {
- ifCond = propName;
- }
-
- /**
- * Specifies that this element should behave as if the content of the
- * element with the matching id attribute was inserted at this location. If
- * specified, no other attributes should be specified.
- * @param r id of referenced target
- */
- public void setRefid(final Reference r) {
- super.setRefid(r);
- }
-
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the define will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public void setUnless(final String propName) {
- unlessCond = propName;
- }
-
- /**
- * Gets cpu.
- * @return cpu, may be null.
- *
- */
- public CPUEnum getCpu() {
- if (isReference()) {
- TargetDef refPlatform = (TargetDef)
- getCheckedRef(TargetDef.class,
- "TargetDef");
- return refPlatform.getCpu();
- }
- return cpu;
- }
-
- /**
- * Gets arch.
- * @return arch, may be null.
- *
- */
- public ArchEnum getArch() {
- if (isReference()) {
- TargetDef refPlatform = (TargetDef)
- getCheckedRef(TargetDef.class,
- "TargetDef");
- return refPlatform.getArch();
- }
- return arch;
- }
-
- /**
- * Gets operating system family.
- * @return os family, may be null.
- *
- */
- public OSFamilyEnum getOsfamily() {
- if (isReference()) {
- TargetDef refPlatform = (TargetDef)
- getCheckedRef(TargetDef.class,
- "TargetDef");
- return refPlatform.getOsfamily();
- }
- return osFamily;
- }
-
- /**
- * Sets preferred cpu, but does not use cpu specific instructions.
- * @param value new value
- */
- public void setCpu(final CPUEnum value) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- cpu = value;
- }
-
- /**
- * Sets cpu architecture, compiler may use cpu specific instructions.
- * @param value new value
- */
- public void setArch(final ArchEnum value) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- if (cpu != null) {
- throw tooManyAttributes();
- }
- arch = value;
- }
-
- /**
- * Sets operating system family.
- * @param value new value
- */
- public void setOsfamily(final OSFamilyEnum value) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- if (cpu != null) {
- throw tooManyAttributes();
- }
- osFamily = value;
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetHistory.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetHistory.java
deleted file mode 100644
index 0094c8ecec..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetHistory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-/**
- * A description of a file built or to be built
- */
-public final class TargetHistory {
- private/* final */String config;
- private/* final */String output;
- private/* final */long outputLastModified;
- private/* final */SourceHistory[] sources;
- /**
- * Constructor from build step
- */
- public TargetHistory(String config, String output, long outputLastModified,
- SourceHistory[] sources) {
- if (config == null) {
- throw new NullPointerException("config");
- }
- if (sources == null) {
- throw new NullPointerException("source");
- }
- if (output == null) {
- throw new NullPointerException("output");
- }
- this.config = config;
- this.output = output;
- this.outputLastModified = outputLastModified;
- this.sources = (SourceHistory[]) sources.clone();
- }
- public String getOutput() {
- return output;
- }
- public long getOutputLastModified() {
- return outputLastModified;
- }
- public String getProcessorConfiguration() {
- return config;
- }
- public SourceHistory[] getSources() {
- SourceHistory[] clone = (SourceHistory[]) sources.clone();
- return clone;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetHistoryTable.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetHistoryTable.java
deleted file mode 100644
index 9fb0a7b642..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetHistoryTable.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
-
-import org.apache.tools.ant.BuildException;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-/**
- * A history of the compiler and linker settings used to build the files in the
- * same directory as the history.
- *
- * @author Curt Arnold
- */
-public final class TargetHistoryTable {
- /**
- * This class handles populates the TargetHistory hashtable in response to
- * SAX parse events
- */
- private class TargetHistoryTableHandler extends DefaultHandler {
- private final File baseDir;
- private String config;
- private final Hashtable history;
- private String output;
- private long outputLastModified;
- private final Vector sources = new Vector();
- /**
- * Constructor
- *
- * @param history
- * hashtable of TargetHistory keyed by output name
- * @param outputFiles
- * existing files in output directory
- */
- private TargetHistoryTableHandler(Hashtable history, File baseDir) {
- this.history = history;
- config = null;
- output = null;
- this.baseDir = baseDir;
- }
- public void endElement(String namespaceURI, String localName,
- String qName) throws SAXException {
- //
- // if </target> then
- // create TargetHistory object and add to hashtable
- // if corresponding output file exists and
- // has the same timestamp
- //
- if (qName.equals("target")) {
- if (config != null && output != null) {
- File existingFile = new File(baseDir, output);
- //
- // if the corresponding files doesn't exist or has a
- // different
- // modification time, then discard this record
- if (existingFile.exists()) {
- long existingLastModified = existingFile.lastModified();
- //
- // would have expected exact time stamps
- // but have observed slight differences
- // in return value for multiple evaluations of
- // lastModified(). Check if times are within
- // a second
- long diff = outputLastModified - existingLastModified;
- if (diff >= -500 && diff <= 500) {
- SourceHistory[] sourcesArray = new SourceHistory[sources
- .size()];
- sources.copyInto(sourcesArray);
- TargetHistory targetHistory = new TargetHistory(
- config, output, outputLastModified,
- sourcesArray);
- history.put(output, targetHistory);
- }
- }
- }
- output = null;
- sources.setSize(0);
- } else {
- //
- // reset config so targets not within a processor element
- // don't pick up a previous processors signature
- //
- if (qName.equals("processor")) {
- config = null;
- }
- }
- }
- /**
- * startElement handler
- */
- public void startElement(String namespaceURI, String localName,
- String qName, Attributes atts) throws SAXException {
- //
- // if sourceElement
- //
- if (qName.equals("source")) {
- String sourceFile = atts.getValue("file");
- long sourceLastModified = Long.parseLong(atts
- .getValue("lastModified"), 16);
- sources.addElement(new SourceHistory(sourceFile,
- sourceLastModified));
- } else {
- //
- // if <target> element,
- // grab file name and lastModified values
- // TargetHistory object will be created in endElement
- //
- if (qName.equals("target")) {
- sources.setSize(0);
- output = atts.getValue("file");
- outputLastModified = Long.parseLong(atts
- .getValue("lastModified"), 16);
- } else {
- //
- // if <processor> element,
- // grab signature attribute
- //
- if (qName.equals("processor")) {
- config = atts.getValue("signature");
- }
- }
- }
- }
- }
- /** Flag indicating whether the cache should be written back to file. */
- private boolean dirty;
- /**
- * a hashtable of TargetHistory's keyed by output file name
- */
- private final Hashtable history = new Hashtable();
- /** The file the cache was loaded from. */
- private/* final */File historyFile;
- private/* final */File outputDir;
- private String outputDirPath;
- /**
- * Creates a target history table from history.xml in the output directory,
- * if it exists. Otherwise, initializes the history table empty.
- *
- * @param task
- * task used for logging history load errors
- * @param outputDir
- * output directory for task
- */
- public TargetHistoryTable(CCTask task, File outputDir)
- throws BuildException {
- if (outputDir == null) {
- throw new NullPointerException("outputDir");
- }
- if (!outputDir.isDirectory()) {
- throw new BuildException("Output directory is not a directory");
- }
- if (!outputDir.exists()) {
- throw new BuildException("Output directory does not exist");
- }
- this.outputDir = outputDir;
- try {
- outputDirPath = outputDir.getCanonicalPath();
- } catch (IOException ex) {
- outputDirPath = outputDir.toString();
- }
- //
- // load any existing history from file
- // suppressing any records whose corresponding
- // file does not exist, is zero-length or
- // last modified dates differ
- historyFile = new File(outputDir, "history.xml");
- if (historyFile.exists()) {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setValidating(false);
- try {
- SAXParser parser = factory.newSAXParser();
- parser.parse(historyFile, new TargetHistoryTableHandler(
- history, outputDir));
- } catch (Exception ex) {
- //
- // a failure on loading this history is not critical
- // but should be logged
- task.log("Error reading history.xml: " + ex.toString());
- }
- } else {
- //
- // create empty history file for identifying new files by last
- // modified
- // timestamp comperation (to compare with
- // System.currentTimeMillis() don't work on Unix, because it
- // maesure timestamps only in seconds).
- //
- try {
- FileOutputStream outputStream = new FileOutputStream(
- historyFile);
- byte[] historyElement = new byte[]{0x3C, 0x68, 0x69, 0x73,
- 0x74, 0x6F, 0x72, 0x79, 0x2F, 0x3E};
- outputStream.write(historyElement);
- outputStream.close();
- } catch (IOException ex) {
- throw new BuildException("Can't create history file", ex);
- }
- }
- }
- public void commit() throws IOException {
- //
- // if not dirty, no need to update file
- //
- if (dirty) {
- //
- // build (small) hashtable of config id's in history
- //
- Hashtable configs = new Hashtable(20);
- Enumeration elements = history.elements();
- while (elements.hasMoreElements()) {
- TargetHistory targetHistory = (TargetHistory) elements
- .nextElement();
- String configId = targetHistory.getProcessorConfiguration();
- if (configs.get(configId) == null) {
- configs.put(configId, configId);
- }
- }
- FileOutputStream outStream = new FileOutputStream(historyFile);
- OutputStreamWriter outWriter;
- //
- // early VM's don't support UTF-8 encoding
- // try and fallback to the default encoding
- // otherwise
- String encodingName = "UTF-8";
- try {
- outWriter = new OutputStreamWriter(outStream, "UTF-8");
- } catch (UnsupportedEncodingException ex) {
- outWriter = new OutputStreamWriter(outStream);
- encodingName = outWriter.getEncoding();
- }
- BufferedWriter writer = new BufferedWriter(outWriter);
- writer.write("<?xml version='1.0' encoding='");
- writer.write(encodingName);
- writer.write("'?>\n");
- writer.write("<history>\n");
- StringBuffer buf = new StringBuffer(200);
- Enumeration configEnum = configs.elements();
- while (configEnum.hasMoreElements()) {
- String configId = (String) configEnum.nextElement();
- buf.setLength(0);
- buf.append(" <processor signature=\"");
- buf.append(CUtil.xmlAttribEncode(configId));
- buf.append("\">\n");
- writer.write(buf.toString());
- elements = history.elements();
- while (elements.hasMoreElements()) {
- TargetHistory targetHistory = (TargetHistory) elements
- .nextElement();
- if (targetHistory.getProcessorConfiguration().equals(
- configId)) {
- buf.setLength(0);
- buf.append(" <target file=\"");
- buf.append(CUtil.xmlAttribEncode(targetHistory
- .getOutput()));
- buf.append("\" lastModified=\"");
- buf.append(Long.toHexString(targetHistory
- .getOutputLastModified()));
- buf.append("\">\n");
- writer.write(buf.toString());
- SourceHistory[] sourceHistories = targetHistory
- .getSources();
- for (int i = 0; i < sourceHistories.length; i++) {
- buf.setLength(0);
- buf.append(" <source file=\"");
- buf.append(CUtil.xmlAttribEncode(sourceHistories[i]
- .getRelativePath()));
- buf.append("\" lastModified=\"");
- buf.append(Long.toHexString(sourceHistories[i]
- .getLastModified()));
- buf.append("\"/>\n");
- writer.write(buf.toString());
- }
- writer.write(" </target>\n");
- }
- }
- writer.write(" </processor>\n");
- }
- writer.write("</history>\n");
- writer.close();
- dirty = false;
- }
- }
- public TargetHistory get(String configId, String outputName) {
- TargetHistory targetHistory = (TargetHistory) history.get(outputName);
- if (targetHistory != null) {
- if (!targetHistory.getProcessorConfiguration().equals(configId)) {
- targetHistory = null;
- }
- }
- return targetHistory;
- }
- public void markForRebuild(Hashtable targetInfos) {
- Enumeration targetInfoEnum = targetInfos.elements();
- while (targetInfoEnum.hasMoreElements()) {
- markForRebuild((TargetInfo) targetInfoEnum.nextElement());
- }
- }
- public void markForRebuild(TargetInfo targetInfo) {
- //
- // if it must already be rebuilt, no need to check further
- //
- if (!targetInfo.getRebuild()) {
- TargetHistory history = get(targetInfo.getConfiguration()
- .toString(), targetInfo.getOutput().getName());
- if (history == null) {
- targetInfo.mustRebuild();
- } else {
- SourceHistory[] sourceHistories = history.getSources();
- File[] sources = targetInfo.getSources();
- if (sourceHistories.length != sources.length) {
- targetInfo.mustRebuild();
- } else {
- for (int i = 0; i < sourceHistories.length
- && !targetInfo.getRebuild(); i++) {
- //
- // relative file name, must absolutize it on output
- // directory
- //
- boolean foundMatch = false;
- String historySourcePath = sourceHistories[i]
- .getAbsolutePath(outputDir);
- for (int j = 0; j < sources.length; j++) {
- File targetSource = sources[j];
- String targetSourcePath = targetSource
- .getAbsolutePath();
- if (targetSourcePath.equals(historySourcePath)) {
- foundMatch = true;
- if (targetSource.lastModified() != sourceHistories[i]
- .getLastModified()) {
- targetInfo.mustRebuild();
- break;
- }
- }
- }
- if (!foundMatch) {
- targetInfo.mustRebuild();
- }
- }
- }
- }
- }
- }
- public void update(ProcessorConfiguration config, String[] sources) {
- String configId = config.getIdentifier();
- String[] onesource = new String[1];
- String outputName;
- for (int i = 0; i < sources.length; i++) {
- onesource[0] = sources[i];
- outputName = config.getOutputFileName(sources[i]);
- update(configId, outputName, onesource);
- }
- }
- private void update(String configId, String outputName, String[] sources) {
- File outputFile = new File(outputDir, outputName);
- //
- // if output file doesn't exist or predates the start of the
- // compile step (most likely a compilation error) then
- // do not write add a history entry
- //
- if (outputFile.exists()
- && outputFile.lastModified() >= historyFile.lastModified()) {
- dirty = true;
- history.remove(outputName);
- SourceHistory[] sourceHistories = new SourceHistory[sources.length];
- for (int i = 0; i < sources.length; i++) {
- File sourceFile = new File(sources[i]);
- long lastModified = sourceFile.lastModified();
- String relativePath = CUtil.getRelativePath(outputDirPath,
- sourceFile);
- sourceHistories[i] = new SourceHistory(relativePath,
- lastModified);
- }
- TargetHistory newHistory = new TargetHistory(configId, outputName,
- outputFile.lastModified(), sourceHistories);
- history.put(outputName, newHistory);
- }
- }
- public void update(TargetInfo linkTarget) {
- File outputFile = linkTarget.getOutput();
- String outputName = outputFile.getName();
- //
- // if output file doesn't exist or predates the start of the
- // compile or link step (most likely a compilation error) then
- // do not write add a history entry
- //
- if (outputFile.exists()
- && outputFile.lastModified() >= historyFile.lastModified()) {
- dirty = true;
- history.remove(outputName);
- SourceHistory[] sourceHistories = linkTarget
- .getSourceHistories(outputDirPath);
- TargetHistory newHistory = new TargetHistory(linkTarget
- .getConfiguration().getIdentifier(), outputName, outputFile
- .lastModified(), sourceHistories);
- history.put(outputName, newHistory);
- }
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetInfo.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetInfo.java
deleted file mode 100644
index 3a9dd14b16..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetInfo.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
-/**
- * A description of a file built or to be built
- */
-public final class TargetInfo {
- private static final File[] emptyFileArray = new File[0];
- private/* final */ProcessorConfiguration config;
- private/* final */File output;
- private boolean rebuild;
- private/* final */File[] sources;
- private File[] sysSources;
- public TargetInfo(ProcessorConfiguration config, File[] sources,
- File[] sysSources, File output, boolean rebuild) {
- if (config == null) {
- throw new NullPointerException("config");
- }
- if (sources == null) {
- throw new NullPointerException("sources");
- }
- if (output == null) {
- throw new NullPointerException("output");
- }
- this.config = config;
- this.sources = (File[]) sources.clone();
- if (sysSources == null) {
- this.sysSources = emptyFileArray;
- } else {
- this.sysSources = (File[]) sysSources.clone();
- }
- this.output = output;
- this.rebuild = rebuild;
- //
- // if the output doesn't exist, must rebuild it
- //
- if (!output.exists()) {
- rebuild = true;
- }
- }
- public String[] getAllSourcePaths() {
- String[] paths = new String[sysSources.length + sources.length];
- for (int i = 0; i < sysSources.length; i++) {
- paths[i] = sysSources[i].toString();
- }
- int offset = sysSources.length;
- for (int i = 0; i < sources.length; i++) {
- paths[offset + i] = sources[i].toString();
- }
- return paths;
- }
- public File[] getAllSources() {
- File[] allSources = new File[sources.length + sysSources.length];
- for (int i = 0; i < sysSources.length; i++) {
- allSources[i] = sysSources[i];
- }
- int offset = sysSources.length;
- for (int i = 0; i < sources.length; i++) {
- allSources[i + offset] = sources[i];
- }
- return allSources;
- }
- public ProcessorConfiguration getConfiguration() {
- return config;
- }
- public File getOutput() {
- return output;
- }
- public boolean getRebuild() {
- return rebuild;
- }
- /**
- * Returns an array of SourceHistory objects (contains relative path and
- * last modified time) for the source[s] of this target
- */
- public SourceHistory[] getSourceHistories(String basePath) {
- SourceHistory[] histories = new SourceHistory[sources.length];
- for (int i = 0; i < sources.length; i++) {
- String relativeName = CUtil.getRelativePath(basePath, sources[i]);
- long lastModified = sources[i].lastModified();
- histories[i] = new SourceHistory(relativeName, lastModified);
- }
- return histories;
- }
- public String[] getSourcePaths() {
- String[] paths = new String[sources.length];
- for (int i = 0; i < sources.length; i++) {
- paths[i] = sources[i].toString();
- }
- return paths;
- }
- public File[] getSources() {
- File[] clone = (File[]) sources.clone();
- return clone;
- }
- public String[] getSysSourcePaths() {
- String[] paths = new String[sysSources.length];
- for (int i = 0; i < sysSources.length; i++) {
- paths[i] = sysSources[i].toString();
- }
- return paths;
- }
- public File[] getSysSources() {
- File[] clone = (File[]) sysSources.clone();
- return clone;
- }
- public void mustRebuild() {
- this.rebuild = true;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetMatcher.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetMatcher.java
deleted file mode 100644
index 2574e1561f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/TargetMatcher.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-import java.io.File;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.LinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
-
-import org.apache.tools.ant.BuildException;
-/**
- * This class matches each visited file with an appropriate compiler
- *
- * @author Curt Arnold
- */
-public final class TargetMatcher implements FileVisitor {
- private LinkerConfiguration linker;
- private Vector objectFiles;
- private File outputDir;
- private ProcessorConfiguration[] processors;
- private final File sourceFiles[] = new File[1];
- private Hashtable targets;
- private CCTask task;
- public TargetMatcher(CCTask task, File outputDir,
- ProcessorConfiguration[] processors, LinkerConfiguration linker,
- Vector objectFiles, Hashtable targets) {
- this.task = task;
- this.outputDir = outputDir;
- this.processors = processors;
- this.targets = targets;
- this.linker = linker;
- this.objectFiles = objectFiles;
- }
- public void visit(File parentDir, String filename) throws BuildException {
- //
- // see if any processor wants to bid
- // on this one
- ProcessorConfiguration selectedCompiler = null;
- int bid = 0;
- if (processors != null) {
- for (int k = 0; k < processors.length; k++) {
- int newBid = processors[k].bid(filename);
- if (newBid > bid) {
- bid = newBid;
- selectedCompiler = processors[k];
- }
- }
- }
- //
- // no processor interested in file
- // log diagnostic message
- if (bid <= 0) {
- if (linker != null) {
- int linkerbid = linker.bid(filename);
- if (linkerbid > 0) {
- File objFile = new File(parentDir, filename);
- objectFiles.addElement(objFile);
- if (linkerbid == 1) {
- task.log("Unrecognized file type " + objFile.toString()
- + " will be passed to linker");
- }
- }
- }
- } else {
- //
- // get output file name
- //
- String outputFileName = selectedCompiler
- .getOutputFileName(filename);
- //
- // if there is some output for this task
- // (that is a source file and not an header file)
- //
- if (outputFileName != null) {
- sourceFiles[0] = new File(parentDir, filename);
- //
- // see if the same output file has already been registered
- //
- TargetInfo previousTarget = (TargetInfo) targets
- .get(outputFileName);
- if (previousTarget == null) {
- targets.put(outputFileName, new TargetInfo(
- selectedCompiler, sourceFiles, null, new File(
- outputDir, outputFileName),
- selectedCompiler.getRebuild()));
- } else {
- if (!previousTarget.getSources()[0].equals(sourceFiles[0])) {
- StringBuffer builder = new StringBuffer(
- "Output filename conflict: ");
- builder.append(outputFileName);
- builder.append(" would be produced from ");
- builder.append(previousTarget.getSources()[0]
- .toString());
- builder.append(" and ");
- builder.append(filename);
- throw new BuildException(builder.toString());
- }
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/VersionInfo.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/VersionInfo.java
deleted file mode 100644
index f55b976fef..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/VersionInfo.java
+++ /dev/null
@@ -1,550 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.Reference;
-
-/**
- * Version Information. (Non-functional prototype)
- *
- */
-public class VersionInfo extends DataType {
- /**
- * if property.
- */
- private String ifCond;
- /**
- * unless property.
- */
- private String unlessCond;
-
- /**
- * extends property.
- */
- private String extendsId;
-
- /**
- * file version.
- *
- */
- private String fileVersion;
- /**
- * Product version.
- *
- */
- private String productVersion;
- /**
- * file language.
- *
- */
- private String language;
-
- /**
- * comments.
- *
- */
- private String fileComments;
- /**
- * Company name.
- *
- */
- private String companyName;
- /**
- * Description.
- *
- */
- private String description;
- /**
- * internal name.
- */
- private String internalName;
- /**
- * legal copyright.
- *
- */
- private String legalCopyright;
- /**
- * legal trademark.
- *
- */
- private String legalTrademark;
- /**
- * original filename.
- *
- */
- private String originalFilename;
- /**
- * private build.
- *
- */
- private String privateBuild;
- /**
- * product name.
- *
- */
- private String productName;
- /**
- * Special build
- */
- private String specialBuild;
- /**
- * compatibility version
- *
- */
- private String compatibilityVersion;
-
-
- /**
- * Constructor.
- *
- */
- public VersionInfo() {
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
- /**
- * Returns true if the define's if and unless conditions (if any) are
- * satisfied.
- *
- * @exception BuildException
- * throws build exception if name is not set
- */
- public final boolean isActive() throws BuildException {
- return CUtil.isActive(getProject(), ifCond, unlessCond);
- }
- /**
- * Sets an id that can be used to reference this element.
- *
- * @param id
- * id
- */
- public void setId(String id) {
- //
- // this is actually accomplished by a different
- // mechanism, but we can document it
- //
- }
- /**
- * Sets the name of a version info that this info extends.
- *
- * @param id
- * id
- */
- public void setExtends(String id) {
- extendsId = id;
- }
-
-
- /**
- * Sets the property name for the 'if' condition.
- *
- * The define will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- *
- * @param propName
- * property name
- */
- public final void setIf(String propName) {
- ifCond = propName;
- }
- /**
- * Specifies that this element should behave as if the content of the
- * element with the matching id attribute was inserted at this location. If
- * specified, no other attributes should be specified.
- *
- */
- public void setRefid(Reference r) throws BuildException {
- super.setRefid(r);
- }
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the define will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public final void setUnless(String propName) {
- unlessCond = propName;
- }
- /**
- * Gets file version.
- * @return file version, may be null.
- *
- */
- public String getFileversion() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getFileversion();
- }
- return fileVersion;
- }
- /**
- * Gets Product version.
- * @return product version, may be null
- */
- public String getProductversion() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getProductversion();
- }
- return productVersion;
- }
- /**
- * Gets compatibility version.
- * @return compatibility version, may be null
- */
- public String getCompatibilityversion() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getCompatibilityversion();
- }
- return compatibilityVersion;
- }
- /**
- * Gets file language, should be an IETF RFC 3066 identifier, for example, en-US.
- * @return language, may be null.
- */
- public String getLanguage() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getLanguage();
- }
- return language;
- }
-
- /**
- * Gets comments.
- * @return comments, may be null.
- */
- public String getFilecomments() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getFilecomments();
- }
- return fileComments;
- }
- /**
- * Gets Company name.
- * @return company name, may be null.
- */
- public String getCompanyname() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getCompanyname();
- }
- return companyName;
- }
- /**
- * Gets Description.
- * @return description, may be null.
- */
- public String getDescription() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getDescription();
- }
- return description;
- }
- /**
- * Gets internal name.
- * @return internal name, may be null.
- */
- public String getInternalname() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getInternalname();
- }
- return internalName;
- }
- /**
- * Gets legal copyright.
- * @return legal copyright, may be null.
- */
- public String getLegalcopyright() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getLegalcopyright();
- }
- return legalCopyright;
- }
- /**
- * Gets legal trademark.
- * @return legal trademark, may be null;
- */
- public String getLegaltrademark() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getLegaltrademark();
- }
- return legalTrademark;
- }
- /**
- * Gets original filename.
- * @return original filename, may be null.
- */
- public String getOriginalfilename() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getOriginalfilename();
- }
- return originalFilename;
- }
- /**
- * Gets private build.
- * @return private build, may be null.
- */
- public String getPrivatebuild() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getPrivatebuild();
- }
- return privateBuild;
- }
- /**
- * Gets product name.
- * @return product name, may be null.
- */
- public String getProductname() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getProductname();
- }
- return productName;
- }
- /**
- * Special build
- * @return special build, may be null.
- */
- public String getSpecialbuild() {
- if (isReference()) {
- VersionInfo refVersion = (VersionInfo)
- getCheckedRef(VersionInfo.class,
- "VersionInfo");
- return refVersion.getSpecialbuild();
- }
- return specialBuild;
- }
-
- /**
- * Sets file version.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setFileversion(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- fileVersion = value;
- }
- /**
- * Sets product version.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setProductversion(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- productVersion = value;
- }
- /**
- * Sets compatibility version.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setCompatibilityversion(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- compatibilityVersion = value;
- }
- /**
- * Sets language.
- * @param value new value, should be an IETF RFC 3066 language identifier.
- * @throws BuildException if specified with refid
- */
- public void setLanguage(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- language = value;
- }
- /**
- * Sets comments.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setFilecomments(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- fileComments = value;
- }
-
- /**
- * Sets company name.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setCompanyname(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- companyName = value;
- }
-
-
- /**
- * Sets internal name. Internal name will automatically be
- * specified from build step, only set this value if
- * intentionally overriding that value.
- *
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setInternalname(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- internalName = value;
- }
-
- /**
- * Sets legal copyright.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setLegalcopyright(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- legalCopyright = value;
- }
- /**
- * Sets legal trademark.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setLegaltrademark(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- legalTrademark = value;
- }
- /**
- * Sets original name. Only set this value if
- * intentionally overriding the value from the build set.
- *
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setOriginalfilename(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- originalFilename = value;
- }
- /**
- * Sets private build.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setPrivatebuild(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- privateBuild = value;
- }
- /**
- * Sets product name.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setProductname(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- productName= value;
- }
- /**
- * Sets private build.
- * @param value new value
- * @throws BuildException if specified with refid
- */
- public void setSpecialbuild(String value) throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- specialBuild = value;
- }
-
- /**
- * Writes windows resource
- * @param writer writer, may not be null.
- * @param project project, may not be null
- * @param executableName name of executable
- */
- public void writeResource(final Writer writer,
- final Project p,
- final String executableName) throws IOException {
- // TODO:
-
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSCCompiler.java
deleted file mode 100644
index 78489b8c31..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSCCompiler.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- *
- * Copyright 2003-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.arm;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCCompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the ARM C Compilers
- *
- * See Doc No: ARM DUI 0151A, Issued: Nov 2001 at
- * http://www.arm.com/arm/User_Guides?OpenDocument
- *
- * @author Curt Arnold
- *
- */
-public class ADSCCompiler extends CommandLineCCompiler {
- /**
- * Header file extensions
- */
- private static final String[] headerExtensions = new String[]{".h", ".hpp",
- ".inl"};
- /**
- * Source file extensions
- */
- private static final String[] sourceExtensions = new String[]{".c", ".cc",
- ".cpp", ".cxx", ".c++"};
- /**
- * Singleton for ARM 32-bit C compiler
- */
- private static final ADSCCompiler armcc = new ADSCCompiler("armcc", false,
- null);
- /**
- * Singleton for ARM 32-bit C++ compiler
- */
- private static final ADSCCompiler armcpp = new ADSCCompiler("armcpp",
- false, null);
- /**
- * Singleton for ARM 16-bit C compiler
- */
- private static final ADSCCompiler tcc = new ADSCCompiler("tcc", false, null);
- /**
- * Singleton for ARM 16-bit C++ compiler
- */
- private static final ADSCCompiler tcpp = new ADSCCompiler("tcpp", false,
- null);
- /**
- * Singleton for ARM 32-bit C compiler
- */
- public static ADSCCompiler getArmCC() {
- return armcc;
- }
- /**
- * Singleton for ARM 32-bit C++ compiler
- */
- public static ADSCCompiler getArmCpp() {
- return armcpp;
- }
- /**
- * Singleton for ARM 16-bit C compiler
- */
- public static ADSCCompiler getThumbCC() {
- return tcpp;
- }
- /**
- * Singleton for ARM 16-bit C++ compiler
- */
- public static ADSCCompiler getThumbCpp() {
- return tcpp;
- }
- private static void quoteFile(StringBuffer buf, String outPath) {
- if (outPath.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(outPath);
- buf.append('\"');
- } else {
- buf.append(outPath);
- }
- }
- /**
- * Private constructor
- *
- * @param command
- * executable name
- * @param newEnvironment
- * Change environment
- * @param env
- * New environment
- */
- private ADSCCompiler(String command, boolean newEnvironment, Environment env) {
- super(command, "-vsn", sourceExtensions, headerExtensions, ".o", false,
- null, newEnvironment, env);
- }
- /**
- * Adds command switches for generic configuration options
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#addImpliedArgs(java.util.Vector,
- * boolean, boolean, boolean,
- * net.sf.antcontrib.cpptasks.compiler.LinkType)
- */
- protected void addImpliedArgs(Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- if (debug) {
- args.addElement("-g");
- }
- //
- // didn't see anything about producing
- // anything other than executables in the docs
- if (linkType.isExecutable()) {
- } else if (linkType.isSharedLibrary()) {
- }
- }
- /**
- * Adds flags that customize the warnings reported
- *
- * Compiler does not appear to have warning levels but ability to turn off
- * specific errors by explicit switches, could fabricate levels by
- * prioritizing errors.
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#addWarningSwitch(java.util.Vector,
- * int)
- */
- protected void addWarningSwitch(Vector args, int warnings) {
- }
- /**
- * Add command line options for preprocessor macro
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getDefineSwitch(java.lang.StringBuffer,
- * java.lang.String, java.lang.String)
- */
- protected void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- buffer.append("-D");
- buffer.append(define);
- if (value != null) {
- buffer.append('=');
- buffer.append(value);
- }
- }
- /**
- * ARMINC environment variable contains the default include path
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getEnvironmentIncludePath()
- */
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("ARMINC", ";");
- }
- /**
- * Returns command line option to specify include directory
- *
- */
- protected String getIncludeDirSwitch(String source) {
- StringBuffer buf = new StringBuffer("-I");
- quoteFile(buf, source);
- return buf.toString();
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Processor#getLinker(net.sf.antcontrib.cpptasks.compiler.LinkType)
- */
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return ADSLibrarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return ADSLinker.getDllInstance();
- }
- return ADSLinker.getInstance();
- }
- /**
- * Maximum command line length
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getMaximumCommandLength()
- */
- public int getMaximumCommandLength() {
- return 1000;
- }
- /*
- * Adds command to undefine preprocessor macro
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getUndefineSwitch(java.lang.StringBuffer,
- * java.lang.String)
- */
- protected void getUndefineSwitch(StringBuffer buffer, String define) {
- buffer.append("-U");
- buffer.append(define);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSLibrarian.java
deleted file mode 100644
index 0ff53d309f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSLibrarian.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *
- * Copyright 2003-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.arm;
-
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * Adapter for ARM Librarian
- *
- * @author Curt Arnold
- */
-public class ADSLibrarian extends CommandLineLinker {
-
- private static final ADSLibrarian instance = new ADSLibrarian();
-
- public static ADSLibrarian getInstance() {
- return instance;
- }
-
- private ADSLibrarian()
- {
- super("armar",null,
- new String[] { ".o" }, new String[0], ".lib", false, null);
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addBase(long, java.util.Vector)
- */
- protected void addBase(long base, Vector args) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addFixed(java.lang.Boolean, java.util.Vector)
- */
- protected void addFixed(Boolean fixed, Vector args) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addImpliedArgs(boolean, net.sf.antcontrib.cpptasks.compiler.LinkType, java.util.Vector)
- */
- protected void addImpliedArgs(
- boolean debug,
- LinkType linkType,
- Vector args,
- Boolean defaultflag) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addIncremental(boolean, java.util.Vector)
- */
- protected void addIncremental(boolean incremental, Vector args) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addMap(boolean, java.util.Vector)
- */
- protected void addMap(boolean map, Vector args) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addStack(int, java.util.Vector)
- */
- protected void addStack(int stack, Vector args) {
- // TODO Auto-generated method stub
-
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getCommandFileSwitch(java.lang.String)
- */
- protected String getCommandFileSwitch(String commandFile) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPath()
- */
- public File[] getLibraryPath() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPatterns(java.lang.String[])
- */
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- return new String[0];
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.Processor#getLinker(net.sf.antcontrib.cpptasks.compiler.LinkType)
- */
- public Linker getLinker(LinkType linkType) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getMaximumCommandLength()
- */
- protected int getMaximumCommandLength() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getOutputFileSwitch(java.lang.String)
- */
- protected String[] getOutputFileSwitch(String outputFile) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#isCaseSensitive()
- */
- public boolean isCaseSensitive() {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSLinker.java
deleted file mode 100644
index 042eb217ec..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/arm/ADSLinker.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- *
- * Copyright 2003-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.arm;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * Adapter for the ARM Linker
- *
- * @author CurtA
- */
-public class ADSLinker extends CommandLineLinker {
- private static final ADSLinker dllInstance = new ADSLinker(".o");
- private static final ADSLinker instance = new ADSLinker(".axf");
- public static ADSLinker getDllInstance() {
- return dllInstance;
- }
- public static ADSLinker getInstance() {
- return instance;
- }
- private ADSLinker(String outputSuffix) {
- super("armlink", "-vsn", new String[]{".o", ".lib", ".res"},
- new String[]{".map", ".pdb", ".lnk"}, outputSuffix, false, null);
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addBase(long,
- * java.util.Vector)
- */
- protected void addBase(long base, Vector args) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addFixed(java.lang.Boolean,
- * java.util.Vector)
- */
- protected void addFixed(Boolean fixed, Vector args) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addImpliedArgs(boolean,
- * net.sf.antcontrib.cpptasks.compiler.LinkType, java.util.Vector)
- */
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- if (debug) {
- args.addElement("-debug");
- }
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addIncremental(boolean,
- * java.util.Vector)
- */
- protected void addIncremental(boolean incremental, Vector args) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addMap(boolean,
- * java.util.Vector)
- */
- protected void addMap(boolean map, Vector args) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addStack(int,
- * java.util.Vector)
- */
- protected void addStack(int stack, Vector args) {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * May have to make this String array return
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getCommandFileSwitch(java.lang.String)
- */
- protected String getCommandFileSwitch(String commandFile) {
- return "-via" + commandFile;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPath()
- */
- public File[] getLibraryPath() {
- return CUtil.getPathFromEnvironment("ARMLIB", ";");
- }
- /*
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPatterns(java.lang.String[])
- */
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- //
- // TODO: looks like bad extension
- //
- return new String[]{".o"};
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Processor#getLinker(net.sf.antcontrib.cpptasks.compiler.LinkType)
- */
- public Linker getLinker(LinkType linkType) {
- return this;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getMaximumCommandLength()
- */
- protected int getMaximumCommandLength() {
- return 1024;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getOutputFileSwitch(java.lang.String)
- */
- protected String[] getOutputFileSwitch(String outputFile) {
- return new String[]{"-output", outputFile};
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#isCaseSensitive()
- */
- public boolean isCaseSensitive() {
- return false;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandCCompiler.java
deleted file mode 100644
index 3304c9a860..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandCCompiler.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.borland;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.CompilerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.PrecompilingCommandLineCCompiler;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Borland(r) C/C++ compiler.
- *
- * @author Curt Arnold
- */
-public class BorlandCCompiler extends PrecompilingCommandLineCCompiler {
- private static final String[] headerExtensions = new String[]{".h", ".hpp",
- ".inl"};
- private static final String[] sourceExtensions = new String[]{".c", ".cc",
- ".cpp", ".cxx", ".c++"};
- private static final BorlandCCompiler instance = new BorlandCCompiler(
- false, null);
- public static BorlandCCompiler getInstance() {
- return instance;
- }
- private BorlandCCompiler(boolean newEnvironment, Environment env) {
- super("bcc32", "--version", sourceExtensions, headerExtensions, ".obj", false,
- null, newEnvironment, env);
- }
- protected void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- args.addElement("-c");
- //
- // turn off compiler autodependency since
- // we do it ourselves
- args.addElement("-X");
- if (exceptions) {
- args.addElement("-x");
- } else {
- args.addElement("-x-");
- }
- if (multithreaded) {
- args.addElement("-tWM");
- }
- if (debug) {
- args.addElement("-Od");
- args.addElement("-v");
- } else {
- if (optimization != null) {
- if (optimization.isSpeed()) {
- args.addElement("-O1");
- } else {
- if (optimization.isSpeed()) {
- args.addElement("-O2");
- } else {
- if (optimization.isNoOptimization()) {
- args.addElement("-Od");
- }
- }
- }
- }
- }
- if (rtti != null && !rtti.booleanValue()) {
- args.addElement("-RT-");
- }
- }
- protected void addWarningSwitch(Vector args, int level) {
- BorlandProcessor.addWarningSwitch(args, level);
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new BorlandCCompiler(newEnvironment, env);
- }
- return this;
- }
- protected CompilerConfiguration createPrecompileGeneratingConfig(
- CommandLineCompilerConfiguration baseConfig, File prototype,
- String lastInclude) {
- String[] additionalArgs = new String[]{"-H=" + lastInclude, "-Hc"};
- return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
- null, true);
- }
- protected CompilerConfiguration createPrecompileUsingConfig(
- CommandLineCompilerConfiguration baseConfig, File prototype,
- String lastInclude, String[] exceptFiles) {
- String[] additionalArgs = new String[]{"-Hu"};
- return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
- exceptFiles, false);
- }
- protected void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- BorlandProcessor.getDefineSwitch(buffer, define, value);
- }
- protected File[] getEnvironmentIncludePath() {
- return BorlandProcessor.getEnvironmentPath("bcc32", 'I',
- new String[]{"..\\include"});
- }
- protected String getIncludeDirSwitch(String includeDir) {
- return BorlandProcessor.getIncludeDirSwitch("-I", includeDir);
- }
- public Linker getLinker(LinkType type) {
- return BorlandLinker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return 1024;
- }
- protected void getUndefineSwitch(StringBuffer buffer, String define) {
- BorlandProcessor.getUndefineSwitch(buffer, define);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandCfgParser.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandCfgParser.java
deleted file mode 100644
index 19daedd203..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandCfgParser.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.borland;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.parser.AbstractParser;
-import net.sf.antcontrib.cpptasks.parser.AbstractParserState;
-import net.sf.antcontrib.cpptasks.parser.LetterState;
-import net.sf.antcontrib.cpptasks.parser.WhitespaceOrLetterState;
-/**
- * A parser that paths from a borland cfg file
- *
- * @author Curt Arnold
- */
-public final class BorlandCfgParser extends AbstractParser {
- private AbstractParserState newLineState;
- private final Vector path = new Vector();
- /**
- *
- *
- */
- public BorlandCfgParser(char switchChar) {
- //
- // a quoted path (-I"some path")
- // doesn't end till a close quote and will be abandoned
- // if a new line is encountered first
- //
- AbstractParserState quote = new CfgFilenameState(this, new char[]{'"'});
- //
- // an unquoted path (-Ic:\borland\include)
- // ends at the first space or new line
- AbstractParserState unquote = new CfgFilenameState(this, new char[]{
- ' ', '\n', '\r'});
- AbstractParserState quoteBranch = new QuoteBranchState(this, quote,
- unquote);
- AbstractParserState toNextSwitch = new ConsumeToSpaceOrNewLine(this);
- AbstractParserState switchState = new LetterState(this, switchChar,
- quoteBranch, toNextSwitch);
- newLineState = new WhitespaceOrLetterState(this, '-', switchState);
- }
- public void addFilename(String include) {
- path.addElement(include);
- }
- public AbstractParserState getNewLineState() {
- return newLineState;
- }
- public String[] parsePath(Reader reader) throws IOException {
- path.setSize(0);
- super.parse(reader);
- String[] retval = new String[path.size()];
- path.copyInto(retval);
- return retval;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandLibrarian.java
deleted file mode 100644
index 5fb3eb0827..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandLibrarian.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.borland;
-import java.io.File;
-import java.io.IOException;
-import java.util.Vector;
-import org.apache.tools.ant.BuildException;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * Adapter for the Borland(r) tlib Librarian
- *
- * @author Curt Arnold
- */
-public class BorlandLibrarian extends CommandLineLinker {
- private static final BorlandLibrarian instance = new BorlandLibrarian();
- public static BorlandLibrarian getInstance() {
- return instance;
- }
- private BorlandLibrarian() {
- super("tlib", "--version", new String[]{".obj"}, new String[0], ".lib", false,
- null);
- }
- protected void addBase(long base, Vector args) {
- }
- protected void addFixed(Boolean fixed, Vector args) {
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- }
- protected void addIncremental(boolean incremental, Vector args) {
- }
- protected void addMap(boolean map, Vector args) {
- }
- protected void addStack(int stack, Vector args) {
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- }
-
- protected String getCommandFileSwitch(String cmdFile) {
- return BorlandProcessor.getCommandFileSwitch(cmdFile);
- }
- public File[] getLibraryPath() {
- return CUtil.getPathFromEnvironment("LIB", ";");
- }
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- return BorlandProcessor.getLibraryPatterns(libnames, libType);
- }
- public Linker getLinker(LinkType type) {
- return BorlandLinker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return 1024;
- }
- public String[] getOutputFileSwitch(String outFile) {
- return BorlandProcessor.getOutputFileSwitch(outFile);
- }
- public boolean isCaseSensitive() {
- return BorlandProcessor.isCaseSensitive();
- }
- /**
- * Gets identifier for the linker.
- *
- * TLIB will lockup when attempting to get version
- * information. Since the Librarian version isn't critical
- * just return a stock response.
- */
- public String getIdentifier() {
- return "TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation";
- }
-
- /**
- * Prepares argument list for exec command.
- *
- * @param outputFile
- * linker output file
- * @param sourceFiles
- * linker input files (.obj, .o, .res)
- * @param args
- * linker arguments
- * @return arguments for runTask
- */
- protected String[] prepareArguments(
- CCTask task,
- String outputDir,
- String outputName,
- String[] sourceFiles,
- CommandLineLinkerConfiguration config) {
- String[] preargs = config.getPreArguments();
- String[] endargs = config.getEndArguments();
- StringBuffer buf = new StringBuffer();
- Vector execArgs = new Vector(preargs.length + endargs.length + 10
- + sourceFiles.length);
-
- execArgs.addElement(this.getCommand());
- String outputFileName = new File(outputDir, outputName).toString();
- execArgs.addElement(quoteFilename(buf, outputFileName));
-
- for (int i = 0; i < preargs.length; i++) {
- execArgs.addElement(preargs[i]);
- }
-
- //
- // add a place-holder for page size
- //
- int pageSizeIndex = execArgs.size();
- execArgs.addElement(null);
-
- int objBytes = 0;
-
- for (int i = 0; i < sourceFiles.length; i++) {
- String last4 = sourceFiles[i]
- .substring(sourceFiles[i].length() - 4).toLowerCase();
- if (last4.equals(".def")) {
- } else {
- if (last4.equals(".res")) {
- } else {
- if (last4.equals(".lib")) {
- } else {
- execArgs.addElement("+" + quoteFilename(buf, sourceFiles[i]));
- objBytes += new File(sourceFiles[i]).length();
- }
- }
- }
- }
-
- for (int i = 0; i < endargs.length; i++) {
- execArgs.addElement(endargs[i]);
- }
-
- String[] execArguments = new String[execArgs.size()];
- execArgs.copyInto(execArguments);
-
- int minPageSize = objBytes >> 16;
- int pageSize = 0;
- for(int i = 4; i <= 15; i++) {
- pageSize = 1 << i;
- if (pageSize > minPageSize) break;
- }
- execArguments[pageSizeIndex] = "/P" + Integer.toString(pageSize);
-
- return execArguments;
- }
-
- /**
- * Prepares argument list to execute the linker using a response file.
- *
- * @param outputFile
- * linker output file
- * @param args
- * output of prepareArguments
- * @return arguments for runTask
- */
- protected String[] prepareResponseFile(File outputFile, String[] args)
- throws IOException {
- return BorlandProcessor.prepareResponseFile(outputFile, args, " & \n");
- }
-
- /**
- * Builds a library
- *
- */
- public void link(CCTask task,
- File outputFile,
- String[] sourceFiles,
- CommandLineLinkerConfiguration config)
- throws BuildException
- {
- //
- // delete any existing library
- outputFile.delete();
- //
- // build a new library
- super.link(task, outputFile, sourceFiles, config);
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandLinker.java
deleted file mode 100644
index f425c528bd..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandLinker.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.borland;
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * Adapter for the Borland(r) ilink32 linker
- *
- * @author Curt Arnold
- */
-public final class BorlandLinker extends CommandLineLinker {
- private static final BorlandLinker dllLinker = new BorlandLinker(".dll");
- private static final BorlandLinker instance = new BorlandLinker(".exe");
- public static BorlandLinker getInstance() {
- return instance;
- }
- private BorlandLinker(String outputSuffix) {
- super("ilink32", "-r", new String[]{".obj", ".lib", ".res"},
- new String[]{".map", ".pdb", ".lnk"}, outputSuffix, false, null);
- }
- protected void addBase(long base, Vector args) {
- if (base >= 0) {
- String baseAddr = Long.toHexString(base);
- args.addElement("-b:" + baseAddr);
- }
- }
- protected void addFixed(Boolean fixed, Vector args) {
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- if (linkType.isExecutable()) {
- if (linkType.isSubsystemConsole()) {
- args.addElement("/ap");
- } else {
- if (linkType.isSubsystemGUI()) {
- args.addElement("/Tpe");
- }
- }
- }
- if (linkType.isSharedLibrary()) {
- args.addElement("/Tpd");
- args.addElement("/Gi");
- }
- }
- protected void addIncremental(boolean incremental, Vector args) {
- }
- protected void addMap(boolean map, Vector args) {
- if (!map) {
- args.addElement("-x");
- }
- }
- protected void addStack(int stack, Vector args) {
- if (stack >= 0) {
- String stackStr = Integer.toHexString(stack);
- args.addElement("-S:" + stackStr);
- }
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- }
-
- public String getCommandFileSwitch(String commandFile) {
- return "@" + commandFile;
- }
- public String getIdentifier() {
- return "Borland Linker";
- }
- public File[] getLibraryPath() {
- return BorlandProcessor.getEnvironmentPath("ilink32", 'L',
- new String[]{"..\\lib"});
- }
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- return BorlandProcessor.getLibraryPatterns(libnames, libType);
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return BorlandLibrarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
- public int getMaximumCommandLength() {
- return 1024;
- }
- public String[] getOutputFileSwitch(String outFile) {
- return BorlandProcessor.getOutputFileSwitch(outFile);
- }
- protected String getStartupObject(LinkType linkType) {
- if (linkType.isSharedLibrary()) {
- return "c0d32.obj";
- }
- if (linkType.isSubsystemGUI()) {
- return "c0w32.obj";
- }
- if (linkType.isSubsystemConsole()) {
- return "c0x32.obj";
- }
- return null;
- }
- public boolean isCaseSensitive() {
- return BorlandProcessor.isCaseSensitive();
- }
- /**
- * Prepares argument list for exec command.
- *
- * @param outputFile
- * linker output file
- * @param sourceFiles
- * linker input files (.obj, .o, .res)
- * @param args
- * linker arguments
- * @return arguments for runTask
- */
- protected String[] prepareArguments(
- CCTask task,
- String outputDir,
- String outputName,
- String[] sourceFiles,
- CommandLineLinkerConfiguration config) {
- String[] preargs = config.getPreArguments();
- String[] endargs = config.getEndArguments();
- Vector execArgs = new Vector(preargs.length + endargs.length + 10
- + sourceFiles.length);
- execArgs.addElement(this.getCommand());
- for (int i = 0; i < preargs.length; i++) {
- execArgs.addElement(preargs[i]);
- }
- for (int i = 0; i < endargs.length; i++) {
- execArgs.addElement(endargs[i]);
- }
- //
- // see if the input files have any known startup obj files
- //
- String startup = null;
- for (int i = 0; i < sourceFiles.length; i++) {
- String filename = new File(sourceFiles[i]).getName().toLowerCase();
- if (startup != null && filename.substring(0, 2).equals("c0")
- && filename.substring(3, 5).equals("32")
- && filename.substring(filename.length() - 4).equals(".obj")) {
- startup = sourceFiles[i];
- }
- }
- //
- // c0w32.obj, c0x32.obj or c0d32.obj depending on
- // link type
- if (startup == null) {
- startup = config.getStartupObject();
- }
- execArgs.addElement(startup);
- Vector resFiles = new Vector();
- Vector libFiles = new Vector();
- String defFile = null;
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < sourceFiles.length; i++) {
- String last4 = sourceFiles[i]
- .substring(sourceFiles[i].length() - 4).toLowerCase();
- if (last4.equals(".def")) {
- defFile = quoteFilename(buf, sourceFiles[i]);
- } else {
- if (last4.equals(".res")) {
- resFiles.addElement(quoteFilename(buf, sourceFiles[i]));
- } else {
- if (last4.equals(".lib")) {
- libFiles.addElement(quoteFilename(buf, sourceFiles[i]));
- } else {
- execArgs.addElement(quoteFilename(buf, sourceFiles[i]));
- }
- }
- }
- }
- //
- // output file name
- //
- String outputFileName = new File(outputDir, outputName).toString();
- execArgs.addElement("," + quoteFilename(buf, outputFileName));
- if (config.getMap()) {
- int lastPeriod = outputFileName.lastIndexOf('.');
- String mapName;
- if (lastPeriod < outputFileName.length() - 4) {
- mapName = outputFileName + ".map";
- } else {
- mapName = outputFileName.substring(0, lastPeriod) + ".map";
- }
- execArgs.addElement("," + quoteFilename(buf, mapName) + ",");
- } else {
- execArgs.addElement(",,");
- }
- //
- // add all the libraries
- //
- Enumeration libEnum = libFiles.elements();
- boolean hasImport32 = false;
- boolean hasCw32 = false;
- while (libEnum.hasMoreElements()) {
- String libName = (String) libEnum.nextElement();
- if (libName.equalsIgnoreCase("import32.lib")) {
- hasImport32 = true;
- }
- if (libName.equalsIgnoreCase("cw32.lib")) {
- hasImport32 = true;
- }
- execArgs.addElement(quoteFilename(buf, libName));
- }
- if (!hasCw32) {
- execArgs.addElement(quoteFilename(buf, "cw32.lib"));
- }
- if (!hasImport32) {
- execArgs.addElement(quoteFilename(buf, "import32.lib"));
- }
- if (defFile == null) {
- execArgs.addElement(",,");
- } else {
- execArgs.addElement("," + quoteFilename(buf, defFile) + ",");
- }
- Enumeration resEnum = resFiles.elements();
- while (resEnum.hasMoreElements()) {
- String resName = (String) resEnum.nextElement();
- execArgs.addElement(quoteFilename(buf, resName));
- }
- String[] execArguments = new String[execArgs.size()];
- execArgs.copyInto(execArguments);
- return execArguments;
- }
- /**
- * Prepares argument list to execute the linker using a response file.
- *
- * @param outputFile
- * linker output file
- * @param args
- * output of prepareArguments
- * @return arguments for runTask
- */
- protected String[] prepareResponseFile(File outputFile, String[] args)
- throws IOException {
- return BorlandProcessor.prepareResponseFile(outputFile, args, " + \n");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandProcessor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandProcessor.java
deleted file mode 100644
index d53f00cc12..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandProcessor.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.borland;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Vector;
-import java.io.FileWriter;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-/**
- * A add-in class for Borland(r) processor adapters
- *
- *
- */
-public final class BorlandProcessor {
- public static void addWarningSwitch(Vector args, int level) {
- switch (level) {
- case 0 :
- args.addElement("-w-");
- break;
- case 5 :
- args.addElement("-w!");
- break;
- default :
- args.addElement("-w");
- break;
- }
- }
- public static String getCommandFileSwitch(String cmdFile) {
- StringBuffer buf = new StringBuffer("@");
- quoteFile(buf, cmdFile);
- return buf.toString();
- }
- public static void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- buffer.append("-D");
- buffer.append(define);
- if (value != null && value.length() > 0) {
- buffer.append('=');
- buffer.append(value);
- }
- }
- /**
- * This method extracts path information from the appropriate .cfg file in
- * the install directory.
- *
- * @param toolName
- * Tool name, for example, "bcc32", "brc32", "ilink32"
- * @param switchChar
- * Command line switch character, for example "L" for libraries
- * @param defaultRelativePaths
- * default paths relative to executable directory
- * @return path
- */
- public static File[] getEnvironmentPath(String toolName, char switchChar,
- String[] defaultRelativePath) {
- if (toolName == null) {
- throw new NullPointerException("toolName");
- }
- if (defaultRelativePath == null) {
- throw new NullPointerException("defaultRelativePath");
- }
- String[] path = defaultRelativePath;
- File exeDir = CUtil.getExecutableLocation(toolName + ".exe");
- if (exeDir != null) {
- File cfgFile = new File(exeDir, toolName + ".cfg");
- if (cfgFile.exists()) {
- try {
- Reader reader = new BufferedReader(new FileReader(cfgFile));
- BorlandCfgParser cfgParser = new BorlandCfgParser(
- switchChar);
- path = cfgParser.parsePath(reader);
- reader.close();
- } catch (IOException ex) {
- //
- // could be logged
- //
- }
- }
- } else {
- //
- // if can't find the executable,
- // assume current directory to resolve relative paths
- //
- exeDir = new File(System.getProperty("user.dir"));
- }
- int nonExistant = 0;
- File[] resourcePath = new File[path.length];
- for (int i = 0; i < path.length; i++) {
- resourcePath[i] = new File(path[i]);
- if (!resourcePath[i].isAbsolute()) {
- resourcePath[i] = new File(exeDir, path[i]);
- }
- //
- // if any of the entries do not exist or are
- // not directories, null them out
- if (!(resourcePath[i].exists() && resourcePath[i].isDirectory())) {
- resourcePath[i] = null;
- nonExistant++;
- }
- }
- //
- // if there were some non-existant or non-directory
- // entries in the configuration file then
- // create a shorter array
- if (nonExistant > 0) {
- File[] culled = new File[resourcePath.length - nonExistant];
- int index = 0;
- for (int i = 0; i < resourcePath.length; i++) {
- if (resourcePath[i] != null) {
- culled[index++] = resourcePath[i];
- }
- }
- resourcePath = culled;
- }
- return resourcePath;
- }
- public static String getIncludeDirSwitch(String includeOption,
- String includeDir) {
- StringBuffer buf = new StringBuffer(includeOption);
- quoteFile(buf, includeDir);
- return buf.toString();
- }
- public static String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- StringBuffer buf = new StringBuffer();
- String[] patterns = new String[libnames.length];
- for (int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(libnames[i]);
- buf.append(".lib");
- patterns[i] = buf.toString();
- }
- return patterns;
- }
- public static String[] getOutputFileSwitch(String outFile) {
- return new String[0];
- }
- public static void getUndefineSwitch(StringBuffer buffer, String define) {
- buffer.append("-U");
- buffer.append(define);
- }
- public static boolean isCaseSensitive() {
- return false;
- }
- private static void quoteFile(StringBuffer buf, String outPath) {
- if (outPath.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(outPath);
- buf.append('\"');
- } else {
- buf.append(outPath);
- }
- }
-
- /**
- * Prepares argument list to execute the linker using a response file.
- *
- * @param outputFile
- * linker output file
- * @param args
- * output of prepareArguments
- * @return arguments for runTask
- */
- public static String[] prepareResponseFile(File outputFile,
- String[] args,
- String continuation)
- throws IOException {
- String baseName = outputFile.getName();
- File commandFile = new File(outputFile.getParent(), baseName + ".lnk");
- FileWriter writer = new FileWriter(commandFile);
- for (int i = 1; i < args.length - 1; i++) {
- writer.write(args[i]);
- //
- // if either the current argument ends with
- // or next argument starts with a comma then
- // don't split the line
- if (args[i].endsWith(",") || args[i + 1].startsWith(",")) {
- writer.write(' ');
- } else {
- //
- // split the line to make it more readable
- //
- writer.write(continuation);
- }
- }
- //
- // write the last argument
- //
- if (args.length > 1) {
- writer.write(args[args.length - 1]);
- }
- writer.close();
- String[] execArgs = new String[2];
- execArgs[0] = args[0];
- execArgs[1] = getCommandFileSwitch(commandFile.toString());
- return execArgs;
- }
-
- private BorlandProcessor() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandResourceCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandResourceCompiler.java
deleted file mode 100644
index 5e8609797e..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/BorlandResourceCompiler.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.borland;
-import java.io.File;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.compiler.ProgressMonitor;
-import net.sf.antcontrib.cpptasks.parser.CParser;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Borland(r) brc32 Resource compiler.
- *
- * @author Curt Arnold
- */
-public class BorlandResourceCompiler extends CommandLineCompiler {
- private static final BorlandResourceCompiler instance = new BorlandResourceCompiler(
- false, null);
- public static BorlandResourceCompiler getInstance() {
- return instance;
- }
- private BorlandResourceCompiler(boolean newEnvironment, Environment env) {
- super("brc32", "c:\\__bogus\\__bogus.rc", new String[]{".rc"},
- new String[]{".h", ".hpp", ".inl"}, ".res", false, null,
- newEnvironment, env);
- }
- protected void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- //
- // compile only
- //
- args.addElement("-r");
- }
- protected void addWarningSwitch(Vector args, int level) {
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new BorlandResourceCompiler(newEnvironment, env);
- }
- return this;
- }
- public void compile(CCTask task, File outputDir, String[] sourceFiles,
- String[] args, String[] endArgs, boolean relentless,
- CommandLineCompilerConfiguration config, ProgressMonitor monitor)
- throws BuildException {
- super.compile(task, outputDir, sourceFiles, args, endArgs, relentless,
- config, monitor);
- }
- /**
- * The include parser for C will work just fine, but we didn't want to
- * inherit from CommandLineCCompiler
- */
- protected Parser createParser(File source) {
- return new CParser();
- }
- protected int getArgumentCountPerInputFile() {
- return 2;
- }
- protected void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- buffer.append("-d");
- buffer.append(define);
- if (value != null && value.length() > 0) {
- buffer.append('=');
- buffer.append(value);
- }
- }
- protected File[] getEnvironmentIncludePath() {
- return BorlandProcessor.getEnvironmentPath("brc32", 'i',
- new String[]{"..\\include"});
- }
- protected String getIncludeDirSwitch(String includeDir) {
- return BorlandProcessor.getIncludeDirSwitch("-i", includeDir);
- }
- protected String getInputFileArgument(File outputDir, String filename,
- int index) {
- if (index == 0) {
- String outputFileName = getOutputFileName(filename);
- String fullOutputName = new File(outputDir, outputFileName)
- .toString();
- return "-fo" + fullOutputName;
- }
- return filename;
- }
- public Linker getLinker(LinkType type) {
- return BorlandLinker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return 1024;
- }
- protected int getMaximumInputFilesPerCommand() {
- return 1;
- }
- protected int getTotalArgumentLengthForInputFile(File outputDir,
- String inputFile) {
- String arg1 = getInputFileArgument(outputDir, inputFile, 0);
- String arg2 = getInputFileArgument(outputDir, inputFile, 1);
- return arg1.length() + arg2.length() + 2;
- }
- protected void getUndefineSwitch(StringBuffer buffer, String define) {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/CfgFilenameState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/CfgFilenameState.java
deleted file mode 100644
index a3651d3b25..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/CfgFilenameState.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.borland;
-import net.sf.antcontrib.cpptasks.parser.AbstractParser;
-import net.sf.antcontrib.cpptasks.parser.AbstractParserState;
-import net.sf.antcontrib.cpptasks.parser.FilenameState;
-public class CfgFilenameState extends FilenameState {
- private char terminator;
- public CfgFilenameState(AbstractParser parser, char[] terminators) {
- super(parser, terminators);
- terminator = terminators[0];
- }
- public AbstractParserState consume(char ch) {
- //
- // if a ';' is encountered then
- // close the previous filename by sending a
- // recognized terminator to our super class
- // and stay in this state for more filenamese
- if (ch == ';') {
- super.consume(terminator);
- return this;
- }
- AbstractParserState newState = super.consume(ch);
- //
- // change null (consume to end of line)
- // to look for next switch character
- if (newState == null) {
- newState = getParser().getNewLineState();
- }
- return newState;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/ConsumeToSpaceOrNewLine.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/ConsumeToSpaceOrNewLine.java
deleted file mode 100644
index d1dd072cce..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/ConsumeToSpaceOrNewLine.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.borland;
-import net.sf.antcontrib.cpptasks.parser.AbstractParser;
-import net.sf.antcontrib.cpptasks.parser.AbstractParserState;
-public class ConsumeToSpaceOrNewLine extends AbstractParserState {
- public ConsumeToSpaceOrNewLine(AbstractParser parser) {
- super(parser);
- }
- public AbstractParserState consume(char ch) {
- if (ch == ' ' || ch == '\t' || ch == '\n') {
- return getParser().getNewLineState();
- }
- return this;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/QuoteBranchState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/QuoteBranchState.java
deleted file mode 100644
index 89724b26e5..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/borland/QuoteBranchState.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.borland;
-import net.sf.antcontrib.cpptasks.parser.AbstractParser;
-import net.sf.antcontrib.cpptasks.parser.AbstractParserState;
-public class QuoteBranchState extends AbstractParserState {
- private AbstractParserState quote;
- private AbstractParserState unquote;
- public QuoteBranchState(AbstractParser parser, AbstractParserState quote,
- AbstractParserState unquote) {
- super(parser);
- this.quote = quote;
- this.unquote = unquote;
- }
- public AbstractParserState consume(char ch) {
- if (ch == '"') {
- return quote;
- }
- return unquote.consume(ch);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java
deleted file mode 100644
index e1d3deb8b6..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranCompiler.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compaq;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineFortranCompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Compaq(r) Visual Fortran compiler.
- *
- * @author Curt Arnold
- */
-public class CompaqVisualFortranCompiler extends CommandLineFortranCompiler {
- private static final CompaqVisualFortranCompiler[] instance = new CompaqVisualFortranCompiler[]{new CompaqVisualFortranCompiler(
- false, null)};
- public static CompaqVisualFortranCompiler getInstance() {
- return instance[0];
- }
- private CompaqVisualFortranCompiler(boolean newEnvironment, Environment env) {
- super("DF", null, new String[]{".f90", ".for", ".f"}, new String[]{
- ".i", ".i90", ".fpp", ".inc", ".bak", ".exe"}, ".obj", false,
- null, newEnvironment, env);
- }
- protected void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- args.addElement("/nologo");
- args.addElement("/compile_only");
- if (debug) {
- args.addElement("/debug:full");
- args.addElement("/define:_DEBUG");
- } else {
- args.addElement("/debug:none");
- args.addElement("/define:NDEBUG");
- }
- if (multithreaded) {
- args.addElement("/threads");
- args.addElement("/define:_MT");
- } else {
- args.addElement("/nothreads");
- }
- boolean staticRuntime = linkType.isStaticRuntime();
- if (staticRuntime) {
- args.addElement("/libs:static");
- } else {
- args.addElement("/libs:dll");
- }
- if (linkType.isSharedLibrary()) {
- args.addElement("/dll");
- args.addElement("/define:_DLL");
- }
- }
- public void addWarningSwitch(Vector args, int level) {
- switch (level) {
- case 0 :
- args.addElement("/nowarn");
- break;
- case 1 :
- break;
- case 2 :
- break;
- case 3 :
- args.addElement("/warn:usage");
- break;
- case 4 :
- args.addElement("/warn:all");
- break;
- case 5 :
- args.addElement("/warn:errors");
- break;
- }
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new CompaqVisualFortranCompiler(newEnvironment, env);
- }
- return this;
- }
- protected void getDefineSwitch(StringBuffer buf, String define, String value) {
- buf.append("/define:");
- buf.append(define);
- if (value != null && value.length() > 0) {
- buf.append('=');
- buf.append(value);
- }
- }
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ";");
- }
- protected String getIncludeDirSwitch(String includeDir) {
- StringBuffer buf = new StringBuffer("/include:");
- if (includeDir.indexOf(' ') >= 0) {
- buf.append('"');
- buf.append(includeDir);
- buf.append('"');
- } else {
- buf.append(includeDir);
- }
- return buf.toString();
- }
- public Linker getLinker(LinkType type) {
- return CompaqVisualFortranLinker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return 1024;
- }
- protected void getUndefineSwitch(StringBuffer buf, String define) {
- buf.append("/undefine:");
- buf.append(define);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java
deleted file mode 100644
index eb4a40769e..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compaq;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioLibrarian;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioProcessor;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * Adapter for the Compaq(r) Visual Fortran Librarian
- *
- * @author Curt Arnold
- */
-public class CompaqVisualFortranLibrarian extends CommandLineLinker {
- private static final CompaqVisualFortranLibrarian instance = new CompaqVisualFortranLibrarian();
- public static CompaqVisualFortranLibrarian getInstance() {
- return instance;
- }
- private CompaqVisualFortranLibrarian() {
- super("lib", "/bogus", new String[]{".obj"}, new String[0], ".lib",
- false, null);
- }
- protected void addBase(long base, Vector args) {
- }
- protected void addFixed(Boolean fixed, Vector args) {
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- args.addElement("/nologo");
- }
- protected void addIncremental(boolean incremental, Vector args) {
- }
- protected void addMap(boolean map, Vector args) {
- }
- protected void addStack(int stack, Vector args) {
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- }
-
- protected String getCommandFileSwitch(String commandFile) {
- return DevStudioProcessor.getCommandFileSwitch(commandFile);
- }
- public File[] getLibraryPath() {
- return new File[0];
- }
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- return new String[0];
- }
- public Linker getLinker(LinkType type) {
- return CompaqVisualFortranLinker.getInstance().getLinker(type);
- }
- protected int getMaximumCommandLength() {
- return DevStudioLibrarian.getInstance().getMaximumCommandLength();
- }
- protected String[] getOutputFileSwitch(String outputFile) {
- return DevStudioLibrarian.getInstance().getOutputFileSwitch(outputFile);
- }
- public boolean isCaseSensitive() {
- return false;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java
deleted file mode 100644
index d83e3b213d..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLinker.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compaq;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioCompatibleLinker;
-/**
- * Adapter for the Compaq(r) Visual Fortran linker.
- *
- * @author Curt Arnold
- */
-public final class CompaqVisualFortranLinker extends DevStudioCompatibleLinker {
- private static final CompaqVisualFortranLinker dllLinker = new CompaqVisualFortranLinker(
- ".dll");
- private static final CompaqVisualFortranLinker instance = new CompaqVisualFortranLinker(
- ".exe");
- public static CompaqVisualFortranLinker getInstance() {
- return instance;
- }
- private CompaqVisualFortranLinker(String outputSuffix) {
- super("DF", "__bogus__.xxx", outputSuffix);
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
- args.addElement("/NOLOGO");
- boolean staticRuntime = linkType.isStaticRuntime();
- if (staticRuntime) {
- args.addElement("/libs:static");
- } else {
- args.addElement("/libs:dll");
- }
- if (debug) {
- args.addElement("/debug");
- } else {
- }
- if (linkType.isSharedLibrary()) {
- args.addElement("/dll");
- } else {
- args.addElement("/exe");
- }
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return CompaqVisualFortranLibrarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
- public String[] getOutputFileSwitch(String outputFile) {
- StringBuffer buf = new StringBuffer("/OUT:");
- if (outputFile.indexOf(' ') >= 0) {
- buf.append('"');
- buf.append(outputFile);
- buf.append('"');
- } else {
- buf.append(outputFile);
- }
- return new String[]{buf.toString()};
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractAslcompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractAslcompiler.java
deleted file mode 100644
index 90c539c965..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractAslcompiler.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.AslcompilerDef;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.TargetDef;
-
-/**
- * An abstract asl compiler implementation.
- *
- */
-public abstract class AbstractAslcompiler extends AbstractProcessor
-implements Aslcompiler {
- private String outputSuffix;
- protected AbstractAslcompiler(String[] sourceExtensions,
- String[] headerExtensions, String outputSuffix) {
- super(sourceExtensions, headerExtensions);
- this.outputSuffix = outputSuffix;
- }
- abstract protected AslcompilerConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef[] baseConfigs,
- AslcompilerDef specificConfig, TargetDef targetPlatform);
-
- public ProcessorConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef[] baseConfigs,
- ProcessorDef specificConfig, TargetDef targetPlatform) {
- if (specificConfig == null) {
- throw new NullPointerException("specificConfig");
- }
- return createConfiguration(task, linkType, baseConfigs,
- (AslcompilerDef) specificConfig, targetPlatform);
- }
-
- public String getOutputFileName(String inputFile) {
- if (bid(inputFile) > 1) {
- String baseName = getBaseOutputName(inputFile);
- return baseName + outputSuffix;
- }
- return null;
- }
- protected String getBaseOutputName(String inputFile) {
- int lastSlash = inputFile.lastIndexOf('/');
- int lastReverse = inputFile.lastIndexOf('\\');
- int lastSep = inputFile.lastIndexOf(File.separatorChar);
- if (lastReverse > lastSlash) {
- lastSlash = lastReverse;
- }
- if (lastSep > lastSlash) {
- lastSlash = lastSep;
- }
- int lastPeriod = inputFile.lastIndexOf('.');
- if (lastPeriod < 0) {
- lastPeriod = inputFile.length();
- }
- return inputFile.substring(lastSlash + 1, lastPeriod);
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractAssembler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractAssembler.java
deleted file mode 100644
index 1d49232a05..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractAssembler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.AssemblerDef;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.TargetDef;
-/**
- * An abstract assembler implementation.
- *
- */
-public abstract class AbstractAssembler extends AbstractProcessor
-implements Assembler {
- private String outputSuffix;
- protected AbstractAssembler(String[] sourceExtensions,
- String[] headerExtensions, String outputSuffix) {
- super(sourceExtensions, headerExtensions);
- this.outputSuffix = outputSuffix;
- }
- abstract protected AssemblerConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef[] baseConfigs,
- AssemblerDef specificConfig, TargetDef targetPlatform);
- public ProcessorConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef[] baseConfigs,
- ProcessorDef specificConfig, TargetDef targetPlatform) {
- if (specificConfig == null) {
- throw new NullPointerException("specificConfig");
- }
- return createConfiguration(task, linkType, baseConfigs,
- (AssemblerDef) specificConfig, targetPlatform);
- }
- public String getOutputFileName(String inputFile) {
- if (bid(inputFile) > 1) {
- String baseName = getBaseOutputName(inputFile);
- return baseName + outputSuffix;
- }
- return null;
- }
- protected String getBaseOutputName(String inputFile) {
- int lastSlash = inputFile.lastIndexOf('/');
- int lastReverse = inputFile.lastIndexOf('\\');
- int lastSep = inputFile.lastIndexOf(File.separatorChar);
- if (lastReverse > lastSlash) {
- lastSlash = lastReverse;
- }
- if (lastSep > lastSlash) {
- lastSlash = lastSep;
- }
- int lastPeriod = inputFile.lastIndexOf('.');
- if (lastPeriod < 0) {
- lastPeriod = inputFile.length();
- }
- return inputFile.substring(lastSlash + 1, lastPeriod);
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractCompiler.java
deleted file mode 100644
index f16ec6caf3..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractCompiler.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.CompilerDef;
-import net.sf.antcontrib.cpptasks.DependencyInfo;
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-import net.sf.antcontrib.cpptasks.TargetDef;
-
-/**
- * An abstract compiler implementation.
- *
- * @author Adam Murdoch
- * @author Curt Arnold
- */
-public abstract class AbstractCompiler extends AbstractProcessor
- implements
- Compiler {
- private static final String[] emptyIncludeArray = new String[0];
- private String outputSuffix;
- protected AbstractCompiler(String[] sourceExtensions,
- String[] headerExtensions, String outputSuffix) {
- super(sourceExtensions, headerExtensions);
- this.outputSuffix = outputSuffix;
- }
- /**
- * Checks file name to see if parse should be attempted
- *
- * Default implementation returns false for files with extensions '.dll',
- * 'tlb', '.res'
- *
- */
- protected boolean canParse(File sourceFile) {
- String sourceName = sourceFile.toString();
- int lastPeriod = sourceName.lastIndexOf('.');
- if (lastPeriod >= 0 && lastPeriod == sourceName.length() - 4) {
- String ext = sourceName.substring(lastPeriod).toUpperCase();
- if (ext.equals(".DLL") || ext.equals(".TLB") || ext.equals(".RES")) {
- return false;
- }
- }
- return true;
- }
- abstract protected CompilerConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef[] baseConfigs,
- CompilerDef specificConfig, TargetDef targetPlatform);
- public ProcessorConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef[] baseConfigs,
- ProcessorDef specificConfig, TargetDef targetPlatform) {
- if (specificConfig == null) {
- throw new NullPointerException("specificConfig");
- }
- return createConfiguration(task, linkType, baseConfigs,
- (CompilerDef) specificConfig, targetPlatform);
- }
- abstract protected Parser createParser(File sourceFile);
- protected String getBaseOutputName(String inputFile) {
- int lastSlash = inputFile.lastIndexOf('/');
- int lastReverse = inputFile.lastIndexOf('\\');
- int lastSep = inputFile.lastIndexOf(File.separatorChar);
- if (lastReverse > lastSlash) {
- lastSlash = lastReverse;
- }
- if (lastSep > lastSlash) {
- lastSlash = lastSep;
- }
- int lastPeriod = inputFile.lastIndexOf('.');
- if (lastPeriod < 0) {
- lastPeriod = inputFile.length();
- }
- return inputFile.substring(lastSlash + 1, lastPeriod);
- }
- public String getOutputFileName(String inputFile) {
- //
- // if a recognized input file
- //
- if (bid(inputFile) > 1) {
- String baseName = getBaseOutputName(inputFile);
- return baseName + outputSuffix;
- }
- return null;
- }
- /**
- * Returns dependency info for the specified source file
- *
- * @param task
- * task for any diagnostic output
- * @param source
- * file to be parsed
- * @param includePath
- * include path to be used to resolve included files
- *
- * @param sysIncludePath
- * sysinclude path from build file, files resolved using
- * sysInclude path will not participate in dependency analysis
- *
- * @param envIncludePath
- * include path from environment variable, files resolved with
- * envIncludePath will not participate in dependency analysis
- *
- * @param baseDir
- * used to produce relative paths in DependencyInfo
- * @param includePathIdentifier
- * used to distinguish DependencyInfo's from different include
- * path settings
- *
- * @author Curt Arnold
- */
- public final DependencyInfo parseIncludes(CCTask task, File source,
- File[] includePath, File[] sysIncludePath, File[] envIncludePath,
- File baseDir, String includePathIdentifier) {
- //
- // if any of the include files can not be identified
- // change the sourceLastModified to Long.MAX_VALUE to
- // force recompilation of anything that depends on it
- long sourceLastModified = source.lastModified();
- File[] sourcePath = new File[1];
- sourcePath[0] = new File(source.getParent());
- Vector onIncludePath = new Vector();
- Vector onSysIncludePath = new Vector();
- String baseDirPath;
- try {
- baseDirPath = baseDir.getCanonicalPath();
- } catch (IOException ex) {
- baseDirPath = baseDir.toString();
- }
- String relativeSource = CUtil.getRelativePath(baseDirPath, source);
- String[] includes = emptyIncludeArray;
- if (canParse(source)) {
- Parser parser = createParser(source);
- try {
- Reader reader = new BufferedReader(new FileReader(source));
- parser.parse(reader);
- includes = parser.getIncludes();
- } catch (IOException ex) {
- task.log("Error parsing " + source.toString() + ":"
- + ex.toString());
- includes = new String[0];
- }
- }
- for (int i = 0; i < includes.length; i++) {
- String includeName = includes[i];
- if (!resolveInclude(includeName, sourcePath, onIncludePath)) {
- if (!resolveInclude(includeName, includePath, onIncludePath)) {
- if (!resolveInclude(includeName, sysIncludePath,
- onSysIncludePath)) {
- if (!resolveInclude(includeName, envIncludePath,
- onSysIncludePath)) {
- //
- // this should be enough to require us to reparse
- // the file with the missing include for dependency
- // information without forcing a rebuild
- sourceLastModified++;
- }
- }
- }
- }
- }
- for (int i = 0; i < onIncludePath.size(); i++) {
- String relativeInclude = CUtil.getRelativePath(baseDirPath,
- (File) onIncludePath.elementAt(i));
- onIncludePath.setElementAt(relativeInclude, i);
- }
- for (int i = 0; i < onSysIncludePath.size(); i++) {
- String relativeInclude = CUtil.getRelativePath(baseDirPath,
- (File) onSysIncludePath.elementAt(i));
- onSysIncludePath.setElementAt(relativeInclude, i);
- }
- return new DependencyInfo(includePathIdentifier, relativeSource,
- sourceLastModified, onIncludePath, onSysIncludePath);
- }
- protected boolean resolveInclude(String includeName, File[] includePath,
- Vector onThisPath) {
- for (int i = 0; i < includePath.length; i++) {
- File includeFile = new File(includePath[i], includeName);
- if (includeFile.exists()) {
- onThisPath.addElement(includeFile);
- return true;
- }
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java
deleted file mode 100644
index 20580e5d33..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.LinkerDef;
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.TargetDef;
-
-
-import org.apache.tools.ant.types.Environment;
-/**
- * An abstract Linker implementation.
- *
- * @author Adam Murdoch
- */
-public abstract class AbstractLinker extends AbstractProcessor
- implements
- Linker {
- public AbstractLinker(String[] objExtensions, String[] ignoredExtensions) {
- super(objExtensions, ignoredExtensions);
- }
- /**
- * Returns the bid of the processor for the file.
- *
- * A linker will bid 1 on any unrecognized file type.
- *
- * @param inputFile
- * filename of input file
- * @return bid for the file, 0 indicates no interest, 1 indicates that the
- * processor recognizes the file but doesn't process it (header
- * files, for example), 100 indicates strong interest
- */
- public int bid(String inputFile) {
- int bid = super.bid(inputFile);
- switch (bid) {
- //
- // unrecognized extension, take the file
- //
- case 0 :
- return 1;
- //
- // discard the ignored extensions
- //
- case 1 :
- return 0;
- }
- return bid;
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- return this;
- }
- abstract protected LinkerConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef[] baseConfigs,
- LinkerDef specificConfig, TargetDef targetPlatform);
- public ProcessorConfiguration createConfiguration(CCTask task,
- LinkType linkType, ProcessorDef[] baseConfigs,
- ProcessorDef specificConfig,
- TargetDef targetPlatform) {
- if (specificConfig == null) {
- throw new NullPointerException("specificConfig");
- }
- return createConfiguration(task, linkType, baseConfigs,
- (LinkerDef) specificConfig, targetPlatform);
- }
- public String getLibraryKey(File libfile) {
- return libfile.getName();
- }
- public abstract String getOutputFileName(String fileName);
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java
deleted file mode 100644
index b6456d5e3e..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import org.apache.tools.ant.types.Environment;
-/**
- * An abstract processor (compiler/linker) implementation.
- *
- * @author Curt Arnold
- */
-public abstract class AbstractProcessor implements Processor, Cloneable {
- /**
- * default bid for a file name that the processor recognizes but does not
- * process and does not want to fall through to the linker
- */
- public final static int DEFAULT_DISCARD_BID = 1;
- /**
- * default bid for a file name that the processor desires to process
- */
- public final static int DEFAULT_PROCESS_BID = 100;
- /**
- * Determines the identification of a command line processor by capture the
- * first line of its output for a specific command.
- *
- * @param command
- * array of command line arguments starting with executable
- * name. For example, { "cl" }
- * @param fallback
- * start of identifier if there is an error in executing the
- * command
- * @return identifier for the processor
- */
- protected static String getIdentifier(String[] command, String fallback) {
- String identifier = fallback;
- try {
- String[] cmdout = CaptureStreamHandler.run(command);
- if (cmdout.length > 0) {
- identifier = cmdout[0];
- }
- } catch (Throwable ex) {
- identifier = fallback + ":" + ex.toString();
- }
- return identifier;
- }
- private final String[] headerExtensions;
- private final String[] sourceExtensions;
- protected AbstractProcessor(String[] sourceExtensions,
- String[] headerExtensions) {
- this.sourceExtensions = (String[]) sourceExtensions.clone();
- this.headerExtensions = (String[]) headerExtensions.clone();
- }
- /**
- * Returns the bid of the processor for the file.
- *
- * @param inputFile
- * filename of input file
- * @return bid for the file, 0 indicates no interest, 1 indicates that the
- * processor recognizes the file but doesn't process it (header
- * files, for example), 100 indicates strong interest
- */
- public int bid(String inputFile) {
- String lower = inputFile.toLowerCase();
- for (int i = 0; i < sourceExtensions.length; i++) {
- if (lower.endsWith(sourceExtensions[i])) {
- return DEFAULT_PROCESS_BID;
- }
- }
- for (int i = 0; i < headerExtensions.length; i++) {
- if (lower.endsWith(headerExtensions[i])) {
- return DEFAULT_DISCARD_BID;
- }
- }
- return 0;
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- return this;
- }
- protected Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
- public String[] getHeaderExtensions() {
- return (String[]) this.headerExtensions.clone();
- }
- abstract public String getIdentifier();
- /**
- * Gets the target operating system architecture
- *
- * @return String target operating system architecture
- */
- protected String getOSArch() {
- return System.getProperty("os.arch");
- }
- /**
- * Gets the target operating system name
- *
- * @return String target operating system name
- */
- protected String getOSName() {
- return System.getProperty("os.name");
- }
- public String[] getSourceExtensions() {
- return (String[]) this.sourceExtensions.clone();
- }
- /**
- * Returns true if the target operating system is Mac OS X or Darwin.
- *
- * @return boolean
- */
- protected boolean isDarwin() {
- String osName = getOSName();
- return "Mac OS X".equals(osName);
- }
- public final String toString() {
- return getIdentifier();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Aslcompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Aslcompiler.java
deleted file mode 100644
index a210e1c684..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Aslcompiler.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-/**
- * A asl compiler.
- *
- */
-public interface Aslcompiler extends Processor {
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AslcompilerConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AslcompilerConfiguration.java
deleted file mode 100644
index 62ac2760c6..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AslcompilerConfiguration.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import org.apache.tools.ant.BuildException;
-/**
- * A configuration for an ASL compiler
- *
- */
-public interface AslcompilerConfiguration extends ProcessorConfiguration {
- void aslcompiler(CCTask task, File outputDir, String[] sourceFiles) throws BuildException;
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Assembler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Assembler.java
deleted file mode 100644
index 1b6d7b5d11..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Assembler.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-/**
- * A assembler.
- *
- */
-public interface Assembler extends Processor {
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AssemblerConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AssemblerConfiguration.java
deleted file mode 100644
index 9411551b47..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AssemblerConfiguration.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import org.apache.tools.ant.BuildException;
-/**
- * A configuration for an assembler
- *
- */
-public interface AssemblerConfiguration extends ProcessorConfiguration {
- void assembler(CCTask task, File outputDir, String[] sourceFiles) throws BuildException;
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java
deleted file mode 100644
index 1b89a70a58..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.Vector;
-
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
-/**
- * Implements ExecuteStreamHandler to capture the output of a Execute to an
- * array of strings
- *
- * @author Curt Arnold
- */
-public class CaptureStreamHandler implements ExecuteStreamHandler {
- /**
- * Runs an executable and captures the output in a String array
- *
- * @param cmdline
- * command line arguments
- * @return output of process
- */
- public static String[] run(String[] cmdline) {
- CaptureStreamHandler handler = new CaptureStreamHandler();
- Execute exec = new Execute(handler);
- exec.setCommandline(cmdline);
- try {
- int status = exec.execute();
- } catch (IOException ex) {
- }
- return handler.getOutput();
- }
- private InputStream errorStream;
- private InputStream fromProcess;
- public CaptureStreamHandler() {
- }
- public String[] getOutput() {
- String[] output;
- if (fromProcess != null) {
- Vector lines = new Vector(10);
- try {
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(errorStream));
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 100; j++) {
- String line = reader.readLine();
- if (line == null) {
- reader = new BufferedReader(new InputStreamReader(
- fromProcess));
- break;
- }
- lines.addElement(line);
- }
- }
- } catch (IOException ex) {
- }
- output = new String[lines.size()];
- lines.copyInto(output);
- return output;
- }
- output = new String[0];
- return output;
- }
- /**
- * Install a handler for the error stream of the subprocess.
- *
- * @param is
- * input stream to read from the error stream from the
- * subprocess
- */
- public void setProcessErrorStream(InputStream is) throws IOException {
- errorStream = is;
- }
- /**
- * Install a handler for the input stream of the subprocess.
- *
- * @param os
- * output stream to write to the standard input stream of the
- * subprocess
- */
- public void setProcessInputStream(OutputStream os) throws IOException {
- os.close();
- }
- /**
- * Install a handler for the output stream of the subprocess.
- *
- * @param is
- * input stream to read from the error stream from the
- * subprocess
- */
- public void setProcessOutputStream(InputStream is) throws IOException {
- fromProcess = is;
- }
- /**
- * Start handling of the streams.
- */
- public void start() throws IOException {
- }
- /**
- * Stop handling of the streams - will not be restarted.
- */
- public void stop() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompiler.java
deleted file mode 100644
index 88dda5796f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompiler.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-
-import java.io.File;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.AslcompilerDef;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.TargetDef;
-import net.sf.antcontrib.cpptasks.types.CommandLineArgument;
-
-import org.apache.tools.ant.BuildException;
-/**
- * An abstract ASL Compiler implementation which uses an external program to
- * perform the ASL compile.
- *
- */
-public abstract class CommandLineAslcompiler extends AbstractAslcompiler{
-
- private String command;
- private String identifier;
- private String identifierArg;
-
- protected CommandLineAslcompiler(String command, String identifierArg,
- String[] sourceExtensions, String[] headerExtensions,
- String outputSuffix) {
- super(sourceExtensions, headerExtensions, outputSuffix);
- this.command = command;
- this.identifierArg = identifierArg;
- }
-
- abstract protected void addImpliedArgs(Vector args, boolean debug,
- Boolean defaultflag);
-
- /**
- * Compile a ACPI source file
- *
- */
- public void aslcompiler(CCTask task, File outputDir, String[] sourceFiles,
- String[] args, String[] endArgs) throws BuildException{
- String command = getCommand();
- int baseLength = command.length() + args.length + endArgs.length;
- for (int i = 0; i < args.length; i++) {
- baseLength += args[i].length();
- }
- for (int i = 0; i < endArgs.length; i++) {
- baseLength += endArgs[i].length();
- }
- if (baseLength > getMaximumCommandLength()) {
- throw new BuildException(
- "Command line is over maximum length without sepcifying source file");
- }
- int maxInputFilesPerCommand = getMaximumInputFilesPerCommand();
- int argumentCountPerInputFile = getArgumentCountPerInputFIle();
- for (int sourceIndex = 0; sourceIndex < sourceFiles.length;) {
- int cmdLength = baseLength;
- int firstFileNextExec;
- for (firstFileNextExec = sourceIndex; firstFileNextExec < sourceFiles.length
- && (firstFileNextExec - sourceIndex) < maxInputFilesPerCommand; firstFileNextExec++) {
- cmdLength += getTotalArgumentLengthForInputFile(outputDir,
- sourceFiles[firstFileNextExec]);
- if (cmdLength >= getMaximumCommandLength())
- break;
- }
- if (firstFileNextExec == sourceIndex) {
- throw new BuildException(
- "Extremely long file name, can't fit on command line");
- }
- int argCount = args.length + 1 + endArgs.length
- + (firstFileNextExec - sourceIndex)
- * argumentCountPerInputFile;
- String[] commandline = new String[argCount];
- int index = 0;
- commandline[index++] = command;
- for (int j = 0; j < args.length; j++) {
- commandline[index++] = args[j];
- }
- for (int j = sourceIndex; j < firstFileNextExec; j++) {
- for (int k = 0; k < argumentCountPerInputFile; k++) {
- commandline[index++] = getInputFileArgument(outputDir,
- sourceFiles[j], k);
- }
- }
- for (int j = 0; j < endArgs.length; j++) {
- commandline[index++] = endArgs[j];
- }
- int retval = runCommand(task, outputDir, commandline);
- // if with monitor, add more code
- if (retval != 0) {
- throw new BuildException(this.getCommand()
- + " failed with return code " + retval,
- task.getLocation());
- }
- sourceIndex = firstFileNextExec;
- }
- }
-
- protected AslcompilerConfiguration createConfiguration(final CCTask task,
- final LinkType linkType,
- final ProcessorDef[] baseDefs,
- final AslcompilerDef specificDef,
- final TargetDef targetPlatform) {
- Vector args = new Vector();
- AslcompilerDef[] defaultProviders = new AslcompilerDef[baseDefs.length +1];
- for (int i = 0; i < baseDefs.length; i++) {
- defaultProviders[i + 1] = (AslcompilerDef) baseDefs[i];
- }
- defaultProviders[0] = specificDef;
- Vector cmdArgs = new Vector();
- //
- // add command line arguments inherited from <cc> element
- // any "extends" and finally and specific AslcompilerDef
- //
- CommandLineArgument[] commandArgs;
- for (int i = defaultProviders.length - 1; i >=0; i--){
- commandArgs = defaultProviders[i].getActiveProcessorArgs();
- for (int j = 0; j < commandArgs.length; j++) {
- if (commandArgs[j].getLocation() == 0) {
- args.addElement(commandArgs[j].getValue());
- }
- else {
- cmdArgs.addElement(commandArgs[j]);
- }
- }
- }
- // omit param
- boolean debug = specificDef.getDebug(baseDefs, 0);
- Boolean defaultflag = specificDef.getDefaultflag(defaultProviders, 1);
- this.addImpliedArgs(args, debug, defaultflag);
- Enumeration argEnum = cmdArgs.elements();
- int endCount = 0;
- while( argEnum.hasMoreElements()) {
- CommandLineArgument arg = (CommandLineArgument) argEnum.nextElement();
- switch (arg.getLocation()) {
- case 1 :
- args.addElement(arg.getValue());
- break;
- case 2 :
- endCount++;
- break;
- }
- }
- String[] endArgs = new String[endCount];
- argEnum = cmdArgs.elements();
- int index = 0;
- while (argEnum.hasMoreElements()) {
- CommandLineArgument arg = (CommandLineArgument) argEnum.nextElement();
- if (arg.getLocation() == 2) {
- endArgs[index++] = arg.getValue();
- }
- }
- String[] argArray = new String[args.size()];
- args.copyInto(argArray);
- return new CommandLineAslcompilerConfiguration(this, argArray, true, endArgs);
- }
-
- protected int getArgumentCountPerInputFile() {
- return 1;
- }
-
- public String getIdentifier() {
- if (identifier == null) {
- if (identifierArg == null) {
- identifier = getIdentifier(new String[]{command}, command);
- }
- else {
- identifier = getIdentifier(
- new String[]{command, identifierArg}, command);
- }
- }
- return identifier;
- }
-
- public final String getCommand() {
- return command;
- }
- abstract public int getMaximumCommandLength();
- public void setCommand(String command) {
- this.command = command;
- }
- protected int getTotalArgumentLengthForInputFile(File outputDir,
- String inputFile) {
- return inputFile.length() + 1;
- }
- protected int runCommand(CCTask task, File workingDir, String[] cmdline)
- throws BuildException {
- return CUtil.runCommand(task, workingDir, cmdline, false, null);
-
- }
- protected int getMaximumInputFilesPerCommand(){
- return 1;
- }
- protected int getArgumentCountPerInputFIle(){
- return 1;
- }
- protected String getInputFileArgument(File outputDir, String filename, int index) {
- //
- // if there is an embedded space,
- // must enclose in quotes
- if (filename.indexOf(' ') >= 0) {
- StringBuffer buf = new StringBuffer("\"");
- buf.append(filename);
- buf.append("\"");
- return buf.toString();
- }
- return filename;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompilerConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompilerConfiguration.java
deleted file mode 100644
index 9a3457dafb..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAslcompilerConfiguration.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.ProcessorParam;
-
-/**
- * A configuration for an ASL compiler
- *
- */
-public final class CommandLineAslcompilerConfiguration implements
- AslcompilerConfiguration {
-
- private String[] args;
-
- private CommandLineAslcompiler acpi;
-
- private String[] endArgs;
-
- private boolean rebuild;
-
- public CommandLineAslcompilerConfiguration (CommandLineAslcompiler acpi,
- String[] args, boolean rebuild, String[] endArgs) {
- if (acpi == null) {
- throw new NullPointerException("acpi");
- }
- if (args == null) {
- this.args = new String[0];
- } else {
- this.args = (String[]) args.clone();
- }
- this.acpi = acpi;
- this.rebuild = rebuild;
- this.endArgs = (String[]) endArgs.clone();
- }
-
- public int bid (String inputFile) {
- int acpiBid = acpi.bid(inputFile);
- return acpiBid;
- }
-
- public void aslcompiler (CCTask task, File outputDir, String[] sourceFiles)
- throws BuildException {
- try {
- acpi.aslcompiler(task, outputDir, sourceFiles, args, endArgs);
- } catch (BuildException ex) {
- throw ex;
- }
- }
-
- public String getIdentifier () {
- return acpi.getCommand();
- }
-
- public ProcessorParam[] getParams () {
- return new ProcessorParam[0];
- }
-
- public boolean getRebuild () {
- return rebuild;
- }
-
- public String[] getPreArguments () {
- return (String[]) args.clone();
- }
-
- public String[] getEndArguments () {
- return (String[]) endArgs.clone();
- }
-
- public String getOutputFileName (String inputFile) {
- return acpi.getOutputFileName(inputFile);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAssembler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAssembler.java
deleted file mode 100644
index f01fc5ee61..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAssembler.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.AssemblerDef;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.TargetDef;
-import net.sf.antcontrib.cpptasks.types.CommandLineArgument;
-
-import org.apache.tools.ant.BuildException;
-
-/**
- * An abstract Assembler implementation which uses an external program to
- * perform the assemble.
- *
- */
-public abstract class CommandLineAssembler extends AbstractAssembler {
-
- private String command;
-
- private String identifier;
-
- private String identifierArg;
-
- protected CommandLineAssembler (String command, String identifierArg,
- String[] sourceExtensions, String[] headerExtensions,
- String outputSuffix) {
- super(sourceExtensions, headerExtensions, outputSuffix);
- this.command = command;
- this.identifierArg = identifierArg;
- }
-
- abstract protected void addImpliedArgs(Vector args, boolean debug,
- Boolean defaultflag);
-
- /**
- * Adds command-line arguments for include directories.
- *
- * If relativeArgs is not null will add corresponding relative paths include
- * switches to that vector (for use in building a configuration identifier
- * that is consistent between machines).
- *
- * @param baseDirPaths
- * A vector containing the parts of the working directory,
- * produced by CUtil.DecomposeFile.
- * @param includeDirs
- * Array of include directory paths
- * @param args
- * Vector of command line arguments used to execute the task
- * @param relativeArgs
- * Vector of command line arguments used to build the
- * configuration identifier
- */
- protected void addIncludes(String baseDirPath, File[] includeDirs,
- Vector args, Vector relativeArgs, StringBuffer includePathId) {
- for (int i = 0; i < includeDirs.length; i++) {
- args.addElement(getIncludeDirSwitch(includeDirs[i]
- .getAbsolutePath()));
- if (relativeArgs != null) {
- String relative = CUtil.getRelativePath(baseDirPath,
- includeDirs[i]);
- relativeArgs.addElement(getIncludeDirSwitch(relative));
- if (includePathId != null) {
- if (includePathId.length() == 0) {
- includePathId.append("/I");
- } else {
- includePathId.append(" /I");
- }
- includePathId.append(relative);
- }
- }
- }
- }
-
- abstract protected String getIncludeDirSwitch(String source);
-
- /**
- * Assembles a source file
- *
- */
- public void assembler(CCTask task, File outputDir, String[] sourceFiles,
- String[] args, String[] endArgs) throws BuildException {
- String command = getCommand();
- int baseLength = command.length() + args.length + endArgs.length;
- for (int i = 0; i < args.length; i++) {
- baseLength += args[i].length();
- }
- for (int i = 0; i < endArgs.length; i++) {
- baseLength += endArgs[i].length();
- }
- if (baseLength > getMaximumCommandLength()) {
- throw new BuildException(
- "Command line is over maximum length without sepcifying source file");
- }
- int maxInputFilesPerCommand = getMaximumInputFilesPerCommand();
- int argumentCountPerInputFile = getArgumentCountPerInputFIle();
- for (int sourceIndex = 0; sourceIndex < sourceFiles.length;) {
- int cmdLength = baseLength;
- int firstFileNextExec;
- for (firstFileNextExec = sourceIndex; firstFileNextExec < sourceFiles.length
- && (firstFileNextExec - sourceIndex) < maxInputFilesPerCommand; firstFileNextExec++) {
- cmdLength += getTotalArgumentLengthForInputFile(outputDir,
- sourceFiles[firstFileNextExec]);
- if (cmdLength >= getMaximumCommandLength())
- break;
- }
- if (firstFileNextExec == sourceIndex) {
- throw new BuildException(
- "Extremely long file name, can't fit on command line");
- }
- int argCount = args.length + 1 + endArgs.length
- + (firstFileNextExec - sourceIndex)
- * argumentCountPerInputFile;
- String[] commandline = new String[argCount];
- int index = 0;
- commandline[index++] = command;
- for (int j = 0; j < args.length; j++) {
- commandline[index++] = args[j];
- }
- for (int j = sourceIndex; j < firstFileNextExec; j++) {
- for (int k = 0; k < argumentCountPerInputFile; k++) {
- commandline[index++] = getInputFileArgument(outputDir,
- sourceFiles[j], k);
- }
- }
- for (int j = 0; j < endArgs.length; j++) {
- commandline[index++] = endArgs[j];
- }
- int retval = runCommand(task, outputDir, commandline);
- // if with monitor, add more code
- if (retval != 0) {
- throw new BuildException(this.getCommand()
- + " failed with return code " + retval, task
- .getLocation());
- }
- sourceIndex = firstFileNextExec;
- }
- }
-
- protected AssemblerConfiguration createConfiguration(final CCTask task,
- final LinkType linkType, final ProcessorDef[] baseDefs,
- final AssemblerDef specificDef,
- final TargetDef targetPlatform) {
- Vector args = new Vector();
- AssemblerDef[] defaultProviders = new AssemblerDef[baseDefs.length + 1];
- for (int i = 0; i < baseDefs.length; i++) {
- defaultProviders[i + 1] = (AssemblerDef) baseDefs[i];
- }
- defaultProviders[0] = specificDef;
- Vector cmdArgs = new Vector();
- //
- // add command line arguments inherited from <cc> element
- // any "extends" and finally and specific AssemblerDef
- //
- CommandLineArgument[] commandArgs;
- for (int i = defaultProviders.length - 1; i >= 0; i--) {
- commandArgs = defaultProviders[i].getActiveProcessorArgs();
- for (int j = 0; j < commandArgs.length; j++) {
- if (commandArgs[j].getLocation() == 0) {
- args.addElement(commandArgs[j].getValue());
- } else {
- cmdArgs.addElement(commandArgs[j]);
- }
- }
- }
- // omit param
- boolean debug = specificDef.getDebug(baseDefs, 0);
- Boolean defaultflag = specificDef.getDefaultflag(defaultProviders, 1);
- this.addImpliedArgs(args, debug, defaultflag);
- //
- // Want to have distinct set of arguments with relative
- // path names for includes that are used to build
- // the configuration identifier
- //
- Vector relativeArgs = (Vector) args.clone();
- //
- // add all active include an
- //
- StringBuffer includePathIdentifier = new StringBuffer();
- File baseDir = specificDef.getProject().getBaseDir();
- String baseDirPath;
- try {
- baseDirPath = baseDir.getCanonicalPath();
- } catch (IOException ex) {
- baseDirPath = baseDir.toString();
- }
- Vector includePath = new Vector();
- Vector sysIncludePath = new Vector();
- for (int i = defaultProviders.length - 1; i >= 0; i--) {
- String[] incPath = defaultProviders[i].getActiveIncludePaths();
- for (int j = 0; j < incPath.length; j++) {
- includePath.addElement(incPath[j]);
- }
- incPath = defaultProviders[i].getActiveSysIncludePaths();
- for (int j = 0; j < incPath.length; j++) {
- sysIncludePath.addElement(incPath[j]);
- }
- }
- File[] incPath = new File[includePath.size()];
- for (int i = 0; i < includePath.size(); i++) {
- incPath[i] = new File((String) includePath.elementAt(i));
- }
- File[] sysIncPath = new File[sysIncludePath.size()];
- for (int i = 0; i < sysIncludePath.size(); i++) {
- sysIncPath[i] = new File((String) sysIncludePath.elementAt(i));
- }
- addIncludes(baseDirPath, incPath, args, relativeArgs,
- includePathIdentifier);
- addIncludes(baseDirPath, sysIncPath, args, null, null);
- StringBuffer buf = new StringBuffer(getIdentifier());
- for (int i = 0; i < relativeArgs.size(); i++) {
- buf.append(relativeArgs.elementAt(i));
- buf.append(' ');
- }
- buf.setLength(buf.length() - 1);
- Enumeration argEnum = cmdArgs.elements();
- int endCount = 0;
- while (argEnum.hasMoreElements()) {
- CommandLineArgument arg = (CommandLineArgument) argEnum
- .nextElement();
- switch (arg.getLocation()) {
- case 1:
- args.addElement(arg.getValue());
- break;
- case 2:
- endCount++;
- break;
- }
- }
- String[] endArgs = new String[endCount];
- argEnum = cmdArgs.elements();
- int index = 0;
- while (argEnum.hasMoreElements()) {
- CommandLineArgument arg = (CommandLineArgument) argEnum
- .nextElement();
- if (arg.getLocation() == 2) {
- endArgs[index++] = arg.getValue();
- }
- }
- String[] argArray = new String[args.size()];
- args.copyInto(argArray);
- return new CommandLineAssemblerConfiguration(this, incPath, sysIncPath,
- new File[0], argArray, true, endArgs, new String[0]);
- }
-
- protected int getArgumentCountPerInputFile() {
- return 1;
- }
-
- protected abstract File[] getEnvironmentIncludePath();
-
- public String getIdentifier() {
- if (identifier == null) {
- if (identifierArg == null) {
- identifier = getIdentifier(new String[] { command }, command);
- } else {
- identifier = getIdentifier(new String[] { command,
- identifierArg }, command);
- }
- }
- return identifier;
- }
-
- public final String getCommand() {
- return command;
- }
-
- abstract public int getMaximumCommandLength();
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- protected int getTotalArgumentLengthForInputFile(File outputDir,
- String inputFile) {
- return inputFile.length() + 1;
- }
-
- protected int runCommand(CCTask task, File workingDir, String[] cmdline)
- throws BuildException {
- return CUtil.runCommand(task, workingDir, cmdline, false, null);
- }
-
- protected int getMaximumInputFilesPerCommand() {
- return Integer.MAX_VALUE;
- }
-
- protected int getArgumentCountPerInputFIle() {
- return 1;
- }
-
- protected String getInputFileArgument(File outputDir, String filename,
- int index) {
- //
- // if there is an embedded space,
- // must enclose in quotes
- if (filename.indexOf(' ') >= 0) {
- StringBuffer buf = new StringBuffer("\"");
- buf.append(filename);
- buf.append("\"");
- return buf.toString();
- }
- return filename;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAssemblerConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAssemblerConfiguration.java
deleted file mode 100644
index 542d441559..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineAssemblerConfiguration.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.ProcessorParam;
-
-/**
- * A configuration for an assember
- *
- */
-public final class CommandLineAssemblerConfiguration implements
- AssemblerConfiguration {
-
- private String[] args;
-
- private CommandLineAssembler assembler;
-
- private String[] endArgs;
-
- //
- // include path from environment variable
- // not explicitly stated in Ant script
- //
- private File[] envIncludePath;
-
- private String[] exceptFiles;
-
- private File[] includePath;
-
- private boolean rebuild;
-
- private File[] sysIncludePath;
-
- public CommandLineAssemblerConfiguration (CommandLineAssembler assembler,
- File[] includePath, File[] sysIncludePath,
- File[] envIncludePath, String[] args, boolean rebuild,
- String[] endArgs, String[] exceptFiles) {
- if (assembler == null) {
- throw new NullPointerException("assembler");
- }
- if (args == null) {
- this.args = new String[0];
- } else {
- this.args = (String[]) args.clone();
- }
- if (includePath == null) {
- this.includePath = new File[0];
- } else {
- this.includePath = (File[]) includePath.clone();
- }
- if (sysIncludePath == null) {
- this.sysIncludePath = new File[0];
- } else {
- this.sysIncludePath = (File[]) sysIncludePath.clone();
- }
- if (envIncludePath == null) {
- this.envIncludePath = new File[0];
- } else {
- this.envIncludePath = (File[]) envIncludePath.clone();
- }
- this.assembler = assembler;
- this.rebuild = rebuild;
- this.endArgs = (String[]) endArgs.clone();
- this.exceptFiles = (String[]) exceptFiles.clone();
- }
-
- public int bid(String inputFile) {
- int assembleBid = assembler.bid(inputFile);
- return assembleBid;
- }
-
- public void assembler(CCTask task, File outputDir, String[] sourceFiles)
- throws BuildException {
- try {
- assembler.assembler(task, outputDir, sourceFiles, args, endArgs);
- } catch (BuildException ex) {
- throw ex;
- }
- }
-
- public String getOutputFileName(String inputFile) {
- return assembler.getOutputFileName(inputFile);
- }
-
- public String getIdentifier() {
- return assembler.getCommand();
- }
-
- public ProcessorParam[] getParams() {
- return new ProcessorParam[0];
- }
-
- public boolean getRebuild() {
- return rebuild;
- }
-
- public String[] getPreArguments() {
- return (String[]) args.clone();
- }
-
- public String[] getEndArguments() {
- return (String[]) endArgs.clone();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCCompiler.java
deleted file mode 100644
index 442d6b8187..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCCompiler.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.parser.CParser;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * An abstract Compiler implementation which uses an external program to
- * perform the compile.
- *
- * @author Adam Murdoch
- */
-public abstract class CommandLineCCompiler extends CommandLineCompiler {
- protected CommandLineCCompiler(String command, String identifierArg,
- String[] sourceExtensions, String[] headerExtensions,
- String outputSuffix, boolean libtool,
- CommandLineCCompiler libtoolCompiler, boolean newEnvironment,
- Environment env) {
- super(command, identifierArg, sourceExtensions, headerExtensions,
- outputSuffix, libtool, libtoolCompiler, newEnvironment, env);
- }
- protected Parser createParser(File source) {
- return new CParser();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCompiler.java
deleted file mode 100644
index 3f45ce539d..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCompiler.java
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.CompilerDef;
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.ProcessorParam;
-import net.sf.antcontrib.cpptasks.types.CommandLineArgument;
-import net.sf.antcontrib.cpptasks.types.UndefineArgument;
-import net.sf.antcontrib.cpptasks.TargetDef;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Environment;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;;
-/**
- * An abstract Compiler implementation which uses an external program to
- * perform the compile.
- *
- * @author Adam Murdoch
- */
-public abstract class CommandLineCompiler extends AbstractCompiler {
- private String command;
- private final Environment env;
- private String identifier;
- private String identifierArg;
- private boolean libtool;
- private CommandLineCompiler libtoolCompiler;
- private final boolean newEnvironment;
- protected CommandLineCompiler(String command, String identifierArg,
- String[] sourceExtensions, String[] headerExtensions,
- String outputSuffix, boolean libtool,
- CommandLineCompiler libtoolCompiler, boolean newEnvironment,
- Environment env) {
- super(sourceExtensions, headerExtensions, outputSuffix);
- this.command = command;
- if (libtool && libtoolCompiler != null) {
- throw new java.lang.IllegalArgumentException(
- "libtoolCompiler should be null when libtool is true");
- }
- this.libtool = libtool;
- this.libtoolCompiler = libtoolCompiler;
- this.identifierArg = identifierArg;
- this.newEnvironment = newEnvironment;
- this.env = env;
- }
- abstract protected void addImpliedArgs(Vector args, boolean debug,
- boolean multithreaded, boolean exceptions, LinkType linkType,
- Boolean rtti, OptimizationEnum optimization, Boolean defaultflag);
- /**
- * Adds command-line arguments for include directories.
- *
- * If relativeArgs is not null will add corresponding relative paths
- * include switches to that vector (for use in building a configuration
- * identifier that is consistent between machines).
- *
- * @param baseDirPaths
- * A vector containing the parts of the working directory,
- * produced by CUtil.DecomposeFile.
- * @param includeDirs
- * Array of include directory paths
- * @param args
- * Vector of command line arguments used to execute the task
- * @param relativeArgs
- * Vector of command line arguments used to build the
- * configuration identifier
- */
- protected void addIncludes(String baseDirPath, File[] includeDirs,
- Vector args, Vector relativeArgs, StringBuffer includePathId) {
- for (int i = 0; i < includeDirs.length; i++) {
- args.addElement(getIncludeDirSwitch(includeDirs[i]
- .getAbsolutePath()));
- if (relativeArgs != null) {
- String relative = CUtil.getRelativePath(baseDirPath,
- includeDirs[i]);
- relativeArgs.addElement(getIncludeDirSwitch(relative));
- if (includePathId != null) {
- if (includePathId.length() == 0) {
- includePathId.append("/I");
- } else {
- includePathId.append(" /I");
- }
- includePathId.append(relative);
- }
- }
- }
- }
- abstract protected void addWarningSwitch(Vector args, int warnings);
- protected void buildDefineArguments(CompilerDef[] defs, Vector args) {
- //
- // assume that we aren't inheriting defines from containing <cc>
- //
- UndefineArgument[] merged = defs[0].getActiveDefines();
- for (int i = 1; i < defs.length; i++) {
- //
- // if we are inheriting, merge the specific defines with the
- // containing defines
- merged = UndefineArgument.merge(defs[i].getActiveDefines(), merged);
- }
- StringBuffer buf = new StringBuffer(30);
- for (int i = 0; i < merged.length; i++) {
- buf.setLength(0);
- UndefineArgument current = merged[i];
- if (current.isDefine()) {
- getDefineSwitch(buf, current.getName(), current.getValue());
- } else {
- getUndefineSwitch(buf, current.getName());
- }
- args.addElement(buf.toString());
- }
- }
- /**
- * Compiles a source file.
- *
- * @author Curt Arnold
- */
- public void compile(CCTask task, File outputDir, String[] sourceFiles,
- String[] args, String[] endArgs, boolean relentless,
- CommandLineCompilerConfiguration config, ProgressMonitor monitor)
- throws BuildException {
- BuildException exc = null;
- //
- // determine length of executable name and args
- //
- String command = getCommand();
- int baseLength = command.length() + args.length + endArgs.length;
- if (libtool) {
- baseLength += 8;
- }
- for (int i = 0; i < args.length; i++) {
- baseLength += args[i].length();
- }
- for (int i = 0; i < endArgs.length; i++) {
- baseLength += endArgs[i].length();
- }
- if (baseLength > getMaximumCommandLength()) {
- throw new BuildException(
- "Command line is over maximum length without specifying source file");
- }
- //
- // typically either 1 or Integer.MAX_VALUE
- //
- int maxInputFilesPerCommand = getMaximumInputFilesPerCommand();
- int argumentCountPerInputFile = getArgumentCountPerInputFile();
- for (int sourceIndex = 0; sourceIndex < sourceFiles.length;) {
- int cmdLength = baseLength;
- int firstFileNextExec;
- for (firstFileNextExec = sourceIndex; firstFileNextExec < sourceFiles.length
- && (firstFileNextExec - sourceIndex) < maxInputFilesPerCommand; firstFileNextExec++) {
- cmdLength += getTotalArgumentLengthForInputFile(outputDir,
- sourceFiles[firstFileNextExec]);
- if (cmdLength >= getMaximumCommandLength())
- break;
- }
- if (firstFileNextExec == sourceIndex) {
- throw new BuildException(
- "Extremely long file name, can't fit on command line");
- }
- int argCount = args.length + 1 + endArgs.length
- + (firstFileNextExec - sourceIndex)
- * argumentCountPerInputFile;
- if (libtool) {
- argCount++;
- }
- String[] commandline = new String[argCount];
- int index = 0;
- if (libtool) {
- commandline[index++] = "libtool";
- }
- commandline[index++] = command;
- for (int j = 0; j < args.length; j++) {
- commandline[index++] = args[j];
- }
- for (int j = sourceIndex; j < firstFileNextExec; j++) {
- for (int k = 0; k < argumentCountPerInputFile; k++) {
- commandline[index++] = getInputFileArgument(outputDir,
- sourceFiles[j], k);
- }
- }
- for (int j = 0; j < endArgs.length; j++) {
- commandline[index++] = endArgs[j];
- }
- int retval = runCommand(task, outputDir, commandline);
- if (monitor != null) {
- String[] fileNames = new String[firstFileNextExec - sourceIndex];
- for (int j = 0; j < fileNames.length; j++) {
- fileNames[j] = sourceFiles[sourceIndex + j];
- }
- monitor.progress(fileNames);
- }
- //
- // if the process returned a failure code and
- // we aren't holding an exception from an earlier
- // interation
- if (retval != 0 && exc == null) {
- //
- // construct the exception
- //
- exc = new BuildException(this.getCommand()
- + " failed with return code " + retval, task
- .getLocation());
- //
- // and throw it now unless we are relentless
- //
- if (!relentless) {
- throw exc;
- }
- }
- sourceIndex = firstFileNextExec;
- }
- //
- // if the compiler returned a failure value earlier
- // then throw an exception
- if (exc != null) {
- throw exc;
- }
- }
- protected CompilerConfiguration createConfiguration(final CCTask task,
- final LinkType linkType,
- final ProcessorDef[] baseDefs,
- final CompilerDef specificDef,
- final TargetDef targetPlatform) {
- Vector args = new Vector();
- CompilerDef[] defaultProviders = new CompilerDef[baseDefs.length + 1];
- for (int i = 0; i < baseDefs.length; i++) {
- defaultProviders[i + 1] = (CompilerDef) baseDefs[i];
- }
- defaultProviders[0] = specificDef;
- Vector cmdArgs = new Vector();
- //
- // add command line arguments inherited from <cc> element
- // any "extends" and finally the specific CompilerDef
- CommandLineArgument[] commandArgs;
- for (int i = defaultProviders.length - 1; i >= 0; i--) {
- commandArgs = defaultProviders[i].getActiveProcessorArgs();
- for (int j = 0; j < commandArgs.length; j++) {
- if (commandArgs[j].getLocation() == 0) {
- args.addElement(commandArgs[j].getValue());
- } else {
- cmdArgs.addElement(commandArgs[j]);
- }
- }
- }
- Vector params = new Vector();
- //
- // add command line arguments inherited from <cc> element
- // any "extends" and finally the specific CompilerDef
- ProcessorParam[] paramArray;
- for (int i = defaultProviders.length - 1; i >= 0; i--) {
- paramArray = defaultProviders[i].getActiveProcessorParams();
- for (int j = 0; j < paramArray.length; j++) {
- params.add(paramArray[j]);
- }
- }
- paramArray = (ProcessorParam[]) (params
- .toArray(new ProcessorParam[params.size()]));
- boolean multithreaded = specificDef.getMultithreaded(defaultProviders,
- 1);
- boolean debug = specificDef.getDebug(baseDefs, 0);
- boolean exceptions = specificDef.getExceptions(defaultProviders, 1);
- Boolean rtti = specificDef.getRtti(defaultProviders, 1);
- Boolean defaultflag = specificDef.getDefaultflag(defaultProviders, 1);
- OptimizationEnum optimization = specificDef.getOptimization(defaultProviders, 1);
- this.addImpliedArgs(args, debug, multithreaded, exceptions, linkType, rtti, optimization, defaultflag);
- //
- // add all appropriate defines and undefines
- //
- buildDefineArguments(defaultProviders, args);
- //
- // Want to have distinct set of arguments with relative
- // path names for includes that are used to build
- // the configuration identifier
- //
- Vector relativeArgs = (Vector) args.clone();
- //
- // add all active include and sysincludes
- //
- StringBuffer includePathIdentifier = new StringBuffer();
- File baseDir = specificDef.getProject().getBaseDir();
- String baseDirPath;
- try {
- baseDirPath = baseDir.getCanonicalPath();
- } catch (IOException ex) {
- baseDirPath = baseDir.toString();
- }
- Vector includePath = new Vector();
- Vector sysIncludePath = new Vector();
- for (int i = defaultProviders.length - 1; i >= 0; i--) {
- String[] incPath = defaultProviders[i].getActiveIncludePaths();
- for (int j = 0; j < incPath.length; j++) {
- includePath.addElement(incPath[j]);
- }
- incPath = defaultProviders[i].getActiveSysIncludePaths();
- for (int j = 0; j < incPath.length; j++) {
- sysIncludePath.addElement(incPath[j]);
- }
- }
- File[] incPath = new File[includePath.size()];
- for (int i = 0; i < includePath.size(); i++) {
- incPath[i] = new File((String) includePath.elementAt(i));
- }
- File[] sysIncPath = new File[sysIncludePath.size()];
- for (int i = 0; i < sysIncludePath.size(); i++) {
- sysIncPath[i] = new File((String) sysIncludePath.elementAt(i));
- }
- addIncludes(baseDirPath, incPath, args, relativeArgs,
- includePathIdentifier);
- addIncludes(baseDirPath, sysIncPath, args, null, null);
- StringBuffer buf = new StringBuffer(getIdentifier());
- for (int i = 0; i < relativeArgs.size(); i++) {
- buf.append(relativeArgs.elementAt(i));
- buf.append(' ');
- }
- buf.setLength(buf.length() - 1);
- String configId = buf.toString();
- int warnings = specificDef.getWarnings(defaultProviders, 0);
- addWarningSwitch(args, warnings);
- Enumeration argEnum = cmdArgs.elements();
- int endCount = 0;
- while (argEnum.hasMoreElements()) {
- CommandLineArgument arg = (CommandLineArgument) argEnum
- .nextElement();
- switch (arg.getLocation()) {
- case 1 :
- args.addElement(arg.getValue());
- break;
- case 2 :
- endCount++;
- break;
- }
- }
- String[] endArgs = new String[endCount];
- argEnum = cmdArgs.elements();
- int index = 0;
- while (argEnum.hasMoreElements()) {
- CommandLineArgument arg = (CommandLineArgument) argEnum
- .nextElement();
- if (arg.getLocation() == 2) {
- endArgs[index++] = arg.getValue();
- }
- }
- String[] argArray = new String[args.size()];
- args.copyInto(argArray);
- boolean rebuild = specificDef.getRebuild(baseDefs, 0);
- File[] envIncludePath = getEnvironmentIncludePath();
- return new CommandLineCompilerConfiguration(this, configId, incPath,
- sysIncPath, envIncludePath, includePathIdentifier.toString(),
- argArray, paramArray, rebuild, endArgs);
- }
- protected int getArgumentCountPerInputFile() {
- return 1;
- }
- protected final String getCommand() {
- return command;
- }
- abstract protected void getDefineSwitch(StringBuffer buffer, String define,
- String value);
- protected abstract File[] getEnvironmentIncludePath();
- public String getIdentifier() {
- if (identifier == null) {
- if (identifierArg == null) {
- identifier = getIdentifier(new String[]{command}, command);
- } else {
- identifier = getIdentifier(
- new String[]{command, identifierArg}, command);
- }
- }
- return identifier;
- }
- abstract protected String getIncludeDirSwitch(String source);
- protected String getInputFileArgument(File outputDir, String filename,
- int index) {
- //
- // if there is an embedded space,
- // must enclose in quotes
- if (filename.indexOf(' ') >= 0) {
- StringBuffer buf = new StringBuffer("\"");
- buf.append(filename);
- buf.append("\"");
- return buf.toString();
- }
- return filename;
- }
- protected final boolean getLibtool() {
- return libtool;
- }
- /**
- * Obtains the same compiler, but with libtool set
- *
- * Default behavior is to ignore libtool
- */
- public final CommandLineCompiler getLibtoolCompiler() {
- if (libtoolCompiler != null) {
- return libtoolCompiler;
- }
- return this;
- }
- abstract public int getMaximumCommandLength();
- protected int getMaximumInputFilesPerCommand() {
- return Integer.MAX_VALUE;
- }
- protected int getTotalArgumentLengthForInputFile(File outputDir,
- String inputFile) {
- return inputFile.length() + 1;
- }
- abstract protected void getUndefineSwitch(StringBuffer buffer, String define);
- /**
- * This method is exposed so test classes can overload and test the
- * arguments without actually spawning the compiler
- */
- protected int runCommand(CCTask task, File workingDir, String[] cmdline)
- throws BuildException {
- return CUtil.runCommand(task, workingDir, cmdline, newEnvironment, env);
- }
- protected final void setCommand(String command) {
- this.command = command;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCompilerConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCompilerConfiguration.java
deleted file mode 100644
index 4c53df105b..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineCompilerConfiguration.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CompilerParam;
-import net.sf.antcontrib.cpptasks.DependencyInfo;
-import net.sf.antcontrib.cpptasks.ProcessorParam;
-
-import org.apache.tools.ant.BuildException;
-/**
- * A configuration for a C++ compiler
- *
- * @author Curt Arnold
- */
-public final class CommandLineCompilerConfiguration
- implements
- CompilerConfiguration {
- private/* final */String[] args;
- private/* final */CommandLineCompiler compiler;
- private String[] endArgs;
- //
- // include path from environment variable not
- // explicitly stated in Ant script
- private/* final */File[] envIncludePath;
- private String[] exceptFiles;
- private/* final */String identifier;
- private/* final */File[] includePath;
- private/* final */String includePathIdentifier;
- private boolean isPrecompiledHeaderGeneration;
- private/* final */ProcessorParam[] params;
- private/* final */boolean rebuild;
- private/* final */File[] sysIncludePath;
- public CommandLineCompilerConfiguration(CommandLineCompiler compiler,
- String identifier, File[] includePath, File[] sysIncludePath,
- File[] envIncludePath, String includePathIdentifier, String[] args,
- ProcessorParam[] params, boolean rebuild, String[] endArgs) {
- if (compiler == null) {
- throw new NullPointerException("compiler");
- }
- if (identifier == null) {
- throw new NullPointerException("identifier");
- }
- if (includePathIdentifier == null) {
- throw new NullPointerException("includePathIdentifier");
- }
- if (args == null) {
- this.args = new String[0];
- } else {
- this.args = (String[]) args.clone();
- }
- if (includePath == null) {
- this.includePath = new File[0];
- } else {
- this.includePath = (File[]) includePath.clone();
- }
- if (sysIncludePath == null) {
- this.sysIncludePath = new File[0];
- } else {
- this.sysIncludePath = (File[]) sysIncludePath.clone();
- }
- if (envIncludePath == null) {
- this.envIncludePath = new File[0];
- } else {
- this.envIncludePath = (File[]) envIncludePath.clone();
- }
- this.compiler = compiler;
- this.params = (ProcessorParam[]) params.clone();
- this.rebuild = rebuild;
- this.identifier = identifier;
- this.includePathIdentifier = includePathIdentifier;
- this.endArgs = (String[]) endArgs.clone();
- exceptFiles = null;
- isPrecompiledHeaderGeneration = false;
- }
- public CommandLineCompilerConfiguration(
- CommandLineCompilerConfiguration base, String[] additionalArgs,
- String[] exceptFiles, boolean isPrecompileHeaderGeneration) {
- compiler = base.compiler;
- identifier = base.identifier;
- rebuild = base.rebuild;
- includePath = (File[]) base.includePath.clone();
- sysIncludePath = (File[]) base.sysIncludePath.clone();
- endArgs = (String[]) base.endArgs.clone();
- envIncludePath = (File[]) base.envIncludePath.clone();
- includePathIdentifier = base.includePathIdentifier;
- if (exceptFiles != null) {
- this.exceptFiles = (String[]) exceptFiles.clone();
- }
- this.isPrecompiledHeaderGeneration = isPrecompileHeaderGeneration;
- args = new String[base.args.length + additionalArgs.length];
- for (int i = 0; i < base.args.length; i++) {
- args[i] = base.args[i];
- }
- int index = base.args.length;
- for (int i = 0; i < additionalArgs.length; i++) {
- args[index++] = additionalArgs[i];
- }
- }
- public int bid(String inputFile) {
- int compilerBid = compiler.bid(inputFile);
- if (compilerBid > 0 && exceptFiles != null) {
- for (int i = 0; i < exceptFiles.length; i++) {
- if (inputFile.equals(exceptFiles[i])) {
- return 0;
- }
- }
- }
- return compilerBid;
- }
- public void compile(CCTask task, File outputDir, String[] sourceFiles,
- boolean relentless, ProgressMonitor monitor) throws BuildException {
- if (monitor != null) {
- monitor.start(this);
- }
- try {
- compiler.compile(task, outputDir, sourceFiles, args, endArgs,
- relentless, this, monitor);
- if (monitor != null) {
- monitor.finish(this, true);
- }
- } catch (BuildException ex) {
- if (monitor != null) {
- monitor.finish(this, false);
- }
- throw ex;
- }
- }
- /**
- *
- * This method may be used to get two distinct compiler configurations, one
- * for compiling the specified file and producing a precompiled header
- * file, and a second for compiling other files using the precompiled
- * header file.
- *
- * The last (preferrably only) include directive in the prototype file will
- * be used to mark the boundary between pre-compiled and normally compiled
- * headers.
- *
- * @param prototype
- * A source file (for example, stdafx.cpp) that is used to build
- * the precompiled header file. @returns null if precompiled
- * headers are not supported or a two element array containing
- * the precompiled header generation configuration and the
- * consuming configuration
- *
- */
- public CompilerConfiguration[] createPrecompileConfigurations(
- File prototype, String[] nonPrecompiledFiles) {
- if (compiler instanceof PrecompilingCompiler) {
- return ((PrecompilingCompiler) compiler)
- .createPrecompileConfigurations(this, prototype,
- nonPrecompiledFiles);
- }
- return null;
- }
- /**
- * Returns a string representation of this configuration. Should be
- * canonical so that equivalent configurations will have equivalent string
- * representations
- */
- public String getIdentifier() {
- return identifier;
- }
- public String getIncludePathIdentifier() {
- return includePathIdentifier;
- }
- public String getOutputFileName(String inputFile) {
- return compiler.getOutputFileName(inputFile);
- }
- public CompilerParam getParam(String name) {
- for (int i = 0; i < params.length; i++) {
- if (name.equals(params[i].getName()))
- return (CompilerParam) params[i];
- }
- return null;
- }
- public ProcessorParam[] getParams() {
- return params;
- }
- public boolean getRebuild() {
- return rebuild;
- }
- public boolean isPrecompileGeneration() {
- return isPrecompiledHeaderGeneration;
- }
- public DependencyInfo parseIncludes(CCTask task, File baseDir, File source) {
- return compiler.parseIncludes(task, source, includePath,
- sysIncludePath, envIncludePath, baseDir,
- getIncludePathIdentifier());
- }
- public String toString() {
- return identifier;
- }
- public String[] getPreArguments() {
- return (String[]) args.clone();
- }
- public String[] getEndArguments() {
- return (String[]) endArgs.clone();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineFortranCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineFortranCompiler.java
deleted file mode 100644
index d01cb9e356..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineFortranCompiler.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.parser.FortranParser;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * An abstract Compiler implementation which uses an external program to
- * perform the compile.
- *
- * @author Curt Arnold
- */
-public abstract class CommandLineFortranCompiler extends CommandLineCompiler {
- protected CommandLineFortranCompiler(String command, String identifierArg,
- String[] sourceExtensions, String[] headerExtensions,
- String outputSuffix, boolean libtool,
- CommandLineFortranCompiler libtoolCompiler, boolean newEnvironment,
- Environment env) {
- super(command, identifierArg, sourceExtensions, headerExtensions,
- outputSuffix, libtool, libtoolCompiler, newEnvironment, env);
- }
- protected Parser createParser(File source) {
- return new FortranParser();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java
deleted file mode 100644
index 4161469a8f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.LinkerDef;
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.ProcessorParam;
-import net.sf.antcontrib.cpptasks.types.CommandLineArgument;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-import net.sf.antcontrib.cpptasks.TargetDef;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Environment;
-
-
-/**
- * An abstract Linker implementation that performs the link via an external
- * command.
- *
- * @author Adam Murdoch
- */
-public abstract class CommandLineLinker extends AbstractLinker
-{
- private String command;
- private Environment env = null;
- private String identifier;
- private String identifierArg;
- private boolean isLibtool;
- private String[] librarySets;
- private CommandLineLinker libtoolLinker;
- private boolean newEnvironment = false;
- private String outputSuffix;
-
-
- /** Creates a comand line linker invocation */
- public CommandLineLinker(String command,
- String identifierArg,
- String[] extensions,
- String[] ignoredExtensions, String outputSuffix,
- boolean isLibtool, CommandLineLinker libtoolLinker)
- {
- super(extensions, ignoredExtensions);
- this.command = command;
- this.identifierArg = identifierArg;
- this.outputSuffix = outputSuffix;
- this.isLibtool = isLibtool;
- this.libtoolLinker = libtoolLinker;
- }
- protected abstract void addBase(long base, Vector args);
-
- protected abstract void addFixed(Boolean fixed, Vector args);
-
- abstract protected void addImpliedArgs(boolean debug,
- LinkType linkType, Vector args, Boolean defaultflag);
- protected abstract void addIncremental(boolean incremental, Vector args);
-
- //
- // Windows processors handle these through file list
- //
- protected String[] addLibrarySets(CCTask task, LibrarySet[] libsets, Vector preargs,
- Vector midargs, Vector endargs) {
- return null;
- }
- protected abstract void addMap(boolean map, Vector args);
- protected abstract void addStack(int stack, Vector args);
- protected abstract void addEntry(String entry, Vector args);
-
- protected LinkerConfiguration createConfiguration(
- CCTask task,
- LinkType linkType,
- ProcessorDef[] baseDefs, LinkerDef specificDef, TargetDef targetPlatform) {
-
- Vector preargs = new Vector();
- Vector midargs = new Vector();
- Vector endargs = new Vector();
- Vector[] args = new Vector[] { preargs, midargs, endargs };
-
- LinkerDef[] defaultProviders = new LinkerDef[baseDefs.length+1];
- defaultProviders[0] = specificDef;
- for(int i = 0; i < baseDefs.length; i++) {
- defaultProviders[i+1] = (LinkerDef) baseDefs[i];
- }
- //
- // add command line arguments inherited from <cc> element
- // any "extends" and finally the specific CompilerDef
- CommandLineArgument[] commandArgs;
- for(int i = defaultProviders.length-1; i >= 0; i--) {
- commandArgs = defaultProviders[i].getActiveProcessorArgs();
- for(int j = 0; j < commandArgs.length; j++) {
- args[commandArgs[j].getLocation()].
- addElement(commandArgs[j].getValue());
- }
- }
-
- Vector params = new Vector();
- //
- // add command line arguments inherited from <cc> element
- // any "extends" and finally the specific CompilerDef
- ProcessorParam[] paramArray;
- for (int i = defaultProviders.length - 1; i >= 0; i--) {
- paramArray = defaultProviders[i].getActiveProcessorParams();
- for (int j = 0; j < paramArray.length; j++) {
- params.add(paramArray[j]);
- }
- }
-
- paramArray = (ProcessorParam[])(params.toArray(new ProcessorParam[params.size()]));
-
- boolean debug = specificDef.getDebug(baseDefs,0);
-
-
- String startupObject = getStartupObject(linkType);
- Boolean defaultflag = specificDef.getDefaultflag(defaultProviders, 1);
- addImpliedArgs(debug, linkType, preargs, defaultflag);
- addIncremental(specificDef.getIncremental(defaultProviders,1), preargs);
- addFixed(specificDef.getFixed(defaultProviders,1), preargs);
- addMap(specificDef.getMap(defaultProviders,1), preargs);
- addBase(specificDef.getBase(defaultProviders,1), preargs);
- addStack(specificDef.getStack(defaultProviders,1), preargs);
- addEntry(specificDef.getEntry(defaultProviders, 1), preargs);
-
- String[] libnames = null;
- LibrarySet[] libsets = specificDef.getActiveLibrarySets(defaultProviders,1);
- if (libsets.length > 0) {
- libnames = addLibrarySets(task, libsets, preargs, midargs, endargs);
- }
-
- StringBuffer buf = new StringBuffer(getIdentifier());
- for (int i = 0; i < 3; i++) {
- Enumeration argenum = args[i].elements();
- while (argenum.hasMoreElements()) {
- buf.append(' ');
- buf.append(argenum.nextElement().toString());
- }
- }
- String configId = buf.toString();
-
- String[][] options = new String[][] {
- new String[args[0].size() + args[1].size()],
- new String[args[2].size()] };
- args[0].copyInto(options[0]);
- int offset = args[0].size();
- for (int i = 0; i < args[1].size(); i++) {
- options[0][i+offset] = (String) args[1].elementAt(i);
- }
- args[2].copyInto(options[1]);
-
-
- boolean rebuild = specificDef.getRebuild(baseDefs,0);
- boolean map = specificDef.getMap(defaultProviders,1);
-
- //task.log("libnames:"+libnames.length, Project.MSG_VERBOSE);
- return new CommandLineLinkerConfiguration(this,configId,options,
- paramArray,
- rebuild,map,libnames, startupObject);
- }
-
- /**
- * Allows drived linker to decorate linker option.
- * Override by GccLinker to prepend a "-Wl," to
- * pass option to through gcc to linker.
- *
- * @param buf buffer that may be used and abused in the decoration process,
- * must not be null.
- * @param arg linker argument
- */
- protected String decorateLinkerOption(StringBuffer buf, String arg) {
- return arg;
- }
-
- protected final String getCommand() {
- return command;
- }
- protected abstract String getCommandFileSwitch(String commandFile);
-
-
- public String getIdentifier() {
- if(identifier == null) {
- if (identifierArg == null) {
- identifier = getIdentifier(new String[] { command }, command);
- } else {
- identifier = getIdentifier(new String[] { command, identifierArg },
- command);
- }
- }
- return identifier;
- }
- public final CommandLineLinker getLibtoolLinker() {
- if (libtoolLinker != null) {
- return libtoolLinker;
- }
- return this;
- }
- protected abstract int getMaximumCommandLength();
-
- public String getOutputFileName(String baseName) {
- return baseName + outputSuffix;
- }
-
- protected String[] getOutputFileSwitch(CCTask task, String outputFile) {
- return getOutputFileSwitch(outputFile);
- }
- protected abstract String[] getOutputFileSwitch(String outputFile);
- protected String getStartupObject(LinkType linkType) {
- return null;
- }
-
- /**
- * Performs a link using a command line linker
- *
- */
- public void link(CCTask task,
- File outputFile,
- String[] sourceFiles,
- CommandLineLinkerConfiguration config)
- throws BuildException
- {
- File parentDir = new File(outputFile.getParent());
- String parentPath;
- try {
- parentPath = parentDir.getCanonicalPath();
- } catch(IOException ex) {
- parentPath = parentDir.getAbsolutePath();
- }
- String[] execArgs = prepareArguments(task, parentPath,outputFile.getName(),
- sourceFiles, config);
- int commandLength = 0;
- for(int i = 0; i < execArgs.length; i++) {
- commandLength += execArgs[i].length() + 1;
- }
-
- //
- // if command length exceeds maximum
- // (1024 for Windows) then create a temporary
- // file containing everything but the command name
- if(commandLength >= this.getMaximumCommandLength()) {
- try {
- execArgs = prepareResponseFile(outputFile,execArgs);
- }
- catch(IOException ex) {
- throw new BuildException(ex);
- }
- }
-
- int retval = runCommand(task,parentDir,execArgs);
- //
- // if the process returned a failure code then
- // throw an BuildException
- //
- if(retval != 0) {
- //
- // construct the exception
- //
- throw new BuildException(this.getCommand() + " failed with return code " + retval, task.getLocation());
- }
-
- }
-
-
- /**
- * Prepares argument list for exec command. Will return null
- * if command line would exceed allowable command line buffer.
- *
- * @param outputFile linker output file
- * @param sourceFiles linker input files (.obj, .o, .res)
- * @param args linker arguments
- * @return arguments for runTask
- */
- protected String[] prepareArguments(
- CCTask task,
- String outputDir,
- String outputFile,
- String[] sourceFiles,
- CommandLineLinkerConfiguration config) {
-
- String[] preargs = config.getPreArguments();
- String[] endargs = config.getEndArguments();
- String outputSwitch[] = getOutputFileSwitch(task, outputFile);
- int allArgsCount = preargs.length + 1 + outputSwitch.length +
- sourceFiles.length + endargs.length;
- if (isLibtool) {
- allArgsCount++;
- }
- String[] allArgs = new String[allArgsCount];
- int index = 0;
- if (isLibtool) {
- allArgs[index++] = "libtool";
- }
- allArgs[index++] = this.getCommand();
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < preargs.length; i++) {
- allArgs[index++] = decorateLinkerOption(buf, preargs[i]);
- }
- for (int i = 0; i < outputSwitch.length; i++) {
- allArgs[index++] = outputSwitch[i];
- }
- for (int i = 0; i < sourceFiles.length; i++) {
- allArgs[index++] = prepareFilename(buf,outputDir,sourceFiles[i]);
- }
- for (int i = 0; i < endargs.length; i++) {
- allArgs[index++] = decorateLinkerOption(buf, endargs[i]);
- }
- return allArgs;
- }
-
- /**
- * Processes filename into argument form
- *
- */
- protected String prepareFilename(StringBuffer buf,
- String outputDir, String sourceFile) {
- String relativePath = CUtil.getRelativePath(outputDir,
- new File(sourceFile));
- return quoteFilename(buf,relativePath);
- }
-
- /**
- * Prepares argument list to execute the linker using a
- * response file.
- *
- * @param outputFile linker output file
- * @param args output of prepareArguments
- * @return arguments for runTask
- */
- protected String[] prepareResponseFile(File outputFile,String[] args) throws IOException
- {
- String baseName = outputFile.getName();
- File commandFile = new File(outputFile.getParent(),baseName + ".rsp");
- FileWriter writer = new FileWriter(commandFile);
- int execArgCount = 1;
- if (isLibtool) {
- execArgCount++;
- }
- String[] execArgs = new String[execArgCount+1];
- for (int i = 0; i < execArgCount; i++) {
- execArgs[i] = args[i];
- }
- execArgs[execArgCount] = getCommandFileSwitch(commandFile.toString());
- for(int i = execArgCount; i < args.length; i++) {
- //
- // if embedded space and not quoted then
- // quote argument
- if (args[i].indexOf(" ") >= 0 && args[i].charAt(0) != '\"') {
- writer.write('\"');
- writer.write(args[i]);
- writer.write("\"\n");
- } else {
- writer.write(args[i]);
- writer.write('\n');
- }
- }
- writer.close();
- return execArgs;
- }
-
-
- protected String quoteFilename(StringBuffer buf,String filename) {
- if(filename.indexOf(' ') >= 0) {
- buf.setLength(0);
- buf.append('\"');
- buf.append(filename);
- buf.append('\"');
- return buf.toString();
- }
- return filename;
- }
-
- /**
- * This method is exposed so test classes can overload
- * and test the arguments without actually spawning the
- * compiler
- */
- protected int runCommand(CCTask task, File workingDir,String[] cmdline)
- throws BuildException {
- return CUtil.runCommand(task,workingDir,cmdline, newEnvironment, env);
- }
-
- protected final void setCommand(String command) {
- this.command = command;
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinkerConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinkerConfiguration.java
deleted file mode 100644
index b3a7290b00..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinkerConfiguration.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.LinkerParam;
-import net.sf.antcontrib.cpptasks.ProcessorParam;
-import net.sf.antcontrib.cpptasks.TargetInfo;
-
-import org.apache.tools.ant.BuildException;
-/**
- * A configuration for a command line linker
- *
- * @author Curt Arnold
- */
-public final class CommandLineLinkerConfiguration
- implements
- LinkerConfiguration {
- private/* final */String[][] args;
- private/* final */String identifier;
- private String[] libraryNames;
- private/* final */CommandLineLinker linker;
- private/* final */boolean map;
- private/* final */ProcessorParam[] params;
- private/* final */boolean rebuild;
- private String startupObject;
- public CommandLineLinkerConfiguration(CommandLineLinker linker,
- String identifier, String[][] args, ProcessorParam[] params,
- boolean rebuild, boolean map, String[] libraryNames,
- String startupObject) {
- if (linker == null) {
- throw new NullPointerException("linker");
- }
- if (args == null) {
- throw new NullPointerException("args");
- } else {
- this.args = (String[][]) args.clone();
- }
- this.linker = linker;
- this.params = (ProcessorParam[]) params.clone();
- this.rebuild = rebuild;
- this.identifier = identifier;
- this.map = map;
- if (libraryNames == null) {
- this.libraryNames = new String[0];
- } else {
- this.libraryNames = (String[]) libraryNames.clone();
- }
- this.startupObject = startupObject;
- }
- public int bid(String filename) {
- return linker.bid(filename);
- }
- public String[] getEndArguments() {
- String[] clone = (String[]) args[1].clone();
- return clone;
- }
- /**
- * Returns a string representation of this configuration. Should be
- * canonical so that equivalent configurations will have equivalent string
- * representations
- */
- public String getIdentifier() {
- return identifier;
- }
- public String[] getLibraryNames() {
- String[] clone = (String[]) libraryNames.clone();
- return clone;
- }
- public boolean getMap() {
- return map;
- }
- public String getOutputFileName(String inputFile) {
- return linker.getOutputFileName(inputFile);
- }
- public LinkerParam getParam(String name) {
- for (int i = 0; i < params.length; i++) {
- if (name.equals(params[i].getName()))
- return (LinkerParam) params[i];
- }
- return null;
- }
- public ProcessorParam[] getParams() {
- return params;
- }
- public String[] getPreArguments() {
- String[] clone = (String[]) args[0].clone();
- return clone;
- }
- public boolean getRebuild() {
- return rebuild;
- }
- public String getStartupObject() {
- return startupObject;
- }
- public void link(CCTask task, TargetInfo linkTarget) throws BuildException {
- //
- // AllSourcePath's include any syslibsets
- //
- String[] sourcePaths = linkTarget.getAllSourcePaths();
- linker.link(task, linkTarget.getOutput(), sourcePaths, this);
- }
- public String toString() {
- return identifier;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Compiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Compiler.java
deleted file mode 100644
index bbb6c99c5d..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Compiler.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-/**
- * A compiler.
- *
- * @author Adam Murdoch
- */
-public interface Compiler extends Processor {
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CompilerConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CompilerConfiguration.java
deleted file mode 100644
index 72abb8b5f4..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CompilerConfiguration.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CompilerParam;
-import net.sf.antcontrib.cpptasks.DependencyInfo;
-
-import org.apache.tools.ant.BuildException;
-/**
- * A configuration for a compiler
- *
- * @author Curt Arnold
- */
-public interface CompilerConfiguration extends ProcessorConfiguration {
- void compile(CCTask task, File outputDir, String[] sourceFiles,
- boolean relentless, ProgressMonitor monitor) throws BuildException;
- /**
- *
- * This method may be used to get two distinct compiler configurations, one
- * for compiling the specified file and producing a precompiled header
- * file, and a second for compiling other files using the precompiled
- * header file.
- *
- * The last (preferrably only) include directive in the prototype file will
- * be used to mark the boundary between pre-compiled and normally compiled
- * headers.
- *
- * @param prototype
- * A source file (for example, stdafx.cpp) that is used to build
- * the precompiled header file. @returns null if precompiled
- * headers are not supported or a two element array containing
- * the precompiled header generation configuration and the
- * consuming configuration
- *
- */
- CompilerConfiguration[] createPrecompileConfigurations(File prototype,
- String[] nonPrecompiledFiles);
- /**
- * Returns an digest for the include path for the configuration.
- *
- * This is used to determine if cached dependency information is invalid
- * because the include paths have changed
- */
- String getIncludePathIdentifier();
- public CompilerParam getParam(String name);
- boolean isPrecompileGeneration();
- DependencyInfo parseIncludes(CCTask task, File baseDir, File source);
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/LinkType.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/LinkType.java
deleted file mode 100644
index 7d6041ff93..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/LinkType.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import net.sf.antcontrib.cpptasks.OutputTypeEnum;
-import net.sf.antcontrib.cpptasks.SubsystemEnum;
-/**
- * This class represents the target platform for the compile and link step. The
- * name is an anachronism and should be changed.
- *
- * @author Curt Arnold
- */
-public class LinkType {
- private OutputTypeEnum outputType = new OutputTypeEnum();
- private boolean staticRuntime = false;
- private SubsystemEnum subsystem = new SubsystemEnum();
- /**
- * Constructor
- *
- * By default, an gui executable with a dynamically linked runtime
- *
- */
- public LinkType() {
- }
- /**
- * Gets whether the link should produce an executable
- *
- * @return boolean
- */
- public boolean isExecutable() {
- String value = outputType.getValue();
- return value.equals("executable");
- }
- /**
- * Gets whether the link should produce a plugin module.
- *
- * @return boolean
- */
- public boolean isPluginModule() {
- String value = outputType.getValue();
- return value.equals("plugin");
- }
- /**
- * Gets whether the link should produce a shared library.
- *
- * @return boolean
- */
- public boolean isSharedLibrary() {
- String value = outputType.getValue();
- return value.equals("shared") || value.equals("plugin");
- }
- /**
- * Gets whether the link should produce a static library.
- *
- * @return boolean
- */
- public boolean isStaticLibrary() {
- String value = outputType.getValue();
- return value.equals("static");
- }
- /**
- * Gets whether the module should use a statically linked runtime library.
- *
- * @return boolean
- */
- public boolean isStaticRuntime() {
- return staticRuntime;
- }
- /**
- * Gets whether the link should produce a module for a console subsystem.
- *
- * @return boolean
- */
- public boolean isSubsystemConsole() {
- String value = subsystem.getValue();
- return value.equals("console");
- }
- /**
- * Gets whether the link should produce a module for a graphical user
- * interface subsystem.
- *
- * @return boolean
- */
- public boolean isSubsystemGUI() {
- String value = subsystem.getValue();
- return value.equals("gui");
- }
- /**
- * Sets the output type (execuable, shared, etc).
- *
- * @param outputType,
- * may not be null
- */
- public void setOutputType(OutputTypeEnum outputType) {
- if (outputType == null) {
- throw new IllegalArgumentException("outputType");
- }
- this.outputType = outputType;
- }
- /**
- * Requests use of a static runtime library.
- *
- * @param staticRuntime
- * if true, use static runtime library if possible.
- */
- public void setStaticRuntime(boolean staticRuntime) {
- this.staticRuntime = staticRuntime;
- }
- /**
- * Sets the subsystem (gui, console, etc).
- *
- * @param subsystem
- * subsystem, may not be null
- */
- public void setSubsystem(SubsystemEnum subsystem) {
- if (subsystem == null) {
- throw new IllegalArgumentException("subsystem");
- }
- this.subsystem = subsystem;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Linker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Linker.java
deleted file mode 100644
index 776a808ac7..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Linker.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.File;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-/**
- * A linker for executables, and static and dynamic libraries.
- *
- * @author Adam Murdoch
- */
-public interface Linker extends Processor {
- /**
- * Extracts the significant part of a library name to ensure there aren't
- * collisions
- */
- String getLibraryKey(File libname);
- /**
- * returns the library path for the linker
- */
- File[] getLibraryPath();
- /**
- * Returns a set of filename patterns corresponding to library names.
- *
- * For example, "advapi32" would be expanded to "advapi32.dll" by
- * DevStudioLinker and to "libadvapi32.a" and "libadvapi32.so" by
- * GccLinker.
- *
- * @param libnames
- * array of library names
- */
- String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libraryType);
- /**
- * Gets the linker for the specified link type.
- *
- * @return appropriate linker or null, will return this if this linker can
- * handle the specified link type
- */
- Linker getLinker(LinkType linkType);
- /**
- * Returns true if the linker is case-sensitive
- */
- boolean isCaseSensitive();
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/LinkerConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/LinkerConfiguration.java
deleted file mode 100644
index c2d62c4137..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/LinkerConfiguration.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.LinkerParam;
-import net.sf.antcontrib.cpptasks.TargetInfo;
-
-import org.apache.tools.ant.BuildException;
-/**
- * A configuration for a linker
- *
- * @author Curt Arnold
- */
-public interface LinkerConfiguration extends ProcessorConfiguration {
- public LinkerParam getParam(String name);
- void link(CCTask task, TargetInfo linkTarget) throws BuildException;
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCCompiler.java
deleted file mode 100644
index eb64119299..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCCompiler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.parser.CParser;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * A command line C compiler that can utilize precompilation of header files
- *
- * @author Curt Arnold
- */
-public abstract class PrecompilingCommandLineCCompiler
- extends
- PrecompilingCommandLineCompiler {
- protected PrecompilingCommandLineCCompiler(String command,
- String identifierArg, String[] sourceExtensions,
- String[] headerExtensions, String outputSuffix, boolean libtool,
- PrecompilingCommandLineCCompiler libtoolCompiler,
- boolean newEnvironment, Environment env) {
- super(command, identifierArg, sourceExtensions, headerExtensions,
- outputSuffix, libtool, libtoolCompiler, newEnvironment, env);
- }
- protected Parser createParser(File source) {
- return new CParser();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCompiler.java
deleted file mode 100644
index 6e3c145675..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCompiler.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-
-import net.sf.antcontrib.cpptasks.parser.Parser;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Environment;
-/**
- * A command line C compiler that can utilize precompilation of header files
- *
- * @author Curt Arnold
- */
-public abstract class PrecompilingCommandLineCompiler
- extends
- CommandLineCompiler implements PrecompilingCompiler {
- protected PrecompilingCommandLineCompiler(String command,
- String identifierArg, String[] sourceExtensions,
- String[] headerExtensions, String outputSuffix, boolean libtool,
- PrecompilingCommandLineCompiler libtoolCompiler,
- boolean newEnvironment, Environment env) {
- super(command, identifierArg, sourceExtensions, headerExtensions,
- outputSuffix, libtool, libtoolCompiler, newEnvironment, env);
- }
- /**
- *
- * This method may be used to get two distinct compiler configurations, one
- * for compiling the specified file and producing a precompiled header
- * file, and a second for compiling other files using the precompiled
- * header file.
- *
- * The last (preferrably only) include directive in the prototype file will
- * be used to mark the boundary between pre-compiled and normally compiled
- * headers.
- *
- * @param config
- * base configuration
- * @param prototype
- * A source file (for example, stdafx.cpp) that is used to build
- * the precompiled header file. @returns null if precompiled
- * headers are not supported or a two element array containing
- * the precompiled header generation configuration and the
- * consuming configuration
- *
- */
- public CompilerConfiguration[] createPrecompileConfigurations(
- CompilerConfiguration config, File prototype, String[] exceptFiles) {
- //
- // cast should success or someone is passing us a configuration
- // that was prepared by another processor
- //
- CommandLineCompilerConfiguration cmdLineConfig = (CommandLineCompilerConfiguration) config;
- //
- // parse prototype file to determine last header
- //
- Parser parser = createParser(prototype);
- String[] includes;
- try {
- Reader reader = new BufferedReader(new FileReader(prototype));
- parser.parse(reader);
- includes = parser.getIncludes();
- } catch (IOException ex) {
- throw new BuildException(
- "Error parsing precompiled header protoype: "
- + prototype.toString() + ":" + ex.toString());
- }
- if (includes.length == 0) {
- throw new BuildException("Precompiled header prototype: "
- + prototype.toString()
- + " does not contain any include directives.");
- }
- CompilerConfiguration[] configs = new CompilerConfiguration[2];
- configs[0] = createPrecompileGeneratingConfig(cmdLineConfig, prototype,
- includes[0]);
- configs[1] = createPrecompileUsingConfig(cmdLineConfig, prototype,
- includes[0], exceptFiles);
- return configs;
- }
- abstract protected CompilerConfiguration createPrecompileGeneratingConfig(
- CommandLineCompilerConfiguration baseConfig, File prototype,
- String lastInclude);
- abstract protected CompilerConfiguration createPrecompileUsingConfig(
- CommandLineCompilerConfiguration baseConfig, File prototype,
- String lastInclude, String[] exceptFiles);
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCompiler.java
deleted file mode 100644
index e60b1da8e6..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/PrecompilingCompiler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import java.io.File;
-/**
- * A compiler that can utilize precompilation of header files
- *
- * @author Curt Arnold
- */
-public interface PrecompilingCompiler {
- /**
- *
- * This method may be used to get two distinct compiler configurations, one
- * for compiling the specified file and producing a precompiled header
- * file, and a second for compiling other files using the precompiled
- * header file.
- *
- * The last (preferrably only) include directive in the prototype file will
- * be used to mark the boundary between pre-compiled and normally compiled
- * headers.
- *
- * @param config
- * base configuration
- * @param prototype
- * A source file (for example, stdafx.cpp) that is used to build
- * the precompiled header file. @returns null if precompiled
- * headers are not supported or a two element array containing
- * the precompiled header generation configuration and the
- * consuming configuration
- *
- */
- CompilerConfiguration[] createPrecompileConfigurations(
- CompilerConfiguration config, File prototype,
- String[] nonPrecompiledFiles);
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Processor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Processor.java
deleted file mode 100644
index 6fb74e9ea3..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/Processor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.TargetDef;
-import org.apache.tools.ant.types.Environment;
-/**
- * A processor. Base interface for Compiler and Linker
- *
- * @author Curt Arnold
- */
-public interface Processor {
- /**
- * Returns a bid indicating the desire of this compiler to process the
- * file.
- *
- * @param inputFile
- * input file
- * @return 0 = no interest, 100 = high interest
- */
- int bid(String inputFile);
- Processor changeEnvironment(boolean newEnvironment, Environment env);
- /**
- * Returns the compiler configuration for <cc>or <compiler>element.
- *
- * @param defaultProviders
- * When specificConfig corresponds to a <compiler>or linker
- * element, defaultProvider will be a zero to two element array.
- * If there is an extends attribute, the first element will be
- * the referenced ProcessorDef, unless inherit = false, the last
- * element will be the containing <cc>element
- * @param specificConfig
- * A <cc>or <compiler>element.
- * @return resulting configuration
- */
- ProcessorConfiguration createConfiguration(CCTask task, LinkType linkType,
- ProcessorDef[] defaultProviders, ProcessorDef specificConfig,
- TargetDef targetPlatform);
- /**
- * Retrieve an identifier that identifies the specific version of the
- * compiler. Compilers with the same identifier should produce the same
- * output files for the same input files and command line switches.
- */
- String getIdentifier();
- /**
- * Gets the linker that is associated with this processors
- */
- Linker getLinker(LinkType type);
- /**
- * Output file name (no path components) corresponding to source file
- *
- * @param inputFile
- * input file
- * @return output file name or null if no output file or name not
- * determined by input file
- */
- String getOutputFileName(String inputFile);
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/ProcessorConfiguration.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/ProcessorConfiguration.java
deleted file mode 100644
index dd75483d6d..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/ProcessorConfiguration.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-import net.sf.antcontrib.cpptasks.ProcessorParam;
-/**
- * A configuration for a C++ compiler, linker or other processor
- *
- * @author Curt Arnold
- */
-public interface ProcessorConfiguration {
- /**
- * An indication of how much this compiler would like to process this file
- *
- * @return 0 is no interest to process, 100 is strong interest to process
- */
- int bid(String filename);
- /**
- * Returns a string representation of this configuration. Should be
- * canonical so that equivalent configurations will have equivalent string
- * representations
- */
- String getIdentifier();
- /**
- * Output file name (no path components) corresponding to source file
- *
- * @param inputFile
- * input file
- * @return output file name or null if no output file or name not
- * determined by input file
- */
- String getOutputFileName(String inputFile);
- ProcessorParam[] getParams();
- /**
- * If true, all files using this configuration should be rebuilt and any
- * existing output files should be ignored
- */
- boolean getRebuild();
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/ProgressMonitor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/ProgressMonitor.java
deleted file mode 100644
index 2206ed874e..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/ProgressMonitor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.compiler;
-/**
- * Interface to receive notification of compile progress
- *
- * @author Curt Arnold
- */
-public interface ProgressMonitor {
- public void finish(ProcessorConfiguration config, boolean normal);
- /**
- * Called to notify monitor of progress
- *
- */
- void progress(String[] sources);
- public void start(ProcessorConfiguration config);
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioAslcompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioAslcompiler.java
deleted file mode 100644
index f0be5945a3..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioAslcompiler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineAslcompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-
-/**
- * Adaptor for Microsoft ASL compiler.
- *
- */
-public final class DevStudioAslcompiler extends CommandLineAslcompiler {
- private final static String[] sourceExtensions = new String[] { ".asl" };
-
- private final static String[] headerExtensions = new String[] {};
-
- private final static String[] defaultflags = new String[] {};
-
- private static final DevStudioAslcompiler instance = new DevStudioAslcompiler(
- "asl", sourceExtensions, headerExtensions, false);
-
- /**
- * Gets asl adapter
- */
- public static DevStudioAslcompiler getInstance() {
- return instance;
- }
-
- /**
- * Private constructor. Use DevStudioAslcompiler.getInstance() to get
- * singleton instance of this class.
- */
- private DevStudioAslcompiler (String command, String[] sourceExtensions,
- String[] headerExtensions, boolean isLibtool) {
- super(command, null, sourceExtensions, headerExtensions, ".aml");
- }
-
- public void addImpliedArgs(Vector args, boolean debug, Boolean defaultflag) {
- if (defaultflag != null && defaultflag.booleanValue()) {
- for (int i = 0; i < defaultflags.length; i++) {
- args.addElement(defaultflags[i]);
- }
- }
- }
-
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
-
- public Linker getLinker(LinkType linkType) {
- return DevStudioLinker.getInstance().getLinker(linkType);
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioAssembler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioAssembler.java
deleted file mode 100644
index 23d319ecd9..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioAssembler.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineAssembler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-
-/**
- * Adaptor for Microsoft MASM
- *
- */
-public final class DevStudioAssembler extends CommandLineAssembler {
- private final static String[] sourceExtensions = new String[] { ".asm" };
-
- private final static String[] headerExtensions = new String[] { ".h",
- ".inc" };
-
- private final static String[] defaultflags = new String[] { "/nologo", "/c" };
-
- private static final DevStudioAssembler instance = new DevStudioAssembler(
- "ml", sourceExtensions, headerExtensions, false);
-
- /**
- * Gets masm adapter
- */
- public static DevStudioAssembler getInstance() {
- return instance;
- }
-
- /**
- * Private constructor. Use DevStudioAssembler.getInstance() to get
- * singleton instance of this class.
- */
- private DevStudioAssembler (String command, String[] sourceExtensions,
- String[] headerExtensions, boolean isLibtool) {
- super(command, null, sourceExtensions, headerExtensions, ".obj");
- }
-
- public void addImpliedArgs(Vector args, boolean debug, Boolean defaultflag) {
- if (defaultflag != null && defaultflag.booleanValue()) {
- for (int i = 0; i < defaultflags.length; i++) {
- args.addElement(defaultflags[i]);
- }
- }
- if (debug) {
- args.addElement("Zi");
- }
- }
-
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
-
- public Linker getLinker(LinkType linkType) {
- return DevStudioLinker.getInstance().getLinker(linkType);
- }
-
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ";");
- }
-
- protected String getIncludeDirSwitch(String includeDir) {
- return "/I" + includeDir.replace('/', '\\');
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java
deleted file mode 100644
index 3bb5181250..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCCompiler.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Microsoft(r) C/C++ Optimizing Compiler
- *
- * @author Adam Murdoch
- */
-public final class DevStudioCCompiler extends DevStudioCompatibleCCompiler {
- private static final DevStudioCCompiler instance = new DevStudioCCompiler(
- "cl", false, null);
- public static DevStudioCCompiler getInstance() {
- return instance;
- }
- private DevStudioCCompiler(String command, boolean newEnvironment,
- Environment env) {
- super(command, "/bogus", newEnvironment, env);
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new DevStudioCCompiler(getCommand(), newEnvironment, env);
- }
- return this;
- }
- public Linker getLinker(LinkType type) {
- return DevStudioLinker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return 4096;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java
deleted file mode 100644
index 5e29a323c7..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-import java.io.File;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.CompilerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.PrecompilingCommandLineCCompiler;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Environment;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-/**
- * An abstract base class for compilers that are basically command line
- * compatible with Microsoft(r) C/C++ Optimizing Compiler
- *
- * @author Curt Arnold
- */
-public abstract class DevStudioCompatibleCCompiler
- extends
- PrecompilingCommandLineCCompiler {
- private static String[] mflags = new String[]{
- //
- // first four are single-threaded
- // (runtime=static,debug=false), (..,debug=true),
- // (runtime=dynamic,debug=true), (..,debug=false), (not supported)
- // next four are multi-threaded, same sequence
- "/ML", "/MLd", null, null, "/MT", "/MTd", "/MD", "/MDd"};
- private static String[] defaultflags = new String[]{"/nologo", "/c"};
- protected DevStudioCompatibleCCompiler(String command,
- String identifierArg, boolean newEnvironment, Environment env) {
- super(command, identifierArg, new String[]{".c", ".cc", ".cpp", ".cxx",
- ".c++"}, new String[]{".h", ".hpp", ".inl"}, ".obj", false,
- null, newEnvironment, env);
- }
- protected void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- if (defaultflag != null && defaultflag.booleanValue()) {
- for (int i = 0; i < defaultflags.length; i++) {
- args.addElement(defaultflags[i]);
- }
- }
- if (exceptions) {
- args.addElement("/GX");
- }
- int mindex = 0;
- if (multithreaded) {
- mindex += 4;
- }
- boolean staticRuntime = linkType.isStaticRuntime();
- if (!staticRuntime) {
- mindex += 2;
- }
- if (debug) {
- mindex += 1;
- args.addElement("/Zi");
- args.addElement("/Od");
- args.addElement("/GZ");
- args.addElement("/D_DEBUG");
- } else {
- if (optimization != null) {
- if (optimization.isSize()) {
- args.addElement("/O1");
- }
- if (optimization.isSpeed()) {
- args.addElement("/O2");
- }
- }
- args.addElement("/DNDEBUG");
- }
- String mflag = mflags[mindex];
- if (mflag == null) {
- throw new BuildException(
- "multithread='false' and runtime='dynamic' not supported");
- }
- args.addElement(mflag);
- if (rtti != null && rtti.booleanValue()) {
- args.addElement("/GR");
- }
- }
- protected void addWarningSwitch(Vector args, int level) {
- DevStudioProcessor.addWarningSwitch(args, level);
- }
- protected CompilerConfiguration createPrecompileGeneratingConfig(
- CommandLineCompilerConfiguration baseConfig, File prototype,
- String lastInclude) {
- String[] additionalArgs = new String[]{
- "/Fp" + CUtil.getBasename(prototype) + ".pch", "/Yc"};
- return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
- null, true);
- }
- protected CompilerConfiguration createPrecompileUsingConfig(
- CommandLineCompilerConfiguration baseConfig, File prototype,
- String lastInclude, String[] exceptFiles) {
- String[] additionalArgs = new String[]{
- "/Fp" + CUtil.getBasename(prototype) + ".pch",
- "/Yu" + lastInclude};
- return new CommandLineCompilerConfiguration(baseConfig, additionalArgs,
- exceptFiles, false);
- }
- protected void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- DevStudioProcessor.getDefineSwitch(buffer, define, value);
- }
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ";");
- }
- protected String getIncludeDirSwitch(String includeDir) {
- return DevStudioProcessor.getIncludeDirSwitch(includeDir);
- }
- protected void getUndefineSwitch(StringBuffer buffer, String define) {
- DevStudioProcessor.getUndefineSwitch(buffer, define);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java
deleted file mode 100644
index 40bef6e239..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-/**
- * Abstract base adapter for librarians with command line options compatible
- * with the Microsoft(r) Library Manager
- *
- * @author Curt Arnold
- */
-public abstract class DevStudioCompatibleLibrarian extends CommandLineLinker {
- private static String[] defaultflags = new String[]{"/nologo"};
- public DevStudioCompatibleLibrarian(String command, String identifierArg) {
- super(command, identifierArg, new String[]{".obj"}, new String[0],
- ".lib", false, null);
- }
- protected void addBase(long base, Vector args) {
- }
- protected void addFixed(Boolean fixed, Vector args) {
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType,
- Vector args, Boolean defaultflag) {
- if(defaultflag != null && defaultflag.booleanValue()){
- for (int i = 0; i < defaultflags.length; i++) {
- args.addElement(defaultflags[i]);
- }
- }
- }
- protected void addIncremental(boolean incremental, Vector args) {
- }
- protected void addMap(boolean map, Vector args) {
- }
- protected void addStack(int stack, Vector args) {
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- }
-
- protected String getCommandFileSwitch(String cmdFile) {
- return "@" + cmdFile;
- }
- public File[] getLibraryPath() {
- return new File[0];
- }
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- return new String[0];
- }
- public int getMaximumCommandLength() {
- return 4096;
- }
- public String[] getOutputFileSwitch(String outFile) {
- StringBuffer buf = new StringBuffer("/OUT:");
- if (outFile.indexOf(' ') >= 0) {
- buf.append('"');
- buf.append(outFile);
- buf.append('"');
- } else {
- buf.append(outFile);
- }
- return new String[]{buf.toString()};
- }
- public boolean isCaseSensitive() {
- return false;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java
deleted file mode 100644
index 9e156b0426..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-/**
- * Abstract base class for linkers that try to mimic the command line arguments
- * for the Microsoft (r) Incremental Linker
- *
- * @author Curt Arnold
- */
-public abstract class DevStudioCompatibleLinker extends CommandLineLinker {
- private static String[] defaultflags = new String[]{"/NOLOGO"};
- public DevStudioCompatibleLinker(String command, String identifierArg,
- String outputSuffix) {
- super(command, identifierArg, new String[]{".obj", ".lib", ".res"},
- new String[]{".map", ".pdb", ".lnk", ".dll"}, outputSuffix,
- false, null);
- }
- protected void addBase(long base, Vector args) {
- if (base >= 0) {
- String baseAddr = Long.toHexString(base);
- args.addElement("/BASE:0x" + baseAddr);
- }
- }
- protected void addFixed(Boolean fixed, Vector args) {
- if (fixed != null) {
- if (fixed.booleanValue()) {
- args.addElement("/FIXED");
- } else {
- args.addElement("/FIXED:NO");
- }
- }
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType,
- Vector args, Boolean defaultflag) {
- if(defaultflag != null && defaultflag.booleanValue()){
- for (int i = 0; i < defaultflags.length; i++) {
- args.addElement(defaultflags[i]);
- }
- }
- if (debug) {
- args.addElement("/DEBUG");
- }
- if (linkType.isSharedLibrary()) {
- args.addElement("/DLL");
- }
- /*
- * if(linkType.isSubsystemGUI()) {
- * args.addElement("/SUBSYSTEM:WINDOWS"); } else {
- * if(linkType.isSubsystemConsole()) {
- * args.addElement("/SUBSYSTEM:CONSOLE"); } }
- */
- }
- protected void addIncremental(boolean incremental, Vector args) {
- if (incremental) {
- args.addElement("/INCREMENTAL:YES");
- } else {
- args.addElement("/INCREMENTAL:NO");
- }
- }
- protected void addMap(boolean map, Vector args) {
- if (map) {
- args.addElement("/MAP");
- }
- }
- protected void addStack(int stack, Vector args) {
- if (stack >= 0) {
- String stackStr = Integer.toHexString(stack);
- args.addElement("/STACK:0x" + stackStr);
- }
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- if (entry != null) {
- args.addElement("/ENTRY:" + entry);
- }
- }
-
- public String getCommandFileSwitch(String commandFile) {
- return "@" + commandFile;
- }
- public File[] getLibraryPath() {
- return CUtil.getPathFromEnvironment("LIB", ";");
- }
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- StringBuffer buf = new StringBuffer();
- String[] patterns = new String[libnames.length];
- for (int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(libnames[i]);
- buf.append(".lib");
- patterns[i] = buf.toString();
- }
- return patterns;
- }
- public int getMaximumCommandLength() {
- return 4096;
- }
- public String[] getOutputFileSwitch(String outputFile) {
- return new String[]{"/OUT:" + outputFile};
- }
- public boolean isCaseSensitive() {
- return false;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioLibrarian.java
deleted file mode 100644
index 06eac71e19..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioLibrarian.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-/**
- * Adapter for the Microsoft (r) Library Manager
- *
- * @author Curt Arnold
- */
-public final class DevStudioLibrarian extends DevStudioCompatibleLibrarian {
- private static final DevStudioLibrarian instance = new DevStudioLibrarian();
- public static DevStudioLibrarian getInstance() {
- return instance;
- }
- private DevStudioLibrarian() {
- super("lib", "/bogus");
- }
- public Linker getLinker(LinkType type) {
- return DevStudioLinker.getInstance().getLinker(type);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioLinker.java
deleted file mode 100644
index 7ae0178a8b..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioLinker.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-/**
- * Adapter for the Microsoft (r) Incremental Linker
- *
- * @author Adam Murdoch
- * @author Curt Arnold
- */
-public final class DevStudioLinker extends DevStudioCompatibleLinker {
- private static final DevStudioLinker dllLinker = new DevStudioLinker(".dll");
- private static final DevStudioLinker instance = new DevStudioLinker(".exe");
- public static DevStudioLinker getInstance() {
- return instance;
- }
- private DevStudioLinker(String outputSuffix) {
- super("link", "/DLL", outputSuffix);
- }
- public Linker getLinker(LinkType type) {
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- if (type.isStaticLibrary()) {
- return DevStudioLibrarian.getInstance();
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java
deleted file mode 100644
index 7df898b92f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-import java.io.File;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.parser.CParser;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-import org.apache.tools.ant.types.Environment;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-/**
- * Adapter for the Microsoft (r) MIDL Compiler
- *
- * @author Curt Arnold
- */
-public final class DevStudioMIDLCompiler extends CommandLineCompiler {
- private static final DevStudioMIDLCompiler instance = new DevStudioMIDLCompiler(
- false, null);
- public static DevStudioMIDLCompiler getInstance() {
- return instance;
- }
- private DevStudioMIDLCompiler(boolean newEnvironment, Environment env) {
- super("midl", null, new String[]{".idl", ".odl"}, new String[]{},
- ".tlb", false, null, newEnvironment, env);
- }
- protected void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- }
- protected void addWarningSwitch(Vector args, int level) {
- DevStudioProcessor.addWarningSwitch(args, level);
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new DevStudioMIDLCompiler(newEnvironment, env);
- }
- return this;
- }
- /**
- * The include parser for C will work just fine, but we didn't want to
- * inherit from CommandLineCCompiler
- */
- protected Parser createParser(File source) {
- return new CParser();
- }
- protected int getArgumentCountPerInputFile() {
- return 3;
- }
- protected void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- DevStudioProcessor.getDefineSwitch(buffer, define, value);
- }
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ";");
- }
- protected String getIncludeDirSwitch(String includeDir) {
- return DevStudioProcessor.getIncludeDirSwitch(includeDir);
- }
- protected String getInputFileArgument(File outputDir, String filename,
- int index) {
- switch (index) {
- case 0 :
- return "/tlb";
- case 1 :
- return new File(outputDir, getOutputFileName(filename))
- .getAbsolutePath();
- }
- return filename;
- }
- public Linker getLinker(LinkType type) {
- return DevStudioLinker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return 1024;
- }
- protected int getMaximumInputFilesPerCommand() {
- return 1;
- }
- protected int getTotalArgumentLengthForInputFile(File outputDir,
- String inputFile) {
- String arg1 = getInputFileArgument(outputDir, inputFile, 0);
- String arg2 = getInputFileArgument(outputDir, inputFile, 1);
- String arg3 = getInputFileArgument(outputDir, inputFile, 2);
- return arg1.length() + arg2.length() + arg3.length() + 3;
- }
- protected void getUndefineSwitch(StringBuffer buffer, String define) {
- DevStudioProcessor.getUndefineSwitch(buffer, define);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioProcessor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioProcessor.java
deleted file mode 100644
index 6b2af7ed54..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioProcessor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-import java.util.Vector;
-/**
- * A add-in class for Microsoft Developer Studio processors
- *
- *
- */
-public class DevStudioProcessor {
- public static void addWarningSwitch(Vector args, int level) {
- switch (level) {
- case 0 :
- args.addElement("/W0");
- break;
- case 1 :
- args.addElement("/W1");
- break;
- case 2 :
- break;
- case 3 :
- args.addElement("/W3");
- break;
- case 4 :
- args.addElement("/W4");
- break;
- case 5 :
- args.addElement("/WX");
- break;
- }
- }
- public static String getCommandFileSwitch(String cmdFile) {
- StringBuffer buf = new StringBuffer("@");
- if (cmdFile.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(cmdFile.replace('/', '\\'));
- buf.append('\"');
- } else {
- buf.append(cmdFile);
- }
- return buf.toString();
- }
- public static void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- buffer.append("/D");
- buffer.append(define);
- if (value != null && value.length() > 0) {
- buffer.append('=');
- buffer.append(value);
- }
- }
- public static String getIncludeDirSwitch(String includeDir) {
- return "/I" + includeDir.replace('/', '\\');
- }
- public static String[] getOutputFileSwitch(String outPath) {
- StringBuffer buf = new StringBuffer("/Fo");
- if (outPath.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(outPath);
- buf.append('\"');
- } else {
- buf.append(outPath);
- }
- String[] retval = new String[]{buf.toString()};
- return retval;
- }
- public static void getUndefineSwitch(StringBuffer buffer, String define) {
- buffer.append("/U");
- buffer.append(define);
- }
- public static boolean isCaseSensitive() {
- return false;
- }
- private DevStudioProcessor() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java
deleted file mode 100644
index d6e2fd4442..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.devstudio;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.parser.CParser;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Microsoft (r) Windows 32 Resource Compiler
- *
- * @author Curt Arnold
- */
-public final class DevStudioResourceCompiler extends CommandLineCompiler {
- private static final DevStudioResourceCompiler instance = new DevStudioResourceCompiler(
- false, null);
- public static DevStudioResourceCompiler getInstance() {
- return instance;
- }
- private String identifier;
- private DevStudioResourceCompiler(boolean newEnvironment, Environment env) {
- super("rc", null, new String[]{".rc"}, new String[]{".h", ".hpp",
- ".inl"}, ".res", false, null, newEnvironment, env);
- }
- protected void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- if (debug) {
- args.addElement("/D_DEBUG");
- } else {
- args.addElement("/DNDEBUG");
- }
- }
- protected void addWarningSwitch(Vector args, int level) {
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new DevStudioResourceCompiler(newEnvironment, env);
- }
- return this;
- }
- /**
- * The include parser for C will work just fine, but we didn't want to
- * inherit from CommandLineCCompiler
- */
- protected Parser createParser(File source) {
- return new CParser();
- }
- protected int getArgumentCountPerInputFile() {
- return 2;
- }
- protected void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- DevStudioProcessor.getDefineSwitch(buffer, define, value);
- }
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ";");
- }
- protected String getIncludeDirSwitch(String includeDir) {
- return DevStudioProcessor.getIncludeDirSwitch(includeDir);
- }
- protected String getInputFileArgument(File outputDir, String filename,
- int index) {
- if (index == 0) {
- String outputFileName = getOutputFileName(filename);
- String fullOutputName = new File(outputDir, outputFileName)
- .toString();
- return "/fo" + fullOutputName;
- }
- return filename;
- }
- public Linker getLinker(LinkType type) {
- return DevStudioLinker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return 1024;
- }
- protected int getMaximumInputFilesPerCommand() {
- return 1;
- }
- protected int getTotalArgumentLengthForInputFile(File outputDir,
- String inputFile) {
- String arg1 = getInputFileArgument(outputDir, inputFile, 0);
- String arg2 = getInputFileArgument(outputDir, inputFile, 1);
- return arg1.length() + arg2.length() + 2;
- }
- protected void getUndefineSwitch(StringBuffer buffer, String define) {
- DevStudioProcessor.getUndefineSwitch(buffer, define);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java
deleted file mode 100644
index f7bb2eab95..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-import org.apache.tools.ant.BuildException;
-/**
- * Adapter for the "ar" tool
- *
- * @author Adam Murdoch
- * @author Curt Arnold
- */
-public abstract class AbstractArLibrarian extends CommandLineLinker {
- private/* final */
- String outputPrefix;
- private static String[] defaultflags = new String[]{};
- protected AbstractArLibrarian(String command, String identificationArg,
- String[] inputExtensions, String[] ignoredExtensions,
- String outputPrefix, String outputExtension, boolean isLibtool,
- AbstractArLibrarian libtoolLibrarian) {
- super(command, identificationArg, inputExtensions, ignoredExtensions,
- outputExtension, isLibtool, libtoolLibrarian);
- this.outputPrefix = outputPrefix;
- }
- public void addBase(long base, Vector args) {
- }
- public void addFixed(Boolean fixed, Vector args) {
- }
- public void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- if(defaultflag != null && defaultflag.booleanValue()){
- for (int i = 0; i < defaultflags.length; i++) {
- args.addElement(defaultflags[i]);
- }
- }
- }
- public void addIncremental(boolean incremental, Vector args) {
- }
- public void addMap(boolean map, Vector args) {
- }
- public void addStack(int stack, Vector args) {
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- }
-
- public String getCommandFileSwitch(String commandFile) {
- return null;
- }
- public File[] getLibraryPath() {
- return new File[0];
- }
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- return new String[0];
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- public String getOutputFileName(String baseName) {
- return outputPrefix + super.getOutputFileName(baseName);
- }
- public String[] getOutputFileSwitch(String outputFile) {
- return GccProcessor.getOutputFileSwitch("rvs", outputFile);
- }
- public boolean isCaseSensitive() {
- return true;
- }
- public void link(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- //
- // if there is an existing library then
- // we must delete it before executing "ar"
- if (outputFile.exists()) {
- if (!outputFile.delete()) {
- throw new BuildException("Unable to delete "
- + outputFile.getAbsolutePath());
- }
- }
- //
- // delegate to CommandLineLinker
- //
- super.link(task, outputFile, sourceFiles, config);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java
deleted file mode 100644
index f6e376643f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * Abstract adapter for ld-like linkers
- *
- * @author Curt Arnold
- */
-public abstract class AbstractLdLinker extends CommandLineLinker {
- private String outputPrefix;
- private static String[] defaultflags = new String[]{};
- protected AbstractLdLinker(String command, String identifierArg,
- String[] extensions, String[] ignoredExtensions,
- String outputPrefix, String outputSuffix, boolean isLibtool,
- AbstractLdLinker libtoolLinker) {
- super(command, identifierArg, extensions, ignoredExtensions,
- outputSuffix, isLibtool, libtoolLinker);
- this.outputPrefix = outputPrefix;
- }
- public void addBase(long base, Vector args) {
- if (base >= 0) {
- args.addElement("--image-base");
- args.addElement(Long.toHexString(base));
- }
- }
- public void addFixed(Boolean fixed, Vector args) {
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- if(defaultflag != null && defaultflag.booleanValue()){
- for (int i = 0; i < defaultflags.length; i++) {
- args.addElement(defaultflags[i]);
- }
- }
- if (debug) {
- args.addElement("-g");
- }
- if (isDarwin()) {
- if (linkType.isPluginModule()) {
- args.addElement("-bundle");
- } else {
- if (linkType.isSharedLibrary()) {
- args.addElement("-prebind");
- args.addElement("-dynamiclib");
- }
- }
- } else {
- if (linkType.isStaticRuntime()) {
- args.addElement("-static");
- }
- if (linkType.isPluginModule()) {
- args.addElement("-shared");
- } else {
- if (linkType.isSharedLibrary()) {
- args.addElement("-shared");
- }
- }
- }
- }
- public void addIncremental(boolean incremental, Vector args) {
- if (incremental) {
- args.addElement("-i");
- }
- }
- protected int addLibraryPatterns(String[] libnames, StringBuffer buf,
- String prefix, String extension, String[] patterns, int offset) {
- for (int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(libnames[i]);
- buf.append(extension);
- patterns[offset + i] = buf.toString();
- }
- return offset + libnames.length;
- }
- public String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
- Vector preargs, Vector midargs, Vector endargs) {
- Vector libnames = new Vector();
- super.addLibrarySets(task, libsets, preargs, midargs, endargs);
- LibraryTypeEnum previousLibraryType = null;
- for (int i = 0; i < libsets.length; i++) {
- LibrarySet set = libsets[i];
- File libdir = set.getDir(null);
- String[] libs = set.getLibs();
- if (libdir != null) {
- if (set.getType() != null &&
- "framework".equals(set.getType().getValue()) &&
- isDarwin()) {
- endargs.addElement("-F" + libdir.getAbsolutePath());
- } else {
- endargs.addElement("-L" + libdir.getAbsolutePath());
- }
- }
- //
- // if there has been a change of library type
- //
- if (set.getType() != previousLibraryType) {
- if (set.getType() != null && "static".equals(set.getType().getValue())) {
- endargs.addElement("-Bstatic");
- previousLibraryType = set.getType();
- } else {
- if (set.getType() == null ||
- !"framework".equals(set.getType().getValue()) ||
- !isDarwin()) {
- endargs.addElement("-Bdynamic");
- previousLibraryType = set.getType();
- }
- }
- }
- StringBuffer buf = new StringBuffer("-l");
- if (set.getType() != null &&
- "framework".equals(set.getType().getValue()) &&
- isDarwin()) {
- buf.setLength(0);
- buf.append("-framework ");
- }
- int initialLength = buf.length();
- for (int j = 0; j < libs.length; j++) {
- //
- // reset the buffer to just "-l"
- //
- buf.setLength(initialLength);
- //
- // add the library name
- buf.append(libs[j]);
- libnames.addElement(libs[j]);
- //
- // add the argument to the list
- endargs.addElement(buf.toString());
- }
- }
- String rc[] = new String[libnames.size()];
- for (int i = 0; i < libnames.size(); i++) {
- rc[i] = (String) libnames.elementAt(i);
- }
- return rc;
- }
- public void addMap(boolean map, Vector args) {
- if (map) {
- args.addElement("-M");
- }
- }
- public void addStack(int stack, Vector args) {
- if (stack > 0) {
- args.addElement("--stack");
- args.addElement(Integer.toString(stack));
- }
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- if (entry != null) {
- args.addElement("-e");
- args.addElement(entry);
- }
- }
-
- public String getCommandFileSwitch(String commandFile) {
- throw new IllegalStateException("ld does not support command files");
- }
- /**
- * Returns library path.
- *
- */
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("LIB", ":");
- }
- public String getLibraryKey(File libfile) {
- String libname = libfile.getName();
- int lastDot = libname.lastIndexOf('.');
- if (lastDot >= 0) {
- return libname.substring(0, lastDot);
- }
- return libname;
- }
- /**
- * Returns library path.
- *
- */
- public File[] getLibraryPath() {
- return new File[0];
- }
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- StringBuffer buf = new StringBuffer();
- int patternCount = libnames.length;
- if (libType == null) {
- patternCount *= 2;
- }
- String[] patterns = new String[patternCount];
- int offset = 0;
- if (libType == null || "static".equals(libType.getValue())) {
- offset = addLibraryPatterns(libnames, buf, "lib", ".a", patterns, 0);
- }
- if (libType != null && "framework".equals(libType.getValue()) && isDarwin()) {
- for(int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(libnames[i]);
- buf.append(".framework/");
- buf.append(libnames[i]);
- patterns[offset++] = buf.toString();
- }
- } else {
- if (libType == null || !"static".equals(libType.getValue())) {
- if (isHPUX()) {
- offset = addLibraryPatterns(libnames, buf, "lib", ".sl", patterns,
- offset);
- } else {
- offset = addLibraryPatterns(libnames, buf, "lib", ".so", patterns,
- offset);
- }
- }
- }
- return patterns;
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- public String getOutputFileName(String baseName) {
- return outputPrefix + super.getOutputFileName(baseName);
- }
- public String[] getOutputFileSwitch(String outputFile) {
- return GccProcessor.getOutputFileSwitch("-o", outputFile);
- }
- public boolean isCaseSensitive() {
- return true;
- }
- protected boolean isHPUX() {
- String osname = System.getProperty("os.name").toLowerCase();
- if (osname.indexOf("hp") >= 0 && osname.indexOf("ux") >= 0) {
- return true;
- }
- return false;
- }
- /**
- * Prepares argument list for exec command. Will return null if command
- * line would exceed allowable command line buffer.
- *
- * @param outputFile
- * linker output file
- * @param sourceFiles
- * linker input files (.obj, .o, .res)
- * @param args
- * linker arguments
- * @return arguments for runTask
- */
- public String[] prepareArguments(CCTask task, String outputDir,
- String outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) {
- //
- // need to suppress sources that correspond to
- // library set entries since they are already
- // in the argument list
- String[] libnames = config.getLibraryNames();
- if (libnames == null || libnames.length == 0) {
- return super.prepareArguments(task, outputDir, outputFile,
- sourceFiles, config);
- }
- //
- //
- // null out any sources that correspond to library names
- //
- String[] localSources = (String[]) sourceFiles.clone();
- int extra = 0;
- for (int i = 0; i < libnames.length; i++) {
- String libname = libnames[i];
- for (int j = 0; j < localSources.length; j++) {
- if (localSources[j] != null
- && localSources[j].indexOf(libname) > 0
- && localSources[j].indexOf("lib") > 0) {
- String filename = new File(localSources[j]).getName();
- if (filename.startsWith("lib")
- && filename.substring(3).startsWith(libname)) {
- String extension = filename
- .substring(libname.length() + 3);
- if (extension.equals(".a") || extension.equals(".so")
- || extension.equals(".sl")) {
- localSources[j] = null;
- extra++;
- }
- }
- }
- }
- }
- if (extra == 0) {
- return super.prepareArguments(task, outputDir, outputFile,
- sourceFiles, config);
- }
- String[] finalSources = new String[localSources.length - extra];
- int index = 0;
- for (int i = 0; i < localSources.length; i++) {
- if (localSources[i] != null) {
- finalSources[index++] = localSources[i];
- }
- }
- return super.prepareArguments(task, outputDir, outputFile,
- finalSources, config);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccAssembler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccAssembler.java
deleted file mode 100644
index 412bffa847..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccAssembler.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineAssembler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-
-/**
- * Adapter for gcc assemble
- *
- */
-public final class GccAssembler extends CommandLineAssembler {
- private final static String[] sourceExtensions = new String[] { ".asm" };
-
- private final static String[] headerExtensions = new String[] { ".h",
- ".inc" };
-
- private static final GccAssembler instance = new GccAssembler("gas",
- sourceExtensions, headerExtensions, false);
-
- /**
- * Gets gcc adapter
- */
- public static GccAssembler getInstance() {
- return instance;
- }
-
- /**
- * Private constructor. Use GccAssembler.getInstance() to get singleton
- * instance of this class.
- */
- private GccAssembler (String command, String[] sourceExtensions,
- String[] headerExtensions, boolean isLibtool) {
- super(command, null, sourceExtensions, headerExtensions,
- isLibtool ? ".fo" : ".o");
- }
-
- public void addImpliedArgs(Vector args, boolean debug, Boolean defaultflag) {
-
- }
-
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
-
- public Linker getLinker(LinkType linkType) {
- return GccLinker.getInstance().getLinker(linkType);
- }
-
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ":");
- }
-
- protected String getIncludeDirSwitch(String includeDir) {
- return "-I" + includeDir;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
deleted file mode 100644
index af3b26b134..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.parser.CParser;
-import net.sf.antcontrib.cpptasks.parser.FortranParser;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Environment;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-/**
- * Adapter for the GCC C/C++ compiler
- *
- * @author Adam Murdoch
- */
-public final class GccCCompiler extends GccCompatibleCCompiler {
- private final static String[] sourceExtensions = new String[]{".c", /* C */
- ".cc", /* C++ */
- ".cpp", /* C++ */
- ".cxx", /* C++ */
- ".c++", /* C++ */
- ".i", /* preprocessed C */
- ".ii", /* preprocessed C++ */
- ".f", /* FORTRAN */
- ".for", /* FORTRAN */
- ".m", /* Objective-C */
- ".mm", /* Objected-C++ */
- ".s" /* Assembly */
- };
- private final static String[] headerExtensions = new String[]{".h", ".hpp",
- ".inl"};
- private static final GccCCompiler cppInstance = new GccCCompiler("c++",
- sourceExtensions, headerExtensions, false,
- new GccCCompiler("c++", sourceExtensions, headerExtensions, true,
- null, false, null), false, null);
- private static final GccCCompiler g77Instance = new GccCCompiler("g77",
- sourceExtensions, headerExtensions, false,
- new GccCCompiler("g77", sourceExtensions, headerExtensions, true,
- null, false, null), false, null);
- private static final GccCCompiler gppInstance = new GccCCompiler("g++",
- sourceExtensions, headerExtensions, false,
- new GccCCompiler("g++", sourceExtensions, headerExtensions, true,
- null, false, null), false, null);
- private static final GccCCompiler instance = new GccCCompiler("gcc",
- sourceExtensions, headerExtensions, false,
- new GccCCompiler("gcc", sourceExtensions, headerExtensions, true,
- null, false, null), false, null);
- /**
- * Gets c++ adapter
- */
- public static GccCCompiler getCppInstance() {
- return cppInstance;
- }
- /**
- * Gets g77 adapter
- */
- public static GccCCompiler getG77Instance() {
- return g77Instance;
- }
- /**
- * Gets gpp adapter
- */
- public static GccCCompiler getGppInstance() {
- return gppInstance;
- }
- /**
- * Gets gcc adapter
- */
- public static GccCCompiler getInstance() {
- return instance;
- }
- private String identifier;
- private File[] includePath;
- private boolean isPICMeaningful = true;
- /**
- * Private constructor. Use GccCCompiler.getInstance() to get singleton
- * instance of this class.
- */
- private GccCCompiler(String command, String[] sourceExtensions,
- String[] headerExtensions, boolean isLibtool,
- GccCCompiler libtoolCompiler, boolean newEnvironment,
- Environment env) {
- super(command, null, sourceExtensions, headerExtensions, isLibtool,
- libtoolCompiler, newEnvironment, env);
- isPICMeaningful = System.getProperty("os.name").indexOf("Windows") < 0;
- }
- public void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- super.addImpliedArgs(args, debug, multithreaded,
- exceptions, linkType, rtti, optimization, defaultflag);
- if (isPICMeaningful && linkType.isSharedLibrary()) {
- args.addElement("-fPIC");
- }
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new GccCCompiler(getCommand(), this.getSourceExtensions(),
- this.getHeaderExtensions(), this.getLibtool(),
- (GccCCompiler) this.getLibtoolCompiler(), newEnvironment,
- env);
- }
- return this;
- }
- /**
- * Create parser to determine dependencies.
- *
- * Will create appropriate parser (C++, FORTRAN) based on file extension.
- *
- */
- protected Parser createParser(File source) {
- if (source != null) {
- String sourceName = source.getName();
- int lastDot = sourceName.lastIndexOf('.');
- if (lastDot >= 0 && lastDot + 1 < sourceName.length()) {
- char afterDot = sourceName.charAt(lastDot + 1);
- if (afterDot == 'f' || afterDot == 'F') {
- return new FortranParser();
- }
- }
- }
- return new CParser();
- }
- public File[] getEnvironmentIncludePath() {
- if (includePath == null) {
- //
- // construct default include path from machine id and version id
- //
- String[] defaultInclude = new String[1];
- StringBuffer buf = new StringBuffer("/lib/");
- buf.append(GccProcessor.getMachine());
- buf.append('/');
- buf.append(GccProcessor.getVersion());
- buf.append("/include");
- defaultInclude[0] = buf.toString();
- //
- // read specs file and look for -istart and -idirafter
- //
- String[] specs = GccProcessor.getSpecs();
- String[][] optionValues = GccProcessor.parseSpecs(specs, "*cpp:",
- new String[]{"-isystem ", "-idirafter "});
- //
- // if no entries were found, then use a default path
- //
- if (optionValues[0].length == 0 && optionValues[1].length == 0) {
- optionValues[0] = new String[]{"/usr/local/include",
- "/usr/include", "/usr/include/win32api"};
- }
- //
- // remove mingw entries.
- // For MinGW compiles this will mean the
- // location of the sys includes will be
- // wrong in dependencies.xml
- // but that should have no significant effect
- for (int i = 0; i < optionValues.length; i++) {
- for (int j = 0; j < optionValues[i].length; j++) {
- if (optionValues[i][j].indexOf("mingw") > 0) {
- optionValues[i][j] = null;
- }
- }
- }
- //
- // if cygwin then
- // we have to prepend location of gcc32
- // and .. to start of absolute filenames to
- // have something that will exist in the
- // windows filesystem
- if (GccProcessor.isCygwin()) {
- GccProcessor.convertCygwinFilenames(optionValues[0]);
- GccProcessor.convertCygwinFilenames(optionValues[1]);
- GccProcessor.convertCygwinFilenames(defaultInclude);
- }
- int count = CUtil.checkDirectoryArray(optionValues[0]);
- count += CUtil.checkDirectoryArray(optionValues[1]);
- count += CUtil.checkDirectoryArray(defaultInclude);
- includePath = new File[count];
- int index = 0;
- for (int i = 0; i < optionValues.length; i++) {
- for (int j = 0; j < optionValues[i].length; j++) {
- if (optionValues[i][j] != null) {
- includePath[index++] = new File(optionValues[i][j]);
- }
- }
- }
- for (int i = 0; i < defaultInclude.length; i++) {
- if (defaultInclude[i] != null) {
- includePath[index++] = new File(defaultInclude[i]);
- }
- }
- }
- return (File[]) includePath.clone();
- }
- public String getIdentifier() throws BuildException {
- if (identifier == null) {
- StringBuffer buf;
- if (getLibtool()) {
- buf = new StringBuffer("libtool ");
- } else {
- buf = new StringBuffer(' ');
- }
- buf.append(getCommand());
- buf.append(' ');
- buf.append(GccProcessor.getVersion());
- buf.append(' ');
- buf.append(GccProcessor.getMachine());
- identifier = buf.toString();
- }
- return identifier;
- }
- public Linker getLinker(LinkType linkType) {
- return GccLinker.getInstance().getLinker(linkType);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java
deleted file mode 100644
index 98f086ed61..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-import java.io.File;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCCompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import org.apache.tools.ant.types.Environment;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-/**
- * Abstract base class for compilers that attempt to be command line compatible
- * with GCC
- *
- * @author Adam Murdoch
- * @author Curt Arnold
- */
-public abstract class GccCompatibleCCompiler extends CommandLineCCompiler {
- private final static String[] headerExtensions = new String[]{".h", ".hpp",
- ".inl"};
- private final static String[] sourceExtensions = new String[]{".c", ".cc",
- ".cpp", ".cxx", ".c++", ".i", ".f", ".for"};
- private final static String[] defaultflags = new String[]{"-c"};
- /**
- * Private constructor. Use GccCCompiler.getInstance() to get singleton
- * instance of this class.
- */
- protected GccCompatibleCCompiler(String command, String identifierArg,
- boolean libtool, GccCompatibleCCompiler libtoolCompiler,
- boolean newEnvironment, Environment env) {
- super(command, identifierArg, sourceExtensions, headerExtensions,
- libtool ? ".fo" : ".o", libtool, libtoolCompiler,
- newEnvironment, env);
- }
- /**
- * Private constructor. Use GccCCompiler.getInstance() to get singleton
- * instance of this class.
- */
- protected GccCompatibleCCompiler(String command, String identifierArg,
- String[] sourceExtensions, String[] headerExtensions,
- boolean libtool, GccCompatibleCCompiler libtoolCompiler,
- boolean newEnvironment, Environment env) {
- super(command, identifierArg, sourceExtensions, headerExtensions,
- libtool ? ".fo" : ".o", libtool, libtoolCompiler,
- newEnvironment, env);
- }
- public void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- //
- // -fPIC is too much trouble
- // users have to manually add it for
- // operating systems that make sense
- //
- if (defaultflag != null && defaultflag.booleanValue()) {
- for (int i = 0; i < defaultflags.length; i++) {
- args.addElement(defaultflags[i]);
- }
- }
- if (debug) {
- args.addElement("-g");
- } else {
- if (optimization != null) {
- if (optimization.isSize()) {
- args.addElement("-Os");
- } else if (optimization.isSpeed()) {
- if ("full".equals(optimization.getValue())) {
- args.addElement("-O2");
- } else {
- if ("speed".equals(optimization.getValue())) {
- args.addElement("-O1");
- } else {
- args.addElement("-O3");
- }
- }
- }
- }
- }
- if (getIdentifier().indexOf("mingw") >= 0) {
- if (linkType.isSubsystemConsole()) {
- args.addElement("-mconsole");
- }
- if (linkType.isSubsystemGUI()) {
- args.addElement("-mwindows");
- }
- }
- if (rtti != null && !rtti.booleanValue()) {
- args.addElement("-fno-rtti");
- }
-
- }
- /**
- * Adds an include path to the command.
- */
- public void addIncludePath(String path, Vector cmd) {
- cmd.addElement("-I" + path);
- }
- public void addWarningSwitch(Vector args, int level) {
- switch (level) {
- case 0 :
- args.addElement("-w");
- break;
- case 5 :
- args.addElement("-Werror");
- /* nobreak */
- case 4 :
- args.addElement("-W");
- /* nobreak */
- case 3 :
- args.addElement("-Wall");
- break;
- }
- }
- public void getDefineSwitch(StringBuffer buffer, String define, String value) {
- buffer.append("-D");
- buffer.append(define);
- if (value != null && value.length() > 0) {
- buffer.append('=');
- buffer.append(value);
- }
- }
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ":");
- }
- public String getIncludeDirSwitch(String includeDir) {
- return "-I" + includeDir;
- }
- public void getUndefineSwitch(StringBuffer buffer, String define) {
- buffer.append("-U");
- buffer.append(define);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccLibrarian.java
deleted file mode 100644
index 62500021cf..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccLibrarian.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-/**
- * Adapter for the 'ar' archiver
- *
- * @author Adam Murdoch
- */
-public final class GccLibrarian extends AbstractArLibrarian {
- private static String[] objFileExtensions = new String[]{".o"};
- private static GccLibrarian instance = new GccLibrarian("ar",
- objFileExtensions, false, new GccLibrarian("ar", objFileExtensions,
- true, null));
- public static GccLibrarian getInstance() {
- return instance;
- }
- private GccLibrarian(String command, String[] inputExtensions,
- boolean isLibtool, GccLibrarian libtoolLibrarian) {
- super(command, "V", inputExtensions, new String[0], "lib", ".a",
- isLibtool, libtoolLibrarian);
- }
- public Linker getLinker(LinkType type) {
- return GccLinker.getInstance().getLinker(type);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
deleted file mode 100644
index f37f55092a..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-/**
- * Adapter for the GCC linker
- *
- * @author Adam Murdoch
- */
-public class GccLinker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[0];
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static String[] linkerOptions = new String[]{"-bundle",
- "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-s",
- "-static", "-shared", "-symbolic", "-Xlinker",
- "--export-all-symbols", "-static-libgcc",};
- private static final GccLinker dllLinker = new GccLinker("gcc", objFiles,
- discardFiles, "lib", ".so", false, new GccLinker("gcc", objFiles,
- discardFiles, "lib", ".so", true, null));
- private static final GccLinker instance = new GccLinker("gcc", objFiles,
- discardFiles, "", "", false, null);
- private static final GccLinker machBundleLinker = new GccLinker("gcc",
- objFiles, discardFiles, "lib", ".bundle", false, null);
- private static final GccLinker machDllLinker = new GccLinker("gcc",
- objFiles, discardFiles, "lib", ".dylib", false, null);
- public static GccLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- protected GccLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix,
- String outputSuffix, boolean isLibtool, GccLinker libtoolLinker) {
- super(command, "-dumpversion", extensions, ignoredExtensions,
- outputPrefix, outputSuffix, isLibtool, libtoolLinker);
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- super.addImpliedArgs(debug, linkType, args, defaultflag);
- if (getIdentifier().indexOf("mingw") >= 0) {
- if (linkType.isSubsystemConsole()) {
- args.addElement("-mconsole");
- }
- if (linkType.isSubsystemGUI()) {
- args.addElement("-mwindows");
- }
- }
- }
- /**
- * Allows drived linker to decorate linker option. Override by GccLinker to
- * prepend a "-Wl," to pass option to through gcc to linker.
- *
- * @param buf
- * buffer that may be used and abused in the decoration process,
- * must not be null.
- * @param arg
- * linker argument
- */
- public String decorateLinkerOption(StringBuffer buf, String arg) {
- String decoratedArg = arg;
- if (arg.length() > 1 && arg.charAt(0) == '-') {
- switch (arg.charAt(1)) {
- //
- // passed automatically by GCC
- //
- case 'g' :
- case 'f' :
- case 'F' :
- /* Darwin */
- case 'm' :
- case 'O' :
- case 'W' :
- case 'l' :
- case 'L' :
- case 'u' :
- case 'v' :
- break;
- default :
- boolean known = false;
- for (int i = 0; i < linkerOptions.length; i++) {
- if (linkerOptions[i].equals(arg)) {
- known = true;
- break;
- }
- }
- if (!known) {
- buf.setLength(0);
- buf.append("-Wl,");
- buf.append(arg);
- decoratedArg = buf.toString();
- }
- break;
- }
- }
- return decoratedArg;
- }
- /**
- * Returns library path.
- *
- */
- public File[] getLibraryPath() {
- if (libDirs == null) {
- //
- // construct gcc lib path from machine and version
- //
- StringBuffer buf = new StringBuffer("/lib/gcc-lib/");
- buf.append(GccProcessor.getMachine());
- buf.append('/');
- buf.append(GccProcessor.getVersion());
- //
- // build default path from gcc and system /lib and /lib/w32api
- //
- String[] impliedLibPath = new String[]{buf.toString(),
- "/lib/w32api", "/lib"};
- //
- // read gcc specs file for other library paths
- //
- String[] specs = GccProcessor.getSpecs();
- String[][] libpaths = GccProcessor.parseSpecs(specs, "*link:",
- new String[]{"%q"});
- String[] libpath;
- if (libpaths[0].length > 0) {
- libpath = new String[libpaths[0].length + 3];
- int i = 0;
- for (; i < libpaths[0].length; i++) {
- libpath[i] = libpaths[0][i];
- }
- libpath[i++] = buf.toString();
- libpath[i++] = "/lib/w32api";
- libpath[i++] = "/lib";
- } else {
- //
- // if a failure to find any matches then
- // use some default values for lib path entries
- libpath = new String[]{"/usr/local/lib/mingw",
- "/usr/local/lib", "/usr/lib/w32api", "/usr/lib/mingw",
- "/usr/lib", buf.toString(), "/lib/w32api", "/lib"};
- }
- for (int i = 0; i < libpath.length; i++) {
- if (libpath[i].indexOf("mingw") >= 0) {
- libpath[i] = null;
- }
- }
- //
- // if cygwin then
- // we have to prepend location of gcc32
- // and .. to start of absolute filenames to
- // have something that will exist in the
- // windows filesystem
- if (GccProcessor.isCygwin()) {
- GccProcessor.convertCygwinFilenames(libpath);
- }
- //
- // check that remaining entries are actual directories
- //
- int count = CUtil.checkDirectoryArray(libpath);
- //
- // populate return array with remaining entries
- //
- libDirs = new File[count];
- int index = 0;
- for (int i = 0; i < libpath.length; i++) {
- if (libpath[i] != null) {
- libDirs[index++] = new File(libpath[i]);
- }
- }
- }
- return libDirs;
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isPluginModule()) {
- if (isDarwin()) {
- return machBundleLinker;
- } else {
- return dllLinker;
- }
- }
- if (type.isSharedLibrary()) {
- if (isDarwin()) {
- return machDllLinker;
- } else {
- return dllLinker;
- }
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccProcessor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccProcessor.java
deleted file mode 100644
index 236969f5e7..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GccProcessor.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CaptureStreamHandler;
-/**
- * A add-in class for Gcc processors
- *
- *
- */
-public class GccProcessor {
- // the results from gcc -dumpmachine
- private static String machine;
- private static String[] specs;
- // the results from gcc -dumpversion
- private static String version;
- private static int addLibraryPatterns(String[] libnames, StringBuffer buf,
- String prefix, String extension, String[] patterns, int offset) {
- for (int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(libnames[i]);
- buf.append(extension);
- patterns[offset + i] = buf.toString();
- }
- return offset + libnames.length;
- }
- /**
- * Converts absolute Cygwin file or directory names to the corresponding
- * Win32 name.
- *
- * @param names
- * array of names, some elements may be null, will be changed in
- * place.
- */
- public static void convertCygwinFilenames(String[] names) {
- if (names == null) {
- throw new NullPointerException("names");
- }
- File gccDir = CUtil.getExecutableLocation("gcc.exe");
- if (gccDir != null) {
- String prefix = gccDir.getAbsolutePath() + "/..";
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < names.length; i++) {
- String name = names[i];
- if (name != null && name.length() > 1 && name.charAt(0) == '/') {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(name);
- names[i] = buf.toString();
- }
- }
- }
- }
- public static String[] getLibraryPatterns(String[] libnames) {
- StringBuffer buf = new StringBuffer();
- String[] patterns = new String[libnames.length * 2];
- int offset = addLibraryPatterns(libnames, buf, "lib", ".a", patterns, 0);
- if (isHPUX()) {
- offset = addLibraryPatterns(libnames, buf, "lib", ".sl", patterns,
- offset);
- } else {
- offset = addLibraryPatterns(libnames, buf, "lib", ".so", patterns,
- offset);
- }
- return patterns;
- }
- public static String getMachine() {
- if (machine == null) {
- String[] args = new String[]{"gcc", "-dumpmachine"};
- String[] cmdout = CaptureStreamHandler.run(args);
- if (cmdout.length == 0) {
- machine = "nomachine";
- } else {
- machine = cmdout[0];
- }
- }
- return machine;
- }
- public static String[] getOutputFileSwitch(String letter, String outputFile) {
- StringBuffer buf = new StringBuffer();
- if (outputFile.indexOf(' ') >= 0) {
- buf.append('"');
- buf.append(outputFile.replace('\\', '/'));
- buf.append('"');
- } else {
- buf.append(outputFile.replace('\\', '/'));
- }
- String[] retval = new String[]{letter, buf.toString()};
- return retval;
- }
- /**
- * Returns the contents of the gcc specs file.
- *
- * The implementation locates gcc.exe in the executable path and then
- * builds a relative path name from the results of -dumpmachine and
- * -dumpversion. Attempts to use gcc -dumpspecs to provide this information
- * resulted in stalling on the Execute.run
- *
- * @returns contents of the specs file
- */
- public static String[] getSpecs() {
- if (specs == null) {
- File gccParent = CUtil.getExecutableLocation("gcc.exe");
- if (gccParent != null) {
- //
- // build a relative path like
- // ../lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
- //
- StringBuffer buf = new StringBuffer("../lib/gcc-lib/");
- buf.append(getMachine());
- buf.append('/');
- buf.append(getVersion());
- buf.append("/specs");
- //
- // resolve it relative to the location of gcc.exe
- //
- String relativePath = buf.toString();
- File specsFile = new File(gccParent, relativePath);
- //
- // found the specs file
- //
- try {
- //
- // read the lines in the file
- //
- BufferedReader reader = new BufferedReader(new FileReader(
- specsFile));
- Vector lines = new Vector(100);
- String line = reader.readLine();
- while (line != null) {
- lines.addElement(line);
- line = reader.readLine();
- }
- specs = new String[lines.size()];
- lines.copyInto(specs);
- } catch (IOException ex) {
- }
- }
- }
- if (specs == null) {
- specs = new String[0];
- }
- return specs;
- }
- public static String getVersion() {
- if (version == null) {
- String[] args = new String[]{"gcc", "-dumpversion"};
- String[] cmdout = CaptureStreamHandler.run(args);
- if (cmdout.length == 0) {
- version = "noversion";
- } else {
- version = cmdout[0];
- }
- }
- return version;
- }
- public static boolean isCaseSensitive() {
- return true;
- }
- /**
- * Determines if task is running with cygwin
- *
- * @return true if cygwin was detected
- */
- public static boolean isCygwin() {
- return getMachine().indexOf("cygwin") > 0;
- }
- private static boolean isHPUX() {
- String osname = System.getProperty("os.name").toLowerCase();
- if (osname.indexOf("hp") >= 0 && osname.indexOf("ux") >= 0) {
- return true;
- }
- return false;
- }
- /**
- *
- * Parses the results of the specs file for a specific processor and
- * options
- *
- * @param specsContent
- * Contents of specs file as returned from getSpecs
- * @param specSectionStart
- * start of spec section, for example "*cpp:"
- * @param options
- * command line switches such as "-istart"
- */
- public static String[][] parseSpecs(String[] specsContent,
- String specSectionStart, String[] options) {
- if (specsContent == null) {
- throw new NullPointerException("specsContent");
- }
- if (specSectionStart == null) {
- throw new NullPointerException("specSectionStart");
- }
- if (options == null) {
- throw new NullPointerException("option");
- }
- String[][] optionValues = new String[options.length][];
- StringBuffer optionValue = new StringBuffer(40);
- for (int i = 0; i < specsContent.length; i++) {
- String specLine = specsContent[i];
- //
- // if start of section then start paying attention
- //
- if (specLine.startsWith(specSectionStart)) {
- Vector[] optionVectors = new Vector[options.length];
- for (int j = 0; j < options.length; j++) {
- optionVectors[j] = new Vector(10);
- }
- //
- // go to next line and examine contents
- // and repeat until end of file
- //
- for (i++; i < specsContent.length; i++) {
- specLine = specsContent[i];
- for (int j = 0; j < options.length; j++) {
- int optionStart = specLine.indexOf(options[j]);
- while (optionStart >= 0) {
- optionValue.setLength(0);
- //
- // walk rest of line looking for first non
- // whitespace
- // and then next space
- boolean hasNonBlank = false;
- int k = optionStart + options[j].length();
- for (; k < specLine.length(); k++) {
- //
- // either a blank or a "}" (close of
- // conditional)
- // section will end the path
- //
- if (specLine.charAt(k) == ' '
- || specLine.charAt(k) == '}') {
- if (hasNonBlank) {
- break;
- }
- } else {
- hasNonBlank = true;
- optionValue.append(specLine.charAt(k));
- }
- }
- //
- // transition back to whitespace
- // value is over, add it to vector
- if (hasNonBlank) {
- optionVectors[j].addElement(optionValue
- .toString());
- }
- //
- // find next occurance on line
- //
- optionStart = specLine.indexOf(options[j], k);
- }
- }
- }
- //
- // copy vectors over to option arrays
- //
- for (int j = 0; j < options.length; j++) {
- optionValues[j] = new String[optionVectors[j].size()];
- optionVectors[j].copyInto(optionValues[j]);
- }
- }
- }
- //
- // fill in any missing option values with
- // a zero-length string array
- for (int i = 0; i < optionValues.length; i++) {
- String[] zeroLenArray = new String[0];
- if (optionValues[i] == null) {
- optionValues[i] = zeroLenArray;
- }
- }
- return optionValues;
- }
- private GccProcessor() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GppLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
deleted file mode 100644
index e7036abe16..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- *
- * Copyright 2003-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CaptureStreamHandler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-/**
- * Adapter for the g++ variant of the GCC linker
- *
- * @author Stephen M. Webb <stephen.webb@bregmasoft.com>
- */
-public class GppLinker extends AbstractLdLinker {
- protected static final String[] discardFiles = new String[0];
- protected static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final GppLinker dllLinker = new GppLinker("gcc", objFiles,
- discardFiles, "lib", ".so", false, new GppLinker("gcc", objFiles,
- discardFiles, "lib", ".so", true, null));
- private final static String libPrefix = "libraries: =";
- protected static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static String[] linkerOptions = new String[]{"-bundle", "-dylib",
- "-dynamic", "-dynamiclib", "-nostartfiles", "-nostdlib",
- "-prebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker"};
- private static final GppLinker instance = new GppLinker("gcc", objFiles,
- discardFiles, "", "", false, null);
- private static final GppLinker machDllLinker = new GppLinker("gcc",
- objFiles, discardFiles, "lib", ".dylib", false, null);
- private static final GppLinker machPluginLinker = new GppLinker("gcc",
- objFiles, discardFiles, "lib", ".bundle", false, null);
- public static GppLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- private String runtimeLibrary;
- protected GppLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix,
- String outputSuffix, boolean isLibtool, GppLinker libtoolLinker) {
- super(command, "-dumpversion", extensions, ignoredExtensions,
- outputPrefix, outputSuffix, isLibtool, libtoolLinker);
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- super.addImpliedArgs(debug, linkType, args, defaultflag);
- if (getIdentifier().indexOf("mingw") >= 0) {
- if (linkType.isSubsystemConsole()) {
- args.addElement("-mconsole");
- }
- if (linkType.isSubsystemGUI()) {
- args.addElement("-mwindows");
- }
- }
- if (linkType.isStaticRuntime()) {
- String[] cmdin = new String[]{"g++", "-print-file-name=libstdc++.a"};
- String[] cmdout = CaptureStreamHandler.run(cmdin);
- if (cmdout.length > 0) {
- runtimeLibrary = cmdout[0];
- } else {
- runtimeLibrary = null;
- }
- } else {
- runtimeLibrary = "-lstdc++";
- }
- }
- public String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
- Vector preargs, Vector midargs, Vector endargs) {
- String[] rs = super.addLibrarySets(task, libsets, preargs, midargs,
- endargs);
- if (runtimeLibrary != null) {
- endargs.addElement(runtimeLibrary);
- }
- return rs;
- }
- /**
- * Allows drived linker to decorate linker option. Override by GppLinker to
- * prepend a "-Wl," to pass option to through gcc to linker.
- *
- * @param buf
- * buffer that may be used and abused in the decoration process,
- * must not be null.
- * @param arg
- * linker argument
- */
- public String decorateLinkerOption(StringBuffer buf, String arg) {
- String decoratedArg = arg;
- if (arg.length() > 1 && arg.charAt(0) == '-') {
- switch (arg.charAt(1)) {
- //
- // passed automatically by GCC
- //
- case 'g' :
- case 'f' :
- case 'F' :
- /* Darwin */
- case 'm' :
- case 'O' :
- case 'W' :
- case 'l' :
- case 'L' :
- case 'u' :
- break;
- default :
- boolean known = false;
- for (int i = 0; i < linkerOptions.length; i++) {
- if (linkerOptions[i].equals(arg)) {
- known = true;
- break;
- }
- }
- if (!known) {
- buf.setLength(0);
- buf.append("-Wl,");
- buf.append(arg);
- decoratedArg = buf.toString();
- }
- break;
- }
- }
- return decoratedArg;
- }
- /**
- * Returns library path.
- *
- */
- public File[] getLibraryPath() {
- if (libDirs == null) {
- Vector dirs = new Vector();
- // Ask GCC where it will look for its libraries.
- String[] args = new String[]{"g++", "-print-search-dirs"};
- String[] cmdout = CaptureStreamHandler.run(args);
- for (int i = 0; i < cmdout.length; ++i) {
- int prefixIndex = cmdout[i].indexOf(libPrefix);
- if (prefixIndex >= 0) {
- // Special case DOS-type GCCs like MinGW or Cygwin
- int s = prefixIndex + libPrefix.length();
- int t = cmdout[i].indexOf(';', s);
- while (t > 0) {
- dirs.addElement(cmdout[i].substring(s, t));
- s = t + 1;
- t = cmdout[i].indexOf(';', s);
- }
- dirs.addElement(cmdout[i].substring(s));
- ++i;
- for (; i < cmdout.length; ++i) {
- dirs.addElement(cmdout[i]);
- }
- }
- }
- // Eliminate all but actual directories.
- String[] libpath = new String[dirs.size()];
- dirs.copyInto(libpath);
- int count = CUtil.checkDirectoryArray(libpath);
- // Build return array.
- libDirs = new File[count];
- int index = 0;
- for (int i = 0; i < libpath.length; ++i) {
- if (libpath[i] != null) {
- libDirs[index++] = new File(libpath[i]);
- }
- }
- }
- return libDirs;
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isPluginModule()) {
- if (GccProcessor.getMachine().indexOf("darwin") >= 0) {
- return machPluginLinker;
- } else {
- return dllLinker;
- }
- }
- if (type.isSharedLibrary()) {
- if (GccProcessor.getMachine().indexOf("darwin") >= 0) {
- return machDllLinker;
- } else {
- return dllLinker;
- }
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/LdLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/LdLinker.java
deleted file mode 100644
index e05fa5b2db..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/LdLinker.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-/**
- * Adapter for the 'ld' linker
- *
- * @author Curt Arnold
- */
-public final class LdLinker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[0];
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final LdLinker dllLinker = new LdLinker("ld", objFiles,
- discardFiles, "lib", ".so", false, new LdLinker("ld", objFiles,
- discardFiles, "lib", ".so", true, null));
- private static final LdLinker instance = new LdLinker("ld", objFiles,
- discardFiles, "", "", false, null);
- private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- public static LdLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- private LdLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix,
- String outputSuffix, boolean isLibtool, LdLinker libtoolLinker) {
- super(command, "-version", extensions, ignoredExtensions, outputPrefix,
- outputSuffix, isLibtool, libtoolLinker);
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccCCompiler.java
deleted file mode 100644
index 6a5697eb80..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccCCompiler.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross;
-import java.io.File;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.CompilerParam;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.compiler.ProgressMonitor;
-import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
-import net.sf.antcontrib.cpptasks.parser.CParser;
-import net.sf.antcontrib.cpptasks.parser.FortranParser;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Environment;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-/**
- * Adapter for the GCC C/C++ compiler
- *
- * @author Adam Murdoch
- */
-public final class GccCCompiler extends GccCompatibleCCompiler {
- private final static String[] headerExtensions = new String[]{".h", ".hpp",
- ".inl"};
- private final static String[] sourceExtensions = new String[]{".c", /* C */
- ".cc", /* C++ */
- ".cpp", /* C++ */
- ".cxx", /* C++ */
- ".c++", /* C++ */
- ".i", /* preprocessed C */
- ".ii", /* preprocessed C++ */
- ".f", /* FORTRAN */
- ".for", /* FORTRAN */
- ".m", /* Objective-C */
- ".mm", /* Objected-C++ */
- ".s" /* Assembly */
- };
- private static final GccCCompiler cppInstance = new GccCCompiler("c++",
- sourceExtensions, headerExtensions, false,
- new GccCCompiler("c++", sourceExtensions, headerExtensions, true,
- null, false, null), false, null);
- private static final GccCCompiler g77Instance = new GccCCompiler("g77",
- sourceExtensions, headerExtensions, false,
- new GccCCompiler("g77", sourceExtensions, headerExtensions, true,
- null, false, null), false, null);
- private static final GccCCompiler gppInstance = new GccCCompiler("g++",
- sourceExtensions, headerExtensions, false,
- new GccCCompiler("g++", sourceExtensions, headerExtensions, true,
- null, false, null), false, null);
- private static final GccCCompiler instance = new GccCCompiler("gcc",
- sourceExtensions, headerExtensions, false,
- new GccCCompiler("gcc", sourceExtensions, headerExtensions, true,
- null, false, null), false, null);
- /**
- * Gets c++ adapter
- */
- public static GccCCompiler getCppInstance() {
- return cppInstance;
- }
- /**
- * Gets g77 adapter
- */
- public static GccCCompiler getG77Instance() {
- return g77Instance;
- }
- /**
- * Gets gpp adapter
- */
- public static GccCCompiler getGppInstance() {
- return gppInstance;
- }
- /**
- * Gets gcc adapter
- */
- public static GccCCompiler getInstance() {
- return instance;
- }
- private String identifier;
- private File[] includePath;
- private boolean isPICMeaningful = true;
- /**
- * Private constructor. Use GccCCompiler.getInstance() to get singleton
- * instance of this class.
- */
- private GccCCompiler(String command, String[] sourceExtensions,
- String[] headerExtensions, boolean isLibtool,
- GccCCompiler libtoolCompiler, boolean newEnvironment,
- Environment env) {
- super(command, null, sourceExtensions, headerExtensions, isLibtool,
- libtoolCompiler, newEnvironment, env);
- isPICMeaningful = System.getProperty("os.name").indexOf("Windows") < 0;
- }
- public void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- super.addImpliedArgs(args, debug, multithreaded,
- exceptions, linkType, rtti, optimization, defaultflag);
- if (isPICMeaningful && linkType.isSharedLibrary()) {
- args.addElement("-fPIC");
- }
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new GccCCompiler(getCommand(), this.getSourceExtensions(),
- this.getHeaderExtensions(), this.getLibtool(),
- (GccCCompiler) this.getLibtoolCompiler(), newEnvironment,
- env);
- }
- return this;
- }
- protected Object clone() throws CloneNotSupportedException {
- GccCCompiler clone = (GccCCompiler) super.clone();
- return clone;
- }
- public void compile(CCTask task, File outputDir, String[] sourceFiles,
- String[] args, String[] endArgs, boolean relentless,
- CommandLineCompilerConfiguration config, ProgressMonitor monitor)
- throws BuildException {
- try {
- GccCCompiler clone = (GccCCompiler) this.clone();
- CompilerParam param = config.getParam("target");
- if (param != null)
- clone.setCommand(param.getValue() + "-" + this.getCommand());
- clone.supercompile(task, outputDir, sourceFiles, args, endArgs,
- relentless, config, monitor);
- } catch (CloneNotSupportedException e) {
- supercompile(task, outputDir, sourceFiles, args, endArgs,
- relentless, config, monitor);
- }
- }
- /**
- * Create parser to determine dependencies.
- *
- * Will create appropriate parser (C++, FORTRAN) based on file extension.
- *
- */
- protected Parser createParser(File source) {
- if (source != null) {
- String sourceName = source.getName();
- int lastDot = sourceName.lastIndexOf('.');
- if (lastDot >= 0 && lastDot + 1 < sourceName.length()) {
- char afterDot = sourceName.charAt(lastDot + 1);
- if (afterDot == 'f' || afterDot == 'F') {
- return new FortranParser();
- }
- }
- }
- return new CParser();
- }
- public File[] getEnvironmentIncludePath() {
- if (includePath == null) {
- //
- // construct default include path from machine id and version id
- //
- String[] defaultInclude = new String[1];
- StringBuffer buf = new StringBuffer("/lib/");
- buf.append(GccProcessor.getMachine());
- buf.append('/');
- buf.append(GccProcessor.getVersion());
- buf.append("/include");
- defaultInclude[0] = buf.toString();
- //
- // read specs file and look for -istart and -idirafter
- //
- String[] specs = GccProcessor.getSpecs();
- String[][] optionValues = GccProcessor.parseSpecs(specs, "*cpp:",
- new String[]{"-isystem ", "-idirafter "});
- //
- // if no entries were found, then use a default path
- //
- if (optionValues[0].length == 0 && optionValues[1].length == 0) {
- optionValues[0] = new String[]{"/usr/local/include",
- "/usr/include", "/usr/include/win32api"};
- }
- //
- // remove mingw entries.
- // For MinGW compiles this will mean the
- // location of the sys includes will be
- // wrong in dependencies.xml
- // but that should have no significant effect
- for (int i = 0; i < optionValues.length; i++) {
- for (int j = 0; j < optionValues[i].length; j++) {
- if (optionValues[i][j].indexOf("mingw") > 0) {
- optionValues[i][j] = null;
- }
- }
- }
- //
- // if cygwin then
- // we have to prepend location of gcc32
- // and .. to start of absolute filenames to
- // have something that will exist in the
- // windows filesystem
- if (GccProcessor.isCygwin()) {
- GccProcessor.convertCygwinFilenames(optionValues[0]);
- GccProcessor.convertCygwinFilenames(optionValues[1]);
- GccProcessor.convertCygwinFilenames(defaultInclude);
- }
- int count = CUtil.checkDirectoryArray(optionValues[0]);
- count += CUtil.checkDirectoryArray(optionValues[1]);
- count += CUtil.checkDirectoryArray(defaultInclude);
- includePath = new File[count];
- int index = 0;
- for (int i = 0; i < optionValues.length; i++) {
- for (int j = 0; j < optionValues[i].length; j++) {
- if (optionValues[i][j] != null) {
- includePath[index++] = new File(optionValues[i][j]);
- }
- }
- }
- for (int i = 0; i < defaultInclude.length; i++) {
- if (defaultInclude[i] != null) {
- includePath[index++] = new File(defaultInclude[i]);
- }
- }
- }
- return (File[]) includePath.clone();
- }
- public String getIdentifier() throws BuildException {
- if (identifier == null) {
- StringBuffer buf;
- if (getLibtool()) {
- buf = new StringBuffer("libtool ");
- } else {
- buf = new StringBuffer(' ');
- }
- buf.append(getCommand());
- buf.append(' ');
- buf.append(GccProcessor.getVersion());
- buf.append(' ');
- buf.append(GccProcessor.getMachine());
- identifier = buf.toString();
- }
- return identifier;
- }
- public Linker getLinker(LinkType linkType) {
- return GccLinker.getInstance().getLinker(linkType);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- private void supercompile(CCTask task, File outputDir,
- String[] sourceFiles, String[] args, String[] endArgs,
- boolean relentless, CommandLineCompilerConfiguration config,
- ProgressMonitor monitor) throws BuildException {
- super.compile(task, outputDir, sourceFiles, args, endArgs, relentless,
- config, monitor);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccLibrarian.java
deleted file mode 100644
index ea2278a6e7..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccLibrarian.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.LinkerParam;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractArLibrarian;
-
-import org.apache.tools.ant.BuildException;
-/**
- * Adapter for the 'ar' archiver
- *
- * @author Adam Murdoch
- */
-public final class GccLibrarian extends AbstractArLibrarian {
- private static String[] objFileExtensions = new String[]{".o"};
- private static GccLibrarian instance = new GccLibrarian("ar",
- objFileExtensions, false, new GccLibrarian("ar", objFileExtensions,
- true, null));
- public static GccLibrarian getInstance() {
- return instance;
- }
- private GccLibrarian(String command, String[] inputExtensions,
- boolean isLibtool, GccLibrarian libtoolLibrarian) {
- super(command, "V", inputExtensions, new String[0], "lib", ".a",
- isLibtool, libtoolLibrarian);
- }
- protected Object clone() throws CloneNotSupportedException {
- GccLibrarian clone = (GccLibrarian) super.clone();
- return clone;
- }
- public Linker getLinker(LinkType type) {
- return GccLinker.getInstance().getLinker(type);
- }
- public void link(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- try {
- GccLibrarian clone = (GccLibrarian) this.clone();
- LinkerParam param = config.getParam("target");
- if (param != null)
- clone.setCommand(param.getValue() + "-" + this.getCommand());
- clone.superlink(task, outputFile, sourceFiles, config);
- } catch (CloneNotSupportedException e) {
- superlink(task, outputFile, sourceFiles, config);
- }
- }
- private void superlink(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- super.link(task, outputFile, sourceFiles, config);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java
deleted file mode 100644
index 3293829d13..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross;
-import java.io.File;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.LinkerParam;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-import org.apache.tools.ant.BuildException;
-/**
- * Adapter for the GCC linker
- *
- * @author Adam Murdoch
- */
-public class GccLinker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[0];
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final GccLinker dllLinker = new GccLinker("gcc", objFiles,
- discardFiles, "lib", ".so", false, new GccLinker("gcc", objFiles,
- discardFiles, "lib", ".so", true, null));
- private static final GccLinker instance = new GccLinker("gcc", objFiles,
- discardFiles, "", "", false, null);
- private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static String[] linkerOptions = new String[]{"-bundle",
- "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-s",
- "-static", "-shared", "-symbolic", "-Xlinker",
- "--export-all-symbols", "-static-libgcc",};
- private static final GccLinker machBundleLinker = new GccLinker("gcc",
- objFiles, discardFiles, "lib", ".bundle", false, null);
- private static final GccLinker machDllLinker = new GccLinker("gcc",
- objFiles, discardFiles, "lib", ".dylib", false, null);
- public static GccLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- protected GccLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix,
- String outputSuffix, boolean isLibtool, GccLinker libtoolLinker) {
- super(command, "-dumpversion", extensions, ignoredExtensions,
- outputPrefix, outputSuffix, isLibtool, libtoolLinker);
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- super.addImpliedArgs(debug, linkType, args, defaultflag);
- if (getIdentifier().indexOf("mingw") >= 0) {
- if (linkType.isSubsystemConsole()) {
- args.addElement("-mconsole");
- }
- if (linkType.isSubsystemGUI()) {
- args.addElement("-mwindows");
- }
- }
- }
- protected Object clone() throws CloneNotSupportedException {
- GccLinker clone = (GccLinker) super.clone();
- return clone;
- }
- /**
- * Allows drived linker to decorate linker option. Override by GccLinker to
- * prepend a "-Wl," to pass option to through gcc to linker.
- *
- * @param buf
- * buffer that may be used and abused in the decoration process,
- * must not be null.
- * @param arg
- * linker argument
- */
- public String decorateLinkerOption(StringBuffer buf, String arg) {
- String decoratedArg = arg;
- if (arg.length() > 1 && arg.charAt(0) == '-') {
- switch (arg.charAt(1)) {
- //
- // passed automatically by GCC
- //
- case 'g' :
- case 'f' :
- case 'F' :
- /* Darwin */
- case 'm' :
- case 'O' :
- case 'W' :
- case 'l' :
- case 'L' :
- case 'u' :
- case 'v' :
- break;
- default :
- boolean known = false;
- for (int i = 0; i < linkerOptions.length; i++) {
- if (linkerOptions[i].equals(arg)) {
- known = true;
- break;
- }
- }
- if (!known) {
- buf.setLength(0);
- buf.append("-Wl,");
- buf.append(arg);
- decoratedArg = buf.toString();
- }
- break;
- }
- }
- return decoratedArg;
- }
- /**
- * Returns library path.
- *
- */
- public File[] getLibraryPath() {
- if (libDirs == null) {
- //
- // construct gcc lib path from machine and version
- //
- StringBuffer buf = new StringBuffer("/lib/gcc-lib/");
- buf.append(GccProcessor.getMachine());
- buf.append('/');
- buf.append(GccProcessor.getVersion());
- //
- // build default path from gcc and system /lib and /lib/w32api
- //
- String[] impliedLibPath = new String[]{buf.toString(),
- "/lib/w32api", "/lib"};
- //
- // read gcc specs file for other library paths
- //
- String[] specs = GccProcessor.getSpecs();
- String[][] libpaths = GccProcessor.parseSpecs(specs, "*link:",
- new String[]{"%q"});
- String[] libpath;
- if (libpaths[0].length > 0) {
- libpath = new String[libpaths[0].length + 3];
- int i = 0;
- for (; i < libpaths[0].length; i++) {
- libpath[i] = libpaths[0][i];
- }
- libpath[i++] = buf.toString();
- libpath[i++] = "/lib/w32api";
- libpath[i++] = "/lib";
- } else {
- //
- // if a failure to find any matches then
- // use some default values for lib path entries
- libpath = new String[]{"/usr/local/lib/mingw",
- "/usr/local/lib", "/usr/lib/w32api", "/usr/lib/mingw",
- "/usr/lib", buf.toString(), "/lib/w32api", "/lib"};
- }
- for (int i = 0; i < libpath.length; i++) {
- if (libpath[i].indexOf("mingw") >= 0) {
- libpath[i] = null;
- }
- }
- //
- // if cygwin then
- // we have to prepend location of gcc32
- // and .. to start of absolute filenames to
- // have something that will exist in the
- // windows filesystem
- if (GccProcessor.isCygwin()) {
- GccProcessor.convertCygwinFilenames(libpath);
- }
- //
- // check that remaining entries are actual directories
- //
- int count = CUtil.checkDirectoryArray(libpath);
- //
- // populate return array with remaining entries
- //
- libDirs = new File[count];
- int index = 0;
- for (int i = 0; i < libpath.length; i++) {
- if (libpath[i] != null) {
- libDirs[index++] = new File(libpath[i]);
- }
- }
- }
- return libDirs;
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isPluginModule()) {
- if (isDarwin()) {
- return machBundleLinker;
- } else {
- return dllLinker;
- }
- }
- if (type.isSharedLibrary()) {
- if (isDarwin()) {
- return machDllLinker;
- } else {
- return dllLinker;
- }
- }
- return instance;
- }
- public void link(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- try {
- GccLinker clone = (GccLinker) this.clone();
- LinkerParam param = config.getParam("target");
- if (param != null)
- clone.setCommand(param.getValue() + "-" + this.getCommand());
- clone.superlink(task, outputFile, sourceFiles, config);
- } catch (CloneNotSupportedException e) {
- superlink(task, outputFile, sourceFiles, config);
- }
- }
- private void superlink(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- super.link(task, outputFile, sourceFiles, config);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccProcessor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccProcessor.java
deleted file mode 100644
index 283df63314..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GccProcessor.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CaptureStreamHandler;
-
-/**
- * A add-in class for Gcc processors
- *
- *
- */
-public class GccProcessor {
- // the results from gcc -dumpmachine
- private static String machine;
- private static String[] specs;
- // the results from gcc -dumpversion
- private static String version;
- private static int addLibraryPatterns(String[] libnames, StringBuffer buf,
- String prefix, String extension, String[] patterns, int offset) {
- for (int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(libnames[i]);
- buf.append(extension);
- patterns[offset + i] = buf.toString();
- }
- return offset + libnames.length;
- }
- /**
- * Converts absolute Cygwin file or directory names to the corresponding
- * Win32 name.
- *
- * @param names
- * array of names, some elements may be null, will be changed in
- * place.
- */
- public static void convertCygwinFilenames(String[] names) {
- if (names == null) {
- throw new NullPointerException("names");
- }
- File gccDir = CUtil.getExecutableLocation("gcc.exe");
- if (gccDir != null) {
- String prefix = gccDir.getAbsolutePath() + "/..";
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < names.length; i++) {
- String name = names[i];
- if (name != null && name.length() > 1 && name.charAt(0) == '/') {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(name);
- names[i] = buf.toString();
- }
- }
- }
- }
-
- public static String getMachine() {
- if (machine == null) {
- String[] args = new String[]{"gcc", "-dumpmachine"};
- String[] cmdout = CaptureStreamHandler.run(args);
- if (cmdout.length == 0) {
- machine = "nomachine";
- } else {
- machine = cmdout[0];
- }
- }
- return machine;
- }
- public static String[] getOutputFileSwitch(String letter, String outputFile) {
- StringBuffer buf = new StringBuffer();
- if (outputFile.indexOf(' ') >= 0) {
- buf.append('"');
- buf.append(outputFile.replace('\\', '/'));
- buf.append('"');
- } else {
- buf.append(outputFile.replace('\\', '/'));
- }
- String[] retval = new String[]{letter, buf.toString()};
- return retval;
- }
- /**
- * Returns the contents of the gcc specs file.
- *
- * The implementation locates gcc.exe in the executable path and then
- * builds a relative path name from the results of -dumpmachine and
- * -dumpversion. Attempts to use gcc -dumpspecs to provide this information
- * resulted in stalling on the Execute.run
- *
- * @returns contents of the specs file
- */
- public static String[] getSpecs() {
- if (specs == null) {
- File gccParent = CUtil.getExecutableLocation("gcc.exe");
- if (gccParent != null) {
- //
- // build a relative path like
- // ../lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
- //
- StringBuffer buf = new StringBuffer("../lib/gcc-lib/");
- buf.append(getMachine());
- buf.append('/');
- buf.append(getVersion());
- buf.append("/specs");
- //
- // resolve it relative to the location of gcc.exe
- //
- String relativePath = buf.toString();
- File specsFile = new File(gccParent, relativePath);
- //
- // found the specs file
- //
- try {
- //
- // read the lines in the file
- //
- BufferedReader reader = new BufferedReader(new FileReader(
- specsFile));
- Vector lines = new Vector(100);
- String line = reader.readLine();
- while (line != null) {
- lines.addElement(line);
- line = reader.readLine();
- }
- specs = new String[lines.size()];
- lines.copyInto(specs);
- } catch (IOException ex) {
- }
- }
- }
- if (specs == null) {
- specs = new String[0];
- }
- return specs;
- }
- public static String getVersion() {
- if (version == null) {
- String[] args = new String[]{"gcc", "-dumpversion"};
- String[] cmdout = CaptureStreamHandler.run(args);
- if (cmdout.length == 0) {
- version = "noversion";
- } else {
- version = cmdout[0];
- }
- }
- return version;
- }
- public static boolean isCaseSensitive() {
- return true;
- }
- /**
- * Determines if task is running with cygwin
- *
- * @return true if cygwin was detected
- */
- public static boolean isCygwin() {
- return getMachine().indexOf("cygwin") > 0;
- }
- private static boolean isHPUX() {
- String osname = System.getProperty("os.name").toLowerCase();
- if (osname.indexOf("hp") >= 0 && osname.indexOf("ux") >= 0) {
- return true;
- }
- return false;
- }
- /**
- *
- * Parses the results of the specs file for a specific processor and
- * options
- *
- * @param specsContent
- * Contents of specs file as returned from getSpecs
- * @param specSectionStart
- * start of spec section, for example "*cpp:"
- * @param options
- * command line switches such as "-istart"
- */
- public static String[][] parseSpecs(String[] specsContent,
- String specSectionStart, String[] options) {
- if (specsContent == null) {
- throw new NullPointerException("specsContent");
- }
- if (specSectionStart == null) {
- throw new NullPointerException("specSectionStart");
- }
- if (options == null) {
- throw new NullPointerException("option");
- }
- String[][] optionValues = new String[options.length][];
- StringBuffer optionValue = new StringBuffer(40);
- for (int i = 0; i < specsContent.length; i++) {
- String specLine = specsContent[i];
- //
- // if start of section then start paying attention
- //
- if (specLine.startsWith(specSectionStart)) {
- Vector[] optionVectors = new Vector[options.length];
- for (int j = 0; j < options.length; j++) {
- optionVectors[j] = new Vector(10);
- }
- //
- // go to next line and examine contents
- // and repeat until end of file
- //
- for (i++; i < specsContent.length; i++) {
- specLine = specsContent[i];
- for (int j = 0; j < options.length; j++) {
- int optionStart = specLine.indexOf(options[j]);
- while (optionStart >= 0) {
- optionValue.setLength(0);
- //
- // walk rest of line looking for first non
- // whitespace
- // and then next space
- boolean hasNonBlank = false;
- int k = optionStart + options[j].length();
- for (; k < specLine.length(); k++) {
- //
- // either a blank or a "}" (close of
- // conditional)
- // section will end the path
- //
- if (specLine.charAt(k) == ' '
- || specLine.charAt(k) == '}') {
- if (hasNonBlank) {
- break;
- }
- } else {
- hasNonBlank = true;
- optionValue.append(specLine.charAt(k));
- }
- }
- //
- // transition back to whitespace
- // value is over, add it to vector
- if (hasNonBlank) {
- optionVectors[j].addElement(optionValue
- .toString());
- }
- //
- // find next occurance on line
- //
- optionStart = specLine.indexOf(options[j], k);
- }
- }
- }
- //
- // copy vectors over to option arrays
- //
- for (int j = 0; j < options.length; j++) {
- optionValues[j] = new String[optionVectors[j].size()];
- optionVectors[j].copyInto(optionValues[j]);
- }
- }
- }
- //
- // fill in any missing option values with
- // a zero-length string array
- for (int i = 0; i < optionValues.length; i++) {
- String[] zeroLenArray = new String[0];
- if (optionValues[i] == null) {
- optionValues[i] = zeroLenArray;
- }
- }
- return optionValues;
- }
- private GccProcessor() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java
deleted file mode 100644
index 3ba8f06bf8..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- *
- * Copyright 2003-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.LinkerParam;
-import net.sf.antcontrib.cpptasks.compiler.CaptureStreamHandler;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-
-import org.apache.tools.ant.BuildException;
-/**
- * Adapter for the g++ variant of the GCC linker
- *
- * @author Stephen M. Webb <stephen.webb@bregmasoft.com>
- */
-public class GppLinker extends AbstractLdLinker {
- protected static final String[] discardFiles = new String[0];
- protected static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final GppLinker dllLinker = new GppLinker("gcc", objFiles,
- discardFiles, "lib", ".so", false, new GppLinker("gcc", objFiles,
- discardFiles, "lib", ".so", true, null));
- private final static String libPrefix = "libraries: =";
- protected static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static String[] linkerOptions = new String[]{"-bundle", "-dylib",
- "-dynamic", "-dynamiclib", "-nostartfiles", "-nostdlib",
- "-prebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker"};
- private static final GppLinker instance = new GppLinker("gcc", objFiles,
- discardFiles, "", "", false, null);
- private static final GppLinker machDllLinker = new GppLinker("gcc",
- objFiles, discardFiles, "lib", ".dylib", false, null);
- private static final GppLinker machPluginLinker = new GppLinker("gcc",
- objFiles, discardFiles, "lib", ".bundle", false, null);
- public static GppLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- private String runtimeLibrary;
- protected GppLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix,
- String outputSuffix, boolean isLibtool, GppLinker libtoolLinker) {
- super(command, "-dumpversion", extensions, ignoredExtensions,
- outputPrefix, outputSuffix, isLibtool, libtoolLinker);
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- super.addImpliedArgs(debug, linkType, args, defaultflag);
- if (getIdentifier().indexOf("mingw") >= 0) {
- if (linkType.isSubsystemConsole()) {
- args.addElement("-mconsole");
- }
- if (linkType.isSubsystemGUI()) {
- args.addElement("-mwindows");
- }
- }
- if (linkType.isStaticRuntime()) {
- String[] cmdin = new String[]{"g++", "-print-file-name=libstdc++.a"};
- String[] cmdout = CaptureStreamHandler.run(cmdin);
- if (cmdout.length > 0) {
- runtimeLibrary = cmdout[0];
- } else {
- runtimeLibrary = null;
- }
- } else {
- runtimeLibrary = "-lstdc++";
- }
- }
- public String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
- Vector preargs, Vector midargs, Vector endargs) {
- String[] rs = super.addLibrarySets(task, libsets, preargs, midargs,
- endargs);
- if (runtimeLibrary != null) {
- endargs.addElement(runtimeLibrary);
- }
- return rs;
- }
- protected Object clone() throws CloneNotSupportedException {
- GppLinker clone = (GppLinker) super.clone();
- return clone;
- }
- /**
- * Allows drived linker to decorate linker option. Override by GppLinker to
- * prepend a "-Wl," to pass option to through gcc to linker.
- *
- * @param buf
- * buffer that may be used and abused in the decoration process,
- * must not be null.
- * @param arg
- * linker argument
- */
- public String decorateLinkerOption(StringBuffer buf, String arg) {
- String decoratedArg = arg;
- if (arg.length() > 1 && arg.charAt(0) == '-') {
- switch (arg.charAt(1)) {
- //
- // passed automatically by GCC
- //
- case 'g' :
- case 'f' :
- case 'F' :
- /* Darwin */
- case 'm' :
- case 'O' :
- case 'W' :
- case 'l' :
- case 'L' :
- case 'u' :
- break;
- default :
- boolean known = false;
- for (int i = 0; i < linkerOptions.length; i++) {
- if (linkerOptions[i].equals(arg)) {
- known = true;
- break;
- }
- }
- if (!known) {
- buf.setLength(0);
- buf.append("-Wl,");
- buf.append(arg);
- decoratedArg = buf.toString();
- }
- break;
- }
- }
- return decoratedArg;
- }
- /**
- * Returns library path.
- *
- */
- public File[] getLibraryPath() {
- if (libDirs == null) {
- Vector dirs = new Vector();
- // Ask GCC where it will look for its libraries.
- String[] args = new String[]{"g++", "-print-search-dirs"};
- String[] cmdout = CaptureStreamHandler.run(args);
- for (int i = 0; i < cmdout.length; ++i) {
- int prefixIndex = cmdout[i].indexOf(libPrefix);
- if (prefixIndex >= 0) {
- // Special case DOS-type GCCs like MinGW or Cygwin
- int s = prefixIndex + libPrefix.length();
- int t = cmdout[i].indexOf(';', s);
- while (t > 0) {
- dirs.addElement(cmdout[i].substring(s, t));
- s = t + 1;
- t = cmdout[i].indexOf(';', s);
- }
- dirs.addElement(cmdout[i].substring(s));
- ++i;
- for (; i < cmdout.length; ++i) {
- dirs.addElement(cmdout[i]);
- }
- }
- }
- // Eliminate all but actual directories.
- String[] libpath = new String[dirs.size()];
- dirs.copyInto(libpath);
- int count = CUtil.checkDirectoryArray(libpath);
- // Build return array.
- libDirs = new File[count];
- int index = 0;
- for (int i = 0; i < libpath.length; ++i) {
- if (libpath[i] != null) {
- libDirs[index++] = new File(libpath[i]);
- }
- }
- }
- return libDirs;
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isPluginModule()) {
- if (GccProcessor.getMachine().indexOf("darwin") >= 0) {
- return machPluginLinker;
- } else {
- return dllLinker;
- }
- }
- if (type.isSharedLibrary()) {
- if (GccProcessor.getMachine().indexOf("darwin") >= 0) {
- return machDllLinker;
- } else {
- return dllLinker;
- }
- }
- return instance;
- }
- public void link(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- try {
- GppLinker clone = (GppLinker) this.clone();
- LinkerParam param = config.getParam("target");
- if (param != null)
- clone.setCommand(param.getValue() + "-" + this.getCommand());
- clone.superlink(task, outputFile, sourceFiles, config);
- } catch (CloneNotSupportedException e) {
- superlink(task, outputFile, sourceFiles, config);
- }
- }
- private void superlink(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- super.link(task, outputFile, sourceFiles, config);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/LdLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/LdLinker.java
deleted file mode 100644
index 8ac0cf82a7..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/LdLinker.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.LinkerParam;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-
-import org.apache.tools.ant.BuildException;
-/**
- * Adapter for the 'ld' linker
- *
- * @author Curt Arnold
- */
-public final class LdLinker extends AbstractLdLinker {
- private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final String[] discardFiles = new String[0];
- private static final LdLinker dllLinker = new LdLinker("ld", objFiles,
- discardFiles, "lib", ".so", false, new LdLinker("ld", objFiles,
- discardFiles, "lib", ".so", true, null));
- private static final LdLinker instance = new LdLinker("ld", objFiles,
- discardFiles, "", "", false, null);
- public static LdLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- private LdLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix,
- String outputSuffix, boolean isLibtool, LdLinker libtoolLinker) {
- super(command, "-version", extensions, ignoredExtensions, outputPrefix,
- outputSuffix, isLibtool, libtoolLinker);
- }
- protected Object clone() throws CloneNotSupportedException {
- LdLinker clone = (LdLinker) super.clone();
- return clone;
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
- public void link(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- try {
- LdLinker clone = (LdLinker) this.clone();
- LinkerParam param = config.getParam("target");
- if (param != null)
- clone.setCommand(param.getValue() + "-" + this.getCommand());
- clone.superlink(task, outputFile, sourceFiles, config);
- } catch (CloneNotSupportedException e) {
- superlink(task, outputFile, sourceFiles, config);
- }
- }
- private void superlink(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- super.link(task, outputFile, sourceFiles, config);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccCCompiler.java
deleted file mode 100644
index 62d65b910c..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccCCompiler.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
-import net.sf.antcontrib.cpptasks.parser.CParser;
-import net.sf.antcontrib.cpptasks.parser.FortranParser;
-import net.sf.antcontrib.cpptasks.parser.Parser;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Environment;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-/**
- * Adapter for the GCC C/C++ compiler
- *
- * @author Adam Murdoch
- */
-public final class GccCCompiler extends GccCompatibleCCompiler {
- private final static String[] sourceExtensions = new String[]{".c", /* C */
- ".cc", /* C++ */
- ".cpp", /* C++ */
- ".cxx", /* C++ */
- ".c++", /* C++ */
- ".i", /* preprocessed C */
- ".ii", /* preprocessed C++ */
- ".f", /* FORTRAN */
- ".for", /* FORTRAN */
- ".m", /* Objective-C */
- ".mm", /* Objected-C++ */
- ".s" /* Assembly */
- };
- private final static String[] headerExtensions = new String[]{".h", ".hpp",
- ".inl"};
- public static final String CMD_PREFIX = "sparc-sun-solaris2-";
- private static final GccCCompiler cppInstance = new GccCCompiler(CMD_PREFIX
- + "c++", sourceExtensions, headerExtensions, false,
- new GccCCompiler(CMD_PREFIX + "c++", sourceExtensions,
- headerExtensions, true, null, false, null), false, null);
- private static final GccCCompiler g77Instance = new GccCCompiler(CMD_PREFIX
- + "g77", sourceExtensions, headerExtensions, false,
- new GccCCompiler(CMD_PREFIX + "g77", sourceExtensions,
- headerExtensions, true, null, false, null), false, null);
- private static final GccCCompiler gppInstance = new GccCCompiler(CMD_PREFIX
- + "g++", sourceExtensions, headerExtensions, false,
- new GccCCompiler(CMD_PREFIX + "g++", sourceExtensions,
- headerExtensions, true, null, false, null), false, null);
- private static final GccCCompiler instance = new GccCCompiler(CMD_PREFIX
- + "gcc", sourceExtensions, headerExtensions, false,
- new GccCCompiler(CMD_PREFIX + "gcc", sourceExtensions,
- headerExtensions, true, null, false, null), false, null);
- /**
- * Gets c++ adapter
- */
- public static GccCCompiler getCppInstance() {
- return cppInstance;
- }
- /**
- * Gets g77 adapter
- */
- public static GccCCompiler getG77Instance() {
- return g77Instance;
- }
- /**
- * Gets gpp adapter
- */
- public static GccCCompiler getGppInstance() {
- return gppInstance;
- }
- /**
- * Gets gcc adapter
- */
- public static GccCCompiler getInstance() {
- return instance;
- }
- private String identifier;
- private File[] includePath;
- private boolean isPICMeaningful = true;
- /**
- * Private constructor. Use GccCCompiler.getInstance() to get singleton
- * instance of this class.
- */
- private GccCCompiler(String command, String[] sourceExtensions,
- String[] headerExtensions, boolean isLibtool,
- GccCCompiler libtoolCompiler, boolean newEnvironment,
- Environment env) {
- super(command, null, sourceExtensions, headerExtensions, isLibtool,
- libtoolCompiler, newEnvironment, env);
- isPICMeaningful = System.getProperty("os.name").indexOf("Windows") < 0;
- }
- public void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- super.addImpliedArgs(args, debug, multithreaded,
- exceptions, linkType, rtti, optimization, defaultflag);
- if (isPICMeaningful && linkType.isSharedLibrary()) {
- args.addElement("-fPIC");
- }
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new GccCCompiler(getCommand(), this.getSourceExtensions(),
- this.getHeaderExtensions(), this.getLibtool(),
- (GccCCompiler) this.getLibtoolCompiler(), newEnvironment,
- env);
- }
- return this;
- }
- /**
- * Create parser to determine dependencies.
- *
- * Will create appropriate parser (C++, FORTRAN) based on file extension.
- *
- */
- protected Parser createParser(File source) {
- if (source != null) {
- String sourceName = source.getName();
- int lastDot = sourceName.lastIndexOf('.');
- if (lastDot >= 0 && lastDot + 1 < sourceName.length()) {
- char afterDot = sourceName.charAt(lastDot + 1);
- if (afterDot == 'f' || afterDot == 'F') {
- return new FortranParser();
- }
- }
- }
- return new CParser();
- }
- public File[] getEnvironmentIncludePath() {
- if (includePath == null) {
- //
- // construct default include path from machine id and version id
- //
- String[] defaultInclude = new String[1];
- StringBuffer buf = new StringBuffer("/lib/");
- buf.append(GccProcessor.getMachine());
- buf.append('/');
- buf.append(GccProcessor.getVersion());
- buf.append("/include");
- defaultInclude[0] = buf.toString();
- //
- // read specs file and look for -istart and -idirafter
- //
- String[] specs = GccProcessor.getSpecs();
- String[][] optionValues = GccProcessor.parseSpecs(specs, "*cpp:",
- new String[]{"-isystem ", "-idirafter "});
- //
- // if no entries were found, then use a default path
- //
- if (optionValues[0].length == 0 && optionValues[1].length == 0) {
- optionValues[0] = new String[]{"/usr/local/include",
- "/usr/include", "/usr/include/win32api"};
- }
- //
- // remove mingw entries.
- // For MinGW compiles this will mean the
- // location of the sys includes will be
- // wrong in dependencies.xml
- // but that should have no significant effect
- for (int i = 0; i < optionValues.length; i++) {
- for (int j = 0; j < optionValues[i].length; j++) {
- if (optionValues[i][j].indexOf("mingw") > 0) {
- optionValues[i][j] = null;
- }
- }
- }
- //
- // if cygwin then
- // we have to prepend location of gcc32
- // and .. to start of absolute filenames to
- // have something that will exist in the
- // windows filesystem
- if (GccProcessor.isCygwin()) {
- GccProcessor.convertCygwinFilenames(optionValues[0]);
- GccProcessor.convertCygwinFilenames(optionValues[1]);
- GccProcessor.convertCygwinFilenames(defaultInclude);
- }
- int count = CUtil.checkDirectoryArray(optionValues[0]);
- count += CUtil.checkDirectoryArray(optionValues[1]);
- count += CUtil.checkDirectoryArray(defaultInclude);
- includePath = new File[count];
- int index = 0;
- for (int i = 0; i < optionValues.length; i++) {
- for (int j = 0; j < optionValues[i].length; j++) {
- if (optionValues[i][j] != null) {
- includePath[index++] = new File(optionValues[i][j]);
- }
- }
- }
- for (int i = 0; i < defaultInclude.length; i++) {
- if (defaultInclude[i] != null) {
- includePath[index++] = new File(defaultInclude[i]);
- }
- }
- }
- return (File[]) includePath.clone();
- }
- public String getIdentifier() throws BuildException {
- if (identifier == null) {
- StringBuffer buf;
- if (getLibtool()) {
- buf = new StringBuffer("libtool ");
- } else {
- buf = new StringBuffer(' ');
- }
- buf.append(getCommand());
- buf.append(' ');
- buf.append(GccProcessor.getVersion());
- buf.append(' ');
- buf.append(GccProcessor.getMachine());
- identifier = buf.toString();
- }
- return identifier;
- }
- public Linker getLinker(LinkType linkType) {
- return GccLinker.getInstance().getLinker(linkType);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLibrarian.java
deleted file mode 100644
index bb243879af..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLibrarian.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractArLibrarian;
-/**
- * Adapter for the 'ar' archiver
- *
- * @author Adam Murdoch
- */
-public final class GccLibrarian extends AbstractArLibrarian {
- private static String[] objFileExtensions = new String[]{".o"};
- private static GccLibrarian instance = new GccLibrarian(
- GccCCompiler.CMD_PREFIX + "ar", objFileExtensions, false,
- new GccLibrarian(GccCCompiler.CMD_PREFIX + "ar", objFileExtensions,
- true, null));
- public static GccLibrarian getInstance() {
- return instance;
- }
- private GccLibrarian(String command, String[] inputExtensions,
- boolean isLibtool, GccLibrarian libtoolLibrarian) {
- super(command, "V", inputExtensions, new String[0], "lib", ".a",
- isLibtool, libtoolLibrarian);
- }
- public Linker getLinker(LinkType type) {
- return GccLinker.getInstance().getLinker(type);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLinker.java
deleted file mode 100644
index 914da34439..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLinker.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-/**
- * Adapter for the GCC linker
- *
- * @author Adam Murdoch
- */
-public class GccLinker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[0];
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static String[] linkerOptions = new String[]{"-bundle",
- "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-s",
- "-static", "-shared", "-symbolic", "-Xlinker",
- "--export-all-symbols", "-static-libgcc",};
- private static final GccLinker dllLinker = new GccLinker(
- GccCCompiler.CMD_PREFIX + "gcc", objFiles, discardFiles, "lib",
- ".so", false, new GccLinker(GccCCompiler.CMD_PREFIX + "gcc",
- objFiles, discardFiles, "lib", ".so", true, null));
- private static final GccLinker instance = new GccLinker(
- GccCCompiler.CMD_PREFIX + "gcc", objFiles, discardFiles, "", "",
- false, null);
- private static final GccLinker machBundleLinker = new GccLinker(
- GccCCompiler.CMD_PREFIX + "gcc", objFiles, discardFiles, "lib",
- ".bundle", false, null);
- private static final GccLinker machDllLinker = new GccLinker(
- GccCCompiler.CMD_PREFIX + "gcc", objFiles, discardFiles, "lib",
- ".dylib", false, null);
- public static GccLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- protected GccLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix,
- String outputSuffix, boolean isLibtool, GccLinker libtoolLinker) {
- super(command, "-dumpversion", extensions, ignoredExtensions,
- outputPrefix, outputSuffix, isLibtool, libtoolLinker);
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- super.addImpliedArgs(debug, linkType, args, defaultflag);
- if (getIdentifier().indexOf("mingw") >= 0) {
- if (linkType.isSubsystemConsole()) {
- args.addElement("-mconsole");
- }
- if (linkType.isSubsystemGUI()) {
- args.addElement("-mwindows");
- }
- }
- }
- /**
- * Allows drived linker to decorate linker option. Override by GccLinker to
- * prepend a "-Wl," to pass option to through gcc to linker.
- *
- * @param buf
- * buffer that may be used and abused in the decoration process,
- * must not be null.
- * @param arg
- * linker argument
- */
- public String decorateLinkerOption(StringBuffer buf, String arg) {
- String decoratedArg = arg;
- if (arg.length() > 1 && arg.charAt(0) == '-') {
- switch (arg.charAt(1)) {
- //
- // passed automatically by GCC
- //
- case 'g' :
- case 'f' :
- case 'F' :
- /* Darwin */
- case 'm' :
- case 'O' :
- case 'W' :
- case 'l' :
- case 'L' :
- case 'u' :
- case 'v' :
- break;
- default :
- boolean known = false;
- for (int i = 0; i < linkerOptions.length; i++) {
- if (linkerOptions[i].equals(arg)) {
- known = true;
- break;
- }
- }
- if (!known) {
- buf.setLength(0);
- buf.append("-Wl,");
- buf.append(arg);
- decoratedArg = buf.toString();
- }
- break;
- }
- }
- return decoratedArg;
- }
- /**
- * Returns library path.
- *
- */
- public File[] getLibraryPath() {
- if (libDirs == null) {
- //
- // construct gcc lib path from machine and version
- //
- StringBuffer buf = new StringBuffer("/lib/gcc-lib/");
- buf.append(GccProcessor.getMachine());
- buf.append('/');
- buf.append(GccProcessor.getVersion());
- //
- // build default path from gcc and system /lib and /lib/w32api
- //
- String[] impliedLibPath = new String[]{buf.toString(),
- "/lib/w32api", "/lib"};
- //
- // read gcc specs file for other library paths
- //
- String[] specs = GccProcessor.getSpecs();
- String[][] libpaths = GccProcessor.parseSpecs(specs, "*link:",
- new String[]{"%q"});
- String[] libpath;
- if (libpaths[0].length > 0) {
- libpath = new String[libpaths[0].length + 3];
- int i = 0;
- for (; i < libpaths[0].length; i++) {
- libpath[i] = libpaths[0][i];
- }
- libpath[i++] = buf.toString();
- libpath[i++] = "/lib/w32api";
- libpath[i++] = "/lib";
- } else {
- //
- // if a failure to find any matches then
- // use some default values for lib path entries
- libpath = new String[]{"/usr/local/lib/mingw",
- "/usr/local/lib", "/usr/lib/w32api", "/usr/lib/mingw",
- "/usr/lib", buf.toString(), "/lib/w32api", "/lib"};
- }
- for (int i = 0; i < libpath.length; i++) {
- if (libpath[i].indexOf("mingw") >= 0) {
- libpath[i] = null;
- }
- }
- //
- // if cygwin then
- // we have to prepend location of gcc32
- // and .. to start of absolute filenames to
- // have something that will exist in the
- // windows filesystem
- if (GccProcessor.isCygwin()) {
- GccProcessor.convertCygwinFilenames(libpath);
- }
- //
- // check that remaining entries are actual directories
- //
- int count = CUtil.checkDirectoryArray(libpath);
- //
- // populate return array with remaining entries
- //
- libDirs = new File[count];
- int index = 0;
- for (int i = 0; i < libpath.length; i++) {
- if (libpath[i] != null) {
- libDirs[index++] = new File(libpath[i]);
- }
- }
- }
- return libDirs;
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isPluginModule()) {
- if (isDarwin()) {
- return machBundleLinker;
- } else {
- return dllLinker;
- }
- }
- if (type.isSharedLibrary()) {
- if (isDarwin()) {
- return machDllLinker;
- } else {
- return dllLinker;
- }
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccProcessor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccProcessor.java
deleted file mode 100644
index 599d6a8013..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccProcessor.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CaptureStreamHandler;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * A add-in class for Gcc processors
- *
- *
- */
-public class GccProcessor {
- // the results from gcc -dumpmachine
- private static String machine;
- private static String[] specs;
- // the results from gcc -dumpversion
- private static String version;
- private static int addLibraryPatterns(String[] libnames, StringBuffer buf,
- String prefix, String extension, String[] patterns, int offset) {
- for (int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(libnames[i]);
- buf.append(extension);
- patterns[offset + i] = buf.toString();
- }
- return offset + libnames.length;
- }
- /**
- * Converts absolute Cygwin file or directory names to the corresponding
- * Win32 name.
- *
- * @param names
- * array of names, some elements may be null, will be changed in
- * place.
- */
- public static void convertCygwinFilenames(String[] names) {
- if (names == null) {
- throw new NullPointerException("names");
- }
- File gccDir = CUtil.getExecutableLocation(GccCCompiler.CMD_PREFIX
- + "gcc.exe");
- if (gccDir != null) {
- String prefix = gccDir.getAbsolutePath() + "/..";
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < names.length; i++) {
- String name = names[i];
- if (name != null && name.length() > 1 && name.charAt(0) == '/') {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(name);
- names[i] = buf.toString();
- }
- }
- }
- }
- public static String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- StringBuffer buf = new StringBuffer();
- String[] patterns = new String[libnames.length * 2];
- int offset = addLibraryPatterns(libnames, buf, "lib", ".a", patterns, 0);
- if (isHPUX()) {
- offset = addLibraryPatterns(libnames, buf, "lib", ".sl", patterns,
- offset);
- } else {
- offset = addLibraryPatterns(libnames, buf, "lib", ".so", patterns,
- offset);
- }
- return patterns;
- }
- public static String getMachine() {
- if (machine == null) {
- String[] args = new String[]{GccCCompiler.CMD_PREFIX + "gcc",
- "-dumpmachine"};
- String[] cmdout = CaptureStreamHandler.run(args);
- if (cmdout.length == 0) {
- machine = "nomachine";
- } else {
- machine = cmdout[0];
- }
- }
- return machine;
- }
- public static String[] getOutputFileSwitch(String letter, String outputFile) {
- StringBuffer buf = new StringBuffer();
- if (outputFile.indexOf(' ') >= 0) {
- buf.append('"');
- buf.append(outputFile.replace('\\', '/'));
- buf.append('"');
- } else {
- buf.append(outputFile.replace('\\', '/'));
- }
- String[] retval = new String[]{letter, buf.toString()};
- return retval;
- }
- /**
- * Returns the contents of the gcc specs file.
- *
- * The implementation locates gcc.exe in the executable path and then
- * builds a relative path name from the results of -dumpmachine and
- * -dumpversion. Attempts to use gcc -dumpspecs to provide this information
- * resulted in stalling on the Execute.run
- *
- * @returns contents of the specs file
- */
- public static String[] getSpecs() {
- if (specs == null) {
- File gccParent = CUtil
- .getExecutableLocation(GccCCompiler.CMD_PREFIX + "gcc.exe");
- if (gccParent != null) {
- //
- // build a relative path like
- // ../lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
- //
- StringBuffer buf = new StringBuffer("../lib/gcc-lib/");
- buf.append(getMachine());
- buf.append('/');
- buf.append(getVersion());
- buf.append("/specs");
- //
- // resolve it relative to the location of gcc.exe
- //
- String relativePath = buf.toString();
- File specsFile = new File(gccParent, relativePath);
- //
- // found the specs file
- //
- try {
- //
- // read the lines in the file
- //
- BufferedReader reader = new BufferedReader(new FileReader(
- specsFile));
- Vector lines = new Vector(100);
- String line = reader.readLine();
- while (line != null) {
- lines.addElement(line);
- line = reader.readLine();
- }
- specs = new String[lines.size()];
- lines.copyInto(specs);
- } catch (IOException ex) {
- }
- }
- }
- if (specs == null) {
- specs = new String[0];
- }
- return specs;
- }
- public static String getVersion() {
- if (version == null) {
- String[] args = new String[]{GccCCompiler.CMD_PREFIX + "gcc",
- "-dumpversion"};
- String[] cmdout = CaptureStreamHandler.run(args);
- if (cmdout.length == 0) {
- version = "noversion";
- } else {
- version = cmdout[0];
- }
- }
- return version;
- }
- public static boolean isCaseSensitive() {
- return true;
- }
- /**
- * Determines if task is running with cygwin
- *
- * @return true if cygwin was detected
- */
- public static boolean isCygwin() {
- return getMachine().indexOf("cygwin") > 0;
- }
- private static boolean isHPUX() {
- String osname = System.getProperty("os.name").toLowerCase();
- if (osname.indexOf("hp") >= 0 && osname.indexOf("ux") >= 0) {
- return true;
- }
- return false;
- }
- /**
- *
- * Parses the results of the specs file for a specific processor and
- * options
- *
- * @param specsContent
- * Contents of specs file as returned from getSpecs
- * @param specSectionStart
- * start of spec section, for example "*cpp:"
- * @param options
- * command line switches such as "-istart"
- */
- public static String[][] parseSpecs(String[] specsContent,
- String specSectionStart, String[] options) {
- if (specsContent == null) {
- throw new NullPointerException("specsContent");
- }
- if (specSectionStart == null) {
- throw new NullPointerException("specSectionStart");
- }
- if (options == null) {
- throw new NullPointerException("option");
- }
- String[][] optionValues = new String[options.length][];
- StringBuffer optionValue = new StringBuffer(40);
- for (int i = 0; i < specsContent.length; i++) {
- String specLine = specsContent[i];
- //
- // if start of section then start paying attention
- //
- if (specLine.startsWith(specSectionStart)) {
- Vector[] optionVectors = new Vector[options.length];
- for (int j = 0; j < options.length; j++) {
- optionVectors[j] = new Vector(10);
- }
- //
- // go to next line and examine contents
- // and repeat until end of file
- //
- for (i++; i < specsContent.length; i++) {
- specLine = specsContent[i];
- for (int j = 0; j < options.length; j++) {
- int optionStart = specLine.indexOf(options[j]);
- while (optionStart >= 0) {
- optionValue.setLength(0);
- //
- // walk rest of line looking for first non
- // whitespace
- // and then next space
- boolean hasNonBlank = false;
- int k = optionStart + options[j].length();
- for (; k < specLine.length(); k++) {
- //
- // either a blank or a "}" (close of
- // conditional)
- // section will end the path
- //
- if (specLine.charAt(k) == ' '
- || specLine.charAt(k) == '}') {
- if (hasNonBlank) {
- break;
- }
- } else {
- hasNonBlank = true;
- optionValue.append(specLine.charAt(k));
- }
- }
- //
- // transition back to whitespace
- // value is over, add it to vector
- if (hasNonBlank) {
- optionVectors[j].addElement(optionValue
- .toString());
- }
- //
- // find next occurance on line
- //
- optionStart = specLine.indexOf(options[j], k);
- }
- }
- }
- //
- // copy vectors over to option arrays
- //
- for (int j = 0; j < options.length; j++) {
- optionValues[j] = new String[optionVectors[j].size()];
- optionVectors[j].copyInto(optionValues[j]);
- }
- }
- }
- //
- // fill in any missing option values with
- // a zero-length string array
- for (int i = 0; i < optionValues.length; i++) {
- String[] zeroLenArray = new String[0];
- if (optionValues[i] == null) {
- optionValues[i] = zeroLenArray;
- }
- }
- return optionValues;
- }
- private GccProcessor() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GppLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GppLinker.java
deleted file mode 100644
index 6a4c0ab14b..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GppLinker.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- *
- * Copyright 2003-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CaptureStreamHandler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-/**
- * Adapter for the g++ variant of the GCC linker
- *
- * @author Stephen M. Webb <stephen.webb@bregmasoft.com>
- */
-public class GppLinker extends AbstractLdLinker {
- protected static final String[] discardFiles = new String[0];
- protected static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private final static String libPrefix = "libraries: =";
- protected static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static String[] linkerOptions = new String[]{"-bundle", "-dylib",
- "-dynamic", "-dynamiclib", "-nostartfiles", "-nostdlib",
- "-prebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker"};
- private static final GppLinker dllLinker = new GppLinker(
- GccCCompiler.CMD_PREFIX + "gcc", objFiles, discardFiles, "lib",
- ".so", false, new GppLinker(GccCCompiler.CMD_PREFIX + "gcc",
- objFiles, discardFiles, "lib", ".so", true, null));
- private static final GppLinker instance = new GppLinker(
- GccCCompiler.CMD_PREFIX + "gcc", objFiles, discardFiles, "", "",
- false, null);
- private static final GppLinker machDllLinker = new GppLinker(
- GccCCompiler.CMD_PREFIX + "gcc", objFiles, discardFiles, "lib",
- ".dylib", false, null);
- private static final GppLinker machPluginLinker = new GppLinker(
- GccCCompiler.CMD_PREFIX + "gcc", objFiles, discardFiles, "lib",
- ".bundle", false, null);
- public static GppLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- private String runtimeLibrary;
- protected GppLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix,
- String outputSuffix, boolean isLibtool, GppLinker libtoolLinker) {
- super(command, "-dumpversion", extensions, ignoredExtensions,
- outputPrefix, outputSuffix, isLibtool, libtoolLinker);
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- super.addImpliedArgs(debug, linkType, args, defaultflag);
- if (getIdentifier().indexOf("mingw") >= 0) {
- if (linkType.isSubsystemConsole()) {
- args.addElement("-mconsole");
- }
- if (linkType.isSubsystemGUI()) {
- args.addElement("-mwindows");
- }
- }
- if (linkType.isStaticRuntime()) {
- String[] cmdin = new String[]{GccCCompiler.CMD_PREFIX + "g++",
- "-print-file-name=libstdc++.a"};
- String[] cmdout = CaptureStreamHandler.run(cmdin);
- if (cmdout.length > 0) {
- runtimeLibrary = cmdout[0];
- } else {
- runtimeLibrary = null;
- }
- } else {
- runtimeLibrary = "-lstdc++";
- }
- }
- public String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
- Vector preargs, Vector midargs, Vector endargs) {
- String[] rs = super.addLibrarySets(task, libsets, preargs, midargs,
- endargs);
- if (runtimeLibrary != null) {
- endargs.addElement(runtimeLibrary);
- }
- return rs;
- }
- /**
- * Allows drived linker to decorate linker option. Override by GppLinker to
- * prepend a "-Wl," to pass option to through gcc to linker.
- *
- * @param buf
- * buffer that may be used and abused in the decoration process,
- * must not be null.
- * @param arg
- * linker argument
- */
- public String decorateLinkerOption(StringBuffer buf, String arg) {
- String decoratedArg = arg;
- if (arg.length() > 1 && arg.charAt(0) == '-') {
- switch (arg.charAt(1)) {
- //
- // passed automatically by GCC
- //
- case 'g' :
- case 'f' :
- case 'F' :
- /* Darwin */
- case 'm' :
- case 'O' :
- case 'W' :
- case 'l' :
- case 'L' :
- case 'u' :
- break;
- default :
- boolean known = false;
- for (int i = 0; i < linkerOptions.length; i++) {
- if (linkerOptions[i].equals(arg)) {
- known = true;
- break;
- }
- }
- if (!known) {
- buf.setLength(0);
- buf.append("-Wl,");
- buf.append(arg);
- decoratedArg = buf.toString();
- }
- break;
- }
- }
- return decoratedArg;
- }
- /**
- * Returns library path.
- *
- */
- public File[] getLibraryPath() {
- if (libDirs == null) {
- Vector dirs = new Vector();
- // Ask GCC where it will look for its libraries.
- String[] args = new String[]{GccCCompiler.CMD_PREFIX + "g++",
- "-print-search-dirs"};
- String[] cmdout = CaptureStreamHandler.run(args);
- for (int i = 0; i < cmdout.length; ++i) {
- int prefixIndex = cmdout[i].indexOf(libPrefix);
- if (prefixIndex >= 0) {
- // Special case DOS-type GCCs like MinGW or Cygwin
- int s = prefixIndex + libPrefix.length();
- int t = cmdout[i].indexOf(';', s);
- while (t > 0) {
- dirs.addElement(cmdout[i].substring(s, t));
- s = t + 1;
- t = cmdout[i].indexOf(';', s);
- }
- dirs.addElement(cmdout[i].substring(s));
- ++i;
- for (; i < cmdout.length; ++i) {
- dirs.addElement(cmdout[i]);
- }
- }
- }
- // Eliminate all but actual directories.
- String[] libpath = new String[dirs.size()];
- dirs.copyInto(libpath);
- int count = CUtil.checkDirectoryArray(libpath);
- // Build return array.
- libDirs = new File[count];
- int index = 0;
- for (int i = 0; i < libpath.length; ++i) {
- if (libpath[i] != null) {
- libDirs[index++] = new File(libpath[i]);
- }
- }
- }
- return libDirs;
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isPluginModule()) {
- if (GccProcessor.getMachine().indexOf("darwin") >= 0) {
- return machPluginLinker;
- } else {
- return dllLinker;
- }
- }
- if (type.isSharedLibrary()) {
- if (GccProcessor.getMachine().indexOf("darwin") >= 0) {
- return machDllLinker;
- } else {
- return dllLinker;
- }
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java
deleted file mode 100644
index fc7761e87c..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-/**
- * Adapter for the 'ld' linker
- *
- * @author Curt Arnold
- */
-public final class LdLinker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[0];
- private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final LdLinker dllLinker = new LdLinker(
- GccCCompiler.CMD_PREFIX + "ld", objFiles, discardFiles, "lib",
- ".so", false, new LdLinker(GccCCompiler.CMD_PREFIX + "ld",
- objFiles, discardFiles, "lib", ".so", true, null));
- private static final LdLinker instance = new LdLinker(
- GccCCompiler.CMD_PREFIX + "ld", objFiles, discardFiles, "", "",
- false, null);
- public static LdLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- private LdLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix,
- String outputSuffix, boolean isLibtool, LdLinker libtoolLinker) {
- super(command, "-version", extensions, ignoredExtensions, outputPrefix,
- outputSuffix, isLibtool, libtoolLinker);
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java
deleted file mode 100644
index 951bfc1a75..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.hp;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the HP aC++ C++ compiler
- *
- * @author Curt Arnold
- */
-public final class aCCCompiler extends GccCompatibleCCompiler {
- private static final aCCCompiler instance = new aCCCompiler("aCC", false,
- null);
- /**
- * Gets singleton instance of this class
- */
- public static aCCCompiler getInstance() {
- return instance;
- }
- private String identifier;
- private File[] includePath;
- /**
- * Private constructor. Use GccCCompiler.getInstance() to get singleton
- * instance of this class.
- */
- private aCCCompiler(String command, boolean newEnvironment, Environment env) {
- super(command, "-help", false, null, newEnvironment, env);
- }
- public void addImpliedArgs(Vector args, boolean debug,
- boolean multithreaded, boolean exceptions, LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization) {
- args.addElement("-c");
- if (debug) {
- args.addElement("-g");
- }
- /*
- * if (multithreaded) { args.addElement("-mt"); }
- */
- if (linkType.isSharedLibrary()) {
- args.addElement("+z");
- }
- }
- public void addWarningSwitch(Vector args, int level) {
- switch (level) {
- case 0 :
- args.addElement("-w");
- break;
- case 1 :
- case 2 :
- args.addElement("+w");
- break;
- /*
- * case 3: case 4: case 5: args.addElement("+w2"); break;
- */
- }
- }
- public File[] getEnvironmentIncludePath() {
- if (includePath == null) {
- File ccLoc = CUtil.getExecutableLocation("aCC");
- if (ccLoc != null) {
- File compilerIncludeDir = new File(
- new File(ccLoc, "../include").getAbsolutePath());
- if (compilerIncludeDir.exists()) {
- includePath = new File[2];
- includePath[0] = compilerIncludeDir;
- }
- }
- if (includePath == null) {
- includePath = new File[1];
- }
- includePath[includePath.length - 1] = new File("/usr/include");
- }
- return includePath;
- }
- public Linker getLinker(LinkType linkType) {
- return aCCLinker.getInstance().getLinker(linkType);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCLinker.java
deleted file mode 100644
index 86b22e0522..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCLinker.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.hp;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-/**
- * Adapter for Sun (r) Forte(tm) C++ Linker
- *
- * @author Curt Arnold
- */
-public final class aCCLinker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[0];
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final aCCLinker arLinker = new aCCLinker("aCC", objFiles,
- discardFiles, "", ".a");
- private static final aCCLinker dllLinker = new aCCLinker("aCC", objFiles,
- discardFiles, "lib", ".sl");
- private static final aCCLinker instance = new aCCLinker("aCC", objFiles,
- discardFiles, "", "");
- public static aCCLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- private aCCLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix, String outputSuffix) {
- super(command, "-help", extensions, ignoredExtensions, outputPrefix,
- outputSuffix, false, null);
- }
- public void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
- if (debug) {
- args.addElement("-g");
- }
- /*
- * if(linkType.isStaticRuntime()) { args.addElement("-static"); }
- */
- if (linkType.isSharedLibrary()) {
- args.addElement("-b");
- }
- /*
- * if (linkType.isStaticLibrary()) { args.addElement("-Wl,-noshared"); }
- */
- }
- public void addIncremental(boolean incremental, Vector args) {
- /*
- * if (incremental) { args.addElement("-xidlon"); } else {
- * args.addElement("-xidloff"); }
- */
- }
- /**
- * Returns library path.
- *
- */
- public File[] getLibraryPath() {
- if (libDirs == null) {
- File CCloc = CUtil.getExecutableLocation("aCC");
- if (CCloc != null) {
- File compilerLib = new File(new File(CCloc, "../lib")
- .getAbsolutePath());
- if (compilerLib.exists()) {
- libDirs = new File[2];
- libDirs[0] = compilerLib;
- }
- }
- if (libDirs == null) {
- libDirs = new File[1];
- }
- }
- libDirs[libDirs.length - 1] = new File("/usr/lib");
- return libDirs;
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return arLinker;
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java
deleted file mode 100644
index f181c0e3af..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.ibm;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the IBM(r) Visual Age(tm) C++ compiler for AIX(tm)
- *
- * @author Curt Arnold
- */
-public final class VisualAgeCCompiler extends GccCompatibleCCompiler {
- private static final VisualAgeCCompiler instance = new VisualAgeCCompiler(
- "xlC", false, null);
- /**
- * Gets singleton instance of this class
- */
- public static VisualAgeCCompiler getInstance() {
- return instance;
- }
- private String identifier;
- private File[] includePath;
- /**
- * Private constructor. Use getInstance() to get singleton instance of this
- * class.
- */
- private VisualAgeCCompiler(String command, boolean newEnvironment,
- Environment env) {
- super(command, "-help", false, null, newEnvironment, env);
- }
- public void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization) {
- args.addElement("-c");
- if (debug) {
- args.addElement("-g");
- }
- if (linkType.isSharedLibrary()) {
- args.addElement("-fpic");
- }
- if (rtti != null) {
- if (rtti.booleanValue()) {
- args.addElement("-qrtti=all");
- } else {
- args.addElement("-qnortti");
- }
- }
- }
- public void addWarningSwitch(Vector args, int level) {
- switch (level) {
- case 0 :
- args.addElement("-w");
- break;
- case 1 :
- args.addElement("-qflag=s:s");
- break;
- case 2 :
- args.addElement("-qflag=e:e");
- break;
- case 3 :
- args.addElement("-qflag=w:w");
- break;
- case 4 :
- args.addElement("-qflag=i:i");
- break;
- case 5 :
- args.addElement("-qhalt=w:w");
- break;
- }
- }
- public Linker getLinker(LinkType linkType) {
- return VisualAgeLinker.getInstance().getLinker(linkType);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- /**
- * Gets identifier for the compiler.
- *
- * Initial attempt at extracting version information
- * would lock up. Using a stock response.
- */
- public String getIdentifier() {
- return "VisualAge compiler - unidentified version";
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ibm/VisualAgeLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ibm/VisualAgeLinker.java
deleted file mode 100644
index f0a811b4ea..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ibm/VisualAgeLinker.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.ibm;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-import net.sf.antcontrib.cpptasks.gcc.GccLibrarian;
-/**
- * Adapter for IBM(r) Visual Age(tm) Linker for AIX(tm)
- *
- * @author Curt Arnold
- */
-public final class VisualAgeLinker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[]{};
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final VisualAgeLinker dllLinker = new VisualAgeLinker(
- "makeC++SharedLib", objFiles, discardFiles, "lib", ".so");
- private static final VisualAgeLinker instance = new VisualAgeLinker("xlC",
- objFiles, discardFiles, "", "");
- public static VisualAgeLinker getInstance() {
- return instance;
- }
- private VisualAgeLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix, String outputSuffix) {
- //
- // just guessing that -? might display something useful
- //
- super(command, "-?", extensions, ignoredExtensions, outputPrefix,
- outputSuffix, false, null);
- }
- public void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
- if (debug) {
- //args.addElement("-g");
- }
- if (linkType.isSharedLibrary()) {
- //args.addElement("-G");
- }
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
- /**
- * Gets identifier for the compiler.
- *
- * Initial attempt at extracting version information
- * would lock up. Using a stock response.
- */
- public String getIdentifier() {
- return "VisualAge linker - unidentified version";
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java
deleted file mode 100644
index 65402f41fb..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Intel (r) C/C++ compiler for IA-32 Linux (r)
- *
- * The Intel (r) C/C++ compiler for IA32 Linux mimics the command options for
- * gcc compiler.
- *
- * @author Curt Arnold
- */
-public final class IntelLinux32CCompiler extends GccCompatibleCCompiler {
- private static final IntelLinux32CCompiler instance = new IntelLinux32CCompiler(
- false, new IntelLinux32CCompiler(true, null, false, null), false,
- null);
- public static IntelLinux32CCompiler getInstance() {
- return instance;
- }
- private IntelLinux32CCompiler(boolean isLibtool,
- IntelLinux32CCompiler libtoolCompiler, boolean newEnvironment,
- Environment env) {
- super("icc", "-V", isLibtool, libtoolCompiler, newEnvironment, env);
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new IntelLinux32CCompiler(getLibtool(),
- (IntelLinux32CCompiler) getLibtoolCompiler(),
- newEnvironment, env);
- }
- return this;
- }
- public Linker getLinker(LinkType type) {
- return IntelLinux32Linker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java
deleted file mode 100644
index 268f490ff3..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-import net.sf.antcontrib.cpptasks.gcc.GccLibrarian;
-/**
- * Adapter for the Intel (r) Linker for Linux (r) for IA-32
- *
- * @author Curt Arnold
- */
-public final class IntelLinux32Linker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[0];
- private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final IntelLinux32Linker dllLinker = new IntelLinux32Linker(
- "lib", ".so", false, new IntelLinux32Linker("lib", ".so", true,
- null));
- private static final IntelLinux32Linker instance = new IntelLinux32Linker(
- "", "", false, null);
- public static IntelLinux32Linker getInstance() {
- return instance;
- }
- private IntelLinux32Linker(String outputPrefix, String outputSuffix,
- boolean isLibtool, IntelLinux32Linker libtoolLinker) {
- super("icc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix,
- isLibtool, libtoolLinker);
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java
deleted file mode 100644
index 5a506e0d85..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Intel (r) C/C++ compiler for IA-64 Linux (r)
- *
- * The Intel C/C++ compiler for IA-64 Linux mimics the command options for gcc
- * compiler.
- *
- * @author Curt Arnold
- */
-public final class IntelLinux64CCompiler extends GccCompatibleCCompiler {
- private static final IntelLinux64CCompiler instance = new IntelLinux64CCompiler(
- false, new IntelLinux64CCompiler(true, null, false, null), false,
- null);
- public static IntelLinux64CCompiler getInstance() {
- return instance;
- }
- private IntelLinux64CCompiler(boolean isLibtool,
- IntelLinux64CCompiler libtoolCompiler, boolean newEnvironment,
- Environment env) {
- super("ecc", "-V", isLibtool, libtoolCompiler, newEnvironment, env);
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new IntelLinux64CCompiler(getLibtool(),
- (IntelLinux64CCompiler) this.getLibtoolCompiler(),
- newEnvironment, env);
- }
- return this;
- }
- public Linker getLinker(LinkType type) {
- return IntelLinux64Linker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java
deleted file mode 100644
index f381403510..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-import net.sf.antcontrib.cpptasks.gcc.GccLibrarian;
-/**
- * Adapter for the Intel (r) linker for Linux for IA-64
- *
- * @author Curt Arnold
- */
-public final class IntelLinux64Linker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[0];
- private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
- ".lib", ".dll", ".so", ".sl"};
- private static final String[] objFiles = new String[]{".o", ".a", ".lib",
- ".dll", ".so", ".sl"};
- private static final IntelLinux64Linker dllLinker = new IntelLinux64Linker(
- "lib", ".so", false, new IntelLinux64Linker("lib", ".so", true,
- null));
- private static final IntelLinux64Linker instance = new IntelLinux64Linker(
- "", "", false, null);
- public static IntelLinux64Linker getInstance() {
- return instance;
- }
- private IntelLinux64Linker(String outputPrefix, String outputSuffix,
- boolean isLibtool, IntelLinux64Linker libtoolLinker) {
- super("ecc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix,
- isLibtool, libtoolLinker);
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return GccLibrarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelProcessor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelProcessor.java
deleted file mode 100644
index d1b4eafec5..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelProcessor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioProcessor;
-/**
- * A add-in class for Intel (r) compilers and linkers
- *
- *
- */
-public class IntelProcessor {
- public static void addWarningSwitch(Vector args, int level) {
- DevStudioProcessor.addWarningSwitch(args, level);
- }
- public static String getCommandFileSwitch(String cmdFile) {
- return DevStudioProcessor.getCommandFileSwitch(cmdFile);
- }
- public static void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- DevStudioProcessor.getDefineSwitch(buffer, define, value);
- }
- public static String getIncludeDirSwitch(String includeDir) {
- return DevStudioProcessor.getIncludeDirSwitch(includeDir);
- }
- public static String[] getOutputFileSwitch(String outPath) {
- return DevStudioProcessor.getOutputFileSwitch(outPath);
- }
- public static void getUndefineSwitch(StringBuffer buffer, String define) {
- DevStudioProcessor.getUndefineSwitch(buffer, define);
- }
- public static boolean isCaseSensitive() {
- return false;
- }
- private IntelProcessor() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Aslcompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Aslcompiler.java
deleted file mode 100644
index 5255cb90ce..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Aslcompiler.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineAslcompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioLinker;
-/**
- * Adapter for Intel ASL compiler
- *
- */
-public final class IntelWin32Aslcompiler extends CommandLineAslcompiler{
- private final static String[] sourceExtensions = new String[]{".asl"};
- private final static String[] headerExtensions = new String[]{};
- private final static String[] defaultflags = new String[]{};
- private static final IntelWin32Aslcompiler instance = new IntelWin32Aslcompiler("iasl",
- sourceExtensions, headerExtensions, false);
-
- /**
- * Gets gcc adapter
- */
- public static IntelWin32Aslcompiler getInstance() {
- return instance;
- }
-
- /**
- * Private constructor. Use GccAssembler.getInstance() to get singleton
- * instance of this class.
- */
- private IntelWin32Aslcompiler(String command, String[] sourceExtensions,
- String[] headerExtensions, boolean isLibtool){
- super(command, null, sourceExtensions, headerExtensions,
- ".aml");
- }
- public void addImpliedArgs(Vector args, boolean debug,
- Boolean defaultflag){
- if (defaultflag != null && defaultflag.booleanValue()) {
- for (int i = 0; i < defaultflags.length; i++) {
- args.addElement(defaultflags[i]);
- }
- }
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- public Linker getLinker(LinkType linkType) {
- return DevStudioLinker.getInstance().getLinker(linkType);
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32CCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32CCompiler.java
deleted file mode 100644
index 7aef79999f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32CCompiler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioCompatibleCCompiler;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Intel (r) C++ compiler for 32-bit applications
- *
- * The Intel (r) C++ compiler for IA32 Windows mimics the command options for
- * the Microsoft (r) C++ compiler.
- *
- * @author Curt Arnold
- */
-public final class IntelWin32CCompiler extends DevStudioCompatibleCCompiler {
- private static final IntelWin32CCompiler instance = new IntelWin32CCompiler(
- false, null);
- public static IntelWin32CCompiler getInstance() {
- return instance;
- }
- private IntelWin32CCompiler(boolean newEnvironment, Environment env) {
- super("icl", null, newEnvironment, env);
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new IntelWin32CCompiler(newEnvironment, env);
- }
- return this;
- }
- public Linker getLinker(LinkType type) {
- return IntelWin32Linker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return 1024;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Librarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Librarian.java
deleted file mode 100644
index e83da1ce0b..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Librarian.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioCompatibleLibrarian;
-/**
- * Adapter for the xilib from the Intel(r) C++ Compiler for IA-32 or IA-64
- * systems running Microsoft (r) operating systems
- *
- * @author Curt Arnold
- */
-public class IntelWin32Librarian extends DevStudioCompatibleLibrarian {
- private static final IntelWin32Librarian instance = new IntelWin32Librarian();
- public static IntelWin32Librarian getInstance() {
- return instance;
- }
- protected IntelWin32Librarian() {
- super("xilib", "/bogus");
- }
- public Linker getLinker(LinkType type) {
- return IntelWin32Linker.getInstance().getLinker(type);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Linker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Linker.java
deleted file mode 100644
index 51258e23ca..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin32Linker.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioCompatibleLinker;
-/**
- * Adapter for the Intel (r) linker for 32-bit applications
- *
- * @author Curt Arnold
- */
-public final class IntelWin32Linker extends DevStudioCompatibleLinker {
- private static final IntelWin32Linker dllLinker = new IntelWin32Linker(
- ".dll");
- private static final IntelWin32Linker instance = new IntelWin32Linker(
- ".exe");
- public static IntelWin32Linker getInstance() {
- return instance;
- }
- private IntelWin32Linker(String outputSuffix) {
- super("xilink", "/bogus", outputSuffix);
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return IntelWin32Librarian.getInstance();
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin64CCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin64CCompiler.java
deleted file mode 100644
index 9b8d2c9db4..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/intel/IntelWin64CCompiler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.intel;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioCompatibleCCompiler;
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Intel C++ compiler for Itanium(TM) Applications
- *
- * @author Curt Arnold
- */
-public final class IntelWin64CCompiler extends DevStudioCompatibleCCompiler {
- private static final IntelWin64CCompiler instance = new IntelWin64CCompiler(
- false, null);
- public static IntelWin64CCompiler getInstance() {
- return instance;
- }
- private IntelWin64CCompiler(boolean newEnvironment, Environment env) {
- super("ecl", null, newEnvironment, env);
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new IntelWin64CCompiler(newEnvironment, env);
- }
- return this;
- }
- public Linker getLinker(LinkType type) {
- //
- // currently the Intel Win32 and Win64 linkers
- // are command line equivalent
- return IntelWin32Linker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return 1024;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390CCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390CCompiler.java
deleted file mode 100644
index 633b55ec0c..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390CCompiler.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.os390;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.CompilerDef;
-import net.sf.antcontrib.cpptasks.compiler.AbstractCompiler;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCCompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.types.DefineArgument;
-import net.sf.antcontrib.cpptasks.types.UndefineArgument;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the IBM (R) OS/390 (tm) C++ Compiler
- *
- * @author Hiram Chirino (cojonudo14@hotmail.com)
- */
-public class OS390CCompiler extends CommandLineCCompiler {
- private static final AbstractCompiler instance = new OS390CCompiler(false,
- null);
- public static AbstractCompiler getInstance() {
- return instance;
- }
- private OS390CCompiler(boolean newEnvironment, Environment env) {
- super("cxx", null, new String[]{".c", ".cc", ".cpp", ".cxx", ".c++",
- ".s"}, new String[]{".h", ".hpp"}, ".o", false, null,
- newEnvironment, env);
- }
- protected void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- // Specifies that only compilations and assemblies be done.
- // Link-edit is not done
- args.addElement("-c");
- args.addElement("-W");
- args.addElement("c,NOEXPMAC,NOSHOWINC");
- /*
- * if (exceptions) { args.addElement("/GX"); }
- */
- if (debug) {
- args.addElement("-g");
- args.addElement("-D");
- args.addElement("_DEBUG");
- /*
- * if (multithreaded) { args.addElement("/D_MT"); if (staticLink) {
- * args.addElement("/MTd"); } else { args.addElement("/MDd");
- * args.addElement("/D_DLL"); } } else { args.addElement("/MLd"); }
- */
- } else {
- args.addElement("-D");
- args.addElement("NEBUG");
- /*
- * if (multithreaded) { args.addElement("/D_MT"); if (staticLink) {
- * args.addElement("/MT"); } else { args.addElement("/MD");
- * args.addElement("/D_DLL"); } } else { args.addElement("/ML"); }
- */
- }
- }
- protected void addWarningSwitch(Vector args, int level) {
- OS390Processor.addWarningSwitch(args, level);
- }
- /**
- * The buildDefineArguments implementation CommandLineCCompiler is not good
- * for us because os390 defines are give by -D definex instead of
- * /Ddefinex, 2 args not 1! since we implement this ourslefs, we do not
- * have to implement the getDefineSwitch() and the getUndefineSwitch().
- */
- protected void buildDefineArguments(CompilerDef[] defs, Vector args) {
- //
- // assume that we aren't inheriting defines from containing <cc>
- //
- UndefineArgument[] merged = defs[0].getActiveDefines();
- for (int i = 1; i < defs.length; i++) {
- //
- // if we are inheriting, merge the specific defines with the
- // containing defines
- merged = DefineArgument.merge(defs[i].getActiveDefines(), merged);
- }
- StringBuffer buf = new StringBuffer(30);
- for (int i = 0; i < merged.length; i++) {
- buf.setLength(0);
- UndefineArgument current = merged[i];
- if (current.isDefine()) {
- args.addElement("-D");
- buf.append(current.getName());
- if (current.getValue() != null
- && current.getValue().length() > 0) {
- buf.append('=');
- buf.append(current.getValue());
- }
- args.addElement(buf.toString());
- } else {
- args.addElement("-U");
- args.addElement(current.getName());
- }
- }
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new OS390CCompiler(newEnvironment, env);
- }
- return this;
- }
- /*
- * @see CommandLineCompiler#getDefineSwitch(StringBuffer, String, String)
- */
- protected void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- }
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ":");
- }
- protected String getIncludeDirSwitch(String includeDir) {
- return OS390Processor.getIncludeDirSwitch(includeDir);
- }
- public Linker getLinker(LinkType type) {
- return OS390Linker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- /* Only compile one file at time for now */
- protected int getMaximumInputFilesPerCommand() {
- return Integer.MAX_VALUE;
- }
- /*
- * @see CommandLineCompiler#getUndefineSwitch(StringBuffer, String)
- */
- protected void getUndefineSwitch(StringBuffer buffer, String define) {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390Linker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390Linker.java
deleted file mode 100644
index f6653b7be4..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390Linker.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.os390;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-import org.apache.tools.ant.BuildException;
-/**
- * Adapter for the IBM (R) OS/390 (tm) Linker
- *
- * @author Hiram Chirino (cojonudo14@hotmail.com)
- */
-public final class OS390Linker extends CommandLineLinker {
- private static final OS390Linker datasetLinker = new OS390Linker();
- private static final OS390Linker dllLinker = new OS390Linker("", ".dll");
- private static final OS390Linker instance = new OS390Linker("", "");
- public static OS390Linker getDataSetInstance() {
- return datasetLinker;
- }
- public static OS390Linker getInstance() {
- return instance;
- }
- private boolean isADatasetLinker;
- File outputFile;
- private String outputPrefix;
- CCTask task;
- private OS390Linker() {
- super("cxx", "/bogus", new String[]{".o", ".a", ".lib", ".xds"},
- new String[]{".dll", ".x"}, ".xds", false, null);
- this.outputPrefix = "";
- this.isADatasetLinker = true;
- }
- private OS390Linker(String outputPrefix, String outputSuffix) {
- super("cxx", "/bogus", new String[]{".o", ".a", ".lib", ".x"},
- new String[]{".dll"}, outputSuffix, false, null);
- this.outputPrefix = outputPrefix;
- this.isADatasetLinker = false;
- }
- protected void addBase(long base, Vector args) {
- }
- protected void addFixed(Boolean fixed, Vector args) {
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- if (linkType.isSharedLibrary()) {
- args.addElement("-W");
- args.addElement("l,DLL");
- }
- }
- protected void addIncremental(boolean incremental, Vector args) {
- }
- /*
- * @see CommandLineLinker#addLibrarySets(LibrarySet[], Vector, Vector,
- * Vector)
- */
- protected String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
- Vector preargs, Vector midargs, Vector endargs) {
- // If yo want to link against a library sitting in a dataset and
- // not in the HFS, you can just use the //'dataset' notation
- // to specify it. e.g:
- // <libset dir="." libs="//'MQM.V5R2M0.SCSQLOAD'"/>
- //
- // We have to have special handling here because the file is not
- // on the normal filesystem so the task will not noramly include it
- // as part of the link command.
- if (libsets != null) {
- for (int i = 0; i < libsets.length; i++) {
- String libs[] = libsets[i].getLibs();
- for (int j = 0; j < libs.length; j++) {
- if (libs[j].startsWith("//")) {
- endargs.addElement("-l");
- endargs.addElement(libs[j]);
- } else if (libsets[i].getDataset() != null) {
- String ds = libsets[i].getDataset();
- endargs.addElement("//'" + ds + "(" + libs[j] + ")'");
- }
- }
- }
- }
- return super.addLibrarySets(task, libsets, preargs, midargs, endargs);
- }
- protected void addMap(boolean map, Vector args) {
- }
- protected void addStack(int stack, Vector args) {
- }
- protected void addEntry(String entry, Vector args) {
- }
-
- public String getCommandFileSwitch(String commandFile) {
- return "@" + commandFile;
- }
- public File[] getLibraryPath() {
- return CUtil.getPathFromEnvironment("LIB", ";");
- }
-
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- StringBuffer buf = new StringBuffer();
- String[] patterns = new String[libnames.length * 3];
- int offset = addLibraryPatterns(libnames, buf, "lib", ".a", patterns, 0);
- offset = addLibraryPatterns(libnames, buf, "", ".x", patterns, offset);
- offset = addLibraryPatterns(libnames, buf, "", ".o", patterns, offset);
- return patterns;
- }
-
- private static int addLibraryPatterns(String[] libnames, StringBuffer buf,
- String prefix, String extension, String[] patterns, int offset) {
- for (int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(libnames[i]);
- buf.append(extension);
- patterns[offset + i] = buf.toString();
- }
- return offset + libnames.length;
- }
-
- public Linker getLinker(LinkType linkType) {
- if (this == datasetLinker)
- return datasetLinker;
- if (linkType.isSharedLibrary())
- return dllLinker;
- return instance;
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- public String getOutputFileName(String baseName) {
- return outputPrefix + super.getOutputFileName(baseName);
- }
- protected String[] getOutputFileSwitch(CCTask task, String outputFile) {
- if (isADatasetLinker && task.getDataset() != null) {
- String ds = task.getDataset();
- outputFile = "//'" + ds + "(" + outputFile + ")'";
- }
- return getOutputFileSwitch(outputFile);
- }
- public String[] getOutputFileSwitch(String outputFile) {
- return new String[]{"-o", outputFile};
- }
- public boolean isCaseSensitive() {
- return OS390Processor.isCaseSensitive();
- }
- /*
- * @see CommandLineLinker#link(Task, File, String[],
- * CommandLineLinkerConfiguration)
- */
- public void link(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- this.task = task;
- this.outputFile = outputFile;
- if (isADatasetLinker) {
- int p = outputFile.getName().indexOf(".");
- if (p >= 0) {
- String newname = outputFile.getName().substring(0, p);
- outputFile = new File(outputFile.getParent(), newname);
- }
- }
- super.link(task, outputFile, sourceFiles, config);
- }
- /*
- * @see CommandLineLinker#runCommand(Task, File, String[])
- */
- protected int runCommand(CCTask task, File workingDir, String[] cmdline)
- throws BuildException {
- int rc = super.runCommand(task, workingDir, cmdline);
- // create the .xds file if everything was ok.
- if (rc == 0) {
- try {
- outputFile.delete();
- new FileOutputStream(outputFile).close();
- } catch (IOException e) {
- throw new BuildException(e.getMessage());
- }
- }
- return rc;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390Processor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390Processor.java
deleted file mode 100644
index 2c209dd6bb..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os390/OS390Processor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.os390;
-import java.util.Vector;
-/**
- * A add-in class for IBM (r) OS/390 compilers and linkers
- *
- * @author Hiram Chirino (cojonudo14@hotmail.com)
- */
-public class OS390Processor {
- public static void addWarningSwitch(Vector args, int level) {
- switch (level) {
- /*
- * case 0: args.addElement("/W0"); break;
- *
- * case 1: args.addElement("/W1"); break;
- *
- * case 2: break;
- *
- * case 3: args.addElement("/W3"); break;
- *
- * case 4: args.addElement("/W4"); break;
- */
- }
- }
- public static String getCommandFileSwitch(String cmdFile) {
- StringBuffer buf = new StringBuffer("@");
- if (cmdFile.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(cmdFile);
- buf.append('\"');
- } else {
- buf.append(cmdFile);
- }
- return buf.toString();
- }
- public static String getIncludeDirSwitch(String includeDir) {
- return "-I" + includeDir;
- }
- public static String[] getOutputFileSwitch(String outPath) {
- StringBuffer buf = new StringBuffer("-o ");
- if (outPath.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(outPath);
- buf.append('\"');
- } else {
- buf.append(outPath);
- }
- String[] retval = new String[]{buf.toString()};
- return retval;
- }
- public static boolean isCaseSensitive() {
- return true;
- }
- private OS390Processor() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccCompiler.java
deleted file mode 100644
index f40858f71b..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccCompiler.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.os400;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.AbstractCompiler;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCCompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the IBM (R) OS/390 (tm) C++ Compiler
- *
- * @author Hiram Chirino (cojonudo14@hotmail.com)
- */
-public class IccCompiler extends CommandLineCCompiler {
- private static final AbstractCompiler instance = new IccCompiler(false,
- null);
- public static AbstractCompiler getInstance() {
- return instance;
- }
- private IccCompiler(boolean newEnvironment, Environment env) {
- super("icc", null, new String[]{".c", ".cc", ".cpp", ".cxx", ".c++",
- ".s"}, new String[]{".h", ".hpp"}, ".o", false, null,
- newEnvironment, env);
- }
- protected void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- // Specifies that only compilations and assemblies be done.
- // Link-edit is not done
- args.addElement("-c");
- /*
- * if (exceptions) { args.addElement("/GX"); }
- */
- if (debug) {
- args.addElement("-g");
- /*
- * args.addElement("-D"); args.addElement("_DEBUG"); if
- * (multithreaded) { args.addElement("/D_MT"); if (staticLink) {
- * args.addElement("/MTd"); } else { args.addElement("/MDd");
- * args.addElement("/D_DLL"); } } else { args.addElement("/MLd"); }
- */
- } else {
- /*
- * args.addElement("-D"); args.addElement("NEBUG"); if
- * (multithreaded) { args.addElement("/D_MT"); if (staticLink) {
- * args.addElement("/MT"); } else { args.addElement("/MD");
- * args.addElement("/D_DLL"); } } else { args.addElement("/ML"); }
- */
- }
- }
- protected void addWarningSwitch(Vector args, int level) {
- IccProcessor.addWarningSwitch(args, level);
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new IccCompiler(newEnvironment, env);
- }
- return this;
- }
- /*
- * @see CommandLineCompiler#getDefineSwitch(StringBuffer, String, String)
- */
- protected void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- buffer.append("-q");
- buffer.append(define);
- if (value != null && value.length() > 0) {
- buffer.append('=');
- buffer.append(value);
- }
- }
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ":");
- }
- protected String getIncludeDirSwitch(String includeDir) {
- return IccProcessor.getIncludeDirSwitch(includeDir);
- }
- public Linker getLinker(LinkType type) {
- return IccLinker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- /* Only compile one file at time for now */
- protected int getMaximumInputFilesPerCommand() {
- return 1;
- //return Integer.MAX_VALUE;
- }
- /*
- * @see CommandLineCompiler#getUndefineSwitch(StringBuffer, String)
- */
- protected void getUndefineSwitch(StringBuffer buffer, String define) {
- /*
- * buffer.addElement("-q"); buf.append(define);
- */
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccLinker.java
deleted file mode 100644
index 5e4e2f229a..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccLinker.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.os400;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-import org.apache.tools.ant.BuildException;
-/**
- * Adapter for the IBM (R) OS/390 (tm) Linker
- *
- * @author Hiram Chirino (cojonudo14@hotmail.com)
- */
-public final class IccLinker extends CommandLineLinker {
- private static final IccLinker datasetLinker = new IccLinker();
- private static final IccLinker dllLinker = new IccLinker("", ".dll");
- private static final IccLinker instance = new IccLinker("", "");
- public static IccLinker getDataSetInstance() {
- return datasetLinker;
- }
- public static IccLinker getInstance() {
- return instance;
- }
- private boolean isADatasetLinker;
- File outputFile;
- private String outputPrefix;
- CCTask task;
- private IccLinker() {
- super("icc", "/bogus", new String[]{".o", ".a", ".lib", ".xds"},
- new String[]{".dll", ".x"}, ".xds", false, null);
- this.outputPrefix = "";
- this.isADatasetLinker = true;
- }
- private IccLinker(String outputPrefix, String outputSuffix) {
- super("icc", "/bogus", new String[]{".o", ".a", ".lib", ".x"},
- new String[]{".dll"}, outputSuffix, false, null);
- this.outputPrefix = outputPrefix;
- this.isADatasetLinker = false;
- }
- protected void addBase(long base, Vector args) {
- }
- protected void addFixed(Boolean fixed, Vector args) {
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- if (linkType.isSharedLibrary()) {
- args.addElement("-W");
- args.addElement("l,DLL");
- }
- }
- protected void addIncremental(boolean incremental, Vector args) {
- }
- /*
- * @see CommandLineLinker#addLibrarySets(LibrarySet[], Vector, Vector,
- * Vector)
- */
- protected String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
- Vector preargs, Vector midargs, Vector endargs) {
- // If yo want to link against a library sitting in a dataset and
- // not in the HFS, you can just use the //'dataset' notation
- // to specify it. e.g:
- // <libset dir="." libs="//'MQM.V5R2M0.SCSQLOAD'"/>
- //
- // We have to have special handling here because the file is not
- // on the normal filesystem so the task will not noramly include it
- // as part of the link command.
- if (libsets != null) {
- for (int i = 0; i < libsets.length; i++) {
- String libs[] = libsets[i].getLibs();
- for (int j = 0; j < libs.length; j++) {
- if (libs[j].startsWith("//")) {
- endargs.addElement("-l");
- endargs.addElement(libs[j]);
- } else if (libsets[i].getDataset() != null) {
- String ds = libsets[i].getDataset();
- endargs.addElement("//'" + ds + "(" + libs[j] + ")'");
- }
- }
- }
- }
- return super.addLibrarySets(task, libsets, preargs, midargs, endargs);
- }
- protected void addMap(boolean map, Vector args) {
- }
- protected void addStack(int stack, Vector args) {
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- }
-
- public String getCommandFileSwitch(String commandFile) {
- return "@" + commandFile;
- }
- public File[] getLibraryPath() {
- return CUtil.getPathFromEnvironment("LIB", ";");
- }
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- StringBuffer buf = new StringBuffer();
- String[] patterns = new String[libnames.length * 3];
- int offset = addLibraryPatterns(libnames, buf, "lib", ".a", patterns, 0);
- offset = addLibraryPatterns(libnames, buf, "", ".x", patterns, offset);
- offset = addLibraryPatterns(libnames, buf, "", ".o", patterns, offset);
- return patterns;
- }
-
- private static int addLibraryPatterns(String[] libnames, StringBuffer buf,
- String prefix, String extension, String[] patterns, int offset) {
- for (int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(libnames[i]);
- buf.append(extension);
- patterns[offset + i] = buf.toString();
- }
- return offset + libnames.length;
- }
-
-
- public Linker getLinker(LinkType linkType) {
- if (this == datasetLinker)
- return datasetLinker;
- if (linkType.isSharedLibrary())
- return dllLinker;
- return instance;
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- protected String[] getOutputFileSwitch(CCTask task, String outputFile) {
- if (isADatasetLinker && task.getDataset() != null) {
- String ds = task.getDataset();
- outputFile = "//'" + ds + "(" + outputFile + ")'";
- }
- return getOutputFileSwitch(outputFile);
- }
- public String[] getOutputFileSwitch(String outputFile) {
- return new String[]{"-o", outputFile};
- }
- public boolean isCaseSensitive() {
- return IccProcessor.isCaseSensitive();
- }
- /*
- * @see CommandLineLinker#link(Task, File, String[],
- * CommandLineLinkerConfiguration)
- */
- public void link(CCTask task, File outputFile, String[] sourceFiles,
- CommandLineLinkerConfiguration config) throws BuildException {
- this.task = task;
- this.outputFile = outputFile;
- if (isADatasetLinker) {
- int p = outputFile.getName().indexOf(".");
- if (p >= 0) {
- String newname = outputFile.getName().substring(0, p);
- outputFile = new File(outputFile.getParent(), newname);
- }
- }
- super.link(task, outputFile, sourceFiles, config);
- }
- /*
- * @see CommandLineLinker#runCommand(Task, File, String[])
- */
- protected int runCommand(CCTask task, File workingDir, String[] cmdline)
- throws BuildException {
- int rc = super.runCommand(task, workingDir, cmdline);
- // create the .xds file if everything was ok.
- if (rc == 0) {
- try {
- outputFile.delete();
- new FileOutputStream(outputFile).close();
- } catch (IOException e) {
- throw new BuildException(e.getMessage());
- }
- }
- return rc;
- }
- public String xgetOutputFileName(String baseName) {
- return outputPrefix + super.getOutputFileName(baseName);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccProcessor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccProcessor.java
deleted file mode 100644
index 4cc7b36ab3..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccProcessor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.os400;
-import java.util.Vector;
-/**
- * A add-in class for IBM (r) OS/390 compilers and linkers
- *
- * @author Hiram Chirino (cojonudo14@hotmail.com)
- */
-public class IccProcessor {
- public static void addWarningSwitch(Vector args, int level) {
- switch (level) {
- /*
- * case 0: args.addElement("/W0"); break;
- *
- * case 1: args.addElement("/W1"); break;
- *
- * case 2: break;
- *
- * case 3: args.addElement("/W3"); break;
- *
- * case 4: args.addElement("/W4"); break;
- */
- }
- }
- public static String getCommandFileSwitch(String cmdFile) {
- StringBuffer buf = new StringBuffer("@");
- if (cmdFile.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(cmdFile);
- buf.append('\"');
- } else {
- buf.append(cmdFile);
- }
- return buf.toString();
- }
- public static String getIncludeDirSwitch(String includeDir) {
- return "-I" + includeDir;
- }
- public static String[] getOutputFileSwitch(String outPath) {
- StringBuffer buf = new StringBuffer("-o ");
- if (outPath.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(outPath);
- buf.append('\"');
- } else {
- buf.append(outPath);
- }
- String[] retval = new String[]{buf.toString()};
- return retval;
- }
- public static boolean isCaseSensitive() {
- return true;
- }
- private IccProcessor() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParser.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParser.java
deleted file mode 100644
index 6f0b79c072..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParser.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-import java.io.IOException;
-import java.io.Reader;
-/**
- * An abstract base class for simple parsers
- *
- * @author Curt Arnold
- */
-public abstract class AbstractParser {
- /**
- *
- *
- */
- protected AbstractParser() {
- }
- protected abstract void addFilename(String filename);
- public abstract AbstractParserState getNewLineState();
- protected void parse(Reader reader) throws IOException {
- char[] buf = new char[4096];
- AbstractParserState newLineState = getNewLineState();
- AbstractParserState state = newLineState;
- int charsRead = -1;
- do {
- charsRead = reader.read(buf, 0, buf.length);
- if (state == null) {
- for (int i = 0; i < charsRead; i++) {
- if (buf[i] == '\n') {
- state = newLineState;
- break;
- }
- }
- }
- if (state != null) {
- for (int i = 0; i < charsRead; i++) {
- state = state.consume(buf[i]);
- //
- // didn't match a production, skip to a new line
- //
- if (state == null) {
- for (; i < charsRead; i++) {
- if (buf[i] == '\n') {
- state = newLineState;
- break;
- }
- }
- }
- }
- }
- } while (charsRead >= 0);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParserState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParserState.java
deleted file mode 100644
index fe66dbbef0..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParserState.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-/**
- * An base class for objects that represent the state of an AbstractParser.
- *
- * @author CurtArnold
- * @see AbstractParser
- */
-public abstract class AbstractParserState {
- private AbstractParser parser;
- protected AbstractParserState(AbstractParser parser) {
- if (parser == null) {
- throw new NullPointerException("parser");
- }
- this.parser = parser;
- }
- /**
- * Consume a character
- *
- * @return new state, may be null to ignore the rest of the line
- */
- public abstract AbstractParserState consume(char ch);
- protected AbstractParser getParser() {
- return parser;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/BranchState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/BranchState.java
deleted file mode 100644
index 370c7d5836..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/BranchState.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-public class BranchState extends AbstractParserState {
- private char[] branchChars;
- private AbstractParserState[] branchStates;
- private AbstractParserState noMatchState;
- public BranchState(AbstractParser parser, char[] branchChars,
- AbstractParserState[] branchStates, AbstractParserState noMatchState) {
- super(parser);
- this.branchChars = (char[]) branchChars.clone();
- this.branchStates = (AbstractParserState[]) branchStates.clone();
- this.noMatchState = noMatchState;
- }
- public AbstractParserState consume(char ch) {
- AbstractParserState state;
- for (int i = 0; i < branchChars.length; i++) {
- if (ch == branchChars[i]) {
- state = branchStates[i];
- return state.consume(ch);
- }
- }
- state = getNoMatchState();
- if (state != null) {
- return state.consume(ch);
- }
- return state;
- }
- protected AbstractParserState getNoMatchState() {
- return noMatchState;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CParser.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CParser.java
deleted file mode 100644
index 07f8eba4e2..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CParser.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Vector;
-/**
- * A parser that extracts #include statements from a Reader.
- *
- * @author Adam Murdoch
- * @author Curt Arnold
- */
-public final class CParser extends AbstractParser implements Parser {
- private final Vector includes = new Vector();
- private AbstractParserState newLineState;
- /**
- *
- *
- */
- public CParser() {
- AbstractParserState quote = new FilenameState(this, new char[]{'"'});
- AbstractParserState bracket = new FilenameState(this, new char[]{'>'});
- AbstractParserState postE = new PostE(this, bracket, quote);
- //
- // nclude
- //
- AbstractParserState e = new LetterState(this, 'e', postE, null);
- AbstractParserState d = new LetterState(this, 'd', e, null);
- AbstractParserState u = new LetterState(this, 'u', d, null);
- AbstractParserState l = new LetterState(this, 'l', u, null);
- AbstractParserState c = new LetterState(this, 'c', l, null);
- AbstractParserState n = new LetterState(this, 'n', c, null);
- //
- // mport is equivalent to nclude
- //
- AbstractParserState t = new LetterState(this, 't', postE, null);
- AbstractParserState r = new LetterState(this, 'r', t, null);
- AbstractParserState o = new LetterState(this, 'o', r, null);
- AbstractParserState p = new LetterState(this, 'p', o, null);
- AbstractParserState m = new LetterState(this, 'm', p, null);
- //
- // switch between
- //
- AbstractParserState n_m = new BranchState(this, new char[]{'n', 'm'},
- new AbstractParserState[]{n, m}, null);
- AbstractParserState i = new WhitespaceOrLetterState(this, 'i', n_m);
- newLineState = new LetterState(this, '#', i, null);
- }
- public void addFilename(String include) {
- includes.addElement(include);
- }
- public String[] getIncludes() {
- String[] retval = new String[includes.size()];
- includes.copyInto(retval);
- return retval;
- }
- public AbstractParserState getNewLineState() {
- return newLineState;
- }
- public void parse(Reader reader) throws IOException {
- includes.setSize(0);
- super.parse(reader);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CaseInsensitiveLetterState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CaseInsensitiveLetterState.java
deleted file mode 100644
index a86700f166..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CaseInsensitiveLetterState.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-/**
- * This parser state checks consumed characters against a specific character
- * (case insensitive).
- *
- * @author Curt Arnold
- */
-public final class CaseInsensitiveLetterState
- extends AbstractParserState {
- /**
- * Next state if a match is found.
- */
- private final AbstractParserState nextState;
-
- /**
- * Next state if not match is found.
- */
- private final AbstractParserState noMatchState;
-
- /**
- * Lower case version of character to match.
- */
- private final char lowerLetter;
-
- /**
- * Lower case version of character to match.
- */
- private final char upperLetter;
-
- /**
- * Constructor.
- *
- * @param parser
- * parser
- * @param matchLetter
- * letter to match
- * @param nextStateArg
- * next state if a match on the letter
- * @param noMatchStateArg
- * state if no match on letter
- */
- public CaseInsensitiveLetterState(final AbstractParser parser,
- final char matchLetter,
- final AbstractParserState nextStateArg,
- final AbstractParserState noMatchStateArg) {
- super(parser);
- this.lowerLetter = Character.toLowerCase(matchLetter);
- this.upperLetter = Character.toUpperCase(matchLetter);
- this.nextState = nextStateArg;
- this.noMatchState = noMatchStateArg;
- }
-
- /**
- * Consumes a character and returns the next state for the parser.
- *
- * @param ch
- * next character
- * @return the configured nextState if ch is the expected character or the
- * configure noMatchState otherwise.
- */
- public AbstractParserState consume(final char ch) {
- if (ch == lowerLetter || ch == upperLetter) {
- return nextState;
- }
- if (ch == '\n') {
- getParser().getNewLineState();
- }
- return noMatchState;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FilenameState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FilenameState.java
deleted file mode 100644
index f33940b0a7..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FilenameState.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-public class FilenameState extends AbstractParserState {
- private final StringBuffer buf = new StringBuffer();
- private final char[] terminators;
- public FilenameState(AbstractParser parser, char[] terminators) {
- super(parser);
- this.terminators = (char[]) terminators.clone();
- }
- public AbstractParserState consume(char ch) {
- for (int i = 0; i < terminators.length; i++) {
- if (ch == terminators[i]) {
- getParser().addFilename(buf.toString());
- buf.setLength(0);
- return null;
- }
- }
- if (ch == '\n') {
- buf.setLength(0);
- return getParser().getNewLineState();
- } else {
- buf.append(ch);
- }
- return this;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FortranParser.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FortranParser.java
deleted file mode 100644
index 261e95ad81..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FortranParser.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Vector;
-
-/**
- * A parser that extracts INCLUDE statements from a Reader.
- *
- * @author Curt Arnold
- */
-public final class FortranParser
- extends AbstractParser
- implements Parser {
- /**
- * List of included filenames.
- */
- private final Vector includes = new Vector();
-
- /**
- * State that starts consuming content at the beginning of a line.
- */
- private final AbstractParserState newLineState;
-
- /**
- * Default constructor.
- *
- */
- public FortranParser() {
- AbstractParserState filename = new FilenameState(this, new char[] {'\'',
- '/'});
- AbstractParserState apos = new WhitespaceOrLetterState(this, '\'',
- filename);
- AbstractParserState blank = new LetterState(this, ' ', apos, null);
- AbstractParserState e = new CaseInsensitiveLetterState(this, 'E',
- blank, null);
- AbstractParserState d = new CaseInsensitiveLetterState(this, 'D', e,
- null);
- AbstractParserState u = new CaseInsensitiveLetterState(this, 'U', d,
- null);
- AbstractParserState l = new CaseInsensitiveLetterState(this, 'L', u,
- null);
- AbstractParserState c = new CaseInsensitiveLetterState(this, 'C', l,
- null);
- AbstractParserState n = new CaseInsensitiveLetterState(this, 'N', c,
- null);
- newLineState = new WhitespaceOrCaseInsensitiveLetterState(this, 'I', n);
- }
-
- /**
- * Called by FilenameState at completion of file name production.
- *
- * @param include
- * include file name
- */
- public void addFilename(final String include) {
- includes.addElement(include);
- }
-
- /**
- * Gets collection of include file names encountered in parse.
- * @return include file names
- */
- public String[] getIncludes() {
- String[] retval = new String[includes.size()];
- includes.copyInto(retval);
- return retval;
- }
-
- /**
- * Get the state for the beginning of a new line.
- * @return start of line state
- */
- public AbstractParserState getNewLineState() {
- return newLineState;
- }
-
- /**
- * Collects all included files from the content of the reader.
- *
- * @param reader
- * character reader containing a FORTRAN source module
- * @throws IOException
- * throw if I/O error during parse
- */
- public void parse(final Reader reader) throws IOException {
- includes.setSize(0);
- super.parse(reader);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/LetterState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/LetterState.java
deleted file mode 100644
index 945ae91233..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/LetterState.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-/**
- * This parser state checks consumed characters against a specific character.
- *
- * @author Curt Arnold
- */
-public final class LetterState
- extends AbstractParserState {
- /**
- * Next state if a match is found.
- */
- private final AbstractParserState nextState;
-
- /**
- * Next state if not match is found.
- */
- private final AbstractParserState noMatchState;
-
- /**
- * Character to match.
- */
- private final char thisLetter;
-
- /**
- * Constructor.
- *
- * @param parser
- * parser
- * @param matchLetter
- * letter to match
- * @param nextStateArg
- * next state if a match on the letter
- * @param noMatchStateArg
- * state if no match on letter
- */
- public LetterState(final AbstractParser parser,
- final char matchLetter,
- final AbstractParserState nextStateArg,
- final AbstractParserState noMatchStateArg) {
- super(parser);
- this.thisLetter = matchLetter;
- this.nextState = nextStateArg;
- this.noMatchState = noMatchStateArg;
- }
-
- /**
- * Consumes a character and returns the next state for the parser.
- *
- * @param ch
- * next character
- * @return the configured nextState if ch is the expected character or the
- * configure noMatchState otherwise.
- */
- public AbstractParserState consume(final char ch) {
- if (ch == thisLetter) {
- return nextState;
- }
- if (ch == '\n') {
- getParser().getNewLineState();
- }
- return noMatchState;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/Parser.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/Parser.java
deleted file mode 100644
index cf759fc7d5..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/Parser.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-import java.io.IOException;
-import java.io.Reader;
-/**
- * A parser that extracts #include statements from a Reader.
- *
- * @author Curt Arnold
- */
-public interface Parser {
- String[] getIncludes();
- void parse(Reader reader) throws IOException;
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/PostE.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/PostE.java
deleted file mode 100644
index fe225fb35a..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/PostE.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-public class PostE extends AbstractParserState {
- private AbstractParserState bracket;
- private AbstractParserState quote;
- public PostE(CParser parser, AbstractParserState bracket,
- AbstractParserState quote) {
- super(parser);
- this.bracket = bracket;
- this.quote = quote;
- }
- public AbstractParserState consume(char ch) {
- switch (ch) {
- case ' ' :
- case '\t' :
- return this;
- case '<' :
- return bracket;
- case '"' :
- return quote;
- case '\n' :
- return getParser().getNewLineState();
- }
- return null;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrCaseInsensitiveLetterState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrCaseInsensitiveLetterState.java
deleted file mode 100644
index 9d42feeaad..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrCaseInsensitiveLetterState.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-/**
- * This parser state checks consumed characters against a specific character
- * (case insensitive) or whitespace.
- *
- * @author Curt Arnold
- */
-public final class WhitespaceOrCaseInsensitiveLetterState
- extends
- AbstractParserState {
- /**
- * Next state if the character is found.
- */
- private final AbstractParserState nextState;
-
- /**
- * Character to match (lower case).
- */
- private final char lowerLetter;
-
- /**
- * Character to match (upper case).
- */
- private final char upperLetter;
-
- /**
- * Constructor.
- *
- * @param parser
- * parser
- * @param matchLetter
- * letter to match
- * @param nextStateArg
- * next state if a match on the letter
- */
- public WhitespaceOrCaseInsensitiveLetterState(final AbstractParser parser,
- final char matchLetter,
- final AbstractParserState
- nextStateArg) {
- super(parser);
- this.lowerLetter = Character.toLowerCase(matchLetter);
- this.upperLetter = Character.toUpperCase(matchLetter);
- this.nextState = nextStateArg;
- }
-
- /**
- * Consumes a character and returns the next state for the parser.
- *
- * @param ch
- * next character
- * @return the configured nextState if ch is the expected character or the
- * configure noMatchState otherwise.
- */
- public AbstractParserState consume(final char ch) {
- if (ch == lowerLetter || ch == upperLetter) {
- return nextState;
- }
- if (ch == ' ' || ch == '\t') {
- return this;
- }
- if (ch == '\n') {
- getParser().getNewLineState();
- }
- return null;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrLetterState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrLetterState.java
deleted file mode 100644
index 824abe6b68..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrLetterState.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-/**
- * This parser state checks consumed characters against a specific character or
- * whitespace.
- *
- * @author Curt Arnold
- */
-public final class WhitespaceOrLetterState
- extends AbstractParserState {
- /**
- * Next state if the character is found.
- */
- private final AbstractParserState nextState;
-
- /**
- * Character to match.
- */
- private final char thisLetter;
-
- /**
- * Constructor.
- *
- * @param parser
- * parser
- * @param matchLetter
- * letter to match
- * @param nextStateArg
- * next state if a match on the letter
- */
- public WhitespaceOrLetterState(final AbstractParser parser,
- final char matchLetter,
- final AbstractParserState nextStateArg) {
- super(parser);
- this.thisLetter = matchLetter;
- this.nextState = nextStateArg;
- }
-
- /**
- * Consumes a character and returns the next state for the parser.
- *
- * @param ch
- * next character @returns the configured nextState if ch is the
- * expected character or the configure noMatchState otherwise.
- * @return next state
- */
- public AbstractParserState consume(final char ch) {
- if (ch == thisLetter) {
- return nextState;
- }
- if (ch == ' ' || ch == '\t') {
- return this;
- }
- if (ch == '\n') {
- getParser().getNewLineState();
- }
- return null;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java
deleted file mode 100644
index 6679c239dd..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.sun;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.AbstractCompiler;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCCompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.compiler.Processor;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for the Sun C89 C++ Compiler
- *
- * @author Hiram Chirino (cojonudo14@hotmail.com)
- */
-public class C89CCompiler extends CommandLineCCompiler {
- private static final AbstractCompiler instance = new C89CCompiler(false,
- null);
- public static AbstractCompiler getInstance() {
- return instance;
- }
- private C89CCompiler(boolean newEnvironment, Environment env) {
- super("c89", null, new String[]{".c", ".cc", ".cpp", ".cxx", ".c++"},
- new String[]{".h", ".hpp"}, ".o", false, null, newEnvironment,
- env);
- }
- protected void addImpliedArgs(
- final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- // Specifies that only compilations and assemblies be done.
- args.addElement("-c");
- /*
- * if (exceptions) { args.addElement("/GX"); }
- */
- if (debug) {
- args.addElement("-g");
- args.addElement("-D_DEBUG");
- /*
- * if (multithreaded) { args.addElement("/D_MT"); if (staticLink) {
- * args.addElement("/MTd"); } else { args.addElement("/MDd");
- * args.addElement("/D_DLL"); } } else { args.addElement("/MLd"); }
- */
- } else {
- args.addElement("-DNDEBUG");
- /*
- * if (multithreaded) { args.addElement("/D_MT"); if (staticLink) {
- * args.addElement("/MT"); } else { args.addElement("/MD");
- * args.addElement("/D_DLL"); } } else { args.addElement("/ML"); }
- */
- }
- }
- protected void addWarningSwitch(Vector args, int level) {
- C89Processor.addWarningSwitch(args, level);
- }
- public Processor changeEnvironment(boolean newEnvironment, Environment env) {
- if (newEnvironment || env != null) {
- return new C89CCompiler(newEnvironment, env);
- }
- return this;
- }
- protected void getDefineSwitch(StringBuffer buf, String define, String value) {
- C89Processor.getDefineSwitch(buf, define, value);
- }
- protected File[] getEnvironmentIncludePath() {
- return CUtil.getPathFromEnvironment("INCLUDE", ":");
- }
- protected String getIncludeDirSwitch(String includeDir) {
- return C89Processor.getIncludeDirSwitch(includeDir);
- }
- public Linker getLinker(LinkType type) {
- return C89Linker.getInstance().getLinker(type);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- /* Only compile one file at time for now */
- protected int getMaximumInputFilesPerCommand() {
- return 1;
- }
- protected void getUndefineSwitch(StringBuffer buf, String define) {
- C89Processor.getUndefineSwitch(buf, define);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89Linker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89Linker.java
deleted file mode 100644
index 37b3950bbe..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89Linker.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.sun;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * Adapter for the Sun C89 Linker
- *
- * @author Hiram Chirino (cojonudo14@hotmail.com)
- */
-public final class C89Linker extends CommandLineLinker {
- private static final C89Linker dllLinker = new C89Linker("lib", ".so");
- private static final C89Linker instance = new C89Linker("", "");
- public static C89Linker getInstance() {
- return instance;
- }
- private String outputPrefix;
- private C89Linker(String outputPrefix, String outputSuffix) {
- super("ld", "/bogus", new String[]{".o", ".a", ".lib", ".x"},
- new String[]{}, outputSuffix, false, null);
- this.outputPrefix = outputPrefix;
- }
- protected void addBase(long base, Vector args) {
- }
- protected void addFixed(Boolean fixed, Vector args) {
- }
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- if (linkType.isSharedLibrary()) {
- args.addElement("-G");
- }
- }
- protected void addIncremental(boolean incremental, Vector args) {
- }
- public String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
- Vector preargs, Vector midargs, Vector endargs) {
- super.addLibrarySets(task, libsets, preargs, midargs, endargs);
- StringBuffer buf = new StringBuffer("-l");
- for (int i = 0; i < libsets.length; i++) {
- LibrarySet set = libsets[i];
- File libdir = set.getDir(null);
- String[] libs = set.getLibs();
- if (libdir != null) {
- endargs.addElement("-L");
- endargs.addElement(libdir.getAbsolutePath());
- }
- for (int j = 0; j < libs.length; j++) {
- //
- // reset the buffer to just "-l"
- //
- buf.setLength(2);
- //
- // add the library name
- buf.append(libs[j]);
- //
- // add the argument to the list
- endargs.addElement(buf.toString());
- }
- }
- return null;
- }
- protected void addMap(boolean map, Vector args) {
- }
- protected void addStack(int stack, Vector args) {
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- }
-
- public String getCommandFileSwitch(String commandFile) {
- return "@" + commandFile;
- }
- public File[] getLibraryPath() {
- return CUtil.getPathFromEnvironment("LIB", ";");
- }
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- return C89Processor.getLibraryPatterns(libnames, libType);
- }
- public Linker getLinker(LinkType linkType) {
- if (linkType.isSharedLibrary()) {
- return dllLinker;
- }
- /*
- * if(linkType.isStaticLibrary()) { return
- * OS390Librarian.getInstance(); }
- */
- return instance;
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
- public String getOutputFileName(String baseName) {
- return outputPrefix + super.getOutputFileName(baseName);
- }
- public String[] getOutputFileSwitch(String outputFile) {
- return new String[]{"-o", outputFile};
- }
- public boolean isCaseSensitive() {
- return C89Processor.isCaseSensitive();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89Processor.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89Processor.java
deleted file mode 100644
index c54c866966..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89Processor.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.sun;
-import java.util.Vector;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * A add-in class for Sun C89 compilers and linkers
- *
- * @author Hiram Chirino (cojonudo14@hotmail.com)
- */
-public class C89Processor {
- private static int addLibraryPatterns(String[] libnames, StringBuffer buf,
- String prefix, String extension, String[] patterns, int offset) {
- for (int i = 0; i < libnames.length; i++) {
- buf.setLength(0);
- buf.append(prefix);
- buf.append(libnames[i]);
- buf.append(extension);
- patterns[offset + i] = buf.toString();
- }
- return offset + libnames.length;
- }
- public static void addWarningSwitch(Vector args, int level) {
- switch (level) {
- /*
- * case 0: args.addElement("/W0"); break;
- *
- * case 1: args.addElement("/W1"); break;
- *
- * case 2: break;
- *
- * case 3: args.addElement("/W3"); break;
- *
- * case 4: args.addElement("/W4"); break;
- */
- }
- }
- public static String getCommandFileSwitch(String cmdFile) {
- StringBuffer buf = new StringBuffer("@");
- if (cmdFile.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(cmdFile);
- buf.append('\"');
- } else {
- buf.append(cmdFile);
- }
- return buf.toString();
- }
- public static void getDefineSwitch(StringBuffer buf, String define,
- String value) {
- buf.setLength(0);
- buf.append("-D");
- buf.append(define);
- if (value != null && value.length() > 0) {
- buf.append('=');
- buf.append(value);
- }
- }
- public static String getIncludeDirSwitch(String includeDir) {
- return "-I" + includeDir;
- }
- public static String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- StringBuffer buf = new StringBuffer();
- int patternCount = libnames.length*2;
- if (libType != null) {
- patternCount = libnames.length;
- }
- String[] patterns = new String[patternCount];
- int offset = 0;
- if (libType == null || "static".equals(libType.getValue())) {
- offset = addLibraryPatterns(libnames, buf, "lib", ".a", patterns, 0);
- }
- if (libType == null || !"static".equals(libType.getValue())) {
- offset = addLibraryPatterns(libnames, buf, "lib", ".so", patterns,
- offset);
- }
- return patterns;
- }
- public static String[] getOutputFileSwitch(String outPath) {
- StringBuffer buf = new StringBuffer("-o ");
- if (outPath.indexOf(' ') >= 0) {
- buf.append('\"');
- buf.append(outPath);
- buf.append('\"');
- } else {
- buf.append(outPath);
- }
- String[] retval = new String[]{buf.toString()};
- return retval;
- }
- public static void getUndefineSwitch(StringBuffer buf, String define) {
- buf.setLength(0);
- buf.append("-U");
- buf.append(define);
- }
- public static boolean isCaseSensitive() {
- return true;
- }
- private C89Processor() {
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java
deleted file mode 100644
index a35d01af49..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.sun;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-/**
- * Adapter for the Sun (r) Forte (tm) C++ compiler
- *
- * @author Curt Arnold
- */
-public final class ForteCCCompiler extends GccCompatibleCCompiler {
- private static final ForteCCCompiler instance = new ForteCCCompiler("CC");
- /**
- * Gets singleton instance of this class
- */
- public static ForteCCCompiler getInstance() {
- return instance;
- }
- private String identifier;
- private File[] includePath;
- /**
- * Private constructor. Use ForteCCCompiler.getInstance() to get singleton
- * instance of this class.
- */
- private ForteCCCompiler(String command) {
- super(command, "-V", false, null, false, null);
- }
- public void addImpliedArgs(final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization) {
- args.addElement("-c");
- if (debug) {
- args.addElement("-g");
- }
- if (optimization != null) {
- if (optimization.isSpeed()) {
- args.addElement("-xO2");
- }
- }
- if (rtti != null) {
- if (rtti.booleanValue()) {
- args.addElement("-features=rtti");
- } else {
- args.addElement("-features=no%rtti");
- }
- }
- if (multithreaded) {
- args.addElement("-mt");
- }
- if (linkType.isSharedLibrary()) {
- args.addElement("-KPIC");
- }
-
- }
- public void addWarningSwitch(Vector args, int level) {
- switch (level) {
- case 0 :
- args.addElement("-w");
- break;
- case 1 :
- case 2 :
- args.addElement("+w");
- break;
- case 3 :
- case 4 :
- case 5 :
- args.addElement("+w2");
- break;
- }
- }
- public File[] getEnvironmentIncludePath() {
- if (includePath == null) {
- File ccLoc = CUtil.getExecutableLocation("CC");
- if (ccLoc != null) {
- File compilerIncludeDir = new File(
- new File(ccLoc, "../include").getAbsolutePath());
- if (compilerIncludeDir.exists()) {
- includePath = new File[2];
- includePath[0] = compilerIncludeDir;
- }
- }
- if (includePath == null) {
- includePath = new File[1];
- }
- includePath[includePath.length - 1] = new File("/usr/include");
- }
- return includePath;
- }
- public Linker getLinker(LinkType linkType) {
- return ForteCCLinker.getInstance().getLinker(linkType);
- }
- public int getMaximumCommandLength() {
- return Integer.MAX_VALUE;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java
deleted file mode 100644
index c39071af9f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.sun;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
-/**
- * Adapter for Sun (r) Forte(tm) C++ Linker
- *
- * @author Curt Arnold
- */
-public final class ForteCCLinker extends AbstractLdLinker {
- private static final String[] discardFiles = new String[]{".dll", ".so",
- ".sl"};
- private static final String[] objFiles = new String[]{".o", ".a", ".lib"};
- private static final ForteCCLinker arLinker = new ForteCCLinker("CC",
- objFiles, discardFiles, "lib", ".a");
- private static final ForteCCLinker dllLinker = new ForteCCLinker("CC",
- objFiles, discardFiles, "lib", ".so");
- private static final ForteCCLinker instance = new ForteCCLinker("CC",
- objFiles, discardFiles, "", "");
- public static ForteCCLinker getInstance() {
- return instance;
- }
- private File[] libDirs;
- private ForteCCLinker(String command, String[] extensions,
- String[] ignoredExtensions, String outputPrefix, String outputSuffix) {
- super(command, "-V", extensions, ignoredExtensions, outputPrefix,
- outputSuffix, false, null);
- }
- public void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
- if (debug) {
- args.addElement("-g");
- }
- if (linkType.isStaticRuntime()) {
- args.addElement("-static");
- }
- if (linkType.isSharedLibrary()) {
- args.addElement("-G");
- }
- if (linkType.isStaticLibrary()) {
- args.addElement("-xar");
- }
- }
- public void addIncremental(boolean incremental, Vector args) {
- /*
- * if (incremental) { args.addElement("-xidlon"); } else {
- * args.addElement("-xidloff"); }
- */
- }
- /**
- * Returns library path.
- *
- */
- public File[] getLibraryPath() {
- if (libDirs == null) {
- File CCloc = CUtil.getExecutableLocation("CC");
- if (CCloc != null) {
- File compilerLib = new File(new File(CCloc, "../lib")
- .getAbsolutePath());
- if (compilerLib.exists()) {
- libDirs = new File[2];
- libDirs[0] = compilerLib;
- }
- }
- if (libDirs == null) {
- libDirs = new File[1];
- }
- }
- libDirs[libDirs.length - 1] = new File("/usr/lib");
- return libDirs;
- }
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- return arLinker;
- }
- if (type.isSharedLibrary()) {
- return dllLinker;
- }
- return instance;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxCCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxCCompiler.java
deleted file mode 100644
index d08b9fbbf6..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxCCompiler.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.ti;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.compiler.CommandLineCCompiler;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.OptimizationEnum;
-
-
-import org.apache.tools.ant.types.Environment;
-/**
- * Adapter for TI DSP compilers with cl** commands
- *
- * @author CurtA
- */
-public class ClxxCCompiler extends CommandLineCCompiler {
- /**
- * Header file extensions
- */
- private static final String[] headerExtensions = new String[]{".h", ".hpp",
- ".inl"};
- /**
- * Source file extensions
- */
- private static final String[] sourceExtensions = new String[]{".c", ".cc",
- ".cpp", ".cxx", ".c++"};
- /**
- * Singleton for TMS320C55x
- */
- private static final ClxxCCompiler cl55 = new ClxxCCompiler("cl55", false,
- null);
- /**
- * Singleton for TMS320C6000
- */
- private static final ClxxCCompiler cl6x = new ClxxCCompiler("cl6x", false,
- null);
- public static ClxxCCompiler getCl55Instance() {
- return cl55;
- }
- public static ClxxCCompiler getCl6xInstance() {
- return cl6x;
- }
- /**
- * Private constructor
- *
- * @param command
- * executable name
- * @param newEnvironment
- * Change environment
- * @param env
- * New environment
- */
- private ClxxCCompiler(String command, boolean newEnvironment,
- Environment env) {
- super(command, "-h", sourceExtensions, headerExtensions, ".o", false,
- null, newEnvironment, env);
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#addImpliedArgs(java.util.Vector,
- * boolean, boolean, boolean,
- * net.sf.antcontrib.cpptasks.compiler.LinkType)
- */
- protected void addImpliedArgs(
- final Vector args,
- final boolean debug,
- final boolean multithreaded,
- final boolean exceptions,
- final LinkType linkType,
- final Boolean rtti,
- final OptimizationEnum optimization,
- final Boolean defaultflag) {
- if (debug) {
- args.addElement("-gw");
- }
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#addWarningSwitch(java.util.Vector,
- * int)
- */
- protected void addWarningSwitch(Vector args, int warnings) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getDefineSwitch(java.lang.StringBuffer,
- * java.lang.String, java.lang.String)
- */
- protected void getDefineSwitch(StringBuffer buffer, String define,
- String value) {
- buffer.append("-d");
- buffer.append(define);
- if (value != null) {
- buffer.append('=');
- buffer.append(value);
- }
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getEnvironmentIncludePath()
- */
- protected File[] getEnvironmentIncludePath() {
- File[] c_dir = CUtil.getPathFromEnvironment("C_DIR", ";");
- File[] cx_dir = CUtil.getPathFromEnvironment("C6X_C_DIR", ";");
- if (c_dir.length == 0) {
- return cx_dir;
- }
- if (cx_dir.length == 0) {
- return c_dir;
- }
- File[] combo = new File[c_dir.length + cx_dir.length];
- for (int i = 0; i < cx_dir.length; i++) {
- combo[i] = cx_dir[i];
- }
- for (int i = 0; i < c_dir.length; i++) {
- combo[i + cx_dir.length] = c_dir[i];
- }
- return combo;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getIncludeDirSwitch(java.lang.String)
- */
- protected String getIncludeDirSwitch(String source) {
- return "-I" + source;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Processor#getLinker(net.sf.antcontrib.cpptasks.compiler.LinkType)
- */
- public Linker getLinker(LinkType type) {
- if (type.isStaticLibrary()) {
- if (this == cl6x) {
- return ClxxLibrarian.getCl6xInstance();
- }
- return ClxxLibrarian.getCl55Instance();
- }
- if (type.isSharedLibrary()) {
- if (this == cl6x) {
- return ClxxLinker.getCl6xDllInstance();
- }
- return ClxxLinker.getCl55DllInstance();
- }
- if (this == cl6x) {
- return ClxxLinker.getCl6xInstance();
- }
- return ClxxLinker.getCl55Instance();
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getMaximumCommandLength()
- */
- public int getMaximumCommandLength() {
- return 1024;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler#getUndefineSwitch(java.lang.StringBuffer,
- * java.lang.String)
- */
- protected void getUndefineSwitch(StringBuffer buffer, String define) {
- buffer.append("-u");
- buffer.append(define);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxLibrarian.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxLibrarian.java
deleted file mode 100644
index 082d1a477f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxLibrarian.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.ti;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- *
- * Adapter for TI DSP librarian
- * *
- * @author CurtA
- */
-public class ClxxLibrarian extends CommandLineLinker {
- private static final ClxxLibrarian cl55Instance = new ClxxLibrarian("ar55");
- private static final ClxxLibrarian cl6xInstance = new ClxxLibrarian("ar6x");
- public static final ClxxLibrarian getCl55Instance() {
- return cl55Instance;
- }
- public static final ClxxLibrarian getCl6xInstance() {
- return cl6xInstance;
- }
- private ClxxLibrarian(String command) {
- super(command, null, new String[]{".o"}, new String[0], ".lib", false,
- null);
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addBase(long,
- * java.util.Vector)
- */
- protected void addBase(long base, Vector args) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addFixed(java.lang.Boolean,
- * java.util.Vector)
- */
- protected void addFixed(Boolean fixed, Vector args) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addImpliedArgs(boolean,
- * net.sf.antcontrib.cpptasks.compiler.LinkType, java.util.Vector)
- */
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addIncremental(boolean,
- * java.util.Vector)
- */
- protected void addIncremental(boolean incremental, Vector args) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addMap(boolean,
- * java.util.Vector)
- */
- protected void addMap(boolean map, Vector args) {
- // TODO Auto-generated method stub
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addStack(int,
- * java.util.Vector)
- */
- protected void addStack(int stack, Vector args) {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getCommandFileSwitch(java.lang.String)
- */
- protected String getCommandFileSwitch(String commandFile) {
- return "@" + commandFile;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPath()
- */
- public File[] getLibraryPath() {
- return new File[0];
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPatterns(java.lang.String[])
- */
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- return new String[0];
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Processor#getLinker(net.sf.antcontrib.cpptasks.compiler.LinkType)
- */
- public Linker getLinker(LinkType linkType) {
- return null;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getMaximumCommandLength()
- */
- protected int getMaximumCommandLength() {
- return 1024;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getOutputFileSwitch(java.lang.String)
- */
- protected String[] getOutputFileSwitch(String outputFile) {
- return new String[]{"-o", outputFile};
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#isCaseSensitive()
- */
- public boolean isCaseSensitive() {
- // TODO Auto-generated method stub
- return false;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxLinker.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxLinker.java
deleted file mode 100644
index 43ee7c0662..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ti/ClxxLinker.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.ti;
-import java.io.File;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
-import net.sf.antcontrib.cpptasks.compiler.LinkType;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
-
-/**
- * Adapter for TI DSP linkers
- * *
- * @author CurtA
- *
- */
-public class ClxxLinker extends CommandLineLinker {
- private static final ClxxLinker cl55DllInstance = new ClxxLinker("lnk55",
- ".dll");
- private static final ClxxLinker cl55Instance = new ClxxLinker("lnk55",
- ".exe");
- private static final ClxxLinker cl6xDllInstance = new ClxxLinker("lnk6x",
- ".dll");
- private static final ClxxLinker cl6xInstance = new ClxxLinker("lnk6x",
- ".exe");
- public static ClxxLinker getCl55DllInstance() {
- return cl55DllInstance;
- }
- public static ClxxLinker getCl55Instance() {
- return cl55Instance;
- }
- public static ClxxLinker getCl6xDllInstance() {
- return cl6xDllInstance;
- }
- public static ClxxLinker getCl6xInstance() {
- return cl6xInstance;
- }
- private ClxxLinker(String command, String outputSuffix) {
- super(command, "-h", new String[]{".o", ".lib", ".res"}, new String[]{
- ".map", ".pdb", ".lnk"}, outputSuffix, false, null);
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addBase(long,
- * java.util.Vector)
- */
- protected void addBase(long base, Vector args) {
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addFixed(java.lang.Boolean,
- * java.util.Vector)
- */
- protected void addFixed(Boolean fixed, Vector args) {
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addImpliedArgs(boolean,
- * net.sf.antcontrib.cpptasks.compiler.LinkType, java.util.Vector)
- */
- protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
- if (linkType.isSharedLibrary()) {
- args.addElement("-abs");
- }
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addIncremental(boolean,
- * java.util.Vector)
- */
- protected void addIncremental(boolean incremental, Vector args) {
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addMap(boolean,
- * java.util.Vector)
- */
- protected void addMap(boolean map, Vector args) {
- if (map) {
- args.addElement("-m");
- }
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addStack(int,
- * java.util.Vector)
- */
- protected void addStack(int stack, Vector args) {
- }
- /* (non-Javadoc)
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
- */
- protected void addEntry(String entry, Vector args) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getCommandFileSwitch(java.lang.String)
- */
- protected String getCommandFileSwitch(String commandFile) {
- return "@" + commandFile;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPath()
- */
- public File[] getLibraryPath() {
- return new File[0];
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPatterns(java.lang.String[])
- */
- public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
- //
- // TODO: Looks bogus, should be .a or .so's not .o's
- //
- String[] libpats = new String[libnames.length];
- for (int i = 0; i < libnames.length; i++) {
- libpats[i] = libnames[i] + ".o";
- }
- return libpats;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Processor#getLinker(net.sf.antcontrib.cpptasks.compiler.LinkType)
- */
- public Linker getLinker(LinkType linkType) {
- return this;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getMaximumCommandLength()
- */
- protected int getMaximumCommandLength() {
- return 1024;
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getOutputFileSwitch(java.lang.String)
- */
- protected String[] getOutputFileSwitch(String outputFile) {
- return new String[]{"-o", outputFile};
- }
- /*
- * (non-Javadoc)
- *
- * @see net.sf.antcontrib.cpptasks.compiler.Linker#isCaseSensitive()
- */
- public boolean isCaseSensitive() {
- // TODO Auto-generated method stub
- return false;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/AslcompilerArgument.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/AslcompilerArgument.java
deleted file mode 100644
index 87babcf740..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/AslcompilerArgument.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-
-/**
- * A aslcompiler command line argument.
- */
-public class AslcompilerArgument extends CommandLineArgument {
- public AslcompilerArgument () {
- }
-
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/AssemblerArgument.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/AssemblerArgument.java
deleted file mode 100644
index 1b5f54d9a7..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/AssemblerArgument.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Copyright 2001-2005 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-
-/**
- * A assembler command line argument.
- */
-public class AssemblerArgument extends CommandLineArgument {
- public AssemblerArgument () {
- }
-
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/CommandLineArgument.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/CommandLineArgument.java
deleted file mode 100644
index 91ab2f6327..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/CommandLineArgument.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-
-import org.apache.tools.ant.types.EnumeratedAttribute;
-import java.io.File;
-/**
- * An compiler/linker command line flag.
- */
-public class CommandLineArgument {
- /**
- * Enumerated attribute with the values "start", "mid" and "end",
- */
- public static class LocationEnum extends EnumeratedAttribute {
- public String[] getValues() {
- return new String[]{"start", "mid", "end"};
- }
- }
- private String ifCond;
- private int location;
- private String unlessCond;
- private String value;
- private File file;
- public CommandLineArgument() {
- }
- public int getLocation() {
- return location;
- }
- public String getValue() {
- return value;
- }
- public File getFile() {
- return file;
- }
- /**
- * Returns true if the define's if and unless conditions (if any) are
- * satisfied.
- */
- public boolean isActive(org.apache.tools.ant.Project p) {
- if (value == null) {
- return false;
- }
- if (ifCond != null && p.getProperty(ifCond) == null) {
- return false;
- } else if (unlessCond != null && p.getProperty(unlessCond) != null) {
- return false;
- }
- return true;
- }
- /**
- * Sets the property name for the 'if' condition.
- *
- * The argument will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- */
- public void setIf(String propName) {
- ifCond = propName;
- }
- /**
- * Specifies relative location of argument on command line. "start" will
- * place argument at start of command line, "mid" will place argument after
- * all "start" arguments but before filenames, "end" will place argument
- * after filenames.
- *
- */
- public void setLocation(LocationEnum location) {
- this.location = location.getIndex();
- }
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the argument will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public void setUnless(String propName) {
- unlessCond = propName;
- }
- /**
- * Specifies the string that should appear on the command line. The
- * argument will be quoted if it contains embedded blanks. Use multiple
- * arguments to avoid quoting.
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
- /**
- * Specifies the file which lists many strings that should appear on
- * the command line. Each line is one argument. The argument will be
- * quated if it contains embedded blanks. Use multiple arguments in
- * file to avoid quating.
- *
- * @param file
- * name of the file
- */
- public void setFile(File file) {
- this.file = file;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/CompilerArgument.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/CompilerArgument.java
deleted file mode 100644
index ca9e90e732..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/CompilerArgument.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-/**
- * A compiler command line argument.
- */
-public class CompilerArgument extends CommandLineArgument {
- public CompilerArgument() {
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalFileSet.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalFileSet.java
deleted file mode 100644
index af2d141e99..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalFileSet.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import net.sf.antcontrib.cpptasks.CUtil;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.AbstractFileSet;
-import org.apache.tools.ant.types.FileSet;
-/**
- * An Ant FileSet object augmented with if and unless conditions.
- *
- * @author Curt Arnold
- */
-public class ConditionalFileSet extends FileSet {
- private String ifCond;
- private String unlessCond;
- public ConditionalFileSet() {
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
- /**
- * overrides FileSet's implementation which would throw an exception since
- * the referenced object isn't this type.
- */
- protected AbstractFileSet getRef(Project p) {
- return (AbstractFileSet) getRefid().getReferencedObject(p);
- }
- /**
- * Returns true if the Path's if and unless conditions (if any) are
- * satisfied.
- */
- public boolean isActive() throws BuildException {
- Project p = getProject();
- if (p == null) {
- throw new java.lang.IllegalStateException(
- "setProject() should have been called");
- }
- return CUtil.isActive(p, ifCond, unlessCond);
- }
- /**
- * Sets the property name for the 'if' condition.
- *
- * The fileset will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- */
- public void setIf(String propName) {
- ifCond = propName;
- }
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the fileset will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public void setUnless(String propName) {
- unlessCond = propName;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalPath.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalPath.java
deleted file mode 100644
index dc21189c15..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalPath.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Path;
-/**
- * An Ant Path object augmented with if and unless conditionals
- *
- * @author Curt Arnold
- */
-public class ConditionalPath extends Path {
- private String ifCond;
- private String unlessCond;
- private File file;
- public ConditionalPath(Project project) {
- super(project);
- }
- public ConditionalPath(Project p, String path) {
- super(p, path);
- }
- public File getFile() {
- return file;
- }
- /**
- * Returns true if the Path's if and unless conditions (if any) are
- * satisfied.
- */
- public boolean isActive(org.apache.tools.ant.Project p)
- throws BuildException {
- return CUtil.isActive(p, ifCond, unlessCond);
- }
- /**
- * Sets the property name for the 'if' condition.
- *
- * The path will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- *
- * @param propName
- * property name
- */
- public void setIf(String propName) {
- ifCond = propName;
- }
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the path will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public void setUnless(String propName) {
- unlessCond = propName;
- }
- /**
- * Specifies the file which lists many include paths that should appear on
- * the command line. Each line is an include path. The includepath will be
- * quated if it contains embedded blanks.
- *
- * @param file
- * name of the file
- */
- public void setFile(File file) {
- this.file = file;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/DefineArgument.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/DefineArgument.java
deleted file mode 100644
index 824e939481..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/DefineArgument.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-/**
- * Preprocessor macro definition.
- *
- * @author Mark A Russell <a
- * href="mailto:mark_russell@csgsystems.com">mark_russell@csg_systems.com
- * </a>
- */
-public class DefineArgument extends UndefineArgument {
- private String value;
- public DefineArgument() {
- super(true);
- }
- /** Returns the value of the define */
- public final String getValue() {
- return value;
- }
- /** Set the value attribute */
- public final void setValue(String value) {
- this.value = value;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/DefineSet.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/DefineSet.java
deleted file mode 100644
index 9d229fb0ff..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/DefineSet.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.Reference;
-/**
- * Set of preprocessor macro defines and undefines.
- *
- * @author Mark A Russell <a
- * href="mailto:mark_russell@csgsystems.com">mark_russell@csg_systems.com
- * </a>
- * @author Adam Murdoch
- */
-public class DefineSet extends DataType {
- private Vector defineList = new Vector();
- private String ifCond = null;
- private String unlessCond = null;
- /**
- *
- * Adds a define element.
- *
- * @throws BuildException
- * if reference
- */
- public void addDefine(DefineArgument arg) throws BuildException {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- defineList.addElement(arg);
- }
- /** Adds defines/undefines. */
- private void addDefines(String[] defs, boolean isDefine) {
- for (int i = 0; i < defs.length; i++) {
- UndefineArgument def;
- if (isDefine) {
- def = new DefineArgument();
- } else {
- def = new UndefineArgument();
- }
- def.setName(defs[i]);
- defineList.addElement(def);
- }
- }
- /**
- *
- * Adds an undefine element.
- *
- * @throws BuildException
- * if reference
- */
- public void addUndefine(UndefineArgument arg) throws BuildException {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- defineList.addElement(arg);
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
- /** Returns the defines and undefines in this set. */
- public UndefineArgument[] getDefines() throws BuildException {
- if (isReference()) {
- DefineSet defset = (DefineSet) getCheckedRef(DefineSet.class,
- "DefineSet");
- return defset.getDefines();
- } else {
- if (isActive()) {
- UndefineArgument[] defs = new UndefineArgument[defineList
- .size()];
- defineList.copyInto(defs);
- return defs;
- } else {
- return new UndefineArgument[0];
- }
- }
- }
- /**
- * Returns true if the define's if and unless conditions (if any) are
- * satisfied.
- *
- * @exception BuildException
- * throws build exception if name is not set
- */
- public final boolean isActive() throws BuildException {
- return CUtil.isActive(getProject(), ifCond, unlessCond);
- }
- /**
- * A comma-separated list of preprocessor macros to define. Use nested
- * define elements to define macro values.
- *
- * @param defList
- * comma-separated list of preprocessor macros
- * @throws BuildException
- * throw if defineset is a reference
- */
- public void setDefine(CUtil.StringArrayBuilder defList)
- throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- addDefines(defList.getValue(), true);
- }
- /**
- * Sets a description of the current data type.
- */
- public void setDescription(String desc) {
- super.setDescription(desc);
- }
- /**
- * Sets an id that can be used to reference this element.
- *
- * @param id
- * id
- */
- public void setId(String id) {
- //
- // this is actually accomplished by a different
- // mechanism, but we can document it
- //
- }
- /**
- * Sets the property name for the 'if' condition.
- *
- * The define will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- *
- * @param propName
- * property name
- */
- public final void setIf(String propName) {
- ifCond = propName;
- }
- /**
- * Specifies that this element should behave as if the content of the
- * element with the matching id attribute was inserted at this location. If
- * specified, no other attributes or child content should be specified,
- * other than "description".
- *
- */
- public void setRefid(Reference r) throws BuildException {
- if (!defineList.isEmpty()) {
- throw tooManyAttributes();
- }
- super.setRefid(r);
- }
- /**
- * A comma-separated list of preprocessor macros to undefine.
- *
- * @param undefList
- * comma-separated list of preprocessor macros
- * @throws BuildException
- * throw if defineset is a reference
- */
- public void setUndefine(CUtil.StringArrayBuilder undefList)
- throws BuildException {
- if (isReference()) {
- throw tooManyAttributes();
- }
- addDefines(undefList.getValue(), false);
- }
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the define will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public final void setUnless(String propName) {
- unlessCond = propName;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/FlexLong.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/FlexLong.java
deleted file mode 100644
index d95959f631..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/FlexLong.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import java.lang.reflect.Method;
-
-/**
- * Helper class which can be used for Ant task attribute setter methods to
- * allow the build file to specify a long in either decimal, octal, or
- * hexadecimal format.
- * // FlexInteger author
- * @author Erik Hatcher
- * @see org.apache.tools.ant.types.FlexInteger
- */
-public class FlexLong {
- private Long value;
- /**
- * Constructor used by Ant's introspection mechanism for attribute
- * population
- */
- public FlexLong(String value) {
- // Java 1.1 did not support Long.decode().. so we call it by
- // reflection.
- try {
- Method m = Long.class
- .getMethod("decode", new Class[]{String.class});
- Object rc = m.invoke(null, new Object[]{value});
- this.value = (Long) rc;
- } catch (Exception e) {
- // Try it the old fashioned way, we must be on a 1.1 jre
- this.value = new Long(value);
- }
- }
- /**
- * Returns the decimal integer value
- */
- public long longValue() {
- return value.longValue();
- }
- /**
- * Overridden method to return the decimal value for display
- */
- public String toString() {
- return value.toString();
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/IncludePath.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/IncludePath.java
deleted file mode 100644
index edcc42103c..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/IncludePath.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import org.apache.tools.ant.Project;
-/**
- * An include path.
- *
- * Works like other paths in Ant with with the addition of "if" and "unless"
- * conditions.
- *
- * @author Curt Arnold
- */
-public class IncludePath extends ConditionalPath {
- public IncludePath(Project project) {
- super(project);
- }
- public IncludePath(Project p, String path) {
- super(p, path);
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LibrarySet.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LibrarySet.java
deleted file mode 100644
index d522ccc36f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LibrarySet.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import java.io.File;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.FileVisitor;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectComponent;
-import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.types.PatternSet;
-/**
- * A set of library names. Libraries can also be added to a link by specifying
- * them in a fileset.
- *
- * For most Unix-like compilers, libset will result in a series of -l and -L
- * linker arguments. For Windows compilers, the library names will be used to
- * locate the appropriate library files which will be added to the linkers
- * input file list as if they had been specified in a fileset.
- *
- * @author Mark A Russell <a
- * href="mailto:mark_russell@csgsystems.com">mark_russell@csg_systems.com
- * </a>
- * @author Adam Murdoch
- * @author Curt Arnold
- */
-public class LibrarySet extends ProjectComponent {
- private String dataset;
- private boolean explicitCaseSensitive;
- private String ifCond;
- private String[] libnames;
- private final FileSet set = new FileSet();
- private String unlessCond;
- private LibraryTypeEnum libraryType;
- public LibrarySet() {
- libnames = new String[0];
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
- /**
- * Gets the dataset. Used on OS390 if the libs are in a dataset.
- *
- * @return Returns a String
- */
- public String getDataset() {
- return dataset;
- }
- public File getDir(Project project) {
- return set.getDir(project);
- }
- protected FileSet getFileSet() {
- return set;
- }
- public String[] getLibs() {
- String[] retval = (String[]) libnames.clone();
- return retval;
- }
-
- /**
- * Gets preferred library type
- *
- * @return library type, may be null.
- */
- public LibraryTypeEnum getType() {
- return libraryType;
- }
- /**
- * Returns true if the define's if and unless conditions (if any) are
- * satisfied.
- */
- public boolean isActive(org.apache.tools.ant.Project p) {
- if (p == null) {
- throw new NullPointerException("p");
- }
- if (ifCond != null) {
- String ifValue = p.getProperty(ifCond);
- if (ifValue != null) {
- if (ifValue.equals("no") || ifValue.equals("false")) {
- throw new BuildException(
- "property "
- + ifCond
- + " used as if condition has value "
- + ifValue
- + " which suggests a misunderstanding of if attributes");
- }
- } else {
- return false;
- }
- }
- if (unlessCond != null) {
- String unlessValue = p.getProperty(unlessCond);
- if (unlessValue != null) {
- if (unlessValue.equals("no") || unlessValue.equals("false")) {
- throw new BuildException(
- "property "
- + unlessCond
- + " used as unless condition has value "
- + unlessValue
- + " which suggests a misunderstanding of unless attributes");
- }
- return false;
- }
- }
- if (libnames.length == 0) {
- p.log("libnames not specified or empty.", Project.MSG_WARN);
- return false;
- }
- return true;
- }
- /**
- * Sets case sensitivity of the file system. If not set, will default to
- * the linker's case sensitivity.
- *
- * @param isCaseSensitive
- * "true"|"on"|"yes" if file system is case sensitive,
- * "false"|"off"|"no" when not.
- */
- public void setCaseSensitive(boolean isCaseSensitive) {
- explicitCaseSensitive = true;
- set.setCaseSensitive(isCaseSensitive);
- }
- /**
- * Sets the dataset. Used on OS390 if the libs are in a dataset.
- *
- * @param dataset
- * The dataset to set
- */
- public void setDataset(String dataset) {
- this.dataset = dataset;
- }
- /**
- * Library directory.
- *
- * @param dir
- * library directory
- *
- */
- public void setDir(File dir) throws BuildException {
- set.setDir(dir);
- }
- /**
- * Sets the property name for the 'if' condition.
- *
- * The library set will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- *
- * @param propName
- * property name
- */
- public void setIf(String propName) {
- ifCond = propName;
- }
- /**
- * Comma-separated list of library names without leading prefixes, such as
- * "lib", or extensions, such as ".so" or ".a".
- *
- */
- public void setLibs(CUtil.StringArrayBuilder libs) throws BuildException {
- libnames = libs.getValue();
- // If this is not active.. then it's ok if the lib names are invalid.
- // so we can do a: <libset if="x.lib" dir="." libs="${x.lib}"/>
- if (!isActive(getProject()))
- return;
- for (int i = 0; i < libnames.length; i++) {
- int lastDot = libnames[i].lastIndexOf('.');
- if (lastDot >= 0) {
- String extension = libnames[i].substring(lastDot);
- if (extension.equalsIgnoreCase(".lib")
- || extension.equalsIgnoreCase(".so")
- || extension.equalsIgnoreCase(".a")) {
- getProject().log(
- "Suspicious library name ending with \""
- + extension + "\": " + libnames[i], Project.MSG_DEBUG );
- }
- }
- if (libnames[i].length() >= 3
- && libnames[i].substring(0, 3).equalsIgnoreCase("lib")) {
- getProject().log(
- "Suspicious library name starting with \"lib\": "
- + libnames[i], Project.MSG_DEBUG);
- }
- }
- }
- public void setProject(Project project) {
- set.setProject(project);
- super.setProject(project);
- }
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the library set will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public void setUnless(String propName) {
- unlessCond = propName;
- }
-
- /**
- * Sets the preferred library type. Supported values "shared", "static", and
- * "framework". "framework" is equivalent to "shared" on non-Darwin platforms.
- */
- public void setType(LibraryTypeEnum type) {
- this.libraryType = type;
- }
-
- public void visitLibraries(Project project, Linker linker, File[] libpath,
- FileVisitor visitor) throws BuildException {
- FileSet localSet = (FileSet) set.clone();
- //
- // unless explicitly set
- // will default to the linker case sensitivity
- //
- if (!explicitCaseSensitive) {
- boolean linkerCaseSensitive = linker.isCaseSensitive();
- localSet.setCaseSensitive(linkerCaseSensitive);
- }
- //
- // if there was a libs attribute then
- // add the corresponding patterns to the FileSet
- //
- if (libnames != null && libnames.length > 0) {
- String[] patterns = linker.getLibraryPatterns(libnames, libraryType);
- //
- // if no patterns, then linker does not support libraries
- //
- if (patterns.length > 0) {
- for (int i = 0; i < patterns.length; i++) {
- PatternSet.NameEntry entry = localSet.createInclude();
- entry.setName(patterns[i]);
- }
- //
- // if there was no specified directory then
- // run through the libpath backwards
- //
- if (localSet.getDir(project) == null) {
- //
- // scan libpath in reverse order
- // to give earlier entries priority
- //
- for (int j = libpath.length - 1; j >= 0; j--) {
- FileSet clone = (FileSet) localSet.clone();
- clone.setDir(libpath[j]);
- DirectoryScanner scanner = clone.getDirectoryScanner(project);
- File basedir = scanner.getBasedir();
- String[] files = scanner.getIncludedFiles();
- for (int k = 0; k < files.length; k++) {
- visitor.visit(basedir, files[k]);
- }
- }
- } else {
- DirectoryScanner scanner = localSet.getDirectoryScanner(project);
- File basedir = scanner.getBasedir();
- String[] files = scanner.getIncludedFiles();
- for (int k = 0; k < files.length; k++) {
- visitor.visit(basedir, files[k]);
- }
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LibraryTypeEnum.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LibraryTypeEnum.java
deleted file mode 100644
index 82d7947bf2..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LibraryTypeEnum.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import org.apache.tools.ant.types.EnumeratedAttribute;
-/**
- * Enumeration of library types for LibrarySet
- *
- * @author Curt Arnold
- *
- */
-public class LibraryTypeEnum extends EnumeratedAttribute {
- /**
- * Constructor
- *
- * Set by default to "shared"
- *
- * @see java.lang.Object#Object()
- */
- public LibraryTypeEnum() {
- setValue("shared");
- }
- /**
- * Gets list of acceptable values
- *
- * @see org.apache.tools.ant.types.EnumeratedAttribute#getValues()
- */
- public String[] getValues() {
- return new String[]{"shared", // prefer shared libraries
- "static", // prefer static libraries
- "framework" // framework libraries (Mac OS/X)
- // equiv to shared on other platforms
- };
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LinkerArgument.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LinkerArgument.java
deleted file mode 100644
index 89bff1881b..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/LinkerArgument.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-/**
- * A linker command line argument.
- */
-public class LinkerArgument extends CommandLineArgument {
- public LinkerArgument() {
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/SystemIncludePath.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/SystemIncludePath.java
deleted file mode 100644
index be0dbd537a..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/SystemIncludePath.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import org.apache.tools.ant.Project;
-/**
- * A system include path.
- *
- * Files located using a system include path will not participate in dependency
- * analysis.
- *
- * Standard include paths for a compiler should not be specified since these
- * should be determined from environment variables or configuration files by
- * the compiler adapter.
- *
- * Works like other paths in Ant with with the addition of "if" and "unless"
- * conditions.
- *
- * @author Curt Arnold
- */
-public class SystemIncludePath extends ConditionalPath {
- public SystemIncludePath(Project project) {
- super(project);
- }
- public SystemIncludePath(Project p, String path) {
- super(p, path);
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/SystemLibrarySet.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/SystemLibrarySet.java
deleted file mode 100644
index 02d08c8ac8..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/SystemLibrarySet.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-/**
- * A set of system library names. Timestamp or location of system libraries are
- * not considered in dependency analysis.
- *
- * Libraries can also be added to a link by specifying them in a fileset.
- *
- * For most Unix-like compilers, syslibset will result in a series of -l and -L
- * linker arguments. For Windows compilers, the library names will be used to
- * locate the appropriate library files which will be added to the linkers
- * input file list as if they had been specified in a fileset.
- */
-public class SystemLibrarySet extends LibrarySet {
- public SystemLibrarySet() {
- super();
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/UndefineArgument.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/UndefineArgument.java
deleted file mode 100644
index 2a18fca6d1..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/UndefineArgument.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CUtil;
-
-import org.apache.tools.ant.BuildException;
-/**
- * Preprocessor macro undefinition.
- *
- * @author Mark A Russell <a
- * href="mailto:mark_russell@csgsystems.com">mark_russell@csg_systems.com
- * </a>
- */
-public class UndefineArgument {
- /**
- * This method returns an array of UndefineArgument and DefineArgument's by
- * merging a base list with an override list.
- *
- * Any define in the base list with a name that appears in the override
- * list is suppressed. All entries in the override list are preserved
- *
- */
- public static UndefineArgument[] merge(UndefineArgument[] base,
- UndefineArgument[] override) {
- if (base.length == 0) {
- UndefineArgument[] overrideClone = (UndefineArgument[]) override
- .clone();
- return overrideClone;
- }
- if (override.length == 0) {
- UndefineArgument[] baseClone = (UndefineArgument[]) base.clone();
- return baseClone;
- }
- Vector unduplicated = new Vector(base.length);
- for (int i = 0; i < base.length; i++) {
- UndefineArgument current = base[i];
- String currentName = current.getName();
- boolean match = false;
- if (currentName == null) {
- match = true;
- } else {
- for (int j = 0; j < override.length; j++) {
- UndefineArgument over = override[j];
- String overName = over.getName();
- if (overName != null && overName.equals(currentName)) {
- match = true;
- break;
- }
- }
- }
- if (!match) {
- unduplicated.addElement(current);
- }
- }
- UndefineArgument[] combined = new UndefineArgument[unduplicated.size()
- + override.length];
- unduplicated.copyInto(combined);
- int offset = unduplicated.size();
- for (int i = 0; i < override.length; i++) {
- combined[offset + i] = override[i];
- }
- return combined;
- }
- private boolean define = false;
- private String ifCond;
- private String name;
- private String unlessCond;
- public UndefineArgument() {
- }
- protected UndefineArgument(boolean isDefine) {
- this.define = isDefine;
- }
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
- /** Returns the name of the define */
- public final String getName() {
- return name;
- }
- /** Returns the value of the define */
- public String getValue() {
- return null;
- }
- /**
- * Returns true if the define's if and unless conditions (if any) are
- * satisfied.
- *
- * @exception BuildException
- * throws build exception if name is not set
- */
- public final boolean isActive(org.apache.tools.ant.Project p)
- throws BuildException {
- if (name == null) {
- throw new BuildException("<define> is missing name attribute");
- }
- return CUtil.isActive(p, ifCond, unlessCond);
- }
- /** Returns true if this is a define, false if an undefine. */
- public final boolean isDefine() {
- return define;
- }
- /**
- * Sets the property name for the 'if' condition.
- *
- * The define will be ignored unless the property is defined.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") will throw an exception when
- * evaluated.
- *
- * @param propName
- * property name
- */
- public final void setIf(String propName) {
- ifCond = propName;
- }
- /** Set the name attribute */
- public final void setName(String name) {
- this.name = name;
- }
- /**
- * Set the property name for the 'unless' condition.
- *
- * If named property is set, the define will be ignored.
- *
- * The value of the property is insignificant, but values that would imply
- * misinterpretation ("false", "no") of the behavior will throw an
- * exception when evaluated.
- *
- * @param propName
- * name of property
- */
- public final void setUnless(String propName) {
- unlessCond = propName;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java
deleted file mode 100644
index 3ed6c9652f..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.userdefine;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.types.CommandLineArgument;
-import net.sf.antcontrib.cpptasks.types.ConditionalFileSet;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Environment;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.Environment.Variable;
-
-/**
- *
- */
-public class CommandLineUserDefine {
-
- String includePathDelimiter = null;
-
- String outputDelimiter = null;
-
- public void command(CCTask cctask, UserDefineDef userdefine) {
- boolean isGccCommand = userdefine.getFamily().equalsIgnoreCase("GCC");
- File workdir;
- Project project = cctask.getProject();
- if (userdefine.getWorkdir() == null) {
- workdir = new File(".");
- } else {
- workdir = userdefine.getWorkdir();
- }
-
- //
- // generate cmdline= command + args + includepath + endargs + outfile
- //
- Vector args = new Vector();
- Vector argsWithoutSpace = new Vector();
- Vector endargs = new Vector();
- Vector endargsWithoutSpace = new Vector();
- Vector includePath = new Vector();
-
- //
- // get Args.
- //
- CommandLineArgument[] argument = userdefine.getActiveProcessorArgs();
- for (int j = 0; j < argument.length; j++) {
- if (argument[j].getLocation() == 0) {
- args.addElement(argument[j].getValue());
- } else {
- endargs.addElement(argument[j].getValue());
- }
- }
-
- //
- // get include path.
- //
- String[] incPath = userdefine.getActiveIncludePaths();
- for (int j = 0; j < incPath.length; j++) {
- includePath.addElement(includePathDelimiter + incPath[j]);
- }
-
- //
- // Remove space in args and endargs.
- //
- for (int i = 0; i < args.size(); i++) {
- String str = (String) args.get(i);
- StringTokenizer st = new StringTokenizer(str, " \t");
- while (st.hasMoreTokens()) {
- argsWithoutSpace.addElement(st.nextToken());
- }
- }
- for (int i = 0; i < endargs.size(); i++) {
- String str = (String) endargs.get(i);
- StringTokenizer st = new StringTokenizer(str, " \t");
- while (st.hasMoreTokens()) {
- endargsWithoutSpace.addElement(st.nextToken());
- }
- }
-
- int cmdLen = 0;
- //
- // command + args + endargs + includepath + sourcefile
- //
- cmdLen = 1 + argsWithoutSpace.size() + endargsWithoutSpace.size()
- + includePath.size() + 1;
- String[] libSet = userdefine.getLibset();
- if (libSet != null && libSet.length > 0) {
- cmdLen = cmdLen + libSet.length;
- if (isGccCommand) {
- cmdLen += 2; // we need -( and -) to group libs for GCC
- }
- }
-
- //
- // In gcc the "cr" flag should follow space then add outputfile name,
- // otherwise
- // it will pop error.
- // TBD
- if (outputDelimiter != null && userdefine.getOutputFile() != null
- && outputDelimiter.trim().length() > 0) {
- if (outputDelimiter.trim().equalsIgnoreCase("-cr")) {
- cmdLen = cmdLen + 2;
- } else {
- cmdLen++;
- }
- }
-
- //
- // for every source file
- // if file is header file, just skip it (add later)
- //
- Vector srcSets = userdefine.getSrcSets();
-
- //
- // if have source file append source file in command line.
- //
- Set allSrcFiles = new LinkedHashSet();
-
- for (int i = 0; i < srcSets.size(); i++) {
- ConditionalFileSet srcSet = (ConditionalFileSet) srcSets
- .elementAt(i);
- if (srcSet.isActive()) {
- //
- // Find matching source files
- //
- DirectoryScanner scanner = srcSet.getDirectoryScanner(project);
- //
- // Check each source file - see if it needs compilation
- //
- String[] fileNames = scanner.getIncludedFiles();
- for (int j = 0; j < fileNames.length; j++) {
- allSrcFiles.add(scanner.getBasedir() + "/" + fileNames[j]);
- if (isGccCommand) {
- System.out.println("[" + userdefine.getType() + "] "
- + fileNames[j]);
- }
- }
- }
- }
-
- String[] fileNames = (String[]) allSrcFiles
- .toArray(new String[allSrcFiles.size()]);
- String[] cmd = new String[cmdLen - 1 + fileNames.length];
- int index = 0;
- cmd[index++] = userdefine.getCmd();
-
- Iterator iter = argsWithoutSpace.iterator();
- while (iter.hasNext()) {
- cmd[index++] = project.replaceProperties((String) iter.next());
- }
-
- iter = endargsWithoutSpace.iterator();
- while (iter.hasNext()) {
- cmd[index++] = project.replaceProperties((String) iter.next());
- }
-
- //
- // Add outputFileFlag and output file to cmd
- //
- if (outputDelimiter != null && userdefine.getOutputFile() != null
- && outputDelimiter.length() > 0) {
- if (outputDelimiter.trim().equalsIgnoreCase("-cr")) {
- cmd[index++] = outputDelimiter;
- cmd[index++] = userdefine.getOutputFile();
- } else {
- cmd[index++] = outputDelimiter + userdefine.getOutputFile();
- }
- }
-
- iter = includePath.iterator();
- while (iter.hasNext()) {
- cmd[index++] = (String) iter.next();
- }
-
- if (libSet != null && libSet.length > 0) {
- if (isGccCommand) {
- cmd[index++] = "-(";
- }
- for (int k = 0; k < libSet.length; k++) {
- cmd[index++] = libSet[k];
- }
- if (isGccCommand) {
- cmd[index++] = "-)";
- }
- }
- for (int j = 0; j < fileNames.length; j++) {
- cmd[index++] = fileNames[j];
- }
-
-// StringBuffer logLine = new StringBuffer();
-// for(int i = 0; i < cmd.length; i++) {
-// logLine.append(cmd[i] + " ");
-// }
-// project.log(logLine.toString(), Project.MSG_VERBOSE);
-
- Environment newEnv = new Environment();
-
- //
- // Prepare for environment variable PATH
- //
- if (userdefine.getDpath() != null && userdefine.getDpath().trim().length() != 0) {
- String pathName = getPathName("PATH");
- String existPath = System.getenv(pathName);
-
- Variable var = new Variable();
- var.setKey(pathName);
- var.setPath(new Path(project, userdefine.getDpath() + ";" + existPath));
- newEnv.addVariable(var);
- }
-
- //
- // Prepare for environment variable LIB
- //
- if (userdefine.getLibpath() != null && userdefine.getLibpath().trim().length() != 0) {
- String pathName = getPathName("LIB");
- String existPath = System.getenv(pathName);
- Variable var = new Variable();
- var.setKey(pathName);
- if (existPath == null) {
- var.setPath(new Path(project, userdefine.getLibpath()));
- } else {
- var.setPath(new Path(project, userdefine.getLibpath() + ";" + existPath));
- }
- newEnv.addVariable(var);
- }
-
- //
- // Prepare for environment variable INCLUDE
- //
- if (userdefine.getInclude() != null && userdefine.getInclude().trim().length() != 0) {
- String pathName = getPathName("INCLUDE");
- String existPath = System.getenv(pathName);
- Variable var = new Variable();
- var.setKey(pathName);
- if (existPath == null) {
- var.setPath(new Path(project, userdefine.getInclude()));
- } else {
- var.setPath(new Path(project, userdefine.getInclude() + ";" + existPath));
- }
- newEnv.addVariable(var);
- }
-
- int retval = runCommand(cctask, workdir, cmd, newEnv);
-
- if (retval != 0) {
- throw new BuildException(userdefine.getCmd()
- + " failed with return code " + retval, cctask
- .getLocation());
- }
- }
-
- private String getPathName(String variableName) {
- Map allEnv = System.getenv();
- Iterator iter = allEnv.keySet().iterator();
- while (iter.hasNext()) {
- String key = (String)iter.next();
- if(key.equalsIgnoreCase(variableName)) {
- return key;
- }
- }
- return variableName;
- }
-
- protected int runCommand(CCTask task, File workingDir, String[] cmdline, Environment env)
- throws BuildException {
- //
- // Write command to File
- //
- return CUtil.runCommand(task, workingDir, cmdline, false, env);
-
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineArgument.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineArgument.java
deleted file mode 100644
index 96d274ad9a..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineArgument.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Copyright 2002-2006 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.userdefine;
-
-import net.sf.antcontrib.cpptasks.types.CommandLineArgument;
-
-/**
- * Collect Arguments.
- *
- */
-public class UserDefineArgument extends CommandLineArgument {
-
- public UserDefineArgument() {
- }
-
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineCompiler.java
deleted file mode 100644
index 47431e84a0..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineCompiler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * Copyright 2002-2006 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.userdefine;
-
-import net.sf.antcontrib.cpptasks.CCTask;
-
-/**
- * Adapter for the User-Defined Compiler
- */
-public class UserDefineCompiler extends CommandLineUserDefine {
-
- public UserDefineCompiler (CCTask cctask, UserDefineDef userdefineDef) {
- String cmdType = userdefineDef.getType();
- String toolchainFamily = userdefineDef.getFamily();
-
- if (userdefineDef.getIncludePathDelimiter() == null) {
- includePathDelimiter = UserDefineMapping.getIncludePathDelimiter(
- toolchainFamily, cmdType);
- } else {
- includePathDelimiter = userdefineDef.getIncludePathDelimiter();
- }
-
- if (userdefineDef.getOutputDelimiter() == null) {
- outputDelimiter = UserDefineMapping.getOutputFileFlag(
- toolchainFamily, cmdType);
- } else {
- outputDelimiter = userdefineDef.getOutputDelimiter();
- }
-
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java
deleted file mode 100644
index c19c98636e..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- *
- * Copyright 2002-2006 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.userdefine;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-
-import net.sf.antcontrib.cpptasks.ProcessorDef;
-import net.sf.antcontrib.cpptasks.types.ConditionalPath;
-import net.sf.antcontrib.cpptasks.types.IncludePath;
-import net.sf.antcontrib.cpptasks.types.LibrarySet;
-
-/**
- * A userdefinedef definition. userdefine elements may be placed either as
- * children of a cc element or the project element. A userdefine element with an
- * id attribute may be referenced by userdefine elements with refid or extends
- * attributes.
- *
- */
-public class UserDefineDef extends ProcessorDef {
-
- public UserDefineDef () {
- }
-
- private String type = "CC";
-
- private String family = "MSFT";
-
- private String cmd;
-
- private String includePathDelimiter;
-
- private String outputDelimiter;
-
- private File workdir;
-
- private Vector includePaths = new Vector();
-
- private String outputFile;
-
- private Vector allLibraries = new Vector();
-
- private String dpath = null;
-
- private String libpath = null;
-
- private String include = null;
-
- public void addLibset(LibrarySet libset) {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- if (libset == null) {
- throw new NullPointerException("libset");
- }
-
- allLibraries.add(libset);
- }
-
- public void execute() throws org.apache.tools.ant.BuildException {
- throw new org.apache.tools.ant.BuildException(
- "Not an actual task, but looks like one for documentation purposes");
- }
-
- public void addConfiguredArgument(UserDefineArgument arg) {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- addConfiguredProcessorArg(arg);
- }
-
- /**
- * Creates an include path.
- */
- public IncludePath createIncludePath() {
- Project p = getProject();
- if (isReference()) {
- throw noChildrenAllowed();
- }
- IncludePath path = new IncludePath(p);
- includePaths.addElement(path);
- return path;
- }
-
- /**
- * Add a <includepath> if specify the file attribute
- *
- * @param activePath
- * Active Path Vector
- * @param file
- * File with multiple path
- * @throws BuildException
- * if the specify file not exist
- */
- protected void loadFile(Vector activePath, File file) throws BuildException {
- FileReader fileReader;
- BufferedReader in;
- String str;
- if (!file.exists()) {
- throw new BuildException("The file " + file + " is not existed");
- }
- try {
- fileReader = new FileReader(file);
- in = new BufferedReader(fileReader);
- while ((str = in.readLine()) != null) {
- if (str.trim().endsWith("")) {
- continue;
- }
- str = getProject().replaceProperties(str);
- activePath.addElement(str.trim());
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- * Returns the specific include path.
- *
- * @return All active include paths
- */
- public String[] getActiveIncludePaths() {
- if (isReference()) {
- return ((UserDefineDef) getCheckedRef(UserDefineDef.class,
- "UserDefineDef")).getActiveIncludePaths();
- }
- return getActivePaths(includePaths);
- }
-
- private String[] getActivePaths(Vector paths) {
- Project p = getProject();
- Vector activePaths = new Vector(paths.size());
- int length = paths.size();
- for (int i = 0; i < length; i++) {
- ConditionalPath path = (ConditionalPath) paths.elementAt(i);
- if (path.isActive(p)) {
- if (path.getFile() == null) {
- String[] pathEntries = path.list();
- for (int j = 0; j < pathEntries.length; j++) {
- activePaths.addElement(pathEntries[j]);
- }
- } else {
- loadFile(activePaths, path.getFile());
- }
- }
- }
- String[] pathNames = new String[activePaths.size()];
- activePaths.copyInto(pathNames);
- return pathNames;
- }
-
- /**
- * Get include path delimiter.
- *
- * @return Include Path Delimiter
- */
- public String getIncludePathDelimiter() {
- if (isReference()) {
- return ((UserDefineDef) getCheckedRef(UserDefineDef.class,
- "UserDefineDef")).getIncludePathDelimiter();
- }
- return includePathDelimiter;
- }
-
- /**
- * Set include path delimiter.
- *
- * @param includePathDelimiter
- * include path delimiter
- */
- public void setIncludePathDelimiter(String includePathDelimiter) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.includePathDelimiter = includePathDelimiter;
- }
-
- /**
- * Get type.
- *
- * @return type
- */
- public String getType() {
- if (isReference()) {
- return ((UserDefineDef) getCheckedRef(UserDefineDef.class,
- "UserDefineDef")).getType();
- }
- return type;
- }
-
- /**
- * Set type.
- *
- * @param type
- * Type
- */
- public void setType(String type) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.type = type;
- }
-
- public String getCmd() {
- return cmd;
- }
-
- public void setCmd(String cmd) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- if (cmd == null || cmd.trim().length() == 0) {
- throw new BuildException("cmd attribute is empty!");
- }
- File cmdProgram = new File(cmd);
- if (cmdProgram.isDirectory()) {
- throw new BuildException(cmd + " is not valid or executable!");
- }
- this.cmd = cmd;
- }
-
- public String getFamily() {
- return family;
- }
-
- public void setFamily(String family) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.family = family;
- }
-
- public String getOutputFile() {
- return outputFile;
- }
-
- public void setOutputFile(String outputFile) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.outputFile = outputFile;
- }
-
- public File getWorkdir() {
- return workdir;
- }
-
- public void setWorkdir(File workdir) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.workdir = workdir;
- }
-
- public String[] getLibset() {
- Set libs = new LinkedHashSet();
- Iterator iter = allLibraries.iterator();
- while (iter.hasNext()) {
- LibrarySet librarySet = (LibrarySet) iter.next();
- File basedir = librarySet.getDir(getProject());
- String[] libStrArray = librarySet.getLibs();
- for (int i = 0; i < libStrArray.length; i++) {
- if (basedir != null) {
- File libFile = new File(libStrArray[i]);
- if (libFile.isAbsolute()) {
- libs.add(libFile.getPath());
- } else {
- libs.add(basedir.getPath() + File.separatorChar
- + libFile.getPath());
- }
- } else {
- libs.add(libStrArray[i]);
- }
- }
- }
- return (String[]) libs.toArray(new String[libs.size()]);
- }
-
- public String getOutputDelimiter() {
- return outputDelimiter;
- }
-
- public void setOutputDelimiter(String outputDelimiter) {
- this.outputDelimiter = outputDelimiter;
- }
-
- public String getDpath() {
- return dpath;
- }
-
- public void setDpath(String dpath) {
- this.dpath = dpath;
- }
-
- public String getLibpath() {
- return libpath;
- }
-
- public void setLibpath(String libpath) {
- this.libpath = libpath;
- }
-
- public String getInclude() {
- return include;
- }
-
- public void setInclude(String include) {
- this.include = include;
- }
-
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineMapping.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineMapping.java
deleted file mode 100644
index 491cadd7f5..0000000000
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineMapping.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.userdefine;
-
-/**
- * Relationship between {family, command type} and flags
- *
- */
-public class UserDefineMapping {
-
- /**
- * Mapping info: include path delimiter <--> family (vendor) + command type
- */
- public static final String[][] includePathFlag = { { "MSFT_CC", "/I" },
- { "GCC_CC", "-I" }, { "INTEL_CC", "/I" },
- { "WINDDK_CC", "/I" }, { "MSFT_ASM", "/I" },
- { "GCC_ASM", "-I" }, { "WINDDK_CC", "/I" },
- { "MSFT_PP", "/I" }, { "GCC_PP", "-I" },
- { "WINDDK_PP", "/I" } };
-
- /**
- * Mapping info: output file flag <--> family (vendor) + command type
- */
- public static final String[][] outputFileFlag = { { "MSFT_CC", "/Fo" },
- { "GCC_CC", "-o" }, { "INTEL_CC", "/Fo" },
- { "WINDDK_CC", "/Fo" }, { "MSFT_SLINK", "/OUT:" },
- { "GCC_SLINK", "-cr" }, { "INTEL_SLINK", "/OUT:" },
- { "WINDDK_SLINK", "/OUT:" }, { "MSFT_DLINK", "/OUT:" },
- { "GCC_DLINK", "-o" }, { "INTEL_DLINK", "/OUT:" },
- { "WINDDK_DLINK", "/OUT:" }, { "MSFT_ASM", "/Fo" },
- { "GCC_ASM", "-o" }, { "WINDDK_ASM", "/Fo" },
- { "WINDDK_IPF_ASM", "-o" } };
-
- /**
- * Get include delimiter with vendow and command type.
- *
- * @param vendor
- * Vendor
- * @param commandType
- * Command Type
- * @return include path delimiter
- */
- public static String getIncludePathDelimiter(String vendor,
- String commandType) {
- String key = vendor + "_" + commandType;
- for (int i = 0; i < includePathFlag.length; i++) {
- if (includePathFlag[i][0].equalsIgnoreCase(key)) {
- return includePathFlag[i][1];
- }
- }
- return "/I";
- }
-
- /**
- * Get Output Flag with vendor and command type.
- *
- * @param vendor
- * Vendor
- * @param commandType
- * Command Type
- * @return Output File Flag
- */
- public static String getOutputFileFlag(String vendor, String commandType) {
- String key = vendor + "_" + commandType;
- for (int i = 0; i < outputFileFlag.length; i++) {
- if (outputFileFlag[i][0].equalsIgnoreCase(key)) {
- return outputFileFlag[i][1];
- }
- }
- return "/Fo";
- }
-
-} \ No newline at end of file
diff --git a/Tools/Java/Source/DbTools/DbTools.msa b/Tools/Java/Source/DbTools/DbTools.msa
deleted file mode 100644
index 254b0bec2d..0000000000
--- a/Tools/Java/Source/DbTools/DbTools.msa
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Database Manipulation Tools</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>c51d72c2-6e85-4fcf-adb2-7c44b2f57f19</GuidValue>
- <Version>0.3</Version>
- <Abstract>The tool manipulates the FrameworkDatabase.db file</Abstract>
- <Description>
-This tool will scan the current workspace and update the FrameworkDatabase.db file if the workspace content is not consistent with the database.
-USAGE:
-DbTool [-v] [-t] [-q] [-V] [--package] [--platform] [-h | -? | --help]</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation All rights reserved.</Copyright>
- <License URL="http://opensource.org/licenses/bsd-license.php">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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DbTools</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>src/org/tianocore/DbTools/UpdateDb.java</Filename>
- <Filename>src/org/tianocore/DbTools/DbTool.java</Filename>
- <Filename>src/org/tianocore/DbTools/DbCmds.java</Filename>
- <Filename>build.xml</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/DbTools/build.xml b/Tools/Java/Source/DbTools/build.xml
deleted file mode 100644
index 5ae43e9223..0000000000
--- a/Tools/Java/Source/DbTools/build.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="DbTools" default="DbTools" basedir=".">
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
- </path>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>
- <target name="DbTools" depends="install"/>
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="src" destdir="${buildDir}">
- <classpath refid="classpath"/>
- <!-- <compilerarg value="-Xlint"/> -->
- </javac>
- </target>
- <target name="clean">
- <delete dir="${buildDir}"/>
- </target>
- <target name="cleanall">
- <delete dir="${buildDir}"/>
- <delete file="${installLocation}/DbTools.jar"/>
- </target>
- <target name="install" depends="source">
- <jar destfile="${installLocation}/DbTools.jar">
- <fileset dir="${buildDir}"/>
- </jar>
- </target>
-</project>
diff --git a/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/DbCmds.java b/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/DbCmds.java
deleted file mode 100644
index f4d45a4cbd..0000000000
--- a/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/DbCmds.java
+++ /dev/null
@@ -1,501 +0,0 @@
-// @file
-// DbCmds command-line interface to the classes that
-// update the FrameworkDatabase.db file based on WORKSPACE Contents
-//
-// Copyright (c) 2006, 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.
-//
-// This program is the command line interface to the CombineMsa class, which
-// will take the following arguments:
-//
-// Input:
-// -t, --test Test the Workspace against the FrameworkDatabase.db file
-// Returns 0 if valid, returns 1 if failed
-//
-// -f, --fix Fix the FrameworkDatabase.db file, so that it matches the
-// the contents of the WORKSPACE
-// Returns 0 if valid, returns 1 if failed
-//
-// -v [-v] Verbose Flag - sum of these will be used to set different
-// levels of verbosity
-//
-// -i Interactive, when used with -f or --fix, will query the user
-// regarding adds and deletes of packages and platforms from
-// the database.
-//
-// -a, --add Add an SPD or FPD file to the FrameworkDatabase.db file. The
-// SPD/FPD file must exist, or the command will fail.
-// Returns 0 if valid, returns 1 if failed
-//
-// -r, --del Remove an SPD or FPD file from the FrameworkDatabase.db file.
-// If the SPD/FPD file exists, the user will be queried to
-// remove it from the directory tree. For SPD files, the user
-// will also be presented with a list of Modules in the SPD
-// file, with the query to remove the modules as well as the
-// SPD file.
-// Returns 0 if valid, returns 1 if failed
-//
-// -u Display the UiName for all Packages and Platforms currently in
-// the FrameworkDatabase.db file.
-// Returns 0 if valid, returns 1 if failed
-//
-// -c Display a CSV listing of Type (SPD|FPD) UiName and Filename of
-// every entry in the FrameworkDatabase.db file.
-// Returns 0 if valid, returns 1 if failed
-//
-// No Options Display a list of Type (Package|Platfrom) and Filename of every
-// entry in the FrameworkDatabase.db file.
-// Returns 0 if valid, returns 1 if failed
-//
-// -h, -?, --help Displays this usage and exits.
-// Returns 0 if valid, returns 1 if failed
-//
-//
-// Output:
-// Displayed information
-//
-// Modifies - OPTIONAL
-// FrameworkDatabase.db
-//
-
-package org.tianocore.DbTools;
-
-import java.io.*;
-
-public class DbCmds {
-
- protected enum Cmd {
- SHOW_CSV, SHOW_PLATFORMS, SHOW_PACKAGES, FIX_DB, TEST_DB, FIND_SOMETHING, SHOW_FAR, ADD_SOMETHING,
- DELETE_SOMETHING
- }
-
- private int DEBUG = 0;
-
- private static final String copyright = "Copyright (c) 2006, Intel Corporation All rights reserved.";
-
- private static final String version = "Version 0.1";
-
- private static final String Specification = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
-
- private int VERBOSE = 0;
-
- public boolean INTERACTIVE = false;
-
- private String workspace = System.getenv("WORKSPACE");
-
- private final String frameworkDatabase = workspace + File.separator + "Tools" + File.separator + "Conf"
- + File.separator + "FrameworkDatabase.db";
-
- private final int ESUCCESS = 0;
-
- private final int EFAILURE = 1;
-
- private final int MIN_VERBOSE = 0;
-
- private final int MED_VERBOSE = 1;
-
- private final int MAX_VERBOSE = 2;
-
- private final static int FOUND = 1;
-
- private final static int NOTFOUND = 0;
-
- private boolean TEST = false;
-
- private int result = ESUCCESS;
-
- private Cmd commandToCall;
-
- private boolean isPlatform = false;
-
- private boolean isPackage = false;
-
- private boolean isFar = false;
-
- private boolean QUIET = false;
-
- private String commandArgs = "";
-
- private String whatToFind = "";
-
- public int DbUpdateCmdLine(String[] args) {
-
- if (testFile(frameworkDatabase) == NOTFOUND) {
- System.out.println("ERROR: E000 Invalid Workspace!");
- System.out.println("The environment variable, WORKSPACE, does not point to a valid workspace");
- System.out.println("DbUpdate Aborted!");
- System.err.flush();
- System.exit(EFAILURE);
- }
- result = parseCmdLine(args);
- if (result == ESUCCESS) {
- if (DEBUG > 2)
- System.out.println("Parse Succeeded!");
- if (VERBOSE > MAX_VERBOSE)
- System.out.println("WORKSPACE: " + workspace);
- if (DEBUG > 1)
- System.out.println("Command to call: " + commandToCall.toString());
- result = processCmdLine(commandToCall);
- } else {
- if (QUIET == false) {
- System.out.println("Invalid Arguments");
- outputUsage();
- result = EFAILURE;
- }
- }
- if (DEBUG > 2)
- System.out.println(" Result: " + result);
-
- return result;
- }
-
- private int processCmdLine(Cmd cmdCode) {
- UpdateDb dbUp = new UpdateDb();
- int res = ESUCCESS;
- switch (cmdCode) {
- case SHOW_CSV:
- // display current Database contents in CSV format
- // Modifies: NOTHING
- if ((DEBUG > 3) || (VERBOSE > MED_VERBOSE))
- System.out.println("Display contents of the FrameworkDatabase.db file in CSV format.");
- result = dbUp.getCsvEntries(frameworkDatabase, VERBOSE);
- break;
- case FIX_DB:
- // Automatically make the database match the contents of the workspace
- // Modifies: FrameworkDatabase.db
- if ((VERBOSE > MIN_VERBOSE) && (QUIET == false)) {
- if (TEST == false)
- System.out.println("Adjusting the FrameworkDatabase to match the contents of the WORKSPACE: "
- + workspace);
- if (TEST)
- System.out.println("Verify the FrameworkDatabase matches the contents of the WORKSPACE: "
- + workspace);
- }
- if ((DEBUG > 3) || (VERBOSE > MED_VERBOSE))
- System.out.println("Scan the Workspace and update the FrameworkDatabase.db file.");
- result = dbUp.fixDatabase(workspace, VERBOSE, INTERACTIVE, TEST, QUIET);
-
- break;
- case ADD_SOMETHING:
- // Add a Platform, package or FAR to the workspace.
- // Modifies: FrameworkDatabase.db
- if (((DEBUG > 3) || (VERBOSE > MED_VERBOSE)) && (isPlatform))
- System.out.println("Add Platform " + commandArgs + " to the FrameworkDatabase.db file");
- else if (((DEBUG > 3) || (VERBOSE > MED_VERBOSE)) && (isPackage))
- System.out.println("Add Package " + commandArgs + " to the FrameworkDatabase.db file");
- else if (((DEBUG > 3) || (VERBOSE > MED_VERBOSE)) && (isFar))
- System.out.println("Add Framework Archive " + commandArgs + " to the FrameworkDatabase.db file");
- result = dbUp.addItem(frameworkDatabase, commandArgs, VERBOSE, INTERACTIVE);
- break;
- case DELETE_SOMETHING:
- // Remove a platform, package or FAR from the workspace
- // Modifies: FrameworkDatabase.db, AND Filesystem
- if (((DEBUG > 3) || (VERBOSE > MED_VERBOSE)) && (isPlatform))
- System.out.println("Removing Platform " + commandArgs + " from the FrameworkDatabase.db file");
- else if (((DEBUG > 3) || (VERBOSE > MED_VERBOSE)) && (isPackage))
- System.out.println("Removing Package " + commandArgs + " from the FrameworkDatabase.db file");
- else if (((DEBUG > 3) || (VERBOSE > MED_VERBOSE)) && (isFar))
- System.out.println("Removing Framework Archive " + commandArgs + " from the FrameworkDatabase.db file");
- result = dbUp.addItem(workspace, commandArgs, VERBOSE, INTERACTIVE);
- break;
- case FIND_SOMETHING:
- // Find something in the workspace
- // Modifies: NOTHING
- if ((DEBUG > 3) || (VERBOSE > MED_VERBOSE))
- System.out.println("Finding " + whatToFind + " " + commandArgs + " in the Workspace");
- result = dbUp.findItem(workspace, VERBOSE, whatToFind, commandArgs);
- break;
- case SHOW_FAR:
- // Display FAR information for all SPDs in the workspace
- // Modifies: NOTHING
- if ((DEBUG > 3) || (VERBOSE > MED_VERBOSE))
- System.out.println("Display Framework Archives in the Workspace");
- result = dbUp.findFars(workspace, VERBOSE);
- break;
- case SHOW_PACKAGES:
- // Display SPD information for all SPDs in the workspace
- // Modifies: NOTHING
- if ((DEBUG > 3) || (VERBOSE > MED_VERBOSE))
- System.out.println("Display Packages in the Workspace");
- result = dbUp.findSpds(workspace, VERBOSE);
- break;
- case SHOW_PLATFORMS:
- // Display FPD information for all SPDs in the workspace
- // Modifies: NOTHING
- if ((DEBUG > 3) || (VERBOSE > MED_VERBOSE))
- System.out.println("Display Platforms in the Workspace");
- result = dbUp.findFpds(workspace, VERBOSE);
- break;
- default:
- // ERROR IF WE GET HERE!
- if ((DEBUG > 3) || (VERBOSE > MAX_VERBOSE))
- System.out.println("We could not process the following: " + commandToCall.toString());
- else if (QUIET == false)
- outputUsage();
- result = EFAILURE;
- break;
- }
- return res;
- }
-
- private int parseCmdLine(String[] args) {
-
- // Default is to fix the database.
- commandToCall = Cmd.FIX_DB;
- if (args.length == NOTFOUND) {
- if ((DEBUG > 3) || (VERBOSE > MAX_VERBOSE))
- System.out.println("NO ARGUMENTS! " + commandToCall.toString());
- return (ESUCCESS);
- }
-
- for (int i = 0; i < args.length; i++)
- if (args[i].toLowerCase().contentEquals("-q"))
- QUIET = true;
-
- for (int i = 0; i < args.length; i++) {
- String arg = args[i].trim();
- // This is the list of valid options
- if (!((arg.toLowerCase().startsWith("-t")) || (arg.toLowerCase().startsWith("--t"))
- || (arg.toLowerCase().startsWith("-q")) || (arg.toLowerCase().startsWith("-i"))
- || (arg.toLowerCase().startsWith("-f")) || (arg.toLowerCase().startsWith("--f"))
- || (arg.toLowerCase().startsWith("-c")) || (arg.toLowerCase().startsWith("--c"))
- || (arg.toLowerCase().startsWith("-a")) || (arg.toLowerCase().startsWith("--a"))
- || (arg.toLowerCase().startsWith("-r")) || (arg.toLowerCase().startsWith("--d"))
- || (arg.toLowerCase().startsWith("-v")) || (arg.toLowerCase().startsWith("--c"))
- || (arg.toLowerCase().startsWith("--p")) || (arg.toLowerCase().startsWith("-h"))
- || (arg.toLowerCase().startsWith("--h")) || (arg.toLowerCase().startsWith("/h")) || (arg
- .toLowerCase()
- .startsWith("-?")))) {
- // This is the fall through, we got something we did not know how to
- // process!
- if (args[i].startsWith("-")) {
- System.out.println("ERROR: E1004 Unknown Option: " + arg);
- System.out.println("Try running with -h or --help");
- } else {
- System.out.println("ERROR: E1005 Unknown Argument: " + arg);
- System.out.println("Try running with -h or --help");
- }
- System.out.println("Program Aborted!");
- System.err.flush();
- System.exit(EFAILURE);
- }
- if ((arg.toLowerCase().contentEquals("-t")) || (arg.toLowerCase().contains("--test"))) {
- // Test Workspace, do not fix.
- TEST = true;
- }
- if (arg.toLowerCase().contentEquals("-q")) {
- QUIET = true;
- }
- if (arg.toLowerCase().contentEquals("-i")) {
- INTERACTIVE = true;
- }
- if ((arg.toLowerCase().contentEquals("-f")) || (arg.toLowerCase().contains("--fix"))) {
- // Non-interactive fix of the database
- commandToCall = Cmd.FIX_DB;
- }
- if ((arg.toLowerCase().contentEquals("-c")) || (arg.toLowerCase().contains("--csv"))) {
- // Dump database in CSV format
- commandToCall = Cmd.SHOW_CSV;
- }
- if ((arg.toLowerCase().trim().contentEquals("-a")) || (arg.toLowerCase().contains("--add"))) {
- i++;
- if (args[i].startsWith("-")) {
- System.out.println("ERROR: E002 Missing Argument!");
- System.out
- .println("The add function requires an argument, either a package name or a platform name!");
- System.out.println("DbUpdate Aborted!");
- System.err.flush();
- System.exit(EFAILURE);
- }
- commandToCall = Cmd.ADD_SOMETHING;
- commandArgs = args[i];
- setArgType(commandArgs);
- }
- if ((arg.toLowerCase().trim().contentEquals("-r")) || (arg.toLowerCase().contains("--del"))) {
- i++;
- if (args[i].startsWith("-")) {
- System.out.println("ERROR: E002 Missing Argument!");
- System.out
- .println("The remove function requires an argument, either a package name or a platform name!");
- System.out.println("DbUpdate Aborted!");
- System.err.flush();
- System.exit(EFAILURE);
- }
- commandToCall = Cmd.DELETE_SOMETHING;
- commandArgs = args[i];
- setArgType(commandArgs);
- }
- if (arg.toLowerCase().contains("--find")) {
- commandToCall = Cmd.FIND_SOMETHING;
- i++;
- if (args[i].toLowerCase().contains("--lib"))
- whatToFind = "LIBRARY";
- else if (args[i].toLowerCase().contains("--guid"))
- whatToFind = "GUID";
- else if (args[i].toLowerCase().contains("--ppi"))
- whatToFind = "PPI";
- else if (args[i].toLowerCase().contains("--prot"))
- whatToFind = "PROTOCOL";
- else if (args[i].toLowerCase().contains("--pcd"))
- whatToFind = "PCD";
- else if (args[i].startsWith("-")) {
- System.out.println("ERROR: E001 Invalid Argument");
- System.out.println("The find function takes either a qualifier of --guid, --ppi,");
- System.out.println(" --proto, --pcd, or the string to search for.");
- System.err.flush();
- System.exit(EFAILURE);
- } else
- commandArgs = args[i];
-
- if (!whatToFind.contentEquals("")) {
- i++;
- if (args[i].startsWith("-")) {
- System.out.println("ERROR: E001 Invalid Argument");
- System.out.println("The find function qualifier (--guid, --ppi, --proto, --pcd)");
- System.out.println(" must be followed by the string to search for.");
- System.err.flush();
- System.exit(EFAILURE);
- } else
- commandArgs = args[i];
- }
-
- }
- if (arg.trim().contentEquals("-v")) {
- VERBOSE++;
- }
- if (arg.toLowerCase().contains("--lib")) {
- whatToFind = "LIBRARY";
- }
- if (arg.toLowerCase().contains("--guid")) {
- whatToFind = "GUID";
- }
- if (arg.toLowerCase().contains("--ppi")) {
- whatToFind = "PPI";
- }
- if (arg.toLowerCase().contains("--prot")) {
- whatToFind = "PROTOCOL";
- }
- if (arg.toLowerCase().contains("--pcd")) {
- whatToFind = "PCD";
- }
- if (arg.toLowerCase().contentEquals("-d") || arg.trim().toLowerCase().contains("--debug")) {
- if ((i + 1 == args.length) || (args[i + 1].trim().startsWith("-"))) {
- DEBUG = 1;
- } else if (i + 1 < args.length) {
- String pattern = "^\\d+";
- if (args[i + 1].trim().matches(pattern)) {
- i++;
- DEBUG = Integer.parseInt(args[i]);
- } else
- DEBUG = 1;
- }
- }
- if (arg.trim().contentEquals("-V")) {
- System.out.println("DbTools, " + version);
- System.out.println(copyright);
- System.out.println(Specification);
- System.err.flush();
- System.exit(ESUCCESS);
- }
- if (arg.toLowerCase().trim().startsWith("--pack")) {
- commandToCall = Cmd.SHOW_PACKAGES;
- }
- if (arg.toLowerCase().trim().startsWith("--far")) {
- commandToCall = Cmd.SHOW_FAR;
- }
- if (arg.toLowerCase().trim().startsWith("--plat")) {
- commandToCall = Cmd.SHOW_PLATFORMS;
- }
- if ((arg.toLowerCase().contentEquals("-h")) || (arg.toLowerCase().contentEquals("-?"))
- || (arg.toLowerCase().startsWith("/h")) || (arg.toLowerCase().contentEquals("--help"))) {
- outputUsage();
- System.exit(EFAILURE);
- }
-
- }
- return ESUCCESS;
- }
-
- private int testFile(String Filename) {
- File tFile = new File(Filename);
- if (DEBUG > 4)
- System.out.println("File is located: " + tFile.getPath());
- if (tFile.exists())
- return FOUND;
- else
- return NOTFOUND;
- }
-
- private void setArgType(String argv) {
- if (argv.trim().toLowerCase().contains(".spd"))
- isPackage = true;
- if (argv.trim().toLowerCase().contains(".fpd"))
- isPlatform = true;
- if (argv.trim().toLowerCase().contains(".far"))
- isFar = true;
- }
-
- public String getArgType() {
- String argt = "UNKNOWN";
- if (isPackage)
- argt = "SPD";
- if (isFar)
- argt = "FAR";
- if (isPlatform)
- argt = "FPD";
- return argt;
- }
-
- private static void outputUsage() {
-
- System.out.println("DbTool, " + version);
- System.out.println(copyright);
- System.out.println("Usage:");
- System.out.println(" DbTool [-v] [-t] [-q] [-V] [--package] [--platform] [-h | -? | --help]");
- System.out.println(" where:");
- System.out.println(" -h | -? | --help OPTIONAL - This Help Text");
- System.out
- .println(" -t | --test OPTIONAL - Test the FrameworkDatabase Contents against the WORKSPACE");
- System.out
- .println(" -q OPTIONAL - Quiet mode - pass or fail only on return value, nothing is printed");
- System.out
- .println(" -f | --fix OPTIONAL - Automatically fix (non-interactive) the Database file to match the WORKSPACE.");
- System.out
- .println(" -v OPTIONAL - Verbose, print information messages. Adding more -v arguments increases verbosity.");
- System.out.println(" --package OPTIONAL - Show all Packages installed in the WORKSPACE.");
- System.out.println(" --platforms OPTIONAL - Show all Platforms installed in the WORKSPACE.");
- System.out.println(" -V OPTIONAL - Display Version information and exit.");
- //
- // TODO: Implement the following options.
- //
- /**
- System.out.println("");
- System.out.println(" =================== Options below this line have not been implemented in this release ===================");
- System.out
- .println(" -i OPTIONAL - Force interactive on commands that modify the WORKSPACE");
- System.out
- .println(" --far OPTIONAL - Show all Framework Archives installed in the WORKSPACE.");
- System.out
- .println(" --find [qualifier] value OPTIONAL - Search the WORKSPACE for value, with one and only one optional Qualifier.");
- System.out.println(" qualifiers: --guid Find a GUID by Guid C Name");
- System.out.println(" --prot Find a Protocol or ProtocolNotify by C Name");
- System.out.println(" --ppi Find a PPI or PpiNotify by C Name");
- System.out.println(" --pcd Find a PCD entry by C Name");
- System.out.println(" --lib Find information about a Library Class");
- System.out
- .println(" -c OPTIONAL - Print a comma separated value listing of TYPE,UiName,Filename");
- System.out
- .println(" -a, --add value OPTIONAL - Add a value (package, platform or far) to the database");
- System.out
- .println(" -r, --del value OPTIONAL - Remove a value (package, platform or far) from the database");
- System.out.println("");
- */
- }
-}
diff --git a/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/DbTool.java b/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/DbTool.java
deleted file mode 100644
index 5e502b710c..0000000000
--- a/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/DbTool.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// @file
-// DbUpdate wrapper
-//
-// Copyright (c) 2006, 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.
-//
-
-package org.tianocore.DbTools;
-
-public class DbTool {
-
- public static void main(String[] args) {
- if (new DbCmds().DbUpdateCmdLine(args) != 0)
- System.exit(1);
- System.exit(0);
- }
-}
diff --git a/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/UpdateDb.java b/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/UpdateDb.java
deleted file mode 100644
index 6d3ef98fc9..0000000000
--- a/Tools/Java/Source/DbTools/src/org/tianocore/DbTools/UpdateDb.java
+++ /dev/null
@@ -1,594 +0,0 @@
-// @file
-// This Class processes multiple MSA files and merges them into a single,
-// merged MSA file. It will optionally add the merged MSA file into a package.
-//
-//
-// Copyright (c) 2006, 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.
-//
-//
-
-package org.tianocore.DbTools;
-
-import java.io.*;
-import java.util.*;
-// import java.sql.Time;
-
-// import java.lang.*;
-// import java.lang.ExceptionInInitializerError;
-
-// import org.apache.xmlbeans.*;
-import org.apache.xmlbeans.XmlCursor;
-// import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-// import org.apache.xmlbeans.XmlException;
-import org.tianocore.*;
-
-// import org.tianocore.*;
-// FrameworkDatabase.db Schema Elements
-import org.tianocore.FrameworkDatabaseDocument.*;
-import org.tianocore.FdbHeaderDocument.*;
-import org.tianocore.PackageListDocument.*;
-import org.tianocore.PlatformListDocument.*;
-import org.tianocore.FarListDocument.*;
-
-// FAR Schema Elements
-// import org.tianocore.FrameworkArchiveManifestDocument.*;
-// import org.tianocore.FarHeaderDocument.*;
-// import org.tianocore.FarPackageDocument.*;
-// import org.tianocore.FarPlatformDocument.*;
-
-// FPD Schema Elements
-import org.tianocore.PlatformSurfaceAreaDocument.*;
-import org.tianocore.PlatformHeaderDocument.*;
-
-// import org.tianocore.FrameworkModulesDocument.*;
-// import org.tianocore.DynamicPcdBuildDefinitionsDocument.*;
-
-// SPD Schema Elements
-// import org.tianocore.PackageSurfaceAreaDocument.*;
-// import org.tianocore.SpdHeaderDocument.*;
-// import org.tianocore.LibraryClassDeclarationsDocument.*;
-// import org.tianocore.GuidDeclarationsDocument.*;
-// import org.tianocore.ProtocolDeclarationsDocument.*;
-// import org.tianocore.PpiDeclarationsDocument.*;
-// import org.tianocore.PcdDeclarationsDocument.*;
-
-// MSA Schema Elements
-// import org.tianocore.ModuleSurfaceAreaDocument.*;
-// import org.tianocore.MsaHeaderDocument.*;
-// import org.tianocore.LicenseDocument.*;
-// import org.tianocore.LibraryClassDefinitionsDocument.*;
-// import org.tianocore.PackageDependenciesDocument.*;
-// import org.tianocore.ProtocolsDocument.*;
-// import org.tianocore.PPIsDocument.*;
-// import org.tianocore.PcdCodedDocument.*;
-
-public class UpdateDb {
-
- private final int DEBUG = 0;
-
- private final int PASS = 0;
-
- private final int FAIL = 1;
-
- private int dCtr = 0;
-
- private int lCtr = 0;
-
- // Future implementations
- // private XmlCursor cursor = null;
-
- // FrameworkDatabase Component Elements
- // private FrameworkDatabaseDocument fdbDoc = null;
-
- // private FrameworkDatabase fdbInstance = null;
-
- // private FdbHeader fdbHeader = null;
-
- // private PackageList fdbPackageList = null;
-
- // private ArrayList<String> packageList = new ArrayList<String>();
-
- // private PlatformList fdbPlatformList = null;
-
- // private ArrayList<String> platformList = new ArrayList<String>();
-
- // private FarList fdbFarList = null;
-
- // private ArrayList<String> farList = new ArrayList<String>();
-
- private ArrayList<String> spdList = new ArrayList<String>();
-
- private ArrayList<String> fpdList = new ArrayList<String>();
-
- // Platform Components
- // private PlatformSurfaceAreaDocument fpdDoc = null;
-
- // private PlatformSurfaceArea fpd = null;
-
- // private PlatformHeader fpdHeader = null;
-
- private boolean wasModified = false;
-
- private int VERBOSE = 0;
-
- // The combineMsaFiles routine is the primary routine for creating a
- // Merged MSA file.
-
- public UpdateDb() {
- init();
- }
-
- private void init() {
-
- }
-
- public int getAllEntries(String dbFilename, int VERBOSE_FLAG) {
- System.out.println("Function not yet implemented!");
- return FAIL;
- }
-
- public int getCsvEntries(String dbFilename, int VERBOSE_FLAG) {
- System.out.println("Function not yet implemented!");
- return FAIL;
- }
-
- public int fixDatabase(String workspace, int VERBOSE_FLAG, boolean INTERACTIVE, boolean TEST, boolean QUIET) {
- int result = PASS;
- String dbFile = workspace + File.separator + "Tools" + File.separator + "Conf" + File.separator
- + "FrameworkDatabase.db";
- String dbBak = dbFile + ".bak";
-
- try {
- // Make a backup file for frameworkDatabase
- if (VERBOSE_FLAG > 3)
- System.out.println("Creating Backup file: " + dbBak);
- copyFile(dbFile, dbBak);
- } catch (IOException e) {
- System.out.println("Error: Cannot make backup file " + dbBak);
- return FAIL;
- }
-
- // Datebase update for SPD and FPD files
- result = fixDB(workspace, dbFile, VERBOSE_FLAG, INTERACTIVE, TEST, QUIET);
- if ((result == 0) && (TEST) && (QUIET == false))
- System.out.println("Workspace is consistent with current database!");
- return PASS;
- }
-
- public int addItem(String dbFilename, String item, int VERBOSE_FLAG, boolean INTERACTIVE) {
- System.out.println("Function not yet implemented!");
- return FAIL;
- }
-
- public int delItem(String workspace, String item, int VERBOSE_FLAG, boolean INTERACTIVE) {
- System.out.println("Function not yet implemented!");
- return FAIL;
- }
-
- public int findItem(String workspace, int VERBOSE_FLAG, String findWhat, String item) {
- System.out.println("Function not yet implemented!");
- return FAIL;
- }
-
- public int findFars(String workspace, int VERBOSE_FLAG) {
- System.out.println("Function not yet implemented!");
- return FAIL;
- }
-
- public int findSpds(String workspace, int VERBOSE_FLAG) {
- System.out.println("The following Package (SPD) files are in the workspace" + workspace);
- File wsDir = new File(workspace);
- findSPDFiles(wsDir, workspace, VERBOSE);
- for (int i = 0; i < spdList.size(); i++) {
- String Filename = workspace + File.separator + spdList.get(i).trim();
- File spdFilename = new File(Filename);
- try {
- FileReader fileReader = new FileReader(spdFilename);
- BufferedReader reader = new BufferedReader(fileReader);
- String PackageName = null;
- String rLine = null;
- while ((rLine = reader.readLine()) != null) {
- if (rLine.contains("<PackageName>")) {
- PackageName = rLine.replace("<PackageName>", "").trim();
- PackageName = PackageName.replace("</PackageName>", "").trim();
- System.out.printf(" %25s - %s\n",PackageName, spdList.get(i).trim());
- break;
- }
- }
- reader.close();
- } catch (IOException e) {
- System.out.println("ERROR Reading File: " + Filename + e);
- System.exit(FAIL);
- }
-
- }
- return PASS;
- }
-
- public int findFpds(String workspace, int VERBOSE_FLAG) {
- System.out.println("The following Platform (FPD) files are in the workspace: " + workspace);
- File wsDir = new File(workspace);
- findFPDFiles(wsDir, workspace, VERBOSE);
- for (int i = 0; i < fpdList.size(); i++) {
- String Filename = workspace + File.separator + fpdList.get(i).trim();
- File fpdFilename = new File(Filename);
- try {
- FileReader fileReader = new FileReader(fpdFilename);
- BufferedReader reader = new BufferedReader(fileReader);
- String PlatformName = null;
- String rLine = null;
- while ((rLine = reader.readLine()) != null) {
- if (rLine.contains("<PlatformName>")) {
- PlatformName = rLine.replace("<PlatformName>", "").trim();
- PlatformName = PlatformName.replace("</PlatformName>", "").trim();
- System.out.printf(" %25s - %s\n",PlatformName, fpdList.get(i).trim());
- break;
- }
- }
- reader.close();
- } catch (IOException e) {
- System.out.println("ERROR Reading File: " + Filename + e);
- System.exit(FAIL);
- }
- }
- return PASS;
- }
-
- // copy from source file to destination file
- private int copyFile(String src, String dst) throws IOException {
- try {
- File srcFile = new File(src);
- FileReader fileReader = new FileReader(srcFile);
- BufferedReader reader = new BufferedReader(fileReader);
-
- File dstFile = new File(dst);
- FileWriter fileWriter = new FileWriter(dstFile);
- BufferedWriter writer = new BufferedWriter(fileWriter);
-
- String line = null;
- while ((line = reader.readLine()) != null) {
- writer.write(line);
- writer.newLine();
- }
-
- reader.close();
- writer.close();
- } catch (IOException e) {
- System.out.println("I/O Exception during file copy: " + e);
- }
-
- return PASS;
- }
-
- private int fixDB(String workspace, String dbFile, int VERBOSE, boolean INTERACTIVE, boolean TEST, boolean QUIET) {
- File wsDir = new File(workspace);
- int retValue = PASS;
- // Find all .spd and .fpd files in workspace and put them in spdList and fpdList
- if (VERBOSE > 0)
- System.out.println("SPD File Search ");
- findSPDFiles(wsDir, workspace, VERBOSE);
- dCtr = 0;
- lCtr = 0;
- if (VERBOSE > 0) {
- System.out.println(" ");
- System.out.println("FPD File Search ");
- }
- findFPDFiles(wsDir, workspace, VERBOSE);
- if (VERBOSE > 0)
- System.out.println(" ");
-
- try {
- // check database file for possible update
- retValue = checkDBForUpdate(workspace, dbFile, VERBOSE, INTERACTIVE, TEST, QUIET);
- } catch (IOException e) {
- if (QUIET == false)
- System.out.println("Error: Updating " + dbFile + " file.");
- return FAIL;
- }
-
- if ((VERBOSE > 0) && (TEST) && (wasModified)) {
- System.out.println("FRAMEWORK Database does NOT match the contents of the WORKSPACE");
- retValue = FAIL;
- }
- if ((VERBOSE > 0) && (wasModified == false) && (QUIET == false))
- System.out.println("FRAMEWORK Database matches the contents of the WORKSPACE");
-
- return retValue;
- }
-
- private void findSPDFiles(File dir, String workspace, int VERBOSE) {
- String str;
-
- if (dir.isDirectory()) {
- dCtr++;
- String[] subdir = dir.list();
- if (dCtr >= 10) {
- if (VERBOSE > 2)
- System.out.print(".");
- dCtr = 0;
- lCtr++;
- }
- if (lCtr > 79) {
- if (VERBOSE > 2)
- System.out.println(" ");
- lCtr = 0;
- dCtr = 0;
- }
-
- for (int i = 0; i < subdir.length; i++) {
- findSPDFiles(new File(dir, subdir[i]), workspace, VERBOSE);
- }
- } else {
- if (dir.toString().toLowerCase().endsWith(".spd")) {
- str = dir.getPath().replace('\\', '/');
- workspace = workspace.replace('\\', '/');
- str = strStrip(str, workspace + "/");
- spdList.add(str.toString());
- if (VERBOSE == 2)
- System.out.println(" " + str);
- if (VERBOSE > 2)
- System.out.print("+");
- lCtr++;
- }
- }
-
- }
-
- private void findFPDFiles(File dir, String workspace, int VERBOSE) {
- String str;
-
- if (dir.isDirectory()) {
- String[] subdir = dir.list();
- if (dCtr >= 10) {
- if (VERBOSE > 2)
- System.out.print(".");
- dCtr = 0;
- lCtr++;
- }
- if (lCtr > 79) {
- if (VERBOSE > 2)
- System.out.println(" ");
- lCtr = 0;
- dCtr = 0;
- }
-
- for (int i = 0; i < subdir.length; i++) {
- findFPDFiles(new File(dir, subdir[i]), workspace, VERBOSE);
- }
- } else {
- if (dir.toString().toLowerCase().endsWith(".fpd")) {
- str = dir.getPath().replace('\\', '/');
- workspace = workspace.replace('\\', '/');
- str = strStrip(str, workspace + "/");
- fpdList.add(str.toString());
- if (VERBOSE == 2)
- System.out.println(" " + str);
- if (VERBOSE > 2)
- System.out.print("+");
- lCtr++;
- }
- }
- }
-
- private int checkDBForUpdate(String workspace, String dbFileName, int VERBOSE, boolean INTERACTIVE, boolean TEST, boolean QUIET)
- throws IOException {
- int SpdFlag = 0;
- int FpdFlag = 0;
- String SpdFile = null;
- String SpdFullFile = null;
- String FpdFile = null;
- String FpdFullFile = null;
-
- String tmpDbFile = dbFileName + ".tmp";
- String newSpd = null;
- String newFpd = null;
-
- FileReader fileReader = new FileReader(dbFileName);
- BufferedReader reader = new BufferedReader(fileReader);
-
- FileWriter fileWriter = new FileWriter(tmpDbFile);
- BufferedWriter writer = new BufferedWriter(fileWriter);
-
- String line = null;
- try {
- while ((line = reader.readLine()) != null) {
- if (line.indexOf("Added the following") >= 0) {
- wasModified = true;
- continue;
- }
- //
- // Process for .spd files
- //
- if (line.indexOf("<PackageList") >= 0) {
- SpdFlag = 1;
- } else {
- if (line.indexOf("</PackageList") >= 0) {
- SpdFlag = 2;
- }
- }
- if (SpdFlag == 1 && line.indexOf("Filename") >= 0) {
- SpdFile = strStrip(line, "<Filename>");
- SpdFile = strStrip(SpdFile, "</Filename>");
- SpdFile = SpdFile.trim();
- SpdFullFile = workspace + File.separator + SpdFile;
- if (!(new File(SpdFullFile)).exists()) {
- if (VERBOSE > 0)
- System.out.println("WARNING: Removing SPD file: " + SpdFile
- + "from the DB, as it does not exist!");
- wasModified = true;
- continue;
- }
- // Don't add files that are already in the database
- spdList.remove(SpdFile);
- }
- if (SpdFlag == 2) {
- int cflag = 0;
- for (int i = 0; i < spdList.size(); i++) {
- newSpd = spdList.get(i);
- newSpd = newSpd.trim();
- if (newSpd.length() > 0) {
- if (cflag == 0) {
- Calendar c = Calendar.getInstance();
- if (TEST == false)
- writer.write(" <!-- Adding the following SPD files " + c.getTime() + " -->\n");
- }
- if (VERBOSE > 0)
- System.out.println(" Adding SPD file: " + newSpd);
- if (TEST == false)
- writer.write(" <Filename>" + newSpd + "</Filename>\n");
- cflag++;
- wasModified = true;
- }
- }
- SpdFlag++;
- }
- //
- // Process for .fpd files
- //
- if (line.indexOf("<PlatformList") >= 0) {
- FpdFlag = 1;
- } else {
- if (line.indexOf("</PlatformList") >= 0) {
- FpdFlag = 2;
- }
- }
- if (FpdFlag == 1 && line.indexOf("Filename") >= 0) {
- FpdFile = strStrip(line, "<Filename>");
- FpdFile = strStrip(FpdFile, "</Filename>");
- FpdFile = FpdFile.trim();
- FpdFullFile = workspace + File.separator + FpdFile;
- if (!(new File(FpdFullFile)).exists()) {
- if (VERBOSE > 0)
- System.out.println("WARNING: Removing FPD file: " + FpdFile
- + " from the DB, as it does not exist!");
- wasModified = true;
- continue;
- }
- // Don't add files that are already in the database
- fpdList.remove(FpdFile);
- }
- if (FpdFlag == 2) {
- int cflag = 0;
- for (int i = 0; i < fpdList.size(); i++) {
- newFpd = fpdList.get(i);
- newFpd = newFpd.trim();
- if (newFpd.length() > 0) {
- if (cflag == 0) {
- Calendar c = Calendar.getInstance();
- if (TEST == false)
- writer.write(" <!-- Adding the following FPD files " + c.getTime() + " -->\n");
- }
- if (VERBOSE > 0)
- System.out.println(" Adding FPD file: " + newFpd);
- if (TEST == false)
- writer.write(" <Filename>" + newFpd + "</Filename>\n");
- cflag++;
- wasModified = true;
- }
- }
- FpdFlag++;
- }
-
- if (DEBUG > 2) {
- System.out.println(line);
- }
- if (TEST == false) {
- writer.write(line);
- writer.newLine();
- }
- }
- reader.close();
- writer.close();
-
- } catch (IOException e) {
- System.out.println("ERROR I/O Exception occured! " + e);
- System.exit(FAIL);
- }
-
- if (wasModified) {
- if ((VERBOSE > 0) && (QUIET == false))
- System.out.println("FrameworkDatabase has been UPDATED for this Workspace!\n");
- if (TEST == false)
- copyFile(tmpDbFile, dbFileName);
- } else {
- if ((VERBOSE > 0) && (QUIET == false))
- System.out.println("FrameworkDatabase correct for this Workspace!\n");
- }
-
- if (TEST == false) {
- File tmpFile = new File(tmpDbFile);
- if (tmpFile.exists()) {
- tmpFile.delete();
- }
- }
-
- return PASS;
- }
-
- static String strStrip(String str, String pattern) {
- int ps = 0;
- int pe = 0;
- StringBuffer result = new StringBuffer();
-
- while ((pe = str.indexOf(pattern, ps)) >= 0) {
- result.append(str.substring(ps, pe));
- ps = pe + pattern.length();
- }
- result.append(str.substring(ps));
- return result.toString();
- }
-
- private String checkDuplicateStrings(String aString, ArrayList<String> aList) {
- // This routine checks a string against an array.
- // If the string is found, it will return an empty string.
- // If the string is not found, it adds the string to the array, and
- // returns the string to the caller.
- for (int lctr = 0; lctr < aList.size(); lctr++) {
- if (DEBUG > 8)
- System.out.println("Comparing: \n" + aString.replace(" ", "").replace("\n", "") + "\nTo: \n"
- + aList.get(lctr).replace(" ", "").replace("\n", "").toString().trim());
- if (aString.replace(" ", "").replace("\n", "").contains(
- aList.get(lctr).replace(" ", "").replace("\n", "")
- .toString().trim())) {
- if ((DEBUG > 3) || (VERBOSE > 3))
- System.out.println("Found a duplicate String, skipping!");
- return "";
- }
- }
- if ((DEBUG > 3) || (VERBOSE > 3))
- System.out.println("Returning UNIQUE String!\n " + aString);
- aList.add(aString);
- return aString;
- }
-
- private static class XmlConfig {
- public static XmlCursor setupXmlCursor(XmlCursor cursor) {
- String uri = "http://www.TianoCore.org/2006/Edk2.0";
- cursor.push();
- cursor.toNextToken();
- cursor.insertNamespace("", uri);
- cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
- cursor.pop();
- return cursor;
-
- }
-
- public static XmlOptions setupXmlOptions() {
- XmlOptions options = new XmlOptions();
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- return options;
- }
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/FrameworkTasks.msa b/Tools/Java/Source/FrameworkTasks/FrameworkTasks.msa
deleted file mode 100644
index f7b1b6225f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/FrameworkTasks.msa
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
- <MsaHeader>
- <ModuleName>Framework Tasks</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>50E76367-0233-4242-A1CA-42B1A4B36C07</GuidValue>
- <Version>2.0</Version>
- <Abstract>This is the EFI/Tiano Tool Resources Module</Abstract>
- <Description>
- This Module provides the EFI/Tiano Tools that are used to create EFI/Tiano
- Modules and Platform Binary Files (PBF)
- These tools require compilation only once if the Developer Workstation and
- the Developer's choice of HOST tool chain are stable. If the developer
- updates either the OS or the HOST tool chain, these tools should be rebuilt.
- </Description>
- <Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
- <License>
-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.
- </License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>build.xml</Filename>
- <Filename>frameworktasks.tasks</Filename>
- <Filename>org/tianocore/framework/tasks/Compress.java</Filename>
- <Filename>org/tianocore/framework/tasks/CompressHeader.java</Filename>
- <Filename>org/tianocore/framework/tasks/CompressSection.java</Filename>
- <Filename>org/tianocore/framework/tasks/CreateMtFileTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/Database.java</Filename>
- <Filename>org/tianocore/framework/tasks/EfiCompressTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/EfiDefine.java</Filename>
- <Filename>org/tianocore/framework/tasks/EfiRomTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/FfsHeader.java</Filename>
- <Filename>org/tianocore/framework/tasks/FfsTypes.java</Filename>
- <Filename>org/tianocore/framework/tasks/FileArg.java</Filename>
- <Filename>org/tianocore/framework/tasks/FlashMapTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/FwImageTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/GenAcpiTableTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/GenCRC32SectionTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/GenCapsuleHdrTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/GenDepexTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/GenFfsFileTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/GenFvImageTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/GenSectionTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/GenTeImageTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/GuidChkTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/IncludePath.java</Filename>
- <Filename>org/tianocore/framework/tasks/Input.java</Filename>
- <Filename>org/tianocore/framework/tasks/InputFile.java</Filename>
- <Filename>org/tianocore/framework/tasks/MakeDeps.java</Filename>
- <Filename>org/tianocore/framework/tasks/ModifyInfTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/NestElement.java</Filename>
- <Filename>org/tianocore/framework/tasks/PeiReBaseTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/SecApResetVectorFixupTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/SecFixupTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/SectFile.java</Filename>
- <Filename>org/tianocore/framework/tasks/Section.java</Filename>
- <Filename>org/tianocore/framework/tasks/SetStampTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/SkipExt.java</Filename>
- <Filename>org/tianocore/framework/tasks/SplitfileTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/StrGatherTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/StripTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/Tool.java</Filename>
- <Filename>org/tianocore/framework/tasks/ToolArg.java</Filename>
- <Filename>org/tianocore/framework/tasks/VfrCompilerTask.java</Filename>
- <Filename>org/tianocore/framework/tasks/ZeroDebugDataTask.java</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/FrameworkTasks/build.xml b/Tools/Java/Source/FrameworkTasks/build.xml
deleted file mode 100644
index c3c86c987c..0000000000
--- a/Tools/Java/Source/FrameworkTasks/build.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="FrameworkTasks" default="FrameworkTasks">
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>
- <target name="FrameworkTasks" depends="install"/>
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="." destdir="${buildDir}">
- <classpath>
- <fileset dir="${WORKSPACE}/Tools/Jars">
- <include name="*.jar"/>
- </fileset>
- </classpath>
- <compilerarg value="-Xlint"/>
- </javac>
- </target>
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false" quiet="true">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/FrameworkTasks" includes="${buildDir}"/>
- </delete>
- </target>
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: frameworktasks.jar"/>
- <delete file="${installLocation}/frameworktasks.jar"/>
- <if>
- <available file="${installLocation}/frameworktasks.jar"/>
- <then>
- <echo message="You must manually remove the file: ${installLocation}/frameworktasks.jar"/>
- <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
- </then>
- </if>
- </target>
- <target name="install" depends="source">
- <copy file="frameworktasks.tasks" toDir="${buildDir}"/>
- <jar destfile="${installLocation}/frameworktasks.jar"
- basedir="${buildDir}"
- includes="**"
- />
- </target>
-</project>
diff --git a/Tools/Java/Source/FrameworkTasks/frameworktasks.tasks b/Tools/Java/Source/FrameworkTasks/frameworktasks.tasks
deleted file mode 100644
index 386c6e886a..0000000000
--- a/Tools/Java/Source/FrameworkTasks/frameworktasks.tasks
+++ /dev/null
@@ -1,25 +0,0 @@
-fwimage=org.tianocore.framework.tasks.FwImageTask
-setstamp=org.tianocore.framework.tasks.SetStampTask
-gendepex=org.tianocore.framework.tasks.GenDepexTask
-gensection=org.tianocore.framework.tasks.GenSectionTask
-genffsfile=org.tianocore.framework.tasks.GenFfsFileTask
-vfrcompile=org.tianocore.framework.tasks.VfrCompilerTask
-strgather=org.tianocore.framework.tasks.StrGatherTask
-genfvimage=org.tianocore.framework.tasks.GenFvImageTask
-guidchk= org.tianocore.framework.tasks.GuidChkTask
-gencrc32section=org.tianocore.framework.tasks.GenCRC32SectionTask
-makedeps=org.tianocore.framework.tasks.MakeDeps
-edkStrip=org.tianocore.framework.tasks.StripTask
-splitfile=org.tianocore.framework.tasks.SplitfileTask
-genacpitable=org.tianocore.framework.tasks.GenAcpiTableTask
-genteimage=org.tianocore.framework.tasks.GenTeImageTask
-secfixup=org.tianocore.framework.tasks.SecFixupTask
-peirebase=org.tianocore.framework.tasks.PeiReBaseTask
-eficompress=org.tianocore.framework.tasks.EfiCompressTask
-zerodebugdata=org.tianocore.framework.tasks.ZeroDebugDataTask
-createmtfile=org.tianocore.framework.tasks.CreateMtFileTask
-efirom=org.tianocore.framework.tasks.EfiRomTask
-secapresetvectorfixup=org.tianocore.framework.tasks.SecApResetVectorFixupTask
-gencapsulehdr=org.tianocore.framework.tasks.GenCapsuleHdrTask
-flashmap=org.tianocore.framework.tasks.FlashMapTask
-modifyinf=org.tianocore.framework.tasks.ModifyInfTask
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java
deleted file mode 100644
index 4410ecdda1..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @file
- Compress class.
-
- This class is to call CompressDll.dll to compress section.
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-/**
-
- This class is to call CompressDll.dll to compress section.
-
-**/
-public class Compress {
- byte[] inputBuffer;
- byte[] outputBuffer;
- int size;
-
- static {
- String dllPath;
-
- dllPath = GenFfsFileTask.path;
- dllPath = dllPath +
- File.separator +
- "CompressDll.dll";
-
- System.load(dllPath);
- }
-
- /**
- CallCompress
-
- This function is to call the compressDll.dll to compress the contents in
- buffer.
-
- @param inputBuffer The input buffer.
- @param size The size of buffer in byte.
- @param dllPath The compressDll.dll path.
- @return The buffer contained the comrpessed input.
- **/
- public native byte[] CallCompress (byte[] inputBuffer, int size, String dllPath);
-
- /**
- Construct function
-
- This function is to initialize the class member and call the compress
- function.
-
- @param inBuffer The input buffer.
- @param size The size of buffer in byte.
- **/
- public Compress (byte[] inBuffer, int size){
- this.inputBuffer = inBuffer;
- this.size = size;
- String path = GenFfsFileTask.path;
-
- //
- // Call Compress function.
- //
- this.outputBuffer = CallCompress (
- this.inputBuffer,
- this.size,
- path
- );
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressHeader.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressHeader.java
deleted file mode 100644
index e1823329ff..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressHeader.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/** @file
- CompressHeader class.
-
- This class is to generate the compressed section header.
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.framework.tasks;
-
-import org.apache.tools.ant.BuildException;
-/**
-
- Internal class: This class is to generate the compressed section header.
-
-**/
-public class CompressHeader {
-
- /**
- CommonSectionHeader
-
- This class define the compressed header structor.
-
- **/
- public class CommonSectionHeader {
- byte[] Size = new byte[3];
- byte type;
- }
-
- ///
- /// Section header.
- ///
- public CommonSectionHeader SectionHeader = new CommonSectionHeader();
-
- ///
- /// Length of uncompress section in byte.
- ///
- public int UncompressLen;
- ///
- /// Compress type.
- ///
- public byte CompressType;
-
- ///
- /// The size of compress header in byte.
- ///
- public int GetSize (){
- return 9;
- }
-
- ///
- /// Write class member to buffer.
- ///
- public void StructToBuffer (byte[] Buffer){
- if (Buffer.length != GetSize()) {
- throw new BuildException ("CompressHeader Buffer size is not correct!");
- }
- for (int i = 0; i < 3; i++){
- Buffer[i] = SectionHeader.Size[i];
- }
- Buffer[3] = SectionHeader.type;
- Buffer[4] = (byte)(UncompressLen & 0xff);
- Buffer[5] = (byte)((UncompressLen & 0xff00)>>8);
- Buffer[6] = (byte)((UncompressLen & 0xff0000)>>16);
- Buffer[7] = (byte)((UncompressLen & 0xff000000)>>24);
- Buffer[8] = CompressType;
- }
-
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
deleted file mode 100644
index 3e2a98f695..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/** @file
- CompressSection class.
-
- CompressSection indicate that all section which in it should be compressed.
-
- Copyright (c) 2006, 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.
-
- **/
-
-
-package org.tianocore.framework.tasks;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-
-
-/**
- CompressSection
-
- CompressSection indicate that all section which in it should be compressed.
-
-**/
-public class CompressSection implements Section, FfsTypes {
- private int alignment = 0;
- //
- // The attribute of compressName.
- //
- private String compressName = "";
- //
- // The list contained the SectFile element.
- //
- private List<Section> sectList = new ArrayList<Section>();
-
- public static Object semaphore = new Object();
- /**
- toBuffer
-
- This function is to collect all sectFile and compress it , then output
- the result to buffer.
-
- @param Buffer The point of output buffer
-
- **/
- public void toBuffer (DataOutputStream buffer){
-
- Section sect;
-
- //
- // Get section file in compress node.
- //
- try{
-
- ByteArrayOutputStream bo = new ByteArrayOutputStream ();
- DataOutputStream Do = new DataOutputStream (bo);
-
- //
- // Get each section which under the compress {};
- // And add it is contains to File;
- //
- Iterator SectionIter = sectList.iterator();
- while (SectionIter.hasNext()){
- sect = (Section)SectionIter.next();
-
- //
- // Call each section class's toBuffer function.
- //
- try {
- sect.toBuffer(Do);
- }
- catch (BuildException e) {
- System.out.print(e.getMessage());
- throw new BuildException ("Compress.toBuffer failed at section");
- }
-
- }
- Do.close();
-
- synchronized (semaphore) {
- //
- // Call compress
- //
- byte[] fileBuffer = bo.toByteArray();
- Compress myCompress = new Compress(fileBuffer, fileBuffer.length);
-
- //
- // Add Compress header
- //
- CompressHeader Ch = new CompressHeader();
- Ch.SectionHeader.Size[0] = (byte)((myCompress.outputBuffer.length +
- Ch.GetSize()) &
- 0xff
- );
- Ch.SectionHeader.Size[1] = (byte)(((myCompress.outputBuffer.length +
- Ch.GetSize())&
- 0xff00) >> 8
- );
- Ch.SectionHeader.Size[2] = (byte)(((myCompress.outputBuffer.length +
- Ch.GetSize()) &
- 0xff0000) >> 16
- );
- Ch.SectionHeader.type = (byte) EFI_SECTION_COMPRESSION;
-
- //
- // Note: The compressName was not efsfective now. Using the
- // EFI_STANDARD_COMPRSSION for compressType .
- // That is follow old Genffsfile tools. Some code will be added for
- // the different compressName;
- //
- Ch.UncompressLen = fileBuffer.length;
- Ch.CompressType = EFI_STANDARD_COMPRESSION;
-
- //
- // Change header struct to byte buffer
- //
- byte [] headerBuffer = new byte[Ch.GetSize()];
- Ch.StructToBuffer(headerBuffer);
-
- //
- // First add CompressHeader to Buffer, then add Compress data.
- //
- buffer.write (headerBuffer);
- buffer.write(myCompress.outputBuffer);
-
- //
- // Buffer 4 Byte aligment
- //
- int size = Ch.GetSize() + myCompress.outputBuffer.length;
-
- while ((size & 0x03) != 0){
- size ++;
- buffer.writeByte(0);
- }
- //
- // Delete temp file
- //
- //di.close();
- //compressOut.delete();
- }
-
- }
- catch (Exception e){
- throw new BuildException("compress.toBuffer failed!\n");
- }
- }
-
- /**
- getCompressName
-
- This function is to get compressName.
-
- @return The compressName.
- **/
- public String getCompressName() {
- return compressName;
- }
-
- /**
- setCompressName
-
- This function is to set compressName.
-
- @param compressName The string of compressName
- **/
- public void setCompressName(String compressName) {
- this.compressName = compressName;
- }
-
- /**
- addSectFile
-
- This function is to add sectFile element to SectList.
-
- @param sectFile SectFile element which succeed from section class.
- **/
- public void addSectFile (SectFile sectFile) {
- sectList.add(sectFile);
-
- }
-
- /**
- addTool
-
- This function is to add tool element to SectList.
- @param tool Tool element which succeed from section class.
- **/
- public void addTool (Tool tool) {
- sectList.add(tool);
- }
-
- public int getAlignment() {
- return alignment;
- }
-
- public void setAlignment(int alignment) {
- if (alignment > 7) {
- this.alignment = 7;
- } else {
- this.alignment = alignment;
- }
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java
deleted file mode 100644
index 773df8e13b..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/** @file
- CreateMtFileTask class.
-
- CreateMtFileTask is used to call CreateMtFile.exe to create MT file.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- CreateMtFileTask class.
-
- CreateMtFileTask is used to call CreateMtFile.exe to create MT file.
-**/
-public class CreateMtFileTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private String toolName = "CreateMtFile";
- //
- // file size
- //
- private ToolArg fileSize = new ToolArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = ".";
-
- /**
- execute
-
- StripTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
-
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + outputFile + fileSize;
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.outputFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getFileSize
-
- This function is to get class member "fileSize".
-
- @return fileSize string of file size.
- **/
- public String getFileSize() {
- return this.fileSize.getValue();
- }
-
- /**
- setFileSize
-
- This function is to set class member "fileSize".
-
- @param fileSize
- string of file size value.
- **/
- public void setFileSize(String fileSize) {
- this.fileSize.setArg(" ", fileSize);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", outputFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Database.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Database.java
deleted file mode 100644
index ade950807c..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Database.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- Database class.
-
- Database represents an exceplicity name list of database file.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-/**
- Database represents an exceplicity name list of database file.
-**/
-public class Database extends NestElement {
- /**
- Override NestElement.toString() to return a string with leading "-db"
-
- @return String
- **/
- public String toString() {
- return super.toString(" -db ");
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java
deleted file mode 100644
index f36aad6481..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/** @file
- EfiCompressTask class.
-
- EfiCompressTask is used to call EfiCompress.exe to strip input file.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- EfiCompressTask class.
-
- EfiCompressTask is used to call EfiCompress.exe to strip input file.
-**/
-public class EfiCompressTask extends Task implements EfiDefine {
- //
- //
- //
- private final static String toolName = "EfiCompress";
- //
- // input file
- //
- private FileArg inputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = ".";
-
- /**
- execute
-
- EfiCompressTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
-
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + inputFile + outputFile;
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList() + " => "
- + this.outputFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
-
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile".
-
- @return string of input file name.
- **/
- public String getInputFile() {
- return inputFile.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", outputFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiDefine.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiDefine.java
deleted file mode 100644
index 6f12f00f43..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiDefine.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- EfiDefine class.
-
- EfiDefine class records the UEFI return status value.
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.framework.tasks;
-
-/**
- EfiDefine class.
-
- EfiDefine class records the UEFI return status value.
-**/
-public interface EfiDefine {
- //
- // EFI define Interface for define constant related to UEFI.
- //
- static final int EFI_SUCCESS = 0;
- static final int EFI_LOAD_ERROR = 0x80000001;
- static final int EFI_INVALID_PARAMETER = 0x80000002;
- static final int EFI_UNSUPPORTED = 0x80000003;
- static final int EFI_BAD_BUFFER_SIZE = 0x80000004;
- static final int EFI_BUFFER_TOO_SMALL = 0x80000005;
- static final int EFI_NOT_READY = 0x80000006;
- static final int EFI_DEVICE_ERROR = 0x80000007;
- static final int EFI_WRITE_PROTECTED = 0x80000008;
- static final int EFI_OUT_OF_RESOURCES = 0x80000009;
- static final int EFI_VOLUME_CORRUPTED = 0x8000000a;
- static final int EFI_VOLUME_FULL = 0x8000000b;
- static final int EFI_NO_MEDIA = 0x8000000c;
- static final int EFI_MEDIA_CHANGED = 0x8000000d;
- static final int EFI_NOT_FOUND = 0x8000000e;
- static final int EFI_ACCESS_DENIED = 0x8000000f;
- static final int EFI_NO_RESPONSE = 0x80000010;
- static final int EFI_NO_MAPPING = 0x80000011;
- static final int EFI_TIMEOUT = 0x80000012;
- static final int EFI_NOT_STARTED = 0x80000013;
- static final int EFI_ALREADY_STARTED = 0x80000014;
- static final int EFI_ABORTED = 0x80000015;
- static final int EFI_ICMP_ERROR = 0x80000016;
- static final int EFI_TFTP_ERROR = 0x80000017;
- static final int EFI_PROTOCOL_ERROR = 0x80000018;
- static final int EFI_INCOMPATIBLE_VERSION = 0x80000019;
- static final int EFI_SECURITY_VIOLATION = 0x80000020;
- static final int EFI_CRC_ERROR = 0x80000021;
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java
deleted file mode 100644
index acfb2ba572..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/** @file
- EfiRomTask class.
-
- EfiRomTask is used to call FlashMap.exe to lay out the flash.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-import java.util.LinkedList;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.tianocore.common.logger.EdkLog;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-/**
- SecFixupTask class.
-
- SecFixupTask is used to call SecFixup.exe to fix up sec image.
- **/
-public class EfiRomTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private final static String toolName = "EfiRom";
-
- //
- // Flash default file
- //
- private ToolArg verbose = new ToolArg();
-
- //
- // Flash device
- //
- private ToolArg venderId = new ToolArg();
-
- //
- // Flash device Image
- //
- private ToolArg deviceId = new ToolArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // binary file
- //
- private Input binaryFileList = new Input();
-
- //
- // Efi PE32 image file
- //
- private Input pe32FileList = new Input();
-
- //
- // Compress efi PE32 image file
- //
- private Input pe32ComprFileList = new Input();
-
- //
- // Hex class code in the PCI data strutor header
- //
- private ToolArg classCode = new ToolArg();
-
- //
- // Hex revision in the PCI data header.
- //
- private ToolArg revision = new ToolArg();
-
- //
- // Dump the headers of an existing option rom image.
- //
- private ToolArg dump = new ToolArg();
-
- //
- // output directory
- //
- private String outputDir = ".";
-
- //
- // command and argument list
- //
- LinkedList<String> argList = new LinkedList<String>();
-
- /**
- execute
-
- EfiRomTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
-
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- String argument = "" + verbose + venderId + deviceId + dump + revision + classCode
- + binaryFileList.toStringWithSinglepPrefix(" -b ")
- + pe32FileList.toStringWithSinglepPrefix(" -e ")
- + pe32ComprFileList.toStringWithSinglepPrefix(" -ec ")
- + outputFile;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, binaryFileList.toFileList()
- + pe32FileList.toFileList() + pe32ComprFileList.toFileList()
- + " => " + outputFile.toFileList());
-
- int exitCode = runner.execute();
- if (exitCode != 0) {
- //
- // command execution fail
- //
- EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));
- throw new BuildException(toolName + " failed!");
- } else {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getVerbose
-
- This function is to get class member "verbose"
-
- @return verbose for verbose output.
- **/
- public String getVerbose() {
- return verbose.getValue();
- }
-
- /**
- setVerbose
-
- This function is to set class member "verbose"
-
- @param verbose for verbose output.
- **/
- public void setVerbose(boolean verbose) {
- if (verbose){
- this.verbose.setArg(" -", "p");
- }
- }
-
- /**
- getVenderId
-
- This function is to get class member "venderId"
-
- @return venderId String of venderId.
- **/
- public String getVenderId() {
- return venderId.getValue();
- }
-
- /**
- setVenderId
-
- This function is to set class member "venderId"
-
- @param venderId String of venderId.
- **/
- public void setVenderId(String venderId) {
- this.venderId.setArg(" -v ", venderId);
- }
-
- /**
- getDeviceId
-
- This function is to get class member "deviceId"
-
- @return deviceId String of device ID.
- **/
- public String getDeviceId() {
- return this.deviceId.getValue();
- }
-
- /**
- setDeviceId
-
- This function is to set class member "deviceId"
-
- @param deviceId String of device ID.
- **/
- public void setDeviceId(String deviceId) {
- this.deviceId.setArg(" -d ", deviceId);
- }
-
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile name of output directory.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "dscFile"
-
- @param outputFile name of DSC file
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -o ", outputFile);
- }
-
- /**
- getClassCode
-
- This function is to get class member "classCode"
-
- @return fdImage name of class code file.
- **/
- public String getClassCode() {
- return classCode.getValue();
- }
-
- /**
- setclassCode
-
- This function is to set class member "classCode"
-
- @param fdImage name of class code file.
- **/
- public void setclassCode(String classCode) {
- this.classCode.setArg(" -cc ", classCode);
- }
-
- /**
- getRevision
-
- This function is to get class member "revision".
-
- @return revision hex revision in the PDI data header.
- **/
- public String getRevision() {
- return revision.getValue();
- }
-
- /**
- setRevision
-
- This function is to set class member "revision"
-
- @param revision hex revision in the PDI data header.
- **/
- public void setRevision(String revision) {
- this.revision.setArg(" -rev ", revision);
- }
-
- /**
- getFlashDeviceImage
-
- This function is to get class member "dump"
-
- @return flashDeviceImage name of flash device image
- **/
- public String getDump() {
- return dump.getValue();
- }
-
- /**
- setFlashDeviceImage
-
- This function is to set class member "dump"
-
- @param flashDeviceImage name of flash device image
- **/
- public void setDump(boolean dump) {
- if (dump) {
- this.dump.setArg(" -", "dump");
- }
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir string of output directory
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-
- /**
- addBinaryFile
-
- This function is to add binary file to binaryFile list.
-
- @param binaryFile name of binary file.
- **/
- public void addConfiguredBinaryFile(Input binaryFile){
- this.binaryFileList.insert(binaryFile);
- }
-
- /**
- addPe32File
-
- This function is to add pe32 file to pe32File list.
-
- @param pe32File name of pe32 file.
- **/
- public void addConfiguredPe32File(Input pe32File){
- this.pe32FileList.insert(pe32File);
- }
-
- /**
- addPe32ComprFile
-
- This function os to add compressed pe32 file to pe32ComprFile list.
-
- @param pe32ComprFile name of compressed pe32 file.
- **/
- public void addConfiguredPe32ComprFile(Input pe32ComprFile){
- this.pe32ComprFileList.insert(pe32ComprFile);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsHeader.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsHeader.java
deleted file mode 100644
index 24cb3df266..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsHeader.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/** @file
- FfsHeader
-
- FfsHeader class describe the struct of Ffs file header.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import org.apache.tools.ant.BuildException;
-
-/**
- FfsHeader
-
- FfsHeader class describe the struct of Ffs file header.
-**/
-public class FfsHeader {
-
- /**
- FfsGuid
-
- FfsGuid is interal class of FfsHeader, it describe the struct of Guid.
- **/
- public class FfsGuid {
-
- int data1 = 0;
- short data2 = 0;
- short data3 = 0;
- byte[] data4 = new byte[8];
- byte[] dataBuffer = new byte[16];
-
- /**
- bufferToStruct
-
- This function is to convert GUID to ffsGuid class member.
-
- @param dataBuffer Buffer contained the GUID value in byte.
- For example: if the input string as : "A6F691AC
- 31C8 4444 854C E2C1A6950F92"
- Then Data1: AC91F6A6
- Data2: C831
- Data3: 4444
- Data4: 4C85E2C1A6950F92
- **/
- public void bufferToStruct (byte[] dataBuffer){
- if (dataBuffer.length != 16) {
- throw new BuildException ("Buffer is not sized [" + dataBuffer.length + "] for data type, GUID!");
- }
-
- data1 = (int)(dataBuffer[3]& 0xff);
- data1 = data1 << 8;
- data1 = (int)data1 | (dataBuffer[2]& 0xff);
- data1 = ((data1 << 8) & 0xffff00) | (dataBuffer[1]& 0xff);
- data1 = ((data1 << 8) & 0xffffff00) | (dataBuffer[0]& 0xff);
-
-
- data2 = (short) (dataBuffer[5] & 0xff);
- data2 = (short)((data2 << 8) | (dataBuffer[4]& 0xff));
-
- data3 = (short)(dataBuffer[7] & 0xff);
- data3 = (short)((data3 << 8) | (dataBuffer[6] & 0xff));
-
- for (int i = 0; i < 8; i++) {
- data4[i] = dataBuffer[i+8];
- }
-
- }
-
- /**
- structToBuffer
-
- This function is to store ffsHeader class member to buffer.
-
- @return Byte buffer which contained the ffsHeader class member
- **/
- public byte[] structToBuffer (){
-
- byte[] buffer = new byte [16];
-
- buffer[3] = (byte)(data1 & 0x000000ff);
- buffer[2] = (byte)((data1 & 0x0000ff00)>> 8);
- buffer[1] = (byte)((data1 & 0x00ff0000)>> 16);
- buffer[0] = (byte)((data1 & 0xff000000)>> 24);
-
- buffer[5] = (byte)(data2 & 0x00ff);
- buffer[4] = (byte)((data2 & 0xff00)>> 8);
-
- buffer[7] = (byte)(data3 & 0x00ff);
- buffer[6] = (byte)((data3 & 0xff00)>> 8);
-
- for (int i = 8; i < 16; i++) {
- buffer[i] = data4[i-8];
- }
- return buffer;
- }
-
-
- }
-
- /**
- integrityCheckSum
-
- This class is used to record the struct of checksum.
- **/
- public class IntegrityCheckSum {
- byte header;
- byte file;
- }
-
- ///
- /// Guid
- ///
- FfsGuid name = new FfsGuid();
-
- ///
- /// CheckSum
- ///
- IntegrityCheckSum integrityCheck = new IntegrityCheckSum();
-
- ///
- /// File type
- ///
- byte fileType;
- ///
- /// Ffs attributes.
- ///
- byte ffsAttributes;
- ///
- /// Ffs file size
- ///
- byte[] ffsFileSize = new byte[3];
- ///
- /// Ffs state.
- ///
- byte ffsState;
-
- /**
- structToBuffer
-
- This function is to store FfsHeader class member to buffer.
-
- @return Byte buffer which contained the FfsHeader class member.
- **/
- public byte[] structToBuffer () {
- int i;
- byte[] buffer1;
- byte[] buffer = new byte[24];
- buffer1 = name.structToBuffer();
-
- for (i = 0; i < 16; i++) {
- buffer[i] = buffer1[i];
- }
-
- buffer[16] = integrityCheck.header;
- buffer[17] = integrityCheck.file;
- buffer[18] = fileType;
- buffer[19] = ffsAttributes;
-
- for (i=20; i < 23; i++) {
- buffer[i] = ffsFileSize[i-20];
- }
-
- buffer[23] = ffsState;
- return buffer;
- }
-
- /**
- getSize
-
- This function is to get the size of FfsHeader in byte.
-
- @return The size of FfsHeader.
- **/
- public int getSize(){
- return 24;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsTypes.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsTypes.java
deleted file mode 100644
index 6afc3a90ad..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsTypes.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/** @file
- FfsTypes class.
-
- FfsType class record the costant value of Ffs File attribute, type, and
- architecture.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-/**
- FfsType
-
- FfsType class record the costant value of Ffs File attribute, type, and
- architecture.
-
-**/
-public interface FfsTypes {
- //
- // Ffs file attributes
- //
- static final int FFS_ATTRIB_TAIL_PRESENT = 0x01;
-
- static final int FFS_ATTRIB_RECOVERY = 0x02;
-
- static final int FFS_ATTRIB_HEADER_EXTENSION = 0x04;
-
- static final int FFS_ATTRIB_DATA_ALIGNMENT = 0x38;
-
- static final int FFS_ATTRIB_CHECKSUM = 0x40;
-
- //
- // Ffs states difinitions
- //
- static final int EFI_FILE_HEADER_CONSTRUCTION = 0x01;
-
- static final int EFI_FILE_HEADER_VALID = 0x02;
-
- static final int EFI_FILE_DATA_VALID = 0x04;
-
- static final int EFI_FILE_MARKED_FOR_UPDATE = 0x08;
-
- static final int EFI_FILE_DELETED = 0x10;
-
- static final int EFI_FILE_HEADER_INVALID = 0x20;
-
- //
- // FFS_FIXED_CHECKSUM is the default checksum value used when the
- // FFS_ATTRIB_CHECKSUM attribute bit is clear note this is NOT an
- // architecturally defined value, but is in this file for implementation
- // convenience
- //
- static final int FFS_FIXED_CHECKSUM = 0x5a;
-
- //
- // Architectural file types
- //
- static final int EFI_FV_FILETYPE_ALL = 0x00;
-
- static final int EFI_FV_FILETYPE_RAW = 0x01;
-
- static final int EFI_FV_FILETYPE_FREEFORM = 0x02;
-
- static final int EFI_FV_FILETYPE_SECURITY_CORE = 0x03;
-
- static final int EFI_FV_FILETYPE_PEI_CORE = 0x04;
-
- static final int EFI_FV_FILETYPE_DXE_CORE = 0x05;
-
- static final int EFI_FV_FILETYPE_PEIM = 0x06;
-
- static final int EFI_FV_FILETYPE_DRIVER = 0x07;
-
- static final int EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER = 0x08;
-
- static final int EFI_FV_FILETYPE_APPLICATION = 0x09;
-
- static final int EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE = 0x0B;
-
- static final int EFI_FV_FILETYPE_FFS_PAD = 0xF0;
-
- //
- // Ffs file type
- //
- static final String EFI_FV_FFS_FILETYPE_STR = ".FFS";
- static final String EFI_FV_DXE_FILETYPE_STR = ".DXE";
- static final String EFI_FV_PEI_FILETYPE_STR = ".PEI";
- static final String EFI_FV_APP_FILETYPE_STR = ".APP";
- static final String EFI_FV_FVI_FILETYPE_STR = ".FVI";
- static final String EFI_FV_SEC_FILETYPE_STR = ".SEC";
-
- //
- // Section Type copy from EfiImageFormat.h
- //
- static final int EFI_SECTION_COMPRESSION = 0x01;
- static final int EFI_SECTION_GUID_DEFINED = 0x02;
-
- //
- // CompressionType values, we currently don't support
- // "EFI_CUSTOMIZED_COMPRESSION".
- //
- static final int EFI_NOT_COMPRESSED = 0x00;
- static final int EFI_STANDARD_COMPRESSION = 0x01;
- static final int EFI_CUSTOMIZED_COMPRESSION = 0x02;
-
-
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java
deleted file mode 100644
index 86adb07581..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for file path
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-/**
- FileArg class is defined to represent tool's argument which specifies file path.
- **/
-public class FileArg extends ToolArg {
- /**
- Default constructor
- **/
- public FileArg() {
- }
-
- /**
- Constructor which accepts argument prefix and its value as parameters
-
- @param prefix The prefix of argument
- @param value The value of argument
- **/
- public FileArg(String prefix, String value) {
- super(prefix);
- this.setValue(value);
- }
-
- /**
- Set the prefix and value of an argument
-
- @param prefix The prefix of argument
- @param value The value of argument
- **/
- public void setArg(String prefix, String value) {
- super.setPrefix(prefix);
- this.setValue(value);
- }
-
- /**
- Set the value of an argument
-
- @param value The value of the argument
- **/
- public void setValue(String value) {
- super.setFile(value);
- }
-
- /**
- Add a value of an argument
-
- @param value The value of the argument
- **/
- public void insValue(String value) {
- super.insFile(value);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java
deleted file mode 100644
index 9a3c61e6c8..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java
+++ /dev/null
@@ -1,848 +0,0 @@
-/** @file
- FlashMapTask class.
-
- FlashMapTask is used to call FlashMap.exe to lay out the flash.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.BufferedReader;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- * FlashMapTask class.
- *
- * FlashMapTask is used to call FlashMap.exe to generate flash map defition files and fd files.
- */
-public class FlashMapTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private static final String toolName = "FlashMap";
-
- //
- //
- //
- private static Pattern fileBlock = Pattern.compile("\\s*File\\s*\\{([^\\{\\}]+)\\}");
- private static Pattern fileNameDef = Pattern.compile("\\bName\\s*=\\s*\"([^\"]+)\"");
-
- //
- // Flash definition file
- //
- private FileArg flashDefFile = new FileArg();
-
- //
- // Flash device
- //
- private ToolArg flashDevice = new ToolArg();
-
- //
- // Flash device Image
- //
- private ToolArg flashDeviceImage = new ToolArg();
-
- //
- // MCI file
- //
- private FileArg mciFile = new FileArg();
-
- //
- // MCO file
- //
- private FileArg mcoFile = new FileArg();
-
- //
- // Discover FD image
- //
- private ToolArg fdImage = new ToolArg();
-
- //
- // Dsc file
- //
- private FileArg dscFile = new FileArg();
-
- //
- // Asm INC file
- //
- private FileArg asmIncFile = new FileArg();
-
- //
- // Image out file
- //
- private FileArg imageOutFile = new FileArg();
-
- //
- // Header file
- //
- private FileArg headerFile = new FileArg();
-
- //
- // Input string file
- //
- private String inStrFile = "";
-
- //
- // Output string file
- //
- private String outStrFile = "";
-
- //
- //
- //
- private FileArg strFile = new FileArg();
- //
- // Base address
- //
- private ToolArg baseAddr = new ToolArg();
-
- //
- // Aligment
- //
- private ToolArg aligment = new ToolArg();
-
- //
- // Padding value
- //
- private ToolArg padValue = new ToolArg();
-
- //
- // output directory
- //
- private String outputDir = ".";
-
- //
- // MCI file array
- //
- FileArg mciFileArray = new FileArg();
-
- /**
- execute
-
- FlashMapTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
- if (isUptodate()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, headerFile.toFileList()
- + imageOutFile.toFileList()
- + mcoFile.toFileList()
- + dscFile.toFileList()
- + asmIncFile.toFileList()
- + outStrFile
- + " is up-to-date!");
- return;
- }
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- //
- // add substituted input file and output file
- //
- if (this.inStrFile != null && this.outStrFile != null
- && this.inStrFile.length() > 0 && this.outStrFile.length() > 0) {
- strFile.setPrefix(" -strsub ");
- strFile.insValue(this.inStrFile);
- strFile.insValue(this.outStrFile);
- }
-
- String argument = "" + flashDefFile + flashDevice + flashDeviceImage
- + mciFile + mcoFile + fdImage + dscFile + asmIncFile
- + imageOutFile + headerFile + strFile + baseAddr
- + aligment + padValue + mciFileArray;
-
-
- //
- // lauch the program
- //
- // ProcessBuilder pb = new ProcessBuilder(argList);
- // pb.directory(new File(outputDir));
- int exitCode = 0;
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
-
- if (outputDir != null) {
- runner.setWorkingDirectory(new File(outputDir));
- }
- //
- // log command line string.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, flashDefFile.toFileList()
- + mciFile.toFileList()
- + mciFileArray.toFileList()
- + fdImage.toFileList()
- + inStrFile
- + " => "
- + headerFile.toFileList()
- + imageOutFile.toFileList()
- + mcoFile.toFileList()
- + dscFile.toFileList()
- + asmIncFile.toFileList()
- + outStrFile);
-
- exitCode = runner.execute();
- if (exitCode != 0) {
- EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));
- } else {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "FlashMap succeeded!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- } finally {
- if (exitCode != 0) {
- throw new BuildException("FlashMap failed!");
- }
- }
- }
-
- /**
- getFlashDefFile
-
- This function is to get class member "flashDefFile"
-
- @return flashDeFile Name of flash definition file.
- **/
- public String getFlashDefFile() {
- return this.flashDefFile.getValue();
- }
-
- /**
- setFlashDefFile
-
- This function is to set class member "flashDefFile"
-
- @param flashDefFile
- Name of flash definition file.
- **/
- public void setFlashDefFile(String flashDefFile) {
- this.flashDefFile.setArg(" -fdf ", flashDefFile);
- }
-
- /**
- getAligment
-
- This function is to get class member "aligment"
-
- @return aligment String of aligment value.
- **/
- public String getAligment() {
- return this.aligment.getValue();
- }
-
- /**
- setAligment
-
- This function is to set class member "aligment"
-
- @param aligment
- String of aligment value.
- **/
- public void setAligment(String aligment) {
- this.aligment.setArg(" -align ", aligment);
- }
-
- /**
- getAsmIncFile
-
- This function is to get class member "asmIncFile"
-
- @return asmIncFile String of ASM include file.
- **/
- public String getAsmIncFile() {
- return this.asmIncFile.getValue();
- }
-
- /**
- setAsmIncFile
-
- This function is to set class member "asmIncFile"
-
- @param asmIncFile
- String of ASM include file.
- **/
- public void setAsmIncFile(String asmIncFile) {
- this.asmIncFile.setArg(" -asmincfile ", asmIncFile);
- }
-
- /**
- getBaseAddr
-
- This function is to get class member "baseAddr"
-
- @return baseAddr String of base address value.
- **/
- public String getBaseAddr() {
- return this.baseAddr.getValue();
- }
-
- /**
- setBaseAddr
-
- This function is to set class member "baseAddr"
-
- @param baseAddr
- String of base address value.
- **/
- public void setBaseAddr(String baseAddr) {
- this.baseAddr.setArg(" -baseaddr ", baseAddr);
- }
-
- /**
- getDscFile
-
- This function is to get class member "dscFile"
-
- @return dscFile name of DSC file
- **/
- public String getDscFile() {
- return this.dscFile.getValue();
- }
-
- /**
- setDscFile
-
- This function is to set class member "dscFile"
-
- @param dscFile
- name of DSC file
- **/
- public void setDscFile(String dscFile) {
- this.dscFile.setArg(" -dsc ", dscFile);
- }
-
- /**
- getFdImage
-
- This function is to get class member "fdImage"
-
- @return fdImage name of input FDI image file.
- **/
- public String getFdImage() {
- return this.fdImage.getValue();
- }
-
- /**
- setFdImage
-
- This function is to set class member "fdImage"
-
- @param fdImage
- name of input FDI image file.
- **/
- public void setFdImage(String fdImage) {
- this.fdImage.setArg(" -discover ", fdImage);
- }
-
- /**
- getFlashDevice
-
- This function is to get class member "flashDevice".
-
- @return flashDevice name of flash device.
- **/
- public String getFlashDevice() {
- return this.flashDevice.getValue();
- }
-
- /**
- setFlashDevice
-
- This function is to set class member "flashDevice"
-
- @param flashDevice
- name of flash device.
- **/
- public void setFlashDevice(String flashDevice) {
- this.flashDevice.setArg(" -flashdevice ", flashDevice);
- }
-
- /**
- getFlashDeviceImage
-
- This function is to get class member "flashDeviceImage"
-
- @return flashDeviceImage name of flash device image
- **/
- public String getFlashDeviceImage() {
- return this.flashDeviceImage.getValue();
- }
-
- /**
- setFlashDeviceImage
-
- This function is to set class member "flashDeviceImage"
-
- @param flashDeviceImage
- name of flash device image
- **/
- public void setFlashDeviceImage(String flashDeviceImage) {
- this.flashDeviceImage.setArg(" -flashdeviceimage ", flashDeviceImage);
-
- }
-
- /**
- getHeaderFile
-
- This function is to get class member "headerFile"
-
- @return headerFile name of include file
- **/
- public String getHeaderFile() {
- return this.headerFile.getValue();
- }
-
- /**
- setHeaderFile
-
- This function is to set class member "headerFile"
-
- @param headerFile
- name of include file
- **/
- public void setHeaderFile(String headerFile) {
- this.headerFile.setArg(" -hfile ", headerFile);
- }
-
- /**
- getImageOutFile
-
- This function is to get class member "imageOutFile"
-
- @return imageOutFile name of output image file
- **/
- public String getImageOutFile() {
- return this.imageOutFile.getValue();
- }
-
- /**
- setImageOutFile
-
- This function is to set class member "ImageOutFile"
-
- @param imageOutFile
- name of output image file
- **/
- public void setImageOutFile(String imageOutFile) {
- this.imageOutFile.setArg(" -imageout ", imageOutFile);
- }
-
- /**
- getInStrFile
-
- This function is to get class member "inStrFile"
-
- @return inStrFile name of input file which used to replace symbol names.
- **/
- public String getInStrFile() {
- return this.inStrFile;
- }
-
- /**
- setInStrFile
-
- This function is to set class member "inStrFile"
-
- @param inStrFile
- name of input file which used to replace symbol names.
- **/
- public void setInStrFile(String inStrFile) {
- this.inStrFile = inStrFile;
- }
-
- /**
- getMciFile
-
- This function is to get class member "mciFile"
-
- @return mciFile name of input microcode file
- **/
- public String getMciFile() {
- return this.mciFile.getValue();
- }
-
- /**
- setMciFile
-
- This function is to set class member "mciFile"
-
- @param mciFile
- name of input microcode file
- **/
- public void setMciFile(String mciFile) {
- this.mciFile.setArg(" -mci ", mciFile);
- }
-
- /**
- getMcoFile
-
- This function is to get class member "mcoFile"
-
- @return mcoFile name of output binary microcode image
- **/
- public String getMcoFile() {
- return this.mcoFile.getValue();
- }
-
- /**
- setMcoFile
-
- This function is to set class member "mcoFile"
-
- @param mcoFile
- name of output binary microcode image
- **/
- public void setMcoFile(String mcoFile) {
- this.mcoFile.setArg(" -mco ", mcoFile);
- }
-
- /**
- getOutStrFile
-
- This function is to get class member "outStrFile"
-
- @return outStrFile name of output string substitution file
- **/
- public String getOutStrFile() {
- return this.outStrFile;
- }
-
- /**
- setOutStrFile
-
- This function is to set class member "outStrFile"
-
- @param outStrFile
- name of output string substitution file
- **/
- public void setOutStrFile(String outStrFile) {
- this.outStrFile = outStrFile;
- }
-
- /**
- getPadValue
-
- This function is to get class member "padValue"
-
- @return padValue string of byte value to use as padding
- **/
- public String getPadValue() {
- return this.padValue.getValue();
- }
-
- /**
- setPadValue
-
- This function is to set class member "padValue"
-
- @param padValue
- string of byte value to use as padding
- **/
- public void setPadValue(String padValue) {
- this.padValue.setArg(" -padvalue ", padValue);
- }
-
- /**
- addMciFile
-
- This function is to add Microcode binary file
-
- @param mciFile
- instance of input class
- **/
- public void addConfiguredMciFile(FileArg mciFile) {
- this.mciFileArray.setPrefix(" -mcmerge ");
- this.mciFileArray.insert(mciFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-
- //
- // Dependency check
- //
- private boolean isUptodate() {
- long srcTimeStamp = 0;
- String srcName = "";
- String dstName = "";
- long timeStamp = 0;
-
- if (!flashDefFile.isEmpty()) {
- srcName = flashDefFile.getValue();
- timeStamp = new File(srcName).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
-
- if (!mciFile.isEmpty()) {
- srcName = mciFile.getValue();
- timeStamp = new File(srcName).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
-
- if (!fdImage.isEmpty()) {
- srcName = fdImage.getValue();
- timeStamp = new File(srcName).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
-
- if (inStrFile.length() != 0) {
- srcName = inStrFile;
- timeStamp = new File(srcName).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
-
- if (!mciFileArray.isEmpty()) {
- for (int i = 0; i < mciFileArray.nameList.size(); ++i) {
- srcName += mciFileArray.nameList.get(i) + " ";
- timeStamp = new File(mciFileArray.nameList.get(i)).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
- }
-
- if (!headerFile.isEmpty()) {
- dstName = headerFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- if (!imageOutFile.isEmpty()) {
- dstName = imageOutFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
-
- //
- // we need to check the time stamp of each FV file specified in fdf file
- //
- if (!isFdUptodate(dstName, getFvFiles(flashDefFile.getValue()))) {
- return false;
- }
- }
-
- if (!mcoFile.isEmpty()) {
- dstName = mcoFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- if (!dscFile.isEmpty()) {
- dstName = dscFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- if (!asmIncFile.isEmpty()) {
- dstName = asmIncFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- if (outStrFile.length() != 0) {
- dstName = outStrFile;
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- return true;
- }
-
- //
- // Parse the flash definition file and find out the FV file names
- //
- private List<String> getFvFiles(String fdfFileName) {
- File fdfFile = new File(fdfFileName);
- int fileLength = (int)fdfFile.length();
- char[] fdfContent = new char[fileLength];
- List<String> fileList = new ArrayList<String>();
-
- try {
- FileReader reader = new FileReader(fdfFile);
- BufferedReader in = new BufferedReader(reader);
-
- in.read(fdfContent, 0, fileLength);
- String str = new String(fdfContent);
-
- //
- // match the
- // File {
- // ...
- // }
- // block
- //
- Matcher matcher = fileBlock.matcher(str);
- while (matcher.find()) {
- String fileBlockContent = str.substring(matcher.start(1), matcher.end(1));
- //
- // match the definition like
- // Name = "..."
- //
- Matcher nameMatcher = fileNameDef.matcher(fileBlockContent);
- if (nameMatcher.find()) {
- fileList.add(fileBlockContent.substring(nameMatcher.start(1), nameMatcher.end(1)));
- }
- }
-
- in.close();
- reader.close();
- } catch (Exception ex) {
- throw new BuildException(ex.getMessage());
- }
-
- return fileList;
- }
-
- private boolean isFdUptodate(String fdFile, List<String> fvFileList) {
- String fvDir = ".";
- File fd = new File(fdFile);
-
- if (outputDir.equals(".")) {
- if (!fd.isAbsolute()) {
- //
- // If we cannot get the absolute path of fd file, we caanot
- // get its time stamp. Re-generate it always in such situation.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "Cannot retrieve the time stamp of " + fdFile);
- return false;
- }
- fvDir = fd.getParent();
- } else {
- fvDir = outputDir;
- if (!fd.isAbsolute()) {
- fd = new File(fvDir + File.separator + fdFile);
- }
- }
-
- long fdTimeStamp = fd.lastModified();
- for (int i = 0; i < fvFileList.size(); ++i) {
- File fv = new File(fvDir + File.separator + fvFileList.get(i));
- if (fv.lastModified() > fdTimeStamp) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, fv.getPath() + " has been changed since last build!");
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java
deleted file mode 100644
index 78d9cbeb18..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/** @file
- FwImageTask class.
-
- FwImageTask is used to call FwImage.ext to generate the FwImage.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- FwImageTask class.
-
- FwImageTask is used to call FwImage.ext to generate the FwImage.
-**/
-public class FwImageTask extends Task implements EfiDefine {
- //
- // fwimage tool name
- //
- private static String toolName = "FwImage";
- //
- // time&data
- //
- private ToolArg time = new ToolArg();
- //
- // input PE image
- //
- private FileArg peImage = new FileArg();
- //
- // output EFI image
- //
- private FileArg outImage = new FileArg();
- //
- // component type
- //
- private ToolArg componentType = new ToolArg();
-
- /**
- execute
-
- FwimageTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- String argument = "" + time + componentType + peImage + outImage;
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, peImage.toFileList() + " => " + outImage.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "FwImage succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException("FwImage failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- setTime
-
- This function is to set operation of class member "time".
-
- @param time string of time
- **/
- public void setTime(String time) {
- this.time.setArg(" -t ", time);
- }
-
- /**
- getTime
-
- This function is to get class member "time"
- @return time string of time
- **/
- public String getTime() {
- return this.time.getValue();
- }
-
- /**
- getPeImage
-
- This function is to get class member "peImage".
- @return name of PE image
- **/
- public String getPeImage() {
- return this.peImage.getValue();
- }
-
- /**
- setPeImage
-
- This function is to set class member "peImage"
- @param peImage name of PE image
- **/
- public void setPeImage(String peImage) {
- this.peImage.setArg(" ", peImage);
- }
-
- /**
- getOutImage
-
- This function is to get class member "outImage".
- @return name of output EFI image
- **/
- public String getOutImage() {
- return this.outImage.getValue();
- }
-
- /**
- setOutImage
-
- This function is to set class member "outImage".
- @param outImage name of output EFI image
- **/
- public void setOutImage(String outImage) {
- this.outImage.setArg(" ", outImage);
- }
-
- /**
- getComponentType
-
- This function is to get class member "componentType".
-
- @return string of componentType
- **/
- public String getComponentType() {
- return this.componentType.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "componentType".
- @param componentType string of component type
- **/
- public void setComponentType(String componentType) {
- this.componentType.setArg(" ", componentType);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java
deleted file mode 100644
index 40d38f349f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/** @file
- GenAcpiTable class.
-
- GenAcpiTable is used to call GenAcpiTable.exe to generate ACPI Table image .
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenAcpiTable class.
-
- GenAcpiTable is used to call GenAcpiTable.exe to generate ACPI Table image .
-**/
-public class GenAcpiTableTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private static String toolName = "GenAcpiTable";
-
- //
- // input file
- //
- private FileArg inputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = ".";
-
- /**
- execute
-
- StripTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + inputFile + outputFile;
-
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList() + " => "
- + this.outputFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile".
-
- @return string of input file name.
- **/
- public String getInputFile() {
- return inputFile.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", outputFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCRC32SectionTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCRC32SectionTask.java
deleted file mode 100644
index d9273acf7b..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCRC32SectionTask.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/** @file
- GenCRC32SectionTask class.
-
- GenCRC32SectionTask is to call GenCRC32Section.exe to generate crc32 section.
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenCRC32SectionTask
-
- GenCRC32SectionTask is to call GenCRC32Section.exe to generate crc32 section.
-
-**/
-public class GenCRC32SectionTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private static String toolName = "GenCRC32Section";
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
- //
- // inputFile list
- //
- private InputFile inputFileList = new InputFile();
-
- //
- // Project
- //
- static private Project project;
-
- /**
- execute
-
- GenCRC32SectionTask execute is to assemble tool command line & execute
- tool command line
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
-
- project = this.getOwningTarget().getProject();
- ///
- /// absolute path of efi tools
- ///
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName ;
- }
- //
- // assemble argument
- //
- String argument = "" + inputFileList.toStringWithSinglepPrefix(" -i ") + outputFile;
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, inputFileList.toFileList() + " => " + outputFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl){
- //
- // command execution success
- //
- EdkLog.log(this, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));
- // LAH Added This Line
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- addInputFile
-
- This function is to add a inputFile element into list
- @param inputFile : inputFile element
- **/
- public void addConfiguredInputfile(InputFile inputFile) {
- inputFileList.insert(inputFile);
- }
-
- /**
- get class member "outputFile"
- @return name of output file
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
- /**
- set class member "outputFile"
- @param outputFile : outputFile parameter
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -o ", outputFile);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java
deleted file mode 100644
index c5b74b5d7e..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/** @file
- GenCapsuleHdrTask class.
-
- GenCapsuleHdrTask is used to call GenCapsuleHdr.exe to generate capsule.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenCapsuleHdrTask class.
-
- GenCapsuleHdrTask is used to call GenCapsuleHdr.exe to generate capsule.
-**/
-public class GenCapsuleHdrTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private String toolName = "GenCapsuleHdr";
-
- //
- // script file
- //
- private FileArg scriptFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = ".";
-
- //
- // Verbose flag
- //
- private ToolArg verbose = new ToolArg();
-
- //
- // Dump flag
- //
- private ToolArg dump = new ToolArg();
-
- //
- // Split size
- //
- private ToolArg size = new ToolArg();
-
- //
- // capsule into one image flag
- //
- private ToolArg joinFlag = new ToolArg();
-
- //
- // capsule file
- //
- private FileArg capsuleFile = new FileArg();
-
-
- /**
- execute
-
- GenCapsuleHdrTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + this.verbose + this.dump + this.outputFile
- + this.scriptFile + this.size + this.joinFlag + this.capsuleFile;
-
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, scriptFile.toFileList() + " => " +
- outputFile.toFileList() + capsuleFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "scriptFile".
-
- @return string of input file name.
- **/
- public String getScriptFile() {
- return this.scriptFile.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setScriptFile(String scriptFile) {
- this.scriptFile.setArg(" -script ", scriptFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -o ", outputFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-
- /**
- getVerbose
-
- This function is to get class member "verbose"
-
- @return verbose the flag of verbose.
- **/
- public String getVerbose() {
- return this.verbose.getValue();
- }
-
- /**
- setVerbose
-
- This function is to set class member "verbose"
-
- @param verbose
- True or False.
- **/
- public void setVerbose(boolean verbose) {
- if (verbose) {
- this.verbose.setArg(" -", "v");
- }
- }
-
- /**
- getDump
-
- This function is to get class member "dump"
-
- @return verbose the flag of dump.
- **/
- public String getDump() {
- return dump.getValue();
- }
-
- /**
- setDump
-
- This function is to set class member "dump".
-
- @param dump
- True or False.
- **/
- public void setDump(boolean dump) {
- if (dump) {
- this.dump.setArg(" -", "dump");
- }
- }
-
- /**
- getSize
-
- This function is to set class member "size".
-
- @return size string of size value
- **/
- public String getSize() {
- return size.getValue();
- }
-
- /**
- setSize
-
- This function is to set class member "size".
-
- @param size string of size value.
- **/
- public void setSize(String size) {
- this.size.setArg(" -split ", size);
- }
-
- /**
- getCapsuleFile
-
- This function is to get class member "capsuleFile"
-
- @return capsuleFile capsule file name
- **/
- public String getCapsuleFile() {
- return capsuleFile.getValue();
- }
-
- /**
- setCapsuleFile
-
- This function is to set class member "capsuleFile"
-
- @param capsuleFile capsule file name
- **/
- public void setCapsuleFile(String capsuleFile) {
- this.capsuleFile.setArg(" ", capsuleFile);
- }
-
- /**
- isJoinFlag
-
- This function is to get class member "joinFlag"
-
- @return joinFlag flag of if need to join split capsule images into
- a single image.
- **/
- public String getJoinFlag() {
- return joinFlag.getValue();
- }
-
- /**
- setJoinFlag
-
- This function is to set class member "joinFlag"
-
- @param joinFlag flag of if need to join split capsule images into
- a single image.
- **/
- public void setJoinFlag(boolean joinFlag) {
- if (joinFlag){
- this.joinFlag.setArg(" -", "j");
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenDepexTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenDepexTask.java
deleted file mode 100644
index 0e0ad9cc2f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenDepexTask.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/** @file
- GenDepexTask class.
-
- GenDepexTask is to call GenDepex.exe to generate depex section.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenDepexTask
-
- GenDepexTask is to call GenDepex.exe to generate depex section.
-
-**/
-public class GenDepexTask extends Task implements EfiDefine {
- private static String toolName = "GenDepex";
- //
- // output binary dependency files name
- //
- private FileArg outputFile = new FileArg();
- //
- // input pre-processed dependency text files name
- //
- private FileArg inputFile = new FileArg();
- //
- // padding integer value
- //
- private ToolArg padding = new FileArg();
- /**
- execute
-
- GenDepexTask execute is to assemble tool command line & execute tool
- command line.
- */
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of edk tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of GenDepex tool
- //
- String argument = "" + inputFile + outputFile + padding;
- //
- // reture value of GenDepex execution
- //
- int returnVal = -1;
-
- try {
- Commandline commandLine = new Commandline();
- commandLine.setExecutable(command);
- commandLine.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
-
- Execute runner = new Execute(streamHandler, null);
- runner.setAntRun(project);
- runner.setCommandline(commandLine.getCommandline());
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));
- EdkLog.log(this, inputFile.toFileList() + " => " + outputFile.toFileList());
-
- returnVal = runner.execute();
- if (EFI_SUCCESS == returnVal) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenDepex succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));
- throw new BuildException("GenDepex failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
- @param outputFileName name of output file
- **/
- public void setOutputFile(String outputFileName) {
- this.outputFile.setArg(" -O ", outputFileName);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile".
-
- @return name of ouput file
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
-
- /**
- setInputFile
-
- This function is to set class member "inputFile".
- @param inputFileName name of inputFile
- **/
- public void setInputFile(String inputFileName) {
- this.inputFile.setArg(" -I ", inputFileName);
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile"
- @return name of input file
- **/
- public String getInputFile() {
- return this.inputFile.getValue();
- }
-
- /**
- setPadding
-
- This function is to set class member "padding"
- @param paddingNum padding value
- **/
- public void setPadding(String paddingNum) {
- this.padding.setArg(" -P ", paddingNum);
- }
-
- /**
- getPadding
-
- This function is to get class member "padding"
- @return value of padding
- **/
- public String getPadding() {
- return this.padding.getValue();
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java
deleted file mode 100644
index ebc26b92a4..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java
+++ /dev/null
@@ -1,1010 +0,0 @@
-/** @file
- GenFfsFileTask class.
-
- GenFfsFileTaks is to generate ffs file.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenFfsFileTask
-
- GenFfsFileTaks is to generate ffs file.
-
-**/
-public class GenFfsFileTask extends Task implements EfiDefine, FfsTypes {
- /**
- * GenFfsFile Task Class
- * class member
- * -baseName : module baseName
- * -ffsFileGuid : module Guid.
- * -ffsFileType : Ffs file type.
- * -ffsAttributeRecovery : The file is required for recovery.
- * -ffsAligment : The file data alignment (0 if none required). See FFS
- * specification for supported alignments (0-7 are only possible
- * values). *
- * -ffsAttributeCheckSum : The file data is checksummed. If this is FALSE a
- * value of 0x5A will be inserted in the file
- * checksum field of the file header. *
- * -sectFileDir : specifies the full path to the component build directory.
- * Required.
- * -ffsAttrib : Data recorde attribute added result.
- * -sectionList : List recorded all section elemet in task.
- */
- ///
- /// module baseName
- ///
- String baseName = "";
- ///
- ///
- ///
- String moduleType;
- ///
- /// module Guid
- ///
- String ffsFileGuid = "";
- ///
- /// Ffs file type
- ///
- String ffsFileType = "";
- ///
- /// ffsAttribHeaderExtension value is used to set the corresponding bit in
- /// the output FFS file header
- ///
- boolean ffsAttribHeaderExtension = false;
- ///
- /// ffsAttribTailPresent value is used to set the corresponding bit in the
- /// output FFS file header
- ///
- boolean ffsAttribTailPresent = false;
- ///
- /// ffsAttribRecovery value is used to set the corresponding bit in the
- /// output FFS file header
- ///
- boolean ffsAttribRecovery = false;
- ///
- /// ffsAttribDataAlignment value is used to set the corresponding bit in the output
- /// FFS file header.The specified FFS alignment must be a value between 0
- /// and 7 inclusive
- ///
- int ffsAttribDataAlignment = 0;
- ///
- /// ffsAttribChecksum value is used to set the corresponding bit in the
- /// output FFS file header
- ///
- boolean FfsAttribChecksum = false;
- ///
- /// Attribute is used to record the sum of all bit in the output FFS file.
- ///
- byte attributes = 0;
- ///
- /// The output directory of ffs file.
- ///
- String outputDir = "";
- ///
- /// List of section.
- ///
- List<Object> sectionList = new ArrayList<Object>();
-
- ///
- /// The path of Framewor_Tools_Paht.
- ///
- static String path = "";
-
- ///
- /// Gensection
- ///
- List<GenSectionTask> genSectList = new ArrayList<GenSectionTask>();
-
- /**
- execute
-
- GenFfsFileTask execute is to generate ffs file according to input section
- dscriptive information.
- **/
- public void execute() throws BuildException {
-
- String ffsSuffix = "";
- String outputPath = "";
-
- //
- // Get Fraemwork_Tools_Path
- //
- Project pj = this.getOwningTarget().getProject();
- path = pj.getProperty("env.FRAMEWORK_TOOLS_PATH");
-
- //
- // Check does the BaseName, Guid, FileType set value.
- //
- if (this.baseName.equals("")) {
- throw new BuildException ("Must set OutputFileBasename!\n");
- }
-
- if (this.ffsFileGuid.equals("")) {
- throw new BuildException ("Must set ffsFileGuid!\n");
- }
-
- if (this.ffsFileType.equals("")) {
- throw new BuildException ("Must set ffsFileType!\n");
- }
- //
- // Create ffs file. File name = FfsFileGuid + BaseName + ffsSuffix.
- // If outputDir's value was set, file will output to the outputDir.
- //
- ffsSuffix = TypeToSuffix (this.moduleType);
- if (!this.outputDir.equals("")) {
- String temp;
- outputPath = this.outputDir;
- temp = outputPath.replace('\\', File.separatorChar);
- outputPath = temp.replace('/', File.separatorChar);
- if (outputPath.charAt(outputPath.length()-1) != File.separatorChar) {
- outputPath = outputPath + File.separator;
- }
-
- }
-
- String ffsFilePath = outputPath + this.ffsFileGuid + '-' + this.baseName + ffsSuffix;
- File ffsFile = new File (ffsFilePath);
- try{
- genFfs(ffsFile);
- }catch (BuildException e){
- if (ffsFile != null && ffsFile.exists()){
- ffsFile.deleteOnExit();
- }
- throw new BuildException(e.getMessage());
-
- }
-
- }
-
- /**
- addCompress
-
- This function is to add compress section to section list.
- @param compress Section of compress
- **/
- public void addCompress(CompressSection compress) {
- this.sectionList.add(compress);
- }
-
- /**
- addTool
-
- This function is to add tool section to section list.
- @param tool Section of tool
- **/
- public void addTool(Tool tool) {
- this.sectionList.add(tool);
- }
-
- /**
- addSectionFile
-
- This function is to add sectFile section to section list.
- @param sectFile Section of sectFile.
- **/
- public void addSectFile (SectFile sectFile) {
- this.sectionList.add(sectFile);
- }
-
- /**
- getBaseName
-
- This function is to get basename
-
- @return String of base name
- **/
- public String getBaseName() {
- return this.baseName;
- }
-
- /**
- setBaseName
-
- This function is to set base name.
- @param baseName
- **/
- public void setBaseName(String baseName) {
- this.baseName = baseName.trim();
- }
-
- /**
- getFfsAligment
-
- This function is to get the ffsAligment
- @return The value of ffsAligment.
- **/
- public int getFfsAttribDataAlignment() {
- return this.ffsAttribDataAlignment;
- }
-
- /**
- setFfsAligment
-
- This function is to set ffsAligment
- @param ffsAligment The value of ffsAligment.
- **/
- public void setFfsAttribDataAlignment(String ffsAligment) {
- this.ffsAttribDataAlignment = stringToInt(ffsAligment.replaceAll(" ", "").toLowerCase());
- if (this.ffsAttribDataAlignment < 0 || this.ffsAttribDataAlignment > 7) {
- throw new BuildException ("FFS_ATTRIB_DATA_ALIGMENT must be an integer value from 0 through 7, inclusive");
- } else {
- attributes |= (((byte)this.ffsAttribDataAlignment) << 3);
- }
- }
-
- /**
- getFfsAttribCheckSum
-
- This function is to get ffsAttribCheckSum
-
- @return Value of ffsAttribChecksum
- **/
- public boolean getFfsAttribChecksum() {
- return this.FfsAttribChecksum;
- }
-
- /**
- setFfsAttribChecksum
-
- This function is to set ffsAttribChecksum
- @param ffsAttributeCheckSum Value of ffsAttribCheckSum
- **/
- public void setFfsAttribChecksum(boolean ffsAttributeCheckSum) {
- this.FfsAttribChecksum = ffsAttributeCheckSum;
- if (ffsAttributeCheckSum) {
- attributes |= FFS_ATTRIB_CHECKSUM;
- }
- }
-
- /**
- getFfsAttribRecovery
-
- This function is to get ffsAttribRecovery
- @return Value of ffsAttribRecovery
- **/
- public boolean getFfsAttribRecovery() {
- return this.ffsAttribRecovery;
- }
-
- /**
- setRecovery
-
- This function is to set ffsAttributeRecovery
-
- @param ffsAttributeRecovery Value of ffsAttributeRecovery
- **/
- public void setRecovery(boolean ffsAttributeRecovery) {
- this.ffsAttribRecovery = ffsAttributeRecovery;
- if (ffsAttributeRecovery) {
- attributes |= FFS_ATTRIB_RECOVERY;
- }
- }
-
- /**
- getFileGuid
-
- This function is to get fileGuid
- @return Guid
- **/
- public String getFileGuid() {
- return this.ffsFileGuid;
- }
-
- /**
- setFileGuid
-
- This function is to set fileGuid
- @param ffsFileGuid String of GUID
- **/
- public void setFileGuid(String ffsFileGuid) {
- this.ffsFileGuid = ffsFileGuid.trim();
- }
-
- /**
- getFfsFileType
-
- This function is to get ffsFileType.
-
- @return value of ffsFileType
- **/
- public String getFfsFileType() {
- return this.ffsFileType;
- }
-
- /**
- setFfsFileType
-
- This function is to set ffsFileType.
-
- @param ffsFileType
- **/
- public void setFfsFileType(String ffsFileType) {
- this.ffsFileType = ffsFileType.trim();
- }
-
- /**
- ffsAttribHeaderExtension
-
- This function is to get ffsAttribHeaderExtension
-
- @return Value of ffsAttribHeaderExtension
- **/
- public boolean isFfsAttribHeaderExtension() {
- return this.ffsAttribHeaderExtension;
- }
-
- /**
- setHeaderExension
-
- This function is to set headerExtension
- @param headerExtension Value of headerExension
- **/
- public void setHeaderExtension(boolean headerExtension) {
- this.ffsAttribHeaderExtension = headerExtension;
- if (headerExtension) {
- attributes |= FFS_ATTRIB_HEADER_EXTENSION;
- }
- }
-
- /**
- isFfsAttribTailPresent
-
- This function is to get ffsAttribTailPresent value.
- @return Value of ffsAttribTailPresent.
- **/
- public boolean isFfsAttribTailPresent() {
- return this.ffsAttribTailPresent;
- }
-
- /**
- setFfsAttribTailPresent
-
- This function is to set ffsAttribTailPresent.
- @param tailPresent Value of ffsAttribTailPresent.
- **/
- public void setFfsAttribTailPresent(boolean tailPresent) {
- this.ffsAttribTailPresent = tailPresent;
- if (tailPresent) {
- attributes |= FFS_ATTRIB_TAIL_PRESENT;
- }
- }
-
-
- /**
- stringToGuid
-
- This function is to convert string to GUID.
- * @param GuidStr String of GUID.
- * @param Guid GUID form.
- */
- private void stringToGuid (String GuidStr, FfsHeader.FfsGuid Guid){
-
- int i = 0;
- int j = 0;
- int k = 0;
- char [] charArry;
- String [] SplitStr;
-
- byte[] buffer = new byte[16];
- if (GuidStr.length()!=36) {
- throw new BuildException ("The GUID length [" + GuidStr.length() + "] is not correct!");
- }
-
-
- SplitStr = GuidStr.split("-");
- if (SplitStr.length != 5) {
- throw new BuildException ("The GUID format is not correct!");
- }
-
-
-
- for (i= 0; i < SplitStr.length; i++) {
- String str = SplitStr[i];
- charArry = str.toCharArray();
-
- for (j =0; j < (str.toCharArray().length)/2; j++) {
-
- buffer[k] = hexCharToByte (charArry[j*2]);
- buffer[k] = (byte)( buffer[k]& 0x0f);
- buffer[k] = (byte)((buffer[k]<< 4));
- buffer[k] = (byte)( buffer[k]& 0xf0);
- buffer[k] = (byte)( buffer[k]|hexCharToByte(charArry[j*2+1]));
- k++;
- }
- }
- Guid.bufferToStruct(buffer);
- }
-
- /**
- typeToSuffix
-
- This function is to get suffix of ffs file according to ffsFileType.
-
- @param ffsFileType ffsFileType
- @return The suffix of ffs file
- **/
- private String TypeToSuffix (String ffsFileType){
- String[][] suffix = { { "BASE", ".FFS"},
- { "SEC", ".SEC" }, { "PEI_CORE", ".PEI" },
- { "PEIM", ".PEI" }, { "DXE_CORE", ".DXE" },
- { "DXE_DRIVER", ".DXE" }, { "DXE_RUNTIME_DRIVER", ".DXE" },
- { "DXE_SAL_DRIVER", ".DXE" }, { "DXE_SMM_DRIVER", ".DXE" },
- { "TOOL", ".FFS" }, { "UEFI_DRIVER", ".DXE" },
- { "UEFI_APPLICATION", ".APP" }, { "USER_DEFINED", ".FFS" } };
-
- for (int i = 0; i < suffix.length; i++) {
- if (suffix[i][0].equalsIgnoreCase(moduleType)) {
- return suffix[i][1];
- }
- }
-
- return ".FFS";
- }
-
-
- /**
- stringToType
-
- This function is to get ffsFileType integer value according to ffsFileType.
- @param ffsFileType String value of ffsFileType
- @return Integer value of ffsFileType.
- **/
- private byte stringToType (String ffsFileType){
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_ALL")) {
- return(byte)EFI_FV_FILETYPE_ALL;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_RAW")) {
- return(byte)EFI_FV_FILETYPE_RAW;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_FREEFORM")) {
- return(byte)EFI_FV_FILETYPE_FREEFORM;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_SECURITY_CORE")) {
- return(byte)EFI_FV_FILETYPE_SECURITY_CORE;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_PEI_CORE")) {
- return(byte) EFI_FV_FILETYPE_PEI_CORE;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_DXE_CORE")) {
- return(byte)EFI_FV_FILETYPE_DXE_CORE;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_PEIM")) {
- return(byte)EFI_FV_FILETYPE_PEIM;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_DRIVER")) {
- return(byte) EFI_FV_FILETYPE_DRIVER;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER")) {
- return(byte)EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_APPLICATION")) {
- return(byte)EFI_FV_FILETYPE_APPLICATION;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE")) {
- return(byte)EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE;
- }
- if (ffsFileType.equals("EFI_FV_FILETYPE_FFS_PAD")) {
- return(byte) EFI_FV_FILETYPE_FFS_PAD;
- }
-
- return -1;
- }
-
-
-
- /**
- calculateCheckSum8
-
- This function is to calculate the value needed for a valid UINT8 checksum
- @param buffer Byte buffer containing byte data of component.
- @param size Size of the buffer.
- @return The 8 bit checksum value needed.
- **/
- private byte calculateChecksum8 (byte[] buffer, int size){
- return(byte) (0x100 - calculateSum8 (buffer, size));
- }
-
-
- /**
- calculateSum8
-
- This function is to calculate the UINT8 sum for the requested region.
- @param buffer Byte buffer containing byte data of component
- @param size Size of the buffer.
- @return The 8 bit checksum value needed.
- **/
- private short calculateSum8 (byte[] buffer, int size){
- int Index;
- byte Sum;
- Sum = 0;
-
- //
- // Perform the word sum for buffer
- //
- for (Index = 0; Index < size; Index++) {
- Sum = (byte) (Sum + buffer[Index]);
- }
-
- return(byte) Sum;
- }
-
- /**
- hexCharToByte
-
- This function is to convert hex character to byte
-
- @param hexChar hex character
- @return Byte which corresponding to the character.
- **/
- private byte hexCharToByte (char hexChar){
- switch (hexChar) {
- case '0':
- return(byte)0x00;
- case '1':
- return(byte)0x01;
- case '2':
- return(byte)0x02;
- case '3':
- return(byte)0x03;
- case '4':
- return(byte)0x04;
- case '5':
- return(byte)0x05;
- case '6':
- return(byte)0x06;
- case '7':
- return(byte)0x07;
- case '8':
- return(byte)0x08;
- case '9':
- return(byte)0x09;
- case 'a':
- case 'A':
- return(byte)0x0a;
- case 'b':
- case 'B':
- return(byte)0x0b;
- case 'c':
- case 'C':
- return(byte)0x0c;
-
- case 'd':
- case 'D':
- return(byte)0x0d;
-
- case 'e':
- case 'E':
- return(byte)0x0e;
- case 'f':
- case 'F':
- return(byte)0x0f;
-
- default:
- return(byte)0xff;
- }
- }
-
- /**
- adjustFileSize
-
- This function is used to adjusts file size to insure sectioned file is exactly the right length such
- that it ends on exactly the last byte of the last section. ProcessScript()
- may have padded beyond the end of the last section out to a 4 byte boundary.
- This padding is stripped.
-
- @param buffer Byte buffer contains a section stream
- @return Corrected size of file.
- **/
- private int adjustFileSize (byte[] buffer){
-
- int orignalLen = buffer.length;
- int adjustLen = 0;
- int sectionPoint = 0;
- int nextSectionPoint = 0;
- int sectionLen = 0;
- int totalLen = 0;
- int firstSectionHeader = 0;
-
-
- firstSectionHeader = buffer[0]& 0xff;
- firstSectionHeader = ((buffer[1]&0xff)<<8) | firstSectionHeader;
- firstSectionHeader = ((buffer[2]&0xff)<<16)| firstSectionHeader;
-
-
- while (sectionPoint < buffer.length) {
- sectionLen = buffer[0 + sectionPoint]& 0xff;
- sectionLen = ((buffer[1 + sectionPoint]&0xff)<<8)| sectionLen;
- sectionLen = ((buffer[2 + sectionPoint]&0xff)<<16)| sectionLen;
- totalLen = totalLen + sectionLen;
-
- if (totalLen == orignalLen) {
- return totalLen;
- }
-
- sectionPoint = sectionPoint + sectionLen;
- adjustLen = sectionPoint;
-
- nextSectionPoint = (sectionPoint + 0x03) & (~0x03);
- totalLen = totalLen + nextSectionPoint - sectionLen;
- sectionPoint = nextSectionPoint;
- }
- return adjustLen;
- }
-
- /**
- getOutputDir
-
- This function is to get output directory.
-
- @return Path of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set output directory.
-
- @param outputDir The output direcotry.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-
- /**
- getModuleTyp
-
- This function is to get string of module type.
-
- @return moduleType The string of module type.
- **/
- public String getModuleType() {
- return this.moduleType;
- }
-
- /**
- setModuleType
-
- This function is to set moduleType.
-
- @param moduleType The string of module type.
- **/
- public void setModuleType(String moduleType) {
- this.moduleType = moduleType;
- }
-
- /**
- Convert a string to a integer.
-
- @param intString The string representing a integer
-
- @retval int The value of integer represented by the
- given string; -1 is returned if the format
- of the string is wrong.
- **/
- private int stringToInt(String intString) {
- int value;
- int hexPrefixPos = intString.indexOf("0x");
- int radix = 10;
- String intStringNoPrefix;
-
- if (hexPrefixPos >= 0) {
- radix = 16;
- intStringNoPrefix = intString.substring(hexPrefixPos + 2, intString.length());
- } else {
- intStringNoPrefix = intString;
- }
-
- try {
- value = Integer.parseInt(intStringNoPrefix, radix);
- } catch (NumberFormatException e) {
- EdkLog.log(this, EdkLog.EDK_ERROR, "Incorrect format of int [" + intString + "]. -1 is assumed");
- return -1;
- }
-
- return value;
- }
-
- private void alignSection(DataOutputStream dataBuffer, int dataSize, int alignment) throws BuildException {
- if (alignment == 0) {
- return;
- }
- dataSize += 4; // take the section header into account
- int[] alignedBytes = {0, 16, 128, 512, 1024, 4096, 32768, 65536};
- int padSize = (alignedBytes[alignment] - dataSize) & (alignedBytes[alignment] - 1);
- if (padSize == 0) {
- //
- // already aligned
- //
- return;
- }
- //
- // if the pad size is not times of 4, there must be something wrong in previous sections
- //
- if (((4 - padSize) & (4 - 1)) != 0) {
- EdkLog.log(this, EdkLog.EDK_ERROR, "PAD section size must be 4-byte aligned (" + padSize + ")!");
- throw new BuildException ("Alignment can't be satisfied!");
- }
- byte[] pad = new byte[padSize];
- //
- // first three byte stores the section size
- //
- pad[0] = (byte)(padSize & 0xff);
- pad[1] = (byte)((padSize >> 8) & 0xff);
- pad[2] = (byte)((padSize >> 16) & 0xff);
- //
- // the fourth byte are section type. use raw type (0x19)
- //
- pad[3] = 0x19;
- try {
- dataBuffer.write(pad);
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- genFfs
-
- This function is to generate FFS file.
-
- @param ffsFile Name of FFS file.
- @param isOrg Flag to indicate generate ORG ffs file or not.
- **/
- private void genFfs(File ffsFile) throws BuildException {
- Section sect;
- int fileSize;
- int fileDataSize;
- FfsHeader ffsHeader = new FfsHeader();
- FfsHeader orgFfsHeader = new FfsHeader();
-
- EdkLog.log(this, EdkLog.EDK_INFO, ffsFile.getName());
-
- try {
- //
- // Create file output stream -- dataBuffer.
- //
- FileOutputStream dataFs = new FileOutputStream (ffsFile.getAbsolutePath());
- DataOutputStream dataBuffer = new DataOutputStream (dataFs);
-
- //
- // Search SectionList find earch section and call it's
- // ToBuffer function.
- //
- Iterator sectionIter = this.sectionList.iterator();
- while (sectionIter.hasNext()) {
- sect = (Section)sectionIter.next();
-
- try {
- int alignment = sect.getAlignment();
- if (this.ffsAttribDataAlignment < alignment) {
- this.ffsAttribDataAlignment = alignment;
- }
- alignSection(dataBuffer, dataBuffer.size(), alignment);
- //
- // The last section don't need 4 byte ffsAligment.
- //
- sect.toBuffer((DataOutputStream)dataBuffer);
- } catch (Exception e) {
- if (dataBuffer != null){
- dataBuffer.close();
- }
- throw new BuildException (e.getMessage());
- }
- }
- dataBuffer.close();
- } catch (Exception e) {
- throw new BuildException (e.getMessage());
- }
-
- //
- // Creat Ffs file header
- //
- try {
-
- //
- // create input stream to read file data
- //
- byte[] fileBuffer = new byte[(int)ffsFile.length()];
- FileInputStream fi = new FileInputStream (ffsFile.getAbsolutePath());
- DataInputStream di = new DataInputStream (fi);
- di.read(fileBuffer);
- di.close();
-
- //
- // Add GUID to header struct
- //
- if (this.ffsFileGuid != null) {
- stringToGuid (this.ffsFileGuid, ffsHeader.name);
- }
-
- //
- // because we may have changed the ffsAttribDataAlignment, we need to refresh attributes
- //
- this.attributes &= ~(((byte)7) << 3);
- this.attributes |= (((byte)this.ffsAttribDataAlignment) << 3);
-
- ffsHeader.ffsAttributes = this.attributes;
- if ((ffsHeader.fileType = stringToType(this.ffsFileType))== -1) {
- throw new BuildException ("FFS_FILE_TYPE unknow!\n");
- }
-
- //
- // Copy ffsHeader.ffsAttribute and fileType to orgFfsHeader.ffsAttribute
- // and fileType
- //
- orgFfsHeader.ffsAttributes = ffsHeader.ffsAttributes;
- orgFfsHeader.fileType = ffsHeader.fileType;
-
- //
- // Adjust file size. The function is used to tripe the last
- // section padding of 4 binary boundary.
- //
- //
- if (ffsHeader.fileType != EFI_FV_FILETYPE_RAW) {
-
- fileDataSize = adjustFileSize (fileBuffer);
- } else {
- fileDataSize = fileBuffer.length;
- }
-
- //
- // 1. add header size to file size
- //
- fileSize = fileDataSize + ffsHeader.getSize();
-
- if ((ffsHeader.ffsAttributes & FFS_ATTRIB_TAIL_PRESENT) != 0) {
- if (ffsHeader.fileType == EFI_FV_FILETYPE_FFS_PAD) {
-
- throw new BuildException (
- "FFS_ATTRIB_TAIL_PRESENT=TRUE is " +
- "invalid for PAD files"
- );
- }
- if (fileSize == ffsHeader.getSize()) {
- throw new BuildException (
- "FFS_ATTRIB_TAIL_PRESENT=TRUE is " +
- "invalid for 0-length files"
- );
- }
- fileSize = fileSize + 2;
- }
-
- //
- // 2. set file size to header struct
- //
- ffsHeader.ffsFileSize[0] = (byte)(fileSize & 0x00FF);
- ffsHeader.ffsFileSize[1] = (byte)((fileSize & 0x00FF00)>>8);
- ffsHeader.ffsFileSize[2] = (byte)(((int)fileSize & 0xFF0000)>>16);
-
- //
- // Fill in checksums and state, these must be zero for checksumming
- //
- ffsHeader.integrityCheck.header = calculateChecksum8 (
- ffsHeader.structToBuffer(),
- ffsHeader.getSize()
- );
-
- if ((this.attributes & FFS_ATTRIB_CHECKSUM) != 0) {
- if ((this.attributes & FFS_ATTRIB_TAIL_PRESENT) != 0) {
- ffsHeader.integrityCheck.file = calculateChecksum8 (
- fileBuffer,
- fileDataSize
- );
- } else {
- ffsHeader.integrityCheck.file = calculateChecksum8 (
- fileBuffer,
- fileDataSize
- );
- }
- } else {
- ffsHeader.integrityCheck.file = FFS_FIXED_CHECKSUM;
- orgFfsHeader.integrityCheck.file = FFS_FIXED_CHECKSUM;
- }
-
- //
- // Set the state now. Spec says the checksum assumes the state is 0.
- //
- ffsHeader.ffsState = EFI_FILE_HEADER_CONSTRUCTION |
- EFI_FILE_HEADER_VALID |
- EFI_FILE_DATA_VALID;
-
- //
- // create output stream to first write header data in file, then write sect data in file.
- //
- FileOutputStream headerFfs = new FileOutputStream (ffsFile.getAbsolutePath());
- DataOutputStream ffsBuffer = new DataOutputStream (headerFfs);
-
- //
- // Add header struct and file data to FFS file
- //
- ffsBuffer.write(ffsHeader.structToBuffer());
- ffsBuffer.write(fileBuffer, 0, fileDataSize);
-
-
-
- //
- // If there is a tail, then set it
- //
- if ((this.attributes & FFS_ATTRIB_TAIL_PRESENT) != 0) {
- short tailValue ;
- byte [] tailByte = new byte[2];
-
- //
- // reverse tailvalue , integritycheck.file as hight byte, and
- // integritycheck.header as low byte.
- //
- tailValue = (short)(ffsHeader.integrityCheck.header & 0xff);
- tailValue = (short)((tailValue) | ((ffsHeader.integrityCheck.file << 8) & 0xff00));
- tailValue = (short)~tailValue;
-
- //
- // Change short to byte[2]
- //
- tailByte[0] = (byte)(tailValue & 0xff);
- tailByte[1] = (byte)((tailValue & 0xff00)>>8);
- ffsBuffer.write(tailByte[0]);
- ffsBuffer.write(tailByte[1]);
-
- }
-
- //
- // close output stream. Note if don't close output stream
- // the buffer can't be rewritten to file.
- //
- ffsBuffer.close();
- } catch (Exception e) {
- EdkLog.log(this, EdkLog.EDK_ERROR, "genffsfile failed!");
- throw new BuildException (e.getMessage());
- }
-
- }
-
- /**
- addGenSection
-
- This function is to add gensection instance to list
-
- @param task Instance of GenSectionTask
- **/
- public void addGenSection (GenSectionTask task){
- this.sectionList.add(task);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java
deleted file mode 100644
index 0f25032f7f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/** @file
- GenFvImageTask class.
-
- GenFvImageTask is to call GenFvImage.exe to generate FvImage.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import java.io.File;
-import java.util.LinkedList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.List;
-import java.util.Iterator;
-import java.io.BufferedReader;
-import java.io.FileReader;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenFvImageTask
-
- GenFvImageTask is to call GenFvImage.exe to generate the FvImage.
-
-**/
-public class GenFvImageTask extends Task implements EfiDefine{
- //
- // tool name
- //
- static final private String toolName = "GenFvImage";
- //
- // Pattern to match the section header (e.g. [options], [files])
- //
- static final private Pattern sectionHeader = Pattern.compile("\\[([^\\[\\]]+)\\]");
- //
- // The name of input inf file
- //
- private FileArg infFile = new FileArg();
- //
- // Output directory
- //
- private String outputDir = ".";
-
- /**
- execute
-
- GenFvImageTask execute is to assemble tool command line & execute tool
- command line.
- **/
- public void execute() throws BuildException {
- Project project = this.getOwningTarget().getProject();
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
-
- if (isUptodate()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, infFile.toFileList() + " is uptodate!");
- return;
- }
-
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- String argument = "" + infFile;
- //
- // lauch the program
- //
- int exitCode = 0;
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
- //
- // log command line string.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, infFile.toFileList());
-
- exitCode = runner.execute();
- if (exitCode != 0) {
- EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));
- } else {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenFvImage succeeded!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- } finally {
- if (exitCode != 0) {
- throw new BuildException("GenFvImage: failed to generate FV file!");
- }
- }
- }
- /**
- getInfFile
-
- This function is to get class member of infFile
- @return String name of infFile
- **/
- public String getInfFile() {
- return infFile.getValue();
- }
-
- /**
- setInfFile
-
- This function is to set class member of infFile.
-
- @param infFile name of infFile
- **/
- public void setInfFile(String infFile) {
- this.infFile.setArg(" -I ", infFile);
- }
-
- /**
- getOutputDir
-
- This function is to get output directory.
-
- @return Path of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set output directory.
-
- @param outputDir The output direcotry.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-
- //
- // dependency check
- //
- private boolean isUptodate() {
- String infName = this.infFile.getValue();
- String fvName = "";
- List<String> ffsFiles = new LinkedList<String>();
- File inf = new File(infName);
-
- try {
- FileReader reader = new FileReader(inf);
- BufferedReader in = new BufferedReader(reader);
- String str;
-
- //
- // Read the inf file line by line
- //
- boolean inFiles = false;
- boolean inOptions = false;
- while ((str = in.readLine()) != null) {
- str = str.trim();
- if (str.length() == 0) {
- continue;
- }
-
- Matcher matcher = sectionHeader.matcher(str);
- if (matcher.find()) {
- //
- // We take care of only "options" and "files" section
- //
- String sectionName = str.substring(matcher.start(1), matcher.end(1));
- if (sectionName.equalsIgnoreCase("options")) {
- inOptions = true;
- inFiles = false;
- } else if (sectionName.equalsIgnoreCase("files")) {
- inFiles = true;
- inOptions = false;
- } else {
- inFiles = false;
- inOptions = false;
- }
- continue;
- }
-
- //
- // skip invalid line
- //
- int equalMarkPos = str.indexOf("=");
- if (equalMarkPos < 0) {
- continue;
- }
-
- //
- // we have only interest in EFI_FILE_NAME
- //
- String fileNameFlag = str.substring(0, equalMarkPos).trim();
- String fileName = str.substring(equalMarkPos + 1).trim();
- if (!fileNameFlag.equalsIgnoreCase("EFI_FILE_NAME")
- || fileName.length() == 0) {
- continue;
- }
-
- if (inFiles) {
- //
- // files specified beneath the [files] section are source files
- //
- ffsFiles.add(fileName);
- } else if (inOptions) {
- //
- // file specified beneath the [options] section is the target file
- //
- fvName = outputDir + File.separator + fileName;
- }
- }
- } catch (Exception ex) {
- throw new BuildException(ex.getMessage());
- }
-
- //
- // if destionation file doesn't exist, we need to generate it.
- //
- File fvFile = new File(fvName);
- if (!fvFile.exists()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, fvName + " doesn't exist!");
- return false;
- }
-
- //
- // the inf file itself will be taken as source file, check its timestamp
- // against the target file
- //
- long fvFileTimeStamp = fvFile.lastModified();
- if (inf.lastModified() > fvFileTimeStamp) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, infName + " has been changed since last build!");
- return false;
- }
-
- //
- // no change in the inf file, we need to check each source files in it
- // against the target file
- //
- for (Iterator it = ffsFiles.iterator(); it.hasNext(); ) {
- String fileName = (String)it.next();
- File file = new File(fileName);
- if (file.lastModified() > fvFileTimeStamp) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, fileName + " has been changed since last build!");
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java
deleted file mode 100644
index 82844f080f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/** @file
- GenSectionTask class.
-
- GenSectionTask is to call GenSection.exe to generate Section.
-
- Copyright (c) 2006, 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.
-
-**/
-
-package org.tianocore.framework.tasks;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-import org.tianocore.common.logger.EdkLog;
-
-public class GenSectionTask extends Task implements EfiDefine, Section, FfsTypes {
- private int alignment = 0;
- //
- // Tool name
- //
- private final static String toolName = "GenSection";
- //
- // inputfile name
- //
- private FileArg inputFile = new FileArg();
-
- //
- // outputfile name
- //
- private FileArg outputFile = new FileArg();
-
- //
- // section type
- //
- private ToolArg sectionType = new ToolArg();
-
- //
- // version number
- //
- private ToolArg versionNum = new ToolArg();
-
- //
- // interface string
- //
- private ToolArg interfaceString = new ToolArg();
-
- //
- // Section file list
- //
- private List<Section> sectFileList = new ArrayList<Section>();
-
- //
- // flag indicated the <tool> element
- //
- private boolean haveTool = false;
-
- /**
- execute
-
- GenSectionTaks execute is to assemble tool command line & execute tool
- command line.
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
- String command;
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- String argument = "" + inputFile + outputFile + sectionType + versionNum + interfaceString;
- //
- // return value of gensection execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
-
- EdkLog.log(this, inputFile.toFileList() + versionNum.getValue()
- + interfaceString.getValue() + " => " + outputFile.toFileList());
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile".
-
- @return name of input file
- **/
- public String getInputFile() {
- return this.inputFile.getValue();
- }
-
- /**
- setInputFile
-
- This function is to set class member "inputFile".
-
- @param inputFile name of input file
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" -i ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile".
-
- @return name of output file
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
-
- /**
- setOutputfile
-
- This function is to set class member "outputFile".
- @param outputFile name of output file
- **/
- public void setOutputfile(String outputFile) {
- this.outputFile.setArg(" -o ", outputFile);
- }
-
- /**
- getSectionType
-
- This function is to get class member "sectionType".
-
- @return sectoin type
- **/
- public String getSectionType() {
- return this.sectionType.getValue();
- }
-
- /**
- setSectionType
-
- This function is to set class member "sectionType".
-
- @param sectionType section type
- **/
- public void setSectionType(String sectionType) {
- this.sectionType.setArg(" -s ", sectionType);
- }
-
- /**
- getVersionNum
-
- This function is to get class member "versionNum".
- @return version number
- **/
- public String getVersionNum() {
- return this.versionNum.getValue();
- }
-
- /**
- setVersionNume
-
- This function is to set class member "versionNum".
- @param versionNum version number
- **/
- public void setVersionNum(String versionNum) {
- this.versionNum.setArg(" -v ", versionNum);
- }
-
- /**
- getInterfaceString
-
- This function is to get class member "interfaceString".
- @return interface string
- **/
- public String getInterfaceString() {
- return this.interfaceString.getValue();
- }
-
- /**
- setInterfaceString
-
- This funcion is to set class member "interfaceString".
- @param interfaceString interface string
- **/
- public void setInterfaceString(String interfaceString) {
- this.interfaceString.setArg(" -a ", "\"" + interfaceString + "\"");
- }
-
- /**
- addSectFile
-
- This function is to add sectFile to list.
-
- @param sectFile instance of sectFile.
- **/
- public void addSectFile(SectFile sectFile){
- this.sectFileList.add(sectFile);
- }
-
- /**
- setTool
-
- This function is to set the class member "Tool";
-
- @param tool
- **/
- public void addTool(Tool tool) {
- this.sectFileList.add(tool);
- this.haveTool = true;
- }
-
- /**
- addGenSection
-
- This function is to add GenSectin element to list
- @param task Instance of genSection
- **/
- public void addGenSection(GenSectionTask task){
- this.sectFileList.add(task);
- }
-
- public int getAlignment() {
- return alignment;
- }
-
- public void setAlignment(int alignment) {
- if (alignment > 7) {
- this.alignment = 7;
- } else {
- this.alignment = alignment;
- }
- }
-
- public void toBuffer(DataOutputStream buffer){
- //
- // Search SectionList find earch section and call it's
- // ToBuffer function.
- //
- if (this.sectionType.getValue().equalsIgnoreCase(
- "EFI_SECTION_COMPRESSION")
- && !this.haveTool) {
- Section sect;
-
- //
- // Get section file in compress node.
- //
- try {
- ByteArrayOutputStream bo = new ByteArrayOutputStream();
- DataOutputStream Do = new DataOutputStream(bo);
-
- //
- // Get each section which under the compress {};
- // And add it is contains to File;
- //
- Iterator SectionIter = this.sectFileList.iterator();
- while (SectionIter.hasNext()) {
- sect = (Section) SectionIter.next();
-
- //
- // Call each section class's toBuffer function.
- //
- try {
- sect.toBuffer(Do);
- } catch (BuildException e) {
- System.out.print(e.getMessage());
- throw new BuildException(
- "Compress.toBuffer failed at section");
- } finally {
- if (Do != null){
- Do.close();
- }
- }
- }
- //
- // Call compress
- //
- byte[] fileBuffer = bo.toByteArray();
-
- synchronized (CompressSection.semaphore) {
- Compress myCompress = new Compress(fileBuffer,
- fileBuffer.length);
-
- //
- // Add Compress header
- //
- CompressHeader Ch = new CompressHeader();
- Ch.SectionHeader.Size[0] = (byte) ((myCompress.outputBuffer.length + Ch
- .GetSize()) & 0xff);
- Ch.SectionHeader.Size[1] = (byte) (((myCompress.outputBuffer.length + Ch
- .GetSize()) & 0xff00) >> 8);
- Ch.SectionHeader.Size[2] = (byte) (((myCompress.outputBuffer.length + Ch
- .GetSize()) & 0xff0000) >> 16);
- Ch.SectionHeader.type = (byte) EFI_SECTION_COMPRESSION;
-
- //
- // Note: The compressName was not efsfective now. Using the
- // EFI_STANDARD_COMPRSSION for compressType .
- // That is follow old Genffsfile tools. Some code will be
- // added for
- // the different compressName;
- //
- Ch.UncompressLen = fileBuffer.length;
- Ch.CompressType = EFI_STANDARD_COMPRESSION;
-
- //
- // Change header struct to byte buffer
- //
- byte[] headerBuffer = new byte[Ch.GetSize()];
- Ch.StructToBuffer(headerBuffer);
-
- //
- // First add CompressHeader to Buffer, then add Compress
- // data.
- //
- buffer.write(headerBuffer);
- buffer.write(myCompress.outputBuffer);
-
- //
- // Buffer 4 Byte aligment
- //
- int size = Ch.GetSize() + myCompress.outputBuffer.length;
-
- while ((size & 0x03) != 0) {
- size++;
- buffer.writeByte(0);
- }
- }
- } catch (Exception e) {
- throw new BuildException("GenSection<SectionType=EFI_SECTION_COMPRESSION> to Buffer failed!\n");
- }
- } else {
- Section sect;
- Iterator sectionIter = this.sectFileList.iterator();
- while (sectionIter.hasNext()) {
- sect = (Section) sectionIter.next();
- try {
- //
- // The last section don't need 4 byte ffsAligment.
- //
- sect.toBuffer(buffer);
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java
deleted file mode 100644
index 34a7987f43..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/** @file
- GenTeImageTask class.
-
- GenTeImageTask is used to call GenTEImage.exe to generate TE image .
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- * GenTeImageTask class.
- *
- * GenTeImageTask is used to call GenAcpiTable.exe to generate ACPI Table image .
- */
-public class GenTeImageTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private String toolName = "GenTeImage";
- //
- // input file
- //
- private FileArg inputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = "";
-
- //
- // Verbose flag
- //
- private ToolArg verbose = new ToolArg();
-
- //
- // Dump flag
- //
- private ToolArg dump = new ToolArg();
-
- /**
- execute
-
- GenTeImgaeTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + this.verbose + this.dump + this.outputFile + this.inputFile;
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList()
- + " => " + this.outputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile".
-
- @return string of input file name.
- **/
- public String getInputFile() {
- return inputFile.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -o ", outputFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-
- /**
- getVerbose
-
- This function is to get class member "verbose"
-
- @return verbose the flag of verbose.
- **/
- public String getVerbose() {
- return this.verbose.getValue();
- }
-
- /**
- setVerbose
-
- This function is to set class member "verbose"
-
- @param verbose
- True or False.
- **/
- public void setVerbose(boolean verbose) {
- if (verbose) {
- this.verbose.setArg(" -", "v");
- }
- }
-
- /**
- getDump
-
- This function is to get class member "dump"
-
- @return verbose the flag of dump.
- **/
- public String getDump() {
- return dump.getValue();
- }
-
- /**
- setDump
-
- This function is to set class member "dump"
-
- @param dump
- True or False.
- **/
- public void setDump(boolean dump) {
- if (dump) {
- this.dump.setArg(" -", "dump");
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java
deleted file mode 100644
index 2f892a7cd4..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/** @file
- GuidChkTask class.
-
- GuidChkTask is to call GuidChk.exe to generate Section.
-
- Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GuidChkTask
-
- GuidChkTask is to call GuidChk.exe to generate Section.
-
-**/
-public class GuidChkTask extends Task implements EfiDefine{
- /**
- * GuidChk task class
- * class member
- * -exDir : directory name of exclusion searching
- * -exFile : file name of exclusion searching
- * -exExt : extension name of exclusion searching
- * -exSubDir: extesnion name of sub dir which excluded searching
- * -outFile : out put file wrote internal GUID+basename list
- * -chkGui : check for duplicate guids
- * -chkSign : check for duplicate signatures
- * -printGuiDef : if set will print guid+defined symbol name
- * -printAllGuid: if set will print all GUIDS found
- * -outPut : redirection file name
- * -fos : out put redirect to this file
- *
- */
- //
- // Tool name
- //
- private static String toolName = "GuidChk";
- //
- // Directory name of exclusion searching
- //
- private FileArg exDir = new FileArg();
- //
- // File name of exclusion searching.
- //
- private FileArg exFile = new FileArg();
- //
- // Extension name of exclusion searching.
- //
- private FileArg exExt = new FileArg();
- //
- // Extesnion name of sub dir which excluded searching.
- //
- private FileArg exSubDir = new FileArg();
- //
- // Out put file wrote internal GUID+basename list
- //
- private FileArg outFile = new FileArg();
- //
- // Check for duplicate guids.
- //
- private ToolArg chkGui = new ToolArg();
- //
- // Check for duplicate signatures
- //
- private ToolArg chkSign = new ToolArg();
- //
- // If set will print guid+defined symbol name
- //
- private ToolArg printGuiDef = new ToolArg();
- //
- // If set will print all GUIDS found
- //
- private ToolArg printAllGuid = new ToolArg();
- //
- // redirection file name.
- //
- private String outPut = "";
- //
- // out put redirect to this file.
- //
- protected PrintWriter fos = null;
-
- //
- // overload class execute method
- //
- public void execute() throws BuildException {
- Project project = this.getOwningTarget().getProject();
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separatorChar + toolName;
- }
- String argument = "" + exDir +
- exFile +
- exExt +
- exSubDir +
- outFile +
- chkGui +
- chkSign +
- printGuiDef +
- printAllGuid;
- try {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);
- //
- // execute command line
- //
- Process proc = Runtime.getRuntime().exec(command + " " + argument);
- //
- // if set output, redirect out put to output file, else print output to screen
- //
- if ( !this.outPut.equals("")) {
- fos = new PrintWriter(this.outPut);
- BufferedReader bin = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = bin.readLine();
- while (line != null ){
- fos.println(line);
- line = bin.readLine();
- }
- fos.close();
- }
- else {
- BufferedReader bin = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = bin.readLine();
- while (line != null ){
- line = bin.readLine();
- }
- }
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " Succeeded!");
- } catch (Exception e) {
- throw new BuildException(toolName + " failed!");
- }
- }
- /**
- getChkGui
-
- This function is to get the string of flag of ChkGui
-
- @return string of flag of ChkGui
- **/
- public String getChkGui() {
- return chkGui.getValue();
- }
-
- /**
- setChkGui
-
- This function is to set chkGui
-
- @param chkGui set class member of chkGui
- **/
- public void setChkGui(boolean chkGui) {
- if (chkGui) {
- this.chkGui.setArg(" -", "g");
- }
- }
-
- /**
- getChkSign
-
- This function is to get chkSign
-
- @return chkSign
- **/
- public String getChkSign() {
- return chkSign.getValue();
- }
-
- /**
- setChkSign
-
- This function is to set class member of chkSign
- * @param chkSign
- */
- public void setChkSign(boolean chkSign) {
- if (chkSign){
- this.chkSign.setArg(" -", "s");
- }
- }
- /**
- getExDir
-
- This function is to get class member of exDir
-
- @return exDir
- **/
- public String getExDir() {
- return exDir.getValue();
- }
-
- /**
- setExDir
-
- This function is to set class member of exDir
-
- @param exDir
- **/
- public void setExDir(String exDir) {
- this.exDir.setArg(" -d ", exDir);
- }
-
- /**
- getExExt
-
- This function is to get class member of exExt
-
- @return exExt
- **/
- public String getExExt() {
- return exExt.getValue();
- }
-
- /**
- setExExt
-
- This function is to set class member of exExt
- @param exExt
- **/
- public void setExExt(String exExt) {
- this.exExt.setArg(" -e ", exExt);
- }
-
- /**
- getExFile
-
- This function is to get class member of exFile
- @return exFile
- **/
- public String getExFile() {
- return exFile.getValue();
- }
-
- /**
- setExFile
-
- This function is to set class member of exFile.
-
- @param exFile
- **/
- public void setExFile(String exFile) {
- this.exFile.setArg(" -f ", exFile);
- }
-
- /**
- getExSubDir
-
- This function is to get class member of exSubDir
-
- @return exSubDir
- **/
- public String getExSubDir() {
- return exSubDir.getValue();
- }
-
- /**
- setExSubDir
-
- This function is to set class member of exSubDir.
- @param exSubDir
- **/
- public void setExSubDir(String exSubDir) {
- this.exSubDir.setArg(" -u ", exSubDir);
- }
-
- /**
- getOutFile
-
- This function is to get outFile
-
- @return outFile
- **/
- public String getOutFile() {
- return outFile.getValue();
- }
- /**
- * set class member of outFile
- * @param outFile
- */
- public void setOutFile(String outFile) {
- this.outFile.setArg(" -b ", outFile);
- }
- /**
- getPrintGuidDef
-
- This function is to get printGuidDef
-
- @return flage of printing (guid+defined symbol name)
- **/
- public String getPrintGuiDef() {
- return printGuiDef.getValue();
- }
-
-
- /**
- setPrintGuidDef
-
- This function is to set class member of printGuiDef.
- @param printGuiDef
- **/
- public void setPrintGuiDef(boolean printGuiDef) {
- if (printGuiDef){
- this.printGuiDef.setArg(" -", "x");
- }
-
- }
-
- /**
- getOutput
-
- This function is to get output
-
- @return name of outPut file
- **/
- public String getOutPut() {
- return outPut;
- }
-
- /**
- setOutPut
-
- This function is to set class member of outPut.
- @param outPut
- **/
- public void setOutPut(String outPut) {
- this.outPut = outPut;
- }
-
- /**
- getPrintAllGuid
-
- This function is to get printAllGuid
- @return printAllGuid
- **/
- public String getPrintAllGuid() {
- return printAllGuid.getValue();
- }
-
- /**
- setPrintAllGuid
-
- This function is to set class member of printAllGuid.
- @param printAllGuid
- **/
- public void setPrintAllGuid(boolean printAllGuid) {
- if (printAllGuid) {
- this.printAllGuid.setArg(" -", "p");
- }
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/IncludePath.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/IncludePath.java
deleted file mode 100644
index 4591406bbf..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/IncludePath.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for include path name
-
-Copyright (c) 2006, 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.
-
-**/
-
-package org.tianocore.framework.tasks;
-
-/**
- IncludePath class is generally used to pass arguments with "-i" before each
- of them.
- **/
-public class IncludePath extends NestElement {
- public String toString() {
- return super.toString(" -i ");
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Input.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Input.java
deleted file mode 100644
index 088d37883b..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Input.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for file path
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-/**
- Input class is defined to be as nested elements of other elements, to specify
- the path of file(s).
- **/
-public class Input extends NestElement {
- public String toString() {
- return super.toString(" -f ");
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/InputFile.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/InputFile.java
deleted file mode 100644
index fe0cc83eb2..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/InputFile.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for specifying files
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-/**
- InputFile is always used to pass arguments separated by space
- **/
-public class InputFile extends NestElement {
- public String toString() {
- return super.toString(" ");
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
deleted file mode 100644
index 86f39adafc..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/** @file
-This file is to wrap MakeDeps.exe tool as ANT task, which is used to generate
-dependency files for source code.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.LineNumberReader;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Stack;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.tianocore.common.cache.FileTimeStamp;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- Class MakeDeps is used to wrap MakeDeps.exe as an ANT task.
- **/
-public class MakeDeps extends Task {
-
- //
- // private members, use set/get to access them
- //
- private String targetFile = "";
- private String depsFilePath = "";
- private IncludePath includePathList = new IncludePath();
- private Input inputFileList = new Input();
- //
- // cache the including files to speed up dependency check
- //
- private static HashMap<String, Set<String>> includesCache = new HashMap<String, Set<String>>();
- //
- // regular expression for "#include ..." directive
- //
- private static final Pattern incPattern = Pattern.compile("[\n\r \t#]*include[ \t]+[\"<]*([^\n\r\"<>]+)[>\" \t]*");
-
- public MakeDeps() {
-
- }
-
- /**
- The Standard execute method for ANT task. It will check if it's necessary
- to generate the dependency list file. If no file is found or the dependency
- is changed, it will compose the command line and call MakeDeps.exe to
- generate the dependency list file.
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
- //
- // if target file is specified and it hasn't been generated, don't generate
- // dep file
- //
- if (targetFile.length() != 0 && (new File(targetFile)).exists() == false) {
- return;
- }
- //
- // check if the dependency list file is uptodate or not
- //
- if (isUptodate()) {
- return;
- }
-
- //
- // if no include path is specified, try locally
- //
- if (includePathList.isEmpty()) {
- includePathList.insPath(".");
- }
-
- Set<String> depFiles = getDependencies(inputFileList.toArray());
-
- File depsFile = new File(depsFilePath);
- FileWriter fileWriter = null;
- BufferedWriter bufWriter = null;
-
- try {
- fileWriter = new FileWriter(depsFile);
- bufWriter = new BufferedWriter(fileWriter);
-
-
- for (Iterator it = depFiles.iterator(); it.hasNext();) {
- String depFile = (String)it.next();
- bufWriter.write(depFile, 0, depFile.length());
- bufWriter.write("\n", 0, 1);
- }
- //
- // put a "tab" at the end of file as file ending flag
- //
- bufWriter.write("\t", 0, 1);
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- } finally {
- try {
- if (bufWriter != null) {
- bufWriter.close();
- }
- if (fileWriter != null) {
- fileWriter.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- //
- // update time stamp of dependency file
- //
- FileTimeStamp.update(depsFilePath, depsFile.lastModified());
- }
-
- public void setTargetFile(String name) {
- targetFile = name;
- }
-
- public String getTargetFile() {
- return targetFile;
- }
-
- /**
- Set method for "DepsFile" attribute
-
- @param name The name of dependency list file
- **/
- public void setDepsFile(String name) {
- depsFilePath = name;
- }
-
- /**
- Get method for "DepsFile" attribute
-
- @returns The name of dependency list file
- **/
- public String getDepsFile() {
- return depsFilePath;
- }
-
- /**
- Add method for "IncludePath" nested element
-
- @param path The IncludePath object from nested IncludePath type of element
- **/
- public void addConfiguredIncludepath(IncludePath path) {
- includePathList.insert(path);
- }
-
- /**
- Add method for "Input" nested element
-
- @param input The Input object from nested Input type of element
- **/
- public void addConfiguredInput(Input inputFile) {
- inputFileList.insert(inputFile);
- }
-
- /**
- Check if the dependency list file should be (re-)generated or not.
-
- @returns true The dependency list file is uptodate. No re-generation is needed.
- @returns false The dependency list file is outofdate. Re-generation is needed.
- **/
- private boolean isUptodate() {
- File df = new File(depsFilePath);
- if (!df.exists()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFilePath + " doesn't exist!");
- return false;
- }
-
- //
- // If the source file(s) is newer than dependency list file, we need to
- // re-generate the dependency list file
- //
- long depsFileTimeStamp = FileTimeStamp.get(depsFilePath);
- List<String> fileList = inputFileList.getNameList();
- for (int i = 0, length = fileList.size(); i < length; ++i) {
- String sf = fileList.get(i);
- if (FileTimeStamp.get(sf) > depsFileTimeStamp) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, sf + " has been changed since last build!");
- return false;
- }
- }
-
- //
- // If the source files haven't been changed since last time the dependency
- // list file was generated, we need to check each file in the file list to
- // see if any of them is changed or not. If anyone of them is newer than
- // the dependency list file, MakeDeps.exe is needed to run again.
- //
- LineNumberReader lineReader = null;
- FileReader fileReader = null;
- boolean ret = false;
- try {
- fileReader = new FileReader(df);
- lineReader = new LineNumberReader(fileReader);
-
- String line = null;
- int lines = 0;
- while ((line = lineReader.readLine()) != null) {
- //
- // check file end flag "\t" to see if the .dep was generated correctly
- //
- if (line.equals("\t")) {
- ret = true;
- continue;
- }
- line = line.trim();
- //
- // skip empty line
- //
- if (line.length() == 0) {
- continue;
- }
- ++lines;
-
- //
- // If a file cannot be found (moved or removed) or newer, regenerate the dep file
- //
- File sourceFile = new File(line);
- if ((!sourceFile.exists()) || (FileTimeStamp.get(line) > depsFileTimeStamp)) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, sourceFile.getPath() + " has been (re)moved or changed since last build!");
- ret = false;
- break;
- }
- }
-
- //
- // check if the .dep file is empty
- //
- if (lines == 0) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFilePath + " is empty!");
- ret = false;
- }
- } catch (IOException e) {
- throw new BuildException(e.getMessage());
- } finally {
- try {
- if (lineReader != null) {
- lineReader.close();
- }
- if (fileReader != null) {
- fileReader.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- return ret;
- }
-
- //
- // get dependent files list by parsing "#include" directive
- //
- private synchronized Set<String> getDependencies(String[] sourceFiles) {
- Set<String> dependencies = new LinkedHashSet<String>();
- String[] searchPathList = includePathList.toArray();
-
- Stack<String> pendingFiles = new Stack<String>();
- for (int i = 0; i < sourceFiles.length; ++i) {
- File srcFile = new File(sourceFiles[i]);
- if (srcFile.exists()) {
- //
- // a file must depend itself
- //
- dependencies.add(srcFile.getAbsolutePath());
- pendingFiles.push(sourceFiles[i]);
- }
- }
-
- while (!pendingFiles.empty()) {
- String src = pendingFiles.pop();
- File srcFile = new File(src);
- int fileLength = (int)srcFile.length();
- if (!srcFile.exists() || fileLength == 0) {
- continue;
- }
- //
- // try cache first
- //
- Set<String> incFiles = includesCache.get(src);
- if (incFiles == null) {
- incFiles = new HashSet<String>();
- FileInputStream fileReader = null;
- BufferedInputStream bufReader = null;
- String fileContent = "";
-
- try {
- fileReader = new FileInputStream(srcFile);
- bufReader = new BufferedInputStream(fileReader);
- byte[] buf = new byte[fileLength];
-
- bufReader.read(buf, 0, fileLength);
- //
- // check if the file is utf-16 encoded
- //
- if (buf[0] == (byte)0xff || buf[0] == (byte)0xfe) {
- fileContent = new String(buf, "UTF-16");
- buf = fileContent.getBytes("UTF-8");
- }
- fileContent = new String(buf);
- } catch (IOException e) {
- throw new BuildException(e.getMessage());
- } finally {
- try {
- if (bufReader != null) {
- bufReader.close();
- }
- if (fileReader != null) {
- fileReader.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- //
- // find out all "#include" lines
- //
- Matcher matcher = incPattern.matcher(fileContent);
- while (matcher.find()) {
- String incFilePath = fileContent.substring(matcher.start(1), matcher.end(1));
- incFiles.add(incFilePath);
- }
-
- //
- // put the includes in cache to avoid re-parsing
- //
- includesCache.put(src, incFiles);
- }
-
- //
- // try each include search path to see if the include file exists or not
- //
- for (Iterator<String> it = incFiles.iterator(); it.hasNext();) {
- String depFilePath = it.next();
-
- for (int i = 0; i < searchPathList.length; ++i) {
- File depFile = new File(searchPathList[i] + File.separator + depFilePath);
- String filePath = depFile.getAbsolutePath();
- //
- // following check is a must. it can prevent dead loop if two
- // files include each other
- //
- if (depFile.exists() && !dependencies.contains(filePath)) {
- dependencies.add(filePath);
- pendingFiles.push(filePath);
- break;
- }
- }
- }
- }
-
- return dependencies;
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java
deleted file mode 100644
index 5892064509..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/** @file
- ModifyInfTask class.
-
- ModifyInfTask is used to call Modify.exe to generate inf file.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- ModifyInfTask class.
-
- ModifyInfTask is used to call Modify.exe to generate inf file.
-**/
-public class ModifyInfTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private String toolName = "ModifyInf";
-
- //
- // input FV inf file
- //
- private FileArg inputFVInfFile = new FileArg();
-
- //
- // output FV inf file
- //
- private FileArg outputFVInfFile = new FileArg();
-
- //
- // pattern string
- //
- private ToolArg patternStr = new ToolArg();
-
- //
- // Output dir
- //
- private String outputDir = ".";
-
- /**
- execute
-
- ModifyInfTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separatorChar + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + this.inputFVInfFile + this.outputFVInfFile + this.patternStr;
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.inputFVInfFile.toFileList()
- + " => " + this.inputFVInfFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getinputFVInfFile
-
- This function is to get class member "inputFVInfFile".
-
- @return string of input inf file name.
- **/
- public String getinputFVInfFile() {
- return this.inputFVInfFile.getValue();
- }
-
- /**
- setinputFVInfFile
-
- This function is to set class member "inputFVInfFile".
-
- @param inputFile
- string of input inf file name.
- **/
- public void setinputFVInfFile(String inputFVInfFileName) {
- this.inputFVInfFile.setArg(" ", inputFVInfFileName);
- }
-
- /**
- getoutputFVInfFile
-
- This function is to get class member "outputFVInfFile"
-
- @return outputFVInfFile string of output inf file name.
- **/
- public String getoutputFVInfFile() {
- return this.outputFVInfFile.getValue();
- }
-
- /**
- setoutputFVInfFile
-
- This function is to set class member "outputFVInfFile"
-
- @param outputFVInfFile
- string of output inf file name.
- **/
- public void setoutputFVInfFile(String outputFVInfFileName) {
- this.outputFVInfFile.setArg(" ", outputFVInfFileName);
- }
-
- /**
- getpatternStr
-
- This function is to get class member "patternStr"
-
- @return patternStr string of pattern.
- **/
- public String getpatternStr() {
- return this.patternStr.getValue();
- }
-
- /**
- setpatternStr
-
- This function is to set class member "patternStr"
-
- @param patternStr
- string of patternStr.
- **/
- public void setpatternStr(String patternStr) {
- this.patternStr.setArg(" ", patternStr);
- }
-
- /**
- getoutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getoutputDir() {
- return this.outputDir;
- }
-
- /**
- setoutputDir
-
- This function is to set class member "outputDir"
-
- @param patternStr
- string of output directory.
- **/
- public void setoutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/NestElement.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/NestElement.java
deleted file mode 100644
index dd36c9127b..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/NestElement.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/** @file
-This file is to define common interfaces for nested element of frameworktasks
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-import java.util.List;
-import java.util.ArrayList;
-import java.io.FileReader;
-import java.io.BufferedReader;
-import java.util.StringTokenizer;
-
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.BuildException;
-
-/**
- Interface NestElement is to define common interfaces for nested element
- **/
-public class NestElement extends DataType {
- //
- // The name list. All the name strings got from setXXX methods will be put
- // in here.
- //
- protected List<String> nameList = new ArrayList<String>();
-
- /**
- Insert content in the newElement into this NestElement
-
- @param newElement The new NestElement
- **/
- public void insert(NestElement newElement) {
- this.nameList.addAll(newElement.getNameList());
- }
-
- /**
- Handle "name" attribute. No delimiter and special treatment are assumed.
-
- @param name A single string value of "name" attribute
- **/
- public void setName(String name) {
- if (name.length() > 0) {
- this.nameList.clear();
- this.nameList.add(name);
- }
- }
-
- public void insName(String name) {
- if (name.length() > 0) {
- this.nameList.add(name);
- }
- }
-
- /**
- Handle "list" attribute. The value of "list" is assumed as string
- separated by space, tab, comma or semmicolon.
-
- @param nameList The value of "list" separated by " \t,;"
- **/
- public void setList(String nameList) {
- if (nameList.length() == 0) {
- return;
- }
-
- this.nameList.clear();
- StringTokenizer tokens = new StringTokenizer(nameList, " \t,;", false);
- while (tokens.hasMoreTokens()) {
- String name = tokens.nextToken().trim();
- if (name.length() > 0) {
- this.nameList.add(name);
- }
- }
- }
-
- /**
- Handle "ListFile" attribute. The value of "ListFile" should be the path of
- a file which contains name strings, one name per line.
-
- @param listFileName The file path
- **/
- public void setListFile(String listFileName) {
- FileReader fileReader = null;
- BufferedReader in = null;
- String str;
-
- //
- // Check if the file exists or not
- //
- File file = new File(listFileName);
- if (!file.exists()) {
- throw new BuildException("The file, " + file + " does not exist!");
- }
-
- try {
- fileReader = new FileReader(file);
- in = new BufferedReader(fileReader);
-
- //
- // Read line by line
- //
- nameList.clear();
- while((str = in.readLine()) != null){
- str = str.trim();
- if (str.length() == 0){
- continue;
- }
-
- //getProject().replaceProperties(str);
- this.nameList.add(str);
- }
- } catch (Exception e){
- throw new BuildException(e.getMessage());
- } finally {
- try {
- //
- // close the file
- //
- if (in != null) {
- in.close();
- }
- if (fileReader != null) {
- fileReader.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
- }
-
- /**
- Handle "file" attribute. The value of "file" should be a path.
-
- @param file The path name of a file
- **/
- public void setFile(String file) {
- setPath(file);
- }
-
- /**
- Add a file or file list into the file list
-
- @param file The path of a file
- **/
- public void insFile(String file) {
- insPath(file);
- }
-
- /**
- Handle "path" attribute. The value of "path" may contain compound path
- separator (/ or \) which should be cleaned up. Because the "path" string
- will always be passed to external native program which may not handle
- non-native path separator, the clean-up action is a must. And the value
- of "path" may contains several path separated by space, tab, comma or
- semmicolon. We need to split it and put each part in nameList.
-
- @param path String value of a file system path
- **/
- public void setPath(String path) {
- this.nameList.clear();
- insPath(path);
- }
-
- /**
- Add a path or path list into the path list
-
- @param path The path string
- **/
- public void insPath(String path) {
- if (path.length() == 0) {
- return;
- }
-
- //
- // split the value of "path" into separated single path
- //
- StringTokenizer tokens = new StringTokenizer(path, " \t,;", false);
- while (tokens.hasMoreTokens()) {
- String pathName = tokens.nextToken().trim();
- if (pathName.length() > 0) {
- //
- // Make clean the path string before storing it
- //
- this.nameList.add(cleanupPath(pathName));
- }
- }
- }
-
- /**
- Handle "FileName" attribute. The value of "FileName" should be the path
- of a file which contains path strings, one path per line.
-
- @param pathFileName
- **/
- public void setPathFile(String pathFileName) {
- FileReader fileReader = null;
- BufferedReader in = null;
- String path;
-
- //
- // Check if the file exists or not
- //
- File file = new File(pathFileName);
- if (!file.exists()) {
- throw new BuildException("The file, " + file + " does not exist!");
- }
-
- try {
- fileReader = new FileReader(file);
- in = new BufferedReader(fileReader);
-
- //
- // Read the file line by line, skipping empty ones
- //
- nameList.clear();
- while((path = in.readLine()) != null){
- path = path.trim();
- if (path.length() == 0){
- continue;
- }
- //getProject().replaceProperties(path);
-
- //
- // Make clean the path string before storing it.
- //
- nameList.add(cleanupPath(path));
- }
- } catch (Exception e){
- throw new BuildException(e.getMessage());
- } finally {
- try {
- //
- // close the file
- //
- if (in != null) {
- in.close();
- }
- if (fileReader != null) {
- fileReader.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
- }
-
- /**
- Return the name list.
-
- @return List<String> The list contains the name(path) strings
- **/
- public List<String> getNameList() {
- return nameList;
- }
-
- /**
- Compose and return the the name/path string without any delimiter. The trick
- here is that it's actually used to return the value of nameList which
- has just one name/string.
-
- @return String
- **/
- public String toString() {
- return toString("");
- }
-
- /**
- Compose and return the name/path string concatenated by leading "prefix".
-
- @param prefix The string will be put before each name/string in nameList
-
- @return String The string concatenated with "prefix"
- **/
- public String toString(String prefix) {
- StringBuffer string = new StringBuffer(1024);
- int length = nameList.size();
-
- for (int i = 0; i < length; ++i) {
- string.append(prefix);
- string.append(nameList.get(i));
- }
-
- return string.toString();
- }
-
- /**
- Compose and return the name/path string concatenated by space and
- with only one "prefix".
-
- @param prefix The prefix at the beginning of the string
-
- @return String The string with one prefix at the beginning
- **/
- public String toStringWithSinglepPrefix(String prefix) {
- return prefix + toString(" ");
- }
-
- /**
- Compose a string list with file names only, separated by spcified string
-
- @param separator The separator string
-
- @return String The file list
- **/
- public String toFileList(String separator) {
- StringBuffer string = new StringBuffer(1024);
- int length = nameList.size();
-
- for (int i = 0; i < length; ++i) {
- File file = new File(nameList.get(i));
- string.append(file.getName());
- string.append(separator);
- }
-
- return string.toString();
- }
-
- /**
- Compose a string list with file names only, separated by space
-
- @return String The list string
- **/
- public String toFileList() {
- return toFileList(" ");
- }
-
- /**
- Get the array of names
-
- @return String[] The array contains the names
- **/
- public String[] toArray() {
- return nameList.toArray(new String[nameList.size()]);
- }
-
- /**
- Check if we have any name or not
-
- @return boolean
- **/
- public boolean isEmpty() {
- return nameList.isEmpty();
- }
-
- //
- // Remove any duplicated path separator or inconsistent path separator
- //
- private String cleanupPath(String path) {
- String separator = "\\" + File.separator;
- String duplicateSeparator = separator + "{2}";
-
- path = Path.translateFile(path);
- path = path.replaceAll(duplicateSeparator, separator);
-
- return path;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java
deleted file mode 100644
index ab563823e8..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/** @file
- PeiReBaseTask class.
-
- PeiReBaseTask is used to call PeiReBase.exe to rebase efi fv file.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- PeiReBaseTask class.
-
- PeiReBaseTask is used to call PeiReBase.exe to rebase efi fv file.
-**/
-public class PeiReBaseTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private String toolName = "PeiReBase";
- //
- // Input file
- //
- private FileArg inputFile = new FileArg();
- //
- // Output file
- //
- private FileArg outputFile = new FileArg();
- //
- // Base address
- //
- private ToolArg baseAddr = new ToolArg();
- //
- // Fv.inf file
- //
- private FileArg fvinfFile = new FileArg();
- //
- // map file
- //
- private FileArg mapFile = new FileArg();
- //
- // Architecture
- //
- private String arch = "IA32";
-
- /**
- execute
-
- PeiReBaseTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
- if (isUptodate()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, outputFile.toFileList() + " is up-to-date!");
- return;
- }
-
- Project project = this.getOwningTarget().getProject();
-
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (this.arch.equalsIgnoreCase("IA32")){
- command = toolName + "_IA32";
- } else if (this.arch.equalsIgnoreCase("X64")){
- command = toolName + "_X64";
- } else if (this.arch.equalsIgnoreCase("IPF")){
- command = toolName + "_IPF";
- } else {
- command = toolName + "_IA32";
- }
- if (path != null) {
- command = path + File.separator + command;
- }
-
- //
- // argument of tools
- //
- if (mapFile.getValue().length() == 0) {
- mapFile.setArg(" -M ", outputFile.getValue() + ".map");
- }
- argument = "" + inputFile + outputFile + baseAddr + fvinfFile;
-
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, inputFile.toFileList() + " => "
- + outputFile.toFileList()
- + mapFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "PeiReBase succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException("PeiReBase failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile".
-
- @return string of input file name.
- **/
- public String getInputFile() {
- return inputFile.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" -I ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -O ", outputFile);
- }
-
- /**
- getBaseAddr
-
- This function is to get class member "baseAddr"
-
- @return baseAddr string of base address.
- **/
- public String getBaseAddr() {
- return baseAddr.getValue();
- }
-
- /**
- setBaseAddr
-
- This function is to set class member "baseAddr"
-
- @param baseAddr string of base address
- **/
- public void setBaseAddr(String baseAddr) {
- this.baseAddr.setArg(" -B ", baseAddr);
- }
-
- /**
- getArch
-
- This function is to get class member "arch".
-
- @return arch Architecture
- **/
- public String getArch() {
- return arch;
- }
-
- /**
- setArch
-
- This function is to set class member "arch"
-
- @param arch Architecture
- **/
- public void setArch(String arch) {
- this.arch = arch;
- }
-
- /**
- Get the value of fv.inf file
-
- @return String The fv.inf file path
- **/
- public String getFvInfFile() {
- return fvinfFile.getValue();
- }
-
- /**
- Set "-F FvinfFile" argument
-
- @param fvinfFile The path of fv.inf file
- **/
- public void setFvInfFile(String fvinfFile) {
- this.fvinfFile.setArg(" -F ", fvinfFile);
- }
-
- /**
- Get the value of map file
-
- @return String The map file path
- **/
- public String getMapFile() {
- return mapFile.getValue();
- }
-
- /**
- Set "-M MapFile" argument
-
- @param mapFile The path of map file
- **/
- public void setMapFile(String mapFile) {
- this.mapFile.setArg(" -M ", mapFile);
- }
-
- //
- // Dependency check
- //
- private boolean isUptodate() {
- File srcFile = new File(inputFile.getValue());
- File dstFile = new File(outputFile.getValue());
-
- if (srcFile.lastModified() > dstFile.lastModified()) {
- return false;
- }
-
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
deleted file mode 100644
index 310cb6a814..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/** @file
- SecApResetVectorFixupTask class.
-
- SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place
- Ap reset vector.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- SecApResetVectorFixupTask class.
-
- SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place
- Ap reset vector.
-**/
-public class SecApResetVectorFixupTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private String toolName = "SecApResetVectorFixup";
- //
- // input FV recovery file
- //
- private FileArg fvInputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg fvOutputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = ".";
-
-
- /**
- execute
-
- SecApResetVectorFixupTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + this.fvInputFile + this.fvOutputFile;
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.fvInputFile.toFileList()
- + " => " + this.fvOutputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "fvInputFile".
-
- @return string of input file name.
- **/
- public String getfvInputFile() {
- return this.fvInputFile.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "fvInputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setFvInputFile(String inputFile) {
- this.fvInputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "fvOutputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return this.fvOutputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "fvOutputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setFvOutputFile(String outputFile) {
- this.fvOutputFile.setArg(" ", outputFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java
deleted file mode 100644
index 2f9bc46b8f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/** @file
- SecFixupTask class.
-
- SecFixupTask is used to call SecFixup.exe to fix up sec image.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- * SecFixupTask class.
- *
- * SecFixupTask is used to call SecFixup.exe to fix up sec image.
- */
-public class SecFixupTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private String toolName = "SecFixup";
-
- //
- // input file
- //
- private FileArg secExeFile = new FileArg();
-
- //
- // output file
- //
- private FileArg resetVectorDataFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = ".";
-
- /**
- execute
-
- SecFixupTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
-
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separatorChar + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + secExeFile + resetVectorDataFile + outputFile;
-
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, secExeFile.toFileList()
- + resetVectorDataFile.toFileList() + " => " + outputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getSecExeFile
-
- This function is to get class member "secExeFile".
-
- @return string of sectExe file name.
- **/
- public String getSecExeFile() {
- return this.secExeFile.getValue();
- }
-
- /**
- setSecExeFile
-
- This function is to set class member "secExeFile".
-
- @param secExeFile
- string of secExe file name.
- **/
- public void setSecExeFile(String secExeFile) {
- this.secExeFile.setArg(" ", secExeFile);
- }
-
- /**
- getResetVectorDataFile
-
- This function is to get class member "resetVectorDataFile"
-
- @return resetVectorDataFile string of resetVectorData file name.
- **/
- public String getResetVectorDataFile() {
- return this.resetVectorDataFile.getValue();
- }
-
- /**
- setResetVectorDataFile
-
- This function is to set class member "resetVectorDataFile"
-
- @param resetVectorDataFile
- string of resetVectorData file name.
- **/
- public void setResetVectorDataFile(String resetVectorDataFile) {
- this.resetVectorDataFile.setArg(" ", resetVectorDataFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", outputFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir name of output directory
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- name of output directory
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java
deleted file mode 100644
index 9d53a21999..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/** @file
-This file is to define nested element which is meant for specifying section file
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import org.apache.tools.ant.BuildException;
-
-/**
- Class SectFile is to define a class corresponding to ANT nested element. It's
- used to specify section file(s) when used with GenFfsFile task
- **/
-public class SectFile implements Section {
- private String fileName = ""; /// section file name
- private int alignment = 0;
-
- /**
- Get method of ANT task/datatype for "FileName" attribute
-
- @returns The name of section file
- **/
- public String getFileName() {
- return fileName;
- }
-
- /**
- Set method of ANT task/datatype for "FileName" attribute
-
- @param fileName The name of section file
- **/
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
- public int getAlignment() {
- return alignment;
- }
-
- public void setAlignment(int alignment) {
- if (alignment > 7) {
- this.alignment = 7;
- } else {
- this.alignment = alignment;
- }
- }
-
- public SectFile (){
- }
-
- /**
- Put the content of section file into specified buffer with extra bytes for
- alignment requirement.
-
- @param Buffer buffer to contain the section file content with alignment
- **/
- public void toBuffer (DataOutputStream buffer){
- File sectFile;
- int fileLen;
-
- ///
- /// open file
- ///
- sectFile = new File (this.fileName);
-
- ///
- /// check if file exist.
- ///
- if (! sectFile.exists()) {
- throw new BuildException("The file " + this.fileName + " is not exist!\n");
- }
-
-
- ///
- /// Read section file and add it's contains to buffer.
- ///
- try {
-
- FileInputStream fs = new FileInputStream (sectFile.getAbsoluteFile());
- DataInputStream In = new DataInputStream (fs);
- fileLen = (int)sectFile.length();
- byte[] sectBuffer = new byte[fileLen];
- In.read(sectBuffer);
- buffer.write(sectBuffer);
-
- ///
- /// 4 byte alignment
- ///
- while ((fileLen & 0x03)!= 0) {
- fileLen ++;
- buffer.writeByte(0);
- }
-
- ///
- /// close inputStream
- ///
- In.close();
-
- } catch (Exception e) {
- System.out.print(e.getMessage());
- throw new BuildException("SectFile, toBuffer failed!\n");
- }
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Section.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Section.java
deleted file mode 100644
index ff4c6d6d11..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Section.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/** @file
-This file is to define interface for manipulating section file
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-import java.io.DataOutputStream;
-
-/**
- Section interface is for geting the contain buffer form compress, tool, and sectFile
- **/
-public interface Section {
- int alignment = 0;
- public void toBuffer (DataOutputStream buffer);
- public void setAlignment(int alignment);
- public int getAlignment();
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SetStampTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SetStampTask.java
deleted file mode 100644
index dc3a96e8e5..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SetStampTask.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/** @file
-This file is to define an ANT task to wrap setstamp.exe tool
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- Class SetStampTask is a wrap class for setstamp.exe.
- **/
-public class SetStampTask extends Task implements EfiDefine {
- /**
- SetStamp Task Class
- class member
- -peFile : file of PE
- -timeFile: Txt file of time
- **/
-
- private static String toolName = "SetStamp";
-
- private FileArg peFile = new FileArg();
-
- private FileArg timeFile = new FileArg();
-
- private String outputDir = ".";
-
- /**
- assemble tool command line & execute tool command line
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- ///
- /// absolute path of edk tools
- ///
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- ///
- /// argument of SetStamp tool
- ///
- String argument = "" + peFile + timeFile;
- ///
- /// reture value of SetStamp execution
- ///
- int returnVal = -1;
-
- try {
- Commandline commandLine = new Commandline();
- commandLine.setExecutable(command);
- commandLine.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
-
- Execute runner = new Execute(streamHandler, null);
- runner.setAntRun(project);
- runner.setCommandline(commandLine.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));
- EdkLog.log(this, peFile.toFileList() + " < " + timeFile.toFileList());
-
- returnVal = runner.execute();
- if (EFI_SUCCESS == returnVal) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- ///
- /// command execution fail
- ///
- EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- set operation of class member "peFile"
-
- @param peFile name of PE File
- **/
- public void setPeFile(String peFile) {
- this.peFile.setArg(" ", peFile);
- }
-
- /**
- get operation of class member "peFile"
-
- @return peFile name of PE file
- **/
- public String getPeFile() {
- return this.peFile.getValue();
- }
-
- /**
- set operation of class member "timeFile"
-
- @param timeFile name of time file
- **/
- public void setTimeFile(String timeFile) {
- this.timeFile.setArg(" ", timeFile);
- }
-
- /**
- get class member "timeFile"
-
- @returns name of time file
- **/
- public String getTimeFile() {
- return this.timeFile.getValue();
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SkipExt.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SkipExt.java
deleted file mode 100644
index 20883c98e3..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SkipExt.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
-This file is to define nested element which is meant for specifying skipped file list
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-/**
- SkipExt nested element Class
- **/
-public class SkipExt extends NestElement {
- public String toString() {
- return super.toString(" -skipext ");
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java
deleted file mode 100644
index 7c1882aaf0..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/** @file
- SplitfileTask class.
-
- SplitfileTask is used to call splitfile.exe to split input file to 2 output
- file.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- SplitfileTask class.
-
- SplitfileTask is used to call splitfile.exe to split input file to 2 output
- file.
-**/
-public class SplitfileTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private static String toolName = "SplitFile";
-
- //
- // input file
- //
- private FileArg inputFile = new FileArg();
-
- //
- // offset value
- //
- private ToolArg offset = new ToolArg();
-
- //
- // Output directory
- //
- private String outputDir = ".";
-
- /**
- execute
-
- SplitfleTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
-
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- //
- // argument of tools
- //
- argument = "" + inputFile + offset;
-
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- String fileName = inputFile.toFileList();
- EdkLog.log(this, EdkLog.EDK_INFO, fileName + " => " + fileName + "1 " + fileName + "2");
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile".
-
- @return string of input file name.
- **/
- public String getInputFile() {
- return inputFile.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOffset
-
- This function is to get class member "offset"
-
- @return offset value of string.
- **/
- public String getOffset() {
- return offset.getValue();
- }
-
- /**
- setOffset
-
- This function is to set class member "offset"
-
- @param offset
- string of offset value.
- **/
- public void setOffset(String offset) {
- this.offset.setArg(" ", offset);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java
deleted file mode 100644
index 541e96f54f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/** @file
-This file is to define an ANT task which wraps StrGather.exe tool.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- StrGather Task Class
- class memberg
- -commandType : command type [parse/scan/dump]
- -baseName : base name of component
- -verbose : level of verbose [all/read/write]
- -outputDatabase : file name of output database file
- -databaseList : file name list of database files
- -inputFileList : file name list of input files
- -newDatabase : whether to need new database [ture/false]
- -unquotedString : whether to unquoted strings are used [ture/false]
- -includePathList: path list of include paths
- -ignoreNotFound : whether to ignore a given STRING_TOKEN(STR) is not found in database [ture/false]
- -skipExtList : skip scan of files with extension name
- -outputString : write string data to filename
- -outputDefines : write string defines to filename
- -outputUnicode : dump database to unicode file filename
- -lang : only dump for the language
- -indirectionFile: specify an indirection file
- -outputHpk : create an HII export pack of the strings
- **/
-public class StrGatherTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private static String toolName = "StrGather";
-
- //
- // common options
- //
- private ToolArg commandType = new ToolArg();
-
- private ToolArg baseName = new ToolArg();
-
- //
- // "all/read/write"
- //
- private ToolArg verbose = new ToolArg();
-
- private FileArg outputDatabase = new FileArg();
-
- private Database databaseList = new Database();
-
- private InputFile inputFileList = new InputFile();
-
- //
- // parse options newDatabase -- "ture/false" unquoteString -- "ture/false"
- //
- private ToolArg newDatabase = new ToolArg();
-
- private ToolArg unquotedString = new ToolArg();
-
- private IncludePath includePathList = new IncludePath();
-
- //
- // scan options ignoreNotFound -- "ture/false"
- //
- private ToolArg ignoreNotFound = new ToolArg();
-
- private SkipExt skipExtList = new SkipExt();
-
- //
- // dump options
- //
- private ToolArg outputString = new ToolArg();
-
- private ToolArg outputDefines = new ToolArg();
-
- private ToolArg outputUnicode = new ToolArg();
-
- private ToolArg lang = new ToolArg();
-
- private FileArg indirectionFile = new FileArg();
-
- private FileArg outputHpk = new FileArg();
-
- //
- // global variable
- //
- static private Project project;
-
- /**
- assemble tool command line & execute tool command line
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
-
- project = this.getOwningTarget().getProject();
- ///
- /// absolute path of efi tools
- ///
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- ///
- /// assemble argument
- ///
- String argument = "" + commandType + verbose + databaseList + baseName
- + outputDatabase + includePathList + newDatabase + unquotedString
- + skipExtList + ignoreNotFound + outputString + outputDefines
- + outputUnicode + lang + indirectionFile + outputHpk
- + inputFileList;
- ///
- /// return value of fwimage execution
- ///
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
-
- String cmdType = getCommandType();
- if (cmdType.equalsIgnoreCase("parse")) {
- EdkLog.log(this, "(parse) " + inputFileList.toFileList() + " => "
- + databaseList.toFileList());
- } else if (cmdType.equalsIgnoreCase("scan")) {
- EdkLog.log(this, "(scan) " + databaseList.toFileList() + " => "
- + outputDatabase.toFileList());
- } else {
- EdkLog.log(this, "(dump) " + databaseList.toFileList() + " => "
- + outputDefines.toFileList() + outputString.toFileList() + outputHpk.toFileList());
- }
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- ///
- /// command execution fail
- ///
- EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- get class member "commandType"
-
- @returns commandType parameter
- **/
- public String getCommandType() {
- return this.commandType.getValue();
- }
-
- /**
- set class member ""
-
- @param commandType type of strgather command [parse/scan/dump]
- **/
- public void setCommandType(String commandType) {
- this.commandType.setArg(" -", commandType);
- }
-
- /**
- get class member "verbose"
-
- @returns verbose parameter
- **/
- public String getVerbose() {
- return this.verbose.getValue();
- }
-
- /**
- set class member "verbose"
-
- @param verbose verbose level [all/read/write]
- **/
- public void setVerbose(String verbose) {
- if (verbose.equals("all")) {
- ///
- /// for verbose output
- ///
- this.verbose.setArg(" -", "v");
- } else if (verbose.equals("read")) {
- ///
- /// for verbose output when reading database
- ///
- this.verbose.setArg(" -", "vdbr");
- } else if (verbose.equals("write")) {
- ///
- /// for verbose output when writing database
- ///
- this.verbose.setArg(" -", "vdbw");
- }
- }
-
- /**
- get class member baseName
-
- @returns baseName parameter
- **/
- public String getBaseName() {
- return this.baseName.getValue();
- }
-
- /**
- set class member baseName
-
- @param baseName name of the output files of .c and .h
- **/
- public void setBaseName(String baseName) {
- this.baseName.setArg(" -bn ", baseName);
- }
-
- /**
- get class member "outputDatabase"
-
- @returns outputDatabase parameter
- **/
- public String getOutputDatabase() {
- return this.outputDatabase.getValue();
- }
-
- /**
- set class member "outputDatabase"
-
- @param outputDatabase filename of output database file
- **/
- public void setOutputDatabase(String outputDatabase) {
- this.outputDatabase.setArg(" -od ", outputDatabase);
- }
-
- /**
- get class member "newDatabase"
-
- @returns newDatabase parameter
- **/
- public boolean getNewDatabse() {
- return this.newDatabase.getPrefix().length() > 0;
- }
-
- /**
- set class member "newDatabase"
-
- @param newDatabase whether to not read in existing database file
- **/
- public void setNewDatabase(boolean newDatabase) {
- if (newDatabase) {
- this.newDatabase.setArg(" -", "newdb");
- }
- }
-
- /**
- get class member "unquotedString"
-
- @returns unquotedString parameter
- **/
- public boolean getUnquotedString() {
- return this.unquotedString.getValue().length() > 0;
- }
-
- /**
- set class member "unquotedString"
-
- @param unquotedString :
- whether to indicate that unquoted strings are used
- **/
- public void setUnquotedString(boolean unquotedString) {
- if (unquotedString) {
- this.unquotedString.setArg(" -", "uqs");
- }
- }
-
- /**
- get class member "ignoreNotFound"
-
- @returns ignoreNotFound parameter
- **/
- public boolean getIgnoreNotFound() {
- return this.ignoreNotFound.getValue().length() > 0;
- }
-
- /**
- set class member "ignoreNotFound"
-
- @param ignoreNotFound whether to ignore if a given STRING_TOKEN(STR)
- is not found in the database
- **/
- public void setIgnoreNotFound(boolean ignoreNotFound) {
- if (ignoreNotFound) {
- this.ignoreNotFound.setArg(" -", "ignorenotfound");
- }
- }
-
- /**
- get class member "outputString"
-
- @returns outputString parameter
- **/
- public String getOutputString() {
- return this.outputString.getValue();
- }
-
- /**
- set class member "outputString"
-
- @param outputString filename of string data file
- **/
- public void setOutputString(String outputString) {
- this.outputString.setArg(" -oc ", outputString);
- }
-
- /**
- get class member "outputDefines"
-
- @returns outputDefines parameter
- **/
- public String getOutputDefines() {
- return this.outputDefines.getValue();
- }
-
- /**
- set class member "outputDefines"
-
- @param outputDefines filename of string defines file
- **/
- public void setOutputDefines(String outputDefines) {
- this.outputDefines.setArg(" -oh ", outputDefines);
- }
-
- /**
- get class member "outputUnicode"
-
- @returns outputUnicode parameter
- **/
- public String getOutputUnicode() {
- return this.outputUnicode.getValue();
- }
-
- /**
- set class member "outputUnicode"
-
- @param outputUnicode filename of unicode file to be dumped database
- **/
- public void setOutputUnicode(String outputUnicode) {
- this.outputUnicode.setArg(" -ou ", outputUnicode);
- }
-
- /**
- get class member "lang"
-
- @returns lang parameter
- **/
- public String getLang() {
- return this.lang.getValue();
- }
-
- /**
- set class member "lang"
-
- @param lang language of dump
- **/
- public void setLang(String lang) {
- this.lang.setArg(" -lang ", lang);
- }
-
- /**
- get class member "indirectionFile"
-
- @returns indirectionFile parameter
- **/
- public String getIndirectionFile() {
- return this.indirectionFile.getValue();
- }
-
- /**
- set class member "indirectionFile"
-
- @param indirectionFile filename of indirection file
- **/
- public void setIndirectionFile(String indirectionFile) {
- this.indirectionFile.setArg(" -if ", indirectionFile);
- }
-
- /**
- get class member "outputHpk"
-
- @returns outputHpk parameter
- **/
- public String getOutputHpk() {
- return this.outputHpk.getValue();
- }
-
- /**
- set class member "outputHpk"
-
- @param outputHpk filename of output HII export pack of the strings
- **/
- public void setOutputHpk(String outputHpk) {
- this.outputHpk.setArg(" -hpk ", outputHpk);
- }
-
- /**
- add a skipExt element into list
-
- @param skipExt skipExt element
- **/
- public void addConfiguredSkipext(SkipExt skipExt) {
- this.skipExtList.insert(skipExt);
- };
-
- /**
- add a includePath element into list
-
- @param includePath includePath element
- **/
- public void addConfiguredIncludepath(IncludePath includePath) {
- this.includePathList.insert(includePath);
- };
-
- /**
- add a inputFile element into list
-
- @param inputFile inputFile element
- **/
- public void addConfiguredInputfile(InputFile inputFile) {
- this.inputFileList.insert(inputFile);
- };
-
- /**
- add a database element into list
-
- @param database :
- database element
- **/
- public void addConfiguredDatabase(Database database) {
- this.databaseList.insert(database);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java
deleted file mode 100644
index 9558f703b9..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/** @file
- StripTask class.
-
- StripTask is used to call Strip.exe to strip input file.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- StripTask class.
-
- StripTask is used to call Strip.exe to strip input file.
- */
-public class StripTask extends Task implements EfiDefine {
- //
- //
- //
- private static String toolName = "Strip";
- //
- // input file
- //
- private FileArg inputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = ".";
-
-
- /**
- execute
-
- StripTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
-
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
-
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- //
- // argument of tools
- //
- argument = "" + inputFile + outputFile;
-
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, inputFile.toFileList() + " => " + outputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile".
-
- @return string of input file name.
- **/
- public String getInputFile() {
- return inputFile.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", outputFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java
deleted file mode 100644
index ea320366b1..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/** @file
-This file is to define nested element which is meant for specifying a tool
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-
-import org.apache.tools.ant.BuildException;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- Class Tool is to define an external tool to be used for genffsfile
- **/
-public class Tool implements EfiDefine, Section {
-
- private int alignment = 0;
- private String toolName = "";
- private ToolArg toolArgList = new ToolArg();
- private Input inputFiles = new Input();
- private Input tempInputFile = new Input();
- private String outputPath;
- private String outputFileName ;
- private static Random ran = new Random(9999);
- private List<Section> gensectList = new ArrayList<Section>();
- /**
- Call extern tool
-
- @param buffer The buffer to put the result with alignment
- **/
- public void toBuffer (DataOutputStream buffer){
- ///
- /// call extern tool
- ///
- try {
- executeTool ();
- } catch (Exception e) {
- throw new BuildException("Call to executeTool failed!\n" + e.getMessage());
- }
-
- ///
- /// check if file exist
- ///
- File outputFile = new File (this.outputFileName);
- if (!outputFile.exists()) {
- throw new BuildException("The file " + outputFile.getPath() + " does not exist!\n");
- }
-
- ///
- /// Read output file and write it's cotains to buffer
- ///
- FileInputStream fs = null;
- DataInputStream in = null;
- try {
- fs = new FileInputStream (outputFile);
- in = new DataInputStream (fs);
-
-
- int fileLen = (int)outputFile.length();
- byte[] data = new byte[fileLen];
- in.read(data);
- buffer.write(data, 0, fileLen);
-
- ///
- /// 4 byte alignment
- ///
- while ((fileLen & 0x03) != 0) {
- fileLen++;
- buffer.writeByte(0);
- }
- } catch (Exception e) {
- EdkLog.log(e.getMessage());
- throw new BuildException("Tool call, toBuffer failed!\n");
- } finally {
- try {
- if (in != null) {
- in.close();
- }
- if (fs != null) {
- fs.close();
- }
- outputFile.delete();
- } catch (Exception e) {
- EdkLog.log("WARNING: Cannot close " + outputFile.getPath());
- }
- }
- }
-
- ///
- /// execute external tool for genffsfile
- ///
- private void executeTool () {
- String command = "";
- String argument = "";
- command = toolName;
-
- //
- // Get each section which under the compress {};
- // And add it is contains to File;
- //
- Section sect;
- try{
- Iterator SectionIter = this.gensectList.iterator();
- while (SectionIter.hasNext()){
- sect = (Section)SectionIter.next();
- //
- // Parse <genSection> element
- //
- File outputFile = File.createTempFile("temp", "sec1", new File(outputPath));
- FileOutputStream bo = new FileOutputStream(outputFile);
- DataOutputStream Do = new DataOutputStream (bo);
- //
- // Call each section class's toBuffer function.
- //
- try {
- sect.toBuffer(Do);
- }
- catch (BuildException e) {
- EdkLog.log(e.getMessage());
- throw new BuildException ("GenSection failed at Tool!");
- } finally {
- if (Do != null){
- Do.close();
- }
-
- }
- this.tempInputFile.insFile(outputFile.getPath());
- }
- } catch (IOException e){
- throw new BuildException ("Gensection failed at tool!");
- }
-
- try {
- this.outputFileName = "Temp" + getRand();
- argument = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ")
- + tempInputFile.toString(" ")+ " -o " + outputFileName;
- EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);
- ///
- /// execute command line
- ///
- Process process = Runtime.getRuntime().exec(command + " " + argument);
- process.waitFor();
- Iterator tempFile = tempInputFile.getNameList().iterator();
- while (tempFile.hasNext()){
- File file = new File((String)tempFile.next());
- if (file.exists()) {
- file.delete();
- }
- }
- } catch (Exception e) {
- EdkLog.log(e.getMessage());
- throw new BuildException("Execution of externalTool task failed!\n");
- }
- }
-
- /**
- Add method of ANT task/datatype for nested ToolArg type of element
-
- @param toolArg The ToolArg object containing arguments for the tool
- **/
- public void addConfiguredToolArg (ToolArg toolArg) {
- toolArgList.insert(toolArg);
- }
-
- /**
- Get method of ANT task/datatype for attribute "OutputPath"
-
- @returns The name of output path
- **/
- public String getOutputPath() {
- return outputPath;
- }
-
- /**
- Set method of ANT task/datatype for attribute "OutputPath"
-
- @param outputPath The name of output path
- **/
- public void setOutputPath(String outPutPath) {
- this.outputPath = outPutPath;
- }
-
- /**
- Get method of ANT task/datatype for attribute "ToolName"
-
- @returns The name of the tool.
- **/
- public String getToolName() {
- return toolName;
- }
-
- /**
- Set method of ANT task/datatype for attribute "ToolName"
-
- @param toolName The name of the tool
- **/
- public void setToolName(String toolName) {
- this.toolName = toolName;
- }
-
- /**
- Add method of ANT task/datatype for nested Input type of element
-
- @param file The Input objec which represents a file
- **/
- public void addConfiguredInput(Input file) {
- inputFiles.insert(file);
- }
-
-// /**
-// addTool
-//
-// This function is to add instance of Tool to list.
-//
-// @param tool instance of Tool.
-// **/
-// public void addTool(Tool tool){
-// this.toolList.add(tool);
-// }
-
- public void addGenSection(GenSectionTask genSect){
- this.gensectList.add(genSect);
- }
-
- /**
- Get random number.
-
- @returns The random integer.
- **/
- public synchronized int getRand() {
- return ran.nextInt();
- }
-
- public int getAlignment() {
- return alignment;
- }
-
- public void setAlignment(int alignment) {
- if (alignment > 7) {
- this.alignment = 7;
- } else {
- this.alignment = alignment;
- }
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ToolArg.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ToolArg.java
deleted file mode 100644
index ade6817955..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ToolArg.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for tool's argument
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-/**
- ToolArg class is defined to represent the argument of a tool. The argument
- includes the prefix (e.g. -I, -o) and the value.
- **/
-public class ToolArg extends NestElement {
- ///
- /// A constant which is used to represent an empty argument
- ///
- public final static ToolArg EMPTY_ARG = new ToolArg();
-
- //
- // Keep track the prefix of this argument
- //
- private String prefix = "";
-
- /**
- Default constructor
- **/
- public ToolArg() {
- }
-
- /**
- Constructor which will initialize the prefix of this argument
-
- @param prefix The string of prefix
- */
- public ToolArg(String prefix) {
- this.prefix = prefix;
- }
-
- /**
- Constructor which will initialize both the prefix and value of this argument
-
- @param prefix The prefix of this argument
- @param value The value of this argument
- */
- public ToolArg(String prefix, String value) {
- setArg(prefix, value);
- }
-
- /**
- Set the prefix and value of this argument
-
- @param prefix The prefix of this argument
- @param value The value of this argument
- */
- public void setArg(String prefix, String value) {
- this.prefix = prefix;
- super.setName(value);
- }
-
- /**
- Set the prefix of this argument
-
- @param prefix The prefix of this argument
- */
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- /**
- Get the prefix of this argument
-
- @return String The prefix of this argument
- */
- public String getPrefix() {
- return this.prefix.trim();
- }
-
- /**
- Set the value of this argument
-
- @param value The value of this argument
- */
- public void setValue(String value) {
- super.setName(value);
- }
-
- /**
- Add a value for this argument
-
- @param value The value of this argument
- */
- public void insValue(String value) {
- super.insName(value);
- }
-
- /**
- Get the value list of this argument, separated by space
-
- @return String The value list
- */
- public String getValue() {
- return super.toString(" ").trim();
- }
-
- /**
- Set the argument as a whole
-
- @param line The argument string line
- */
- public void setLine(String line) {
- //
- // Since the prefix is in the "line", we don't need another prefix.
- //
- this.prefix = " ";
- super.setName(line);
- }
-
- /**
- Get the argument line
-
- @return String The argument string line
- */
- public String getLine() {
- return this.toString();
- }
-
- /**
- Compose a complete argument string.
-
- @return String The complete argument
- */
- public String toString() {
- return super.toString(prefix);
- }
-
- /**
- Check if the argument is empty or not
-
- @return boolean
- **/
- public boolean isEmpty() {
- return (prefix.length() == 0) && (nameList.isEmpty());
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
deleted file mode 100644
index 178e92ae66..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/** @file
-This file is to define an ANT task which wraps VfrCompile.exe tool
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- VfrcompilerTask Task Class
- class member
- -createListFile : create an output IFR listing file.
- -outPutDir : deposit all output files to directory OutputDir (default=cwd)
- -createIfrBinFile: create an IFR HII pack file
- -vfrFile : name of the input VFR script file
- -processArg : c processer argument
- -includepathList : add IncPath to the search path for VFR included files
- **/
-public class VfrCompilerTask extends Task implements EfiDefine {
- private static String toolName = "VfrCompile";
-
- private ToolArg createListFile = new ToolArg();
- private ToolArg createIfrBinFile = new ToolArg();
- private ToolArg processerArg = new ToolArg();
- private FileArg vfrFile = new FileArg();
- private IncludePath includepathList = new IncludePath();
- private FileArg outPutDir = new FileArg(" -od ", ".");
- private String dllPath = "";
-
- /**
- get class member of createList file
-
- @returns file name of createList
- **/
- public boolean getCreateListFile() {
- return this.createListFile.getValue().length() > 0;
- }
-
- /**
- set class member of createList file
-
- @param createListFile if createList string equal "on" set '-l' flag
- **/
- public void setCreateListFile(boolean createListFile) {
- if (createListFile) {
- this.createListFile.setArg(" -", "l");
- }
- }
-
- /**
- get output dir
-
- @returns name of output dir
- **/
- public String getOutPutDir() {
- return this.outPutDir.getValue();
- }
-
- /**
- set class member of outPutDir
-
- @param outPutDir The directory name for ouput file
- **/
- public void setOutPutDir(String outPutDir) {
- this.outPutDir.setArg(" -od ", outPutDir);
- }
-
-
- /**
- get class member of ifrBinFile
-
- @return file name of ifrBinFile
- **/
- public boolean getCreateIfrBinFile() {
- return this.createIfrBinFile.getValue().length() > 0;
- }
-
- /**
- set class member of ifrBinFile
-
- @param createIfrBinFile The flag to specify if the IFR binary file should
- be generated or not
- */
- public void setCreateIfrBinFile(boolean createIfrBinFile) {
- if (createIfrBinFile) {
- this.createIfrBinFile.setArg(" -", "ibin");
- }
- }
-
- /**
- get class member of vfrFile
-
- @returns name of vfrFile
- **/
- public String getVfrFile() {
- return this.vfrFile.getValue();
- }
-
- /**
- set class member of vfrFile
-
- @param vfrFile The name of VFR file
- **/
- public void setVfrFile(String vfrFile) {
- this.vfrFile.setArg(" ", vfrFile);
- }
-
- /**
- add includePath in includepath List
-
- @param includepath The IncludePath object which represents include path
- **/
- public void addConfiguredIncludepath(IncludePath includepath){
- this.includepathList.insert(includepath);
- }
-
- /**
- get class member of processerArg
-
- @returns processer argument
- **/
- public String getProcesserArg() {
- return this.processerArg.getValue();
- }
-
-
- /**
- set class member of processerArg
-
- @param processerArg The processor argument
- */
- public void setProcesserArg(String processerArg) {
- this.processerArg.setArg(" -ppflag ", processerArg);
- }
-
- public void setDllPath(String dllPath) {
- this.dllPath = dllPath;
- }
-
- /**
- The standard execute method of ANT task.
- **/
- public void execute() throws BuildException {
- Project project = this.getProject();
- String toolPath= project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (toolPath == null) {
- command = toolName;
- } else {
- command = toolPath + File.separator + toolName;
- }
-
- String argument = "" + createIfrBinFile
- + processerArg
- + includepathList
- + outPutDir
- + createListFile
- + vfrFile;
- try {
- ///
- /// constructs the command-line
- ///
- Commandline commandLine = new Commandline();
- commandLine.setExecutable(command);
- commandLine.createArgument().setLine(argument);
-
- ///
- /// configures the Execute object
- ///
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO,
- Project.MSG_WARN);
-
- Execute runner = new Execute(streamHandler,null);
- runner.setAntRun(project);
- runner.setCommandline(commandLine.getCommandline());
- runner.setWorkingDirectory(new File(outPutDir.getValue()));
- runner.setEnvironment(new String[]{"PATH", dllPath});
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));
- EdkLog.log(this, vfrFile.toFileList());
-
- int returnVal = runner.execute();
- if (EFI_SUCCESS == returnVal) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "VfrCompile succeeded!");
- } else {
- EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));
- throw new BuildException("VfrCompile failed!");
- }
- } catch (IOException e) {
- throw new BuildException(e.getMessage());
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java
deleted file mode 100644
index f60b8a6bb8..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/** @file
- ZeroDebugDataTask class.
-
- ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.
-
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.framework.tasks;
-
-import java.io.File;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- ZeroDebugDataTask class.
-
- ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.
-**/
-public class ZeroDebugDataTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private static String toolName = "ZeroDebugData";
- //
- // input PE file
- //
- private FileArg peFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg(" ", "DebugData.dat");
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = ".";
-
-
- /**
- execute
-
- ZeroDebugDataTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
-
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- String argument;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separatorChar + toolName;
- }
-
- //
- // argument of tools
- //
- argument = "" + peFile + outputFile;
-
- //
- // return value of fwimage execution
- //
- int revl = -1;
-
- try {
- Commandline cmdline = new Commandline();
- cmdline.setExecutable(command);
- cmdline.createArgument().setLine(argument);
-
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO, Project.MSG_WARN);
- Execute runner = new Execute(streamHandler, null);
-
- runner.setAntRun(project);
- runner.setCommandline(cmdline.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, peFile.toFileList() + " => " + outputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "ZeroDebugData succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException("ZeroDebugData failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getPeFile
-
- This function is to get class member "inputFile".
-
- @return string of input file name.
- **/
- public String getPeFile() {
- return this.peFile.getValue();
- }
-
- /**
- setPeFile
-
- This function is to set class member "peFile".
-
- @param peFile
- string of input file name.
- **/
- public void setPeFile(String peFile) {
- this.peFile.setArg(" ", peFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", outputFile);
- }
-
- /**
- getOutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set class member "outputDir"
-
- @param outputDir
- string of output directory.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/FrameworkWizard.msa b/Tools/Java/Source/FrameworkWizard/FrameworkWizard.msa
deleted file mode 100644
index 85d1b88fe6..0000000000
--- a/Tools/Java/Source/FrameworkWizard/FrameworkWizard.msa
+++ /dev/null
@@ -1,224 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
- <MsaHeader>
- <ModuleName>Framework Wizard</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>EAC548CB-1B55-4d32-B3E1-F790095BF590</GuidValue>
- <Version>2.0</Version>
- <Abstract>This is the EFI/Tiano Tool Resources Module</Abstract>
- <Description>
- This Module provides the EFI/Tiano Tools that are used to create EFI/Tiano
- Modules and Platform Binary Files (PBF)
- These tools require compilation only once if the Developer Workstation and
- the Developer's choice of HOST tool chain are stable. If the developer
- updates either the OS or the HOST tool chain, these tools should be rebuilt.
- </Description>
- <Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
- <License>
-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.
- </License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>build.xml</Filename>
- <Filename>MANIFEST.MF</Filename>
- <Filename>rsc/resources/images/logo.gif</Filename>
- <Filename>rsc/resources/images/No.JPG</Filename>
- <Filename>rsc/resources/images/Yes.JPG</Filename>
- <Filename>src/org/tianocore/frameworkwizard/About.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/Clone.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/FrameworkWizardUI.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/NewFileChooser.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/SelectModuleBelong.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/SplashScreen.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/ToolChainConfig.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/DataType.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/DataValidation.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/EnumerationData.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/FileOperation.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/GlobalData.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/IFileFilter.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Log.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/OpenFile.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/SaveFile.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Sort.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Tools.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/XmlConfig.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/Find.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/FindResult.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/FindResultId.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/GuidId.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/LibraryClassId.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/PcdFindResultId.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/PcdId.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/PpiId.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/find/ProtocolId.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/Identification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningFileType.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformList.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformType.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigId.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/ExitConfirm.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/IComboBox.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/IDefaultMutableTreeNode.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/IDesktopManager.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/IDialog.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/IFrame.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/ITree.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/StarLabel.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListCellRenderer.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListener.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListModel.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/AggregationOperation.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/DistributeRule.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/Far.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/FarFileItem.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/FarHeader.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/FarIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/FarInterface.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/FarMd5.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/FarPackage.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/FarPlatformItem.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/FarStringDefinition.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/Manifest.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/ManifestInterface.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/PackageQuery.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/toolchain/Preferences.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/workspace/Workspace.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java</Filename>
- <Filename>src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/FrameworkWizard/MANIFEST.MF b/Tools/Java/Source/FrameworkWizard/MANIFEST.MF
deleted file mode 100644
index cfce7f7552..0000000000
--- a/Tools/Java/Source/FrameworkWizard/MANIFEST.MF
+++ /dev/null
@@ -1,2 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: org.tianocore.frameworkwizard.FrameworkWizardUI
diff --git a/Tools/Java/Source/FrameworkWizard/build.xml b/Tools/Java/Source/FrameworkWizard/build.xml
deleted file mode 100644
index 5c71edbd19..0000000000
--- a/Tools/Java/Source/FrameworkWizard/build.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="FrameworkWizard" default="FrameworkWizard" basedir=".">
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
- </path>
- <property name="buildDir" value="build"/>
- <property name="resourceDir" value="rsc"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/bin"/>
- <target name="FrameworkWizard" depends="install"/>
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="src" destdir="${buildDir}">
- <classpath refid="classpath"/>
- <!-- <compilerarg value="-Xlint"/> -->
- </javac>
- </target>
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false" quiet="true">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/FrameworkWizard" includes="${buildDir}"/>
- </delete>
- </target>
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: FrameworkWizard.jar"/>
- <delete file="${installLocation}/FrameworkWizard.jar"/>
- </target>
- <target name="install" depends="source">
- <jar destfile="${installLocation}/FrameworkWizard.jar" manifest="MANIFEST.MF">
- <fileset dir="${buildDir}"/>
- <fileset dir="${resourceDir}"/>
- </jar>
- </target>
-</project>
diff --git a/Tools/Java/Source/FrameworkWizard/rsc/resources/images/No.JPG b/Tools/Java/Source/FrameworkWizard/rsc/resources/images/No.JPG
deleted file mode 100644
index c3f312b279..0000000000
--- a/Tools/Java/Source/FrameworkWizard/rsc/resources/images/No.JPG
+++ /dev/null
Binary files differ
diff --git a/Tools/Java/Source/FrameworkWizard/rsc/resources/images/Yes.JPG b/Tools/Java/Source/FrameworkWizard/rsc/resources/images/Yes.JPG
deleted file mode 100644
index 67d6539e74..0000000000
--- a/Tools/Java/Source/FrameworkWizard/rsc/resources/images/Yes.JPG
+++ /dev/null
Binary files differ
diff --git a/Tools/Java/Source/FrameworkWizard/rsc/resources/images/logo.gif b/Tools/Java/Source/FrameworkWizard/rsc/resources/images/logo.gif
deleted file mode 100644
index a9e0c8d921..0000000000
--- a/Tools/Java/Source/FrameworkWizard/rsc/resources/images/logo.gif
+++ /dev/null
Binary files differ
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java
deleted file mode 100644
index 95c06b8200..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/** @file
-
- To show a about window with copyright information
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.WindowEvent;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import javax.swing.ImageIcon;
-
-/**
- The class is used to show a about window with copyright information
- It extends IDialog
-
- **/
-public class About extends IDialog {
-
- ///
- /// Define Class Serial Version UID
- ///
- private static final long serialVersionUID = 2958136136667310962L;
-
- ///
- /// Define Class Members
- ///
- private JPanel jContentPane = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel1 = null;
-
- private JLabel jLabel2 = null;
-
- private JButton jButtonOK = null;
-
- private JLabel jLabelImage = null;
-
- /**
- This method initializes jButtonOK
-
- @return javax.swing.JButton jButtonOK
-
- **/
- private JButton getJButtonOK() {
- if (jButtonOK == null) {
- jButtonOK = new JButton();
- jButtonOK.setBounds(new java.awt.Rectangle(115, 200, 90, 20));
- jButtonOK.setText("OK");
- jButtonOK.addActionListener(this);
- }
- return jButtonOK;
- }
-
- /**
- This is the default constructor
-
- **/
- public About() {
- super();
- init();
- }
-
- /**
- This is the default constructor
-
- **/
- public About(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- init();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(320, 265);
- this.setContentPane(getJContentPane());
- this.setTitle("About");
- this.getRootPane().setDefaultButton(jButtonOK);
- this.centerWindow();
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelImage = new JLabel();
- jLabelImage.setBounds(new java.awt.Rectangle(63, 20, 193, 58));
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/logo.gif")));
-
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(25, 160, 270, 20));
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel2.setText("All rights reserved");
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(25, 130, 270, 20));
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel1.setText("Copyright (c) 2006, Intel Corporation");
- jLabel = new JLabel();
- jLabel.setToolTipText("");
- jLabel.setBounds(new java.awt.Rectangle(25, 90, 270, 20));
- jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel.setText(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(320, 235));
- jContentPane.add(jLabel, null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(getJButtonOK(), null);
- jContentPane.add(jLabelImage, null);
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOK) {
- returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- /**
- Dispose when windows is closing
-
- @param arg0
-
- **/
- public void windowClosing(WindowEvent arg0) {
- this.dispose();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java
deleted file mode 100644
index f4aebe0483..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java
+++ /dev/null
@@ -1,1291 +0,0 @@
-/** @file
-
- The file is used to clone workspace, module, package and platform
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.Vector;
-
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import javax.swing.JButton;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.ModuleDefinitionsDocument.ModuleDefinitions;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageDefinitionsDocument.PackageDefinitions;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformDefinitionsDocument.PlatformDefinitions;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.FileOperation;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.common.SaveFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-import javax.swing.JComboBox;
-
-/**
- The class is used to provide functions to clone workspace, module, package and platform
- It extends IDialog
-
- **/
-public class Clone extends IDialog {
-
- ///
- /// Define Class Serial Version UID
- ///
- private static final long serialVersionUID = -5469299324965727137L;
-
- ///
- /// Define Class Members
- ///
- private JPanel jContentPane = null;
-
- private JLabel jLabelType = null;
-
- private JTextField jTextFieldType = null;
-
- private JLabel jLabelSource = null;
-
- private JTextField jTextFieldSource = null;
-
- private JButton jButtonBrowse = null;
-
- private JLabel jLabelDestinationFile = null;
-
- private JTextField jTextFieldFilePath = null;
-
- private JLabel jLabelBaseName = null;
-
- private JTextField jTextFieldBaseName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelBelong = null;
-
- private JComboBox jComboBoxExistingPackage = null;
-
- ///
- /// Define members not for UI
- ///
-
- private int mode = -1;
-
- private Vector<PackageIdentification> packages = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private Identification oldId = null;
-
- private Identification newId = null;
-
- private ModuleIdentification mid = null;
-
- private PackageIdentification pid = null;
-
- private PlatformIdentification fid = null;
-
- /**
- This method initializes jTextFieldType
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldType() {
- if (jTextFieldType == null) {
- jTextFieldType = new JTextField();
- jTextFieldType.setBounds(new java.awt.Rectangle(210, 10, 320, 20));
- jTextFieldType.setEditable(false);
- }
- return jTextFieldType;
- }
-
- /**
- This method initializes jTextFieldSource
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldSource() {
- if (jTextFieldSource == null) {
- jTextFieldSource = new JTextField();
- jTextFieldSource.setBounds(new java.awt.Rectangle(210, 35, 320, 20));
- jTextFieldSource.setEditable(false);
- }
- return jTextFieldSource;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(445, 85, 85, 20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.addActionListener(this);
- }
- return jButtonBrowse;
- }
-
- /**
- This method initializes jTextFieldDestinationFile
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldFilePath() {
- if (jTextFieldFilePath == null) {
- jTextFieldFilePath = new JTextField();
- jTextFieldFilePath.setBounds(new java.awt.Rectangle(210, 85, 230, 20));
- }
- return jTextFieldFilePath;
- }
-
- /**
- This method initializes jTextFieldBaseName
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(210, 110, 320, 20));
- }
- return jTextFieldBaseName;
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(210, 135, 230, 20));
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jTextFieldVersion
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(210, 160, 320, 20));
- }
- return jTextFieldVersion;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(285, 200, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(405, 200, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jButtonGenerateGuid
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(445, 135, 85, 20));
- jButtonGenerateGuid.setText("Gen");
- jButtonGenerateGuid.addActionListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- This method initializes jComboBoxExistingPackage
-
- @return javax.swing.JComboBox
-
- **/
- private JComboBox getJComboBoxExistingPackage() {
- if (jComboBoxExistingPackage == null) {
- jComboBoxExistingPackage = new JComboBox();
- jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(210, 60, 320, 20));
- }
- return jComboBoxExistingPackage;
- }
-
- /**
- This is the default constructor
-
- **/
- public Clone() {
- super();
- init();
- }
-
- /**
- This is the override constructor
-
- @param parentFrame The parent frame which starts this frame
- @param modal To identify the frame's modal
- @param fileType To identify the clone target type
- @param identification The clone target's identification
-
- **/
- public Clone(IFrame parentFrame, boolean modal, int fileType, Identification identification) {
- super(parentFrame, modal);
- this.mode = fileType;
- if (identification != null) {
- this.oldId = new Identification(identification.getName(), identification.getGuid(),
- identification.getVersion(), identification.getPath());
- this.newId = new Identification(identification.getName(), identification.getGuid(),
- identification.getVersion(), identification.getPath());
- }
- init(mode);
- }
-
- /**
- Query all existing packages and fill them into combox
-
- **/
- private void initExistingPackage() {
- packages = wt.getAllPackages();
- for (int index = 0; index < packages.size(); index++) {
- this.jComboBoxExistingPackage.addItem(packages.elementAt(index).getName());
- }
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(550, 260);
- this.setContentPane(getJContentPane());
- this.setTitle("Clone");
- this.centerWindow();
- }
-
- /**
- This method initializes this with given clone target type.
- Customize the frame interface via different clone target type.
-
- @param mode To identify the clone target type
-
- **/
- private void init(int mode) {
- init();
- //
- // For MODULE_SURFACE_AREA
- //
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- this.jTextFieldType.setText(DataType.MODULE_SURFACE_AREA);
- String s = oldId.getPath();
- s = Tools.getRelativePath(s, Tools.getFilePathOnly(wt.getPackageIdByModuleId(oldId).getPath()));
- this.jTextFieldSource.setText(Tools.convertPathToCurrentOsType(s));
- initExistingPackage();
- this.jButtonBrowse.setVisible(false);
- this.jTextFieldFilePath
- .setToolTipText("<html>Input the module's relative path and filename, for example:<br>Application\\HelloWorld\\HelloWorld.msa</html>");
- this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);
- this.jLabelDestinationFile.setText("New Module Path and Filename");
- }
- //
- // For PACKAGE_SURFACE_AREA
- //
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- this.jTextFieldType.setText(DataType.PACKAGE_SURFACE_AREA);
- String s = oldId.getPath();
- s = Tools.getRelativePath(oldId.getPath(), Workspace.getCurrentWorkspace());
- this.jTextFieldSource.setText(Tools.convertPathToCurrentOsType(s));
- this.jLabelBelong.setEnabled(false);
- this.jComboBoxExistingPackage.setEnabled(false);
- this.jButtonBrowse.setVisible(false);
- this.jTextFieldFilePath
- .setToolTipText("<html>Input the package's relative path and file name, for example:<br>MdePkg\\MdePkg.spd</html>");
- this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);
- this.jLabelDestinationFile.setText("New Package Path and Filename");
-
- //
- // Check if the package can be cloned
- //
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.openingPackageList
- .getIdByPath(this.oldId
- .getPath()));
- if (spd != null) {
- if (spd.getPackageDefinitions() != null) {
- if (!spd.getPackageDefinitions().getRePackage()) {
- Log.wrn("Clone Package", "This package can't repackaged and cloned");
- this.jTextFieldBaseName.setEnabled(false);
- this.jTextFieldFilePath.setEnabled(false);
- this.jTextFieldGuid.setEnabled(false);
- this.jTextFieldVersion.setEnabled(false);
- this.jButtonGenerateGuid.setEnabled(false);
- this.jButtonOk.setEnabled(false);
- }
- }
- }
- }
- //
- // For PLATFORM_SURFACE_AREA
- //
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- this.jTextFieldType.setText(DataType.PLATFORM_SURFACE_AREA);
- this.jTextFieldSource.setText(oldId.getPath());
- this.jLabelBelong.setEnabled(false);
- this.jComboBoxExistingPackage.setEnabled(false);
- this.jTextFieldFilePath
- .setToolTipText("<html>Select the platform's relative path and filename. For example:<br>C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd</html>");
- this.jLabelDestinationFile.setText("New Platform Path and Filename");
- }
- //
- // For WORKSPACE
- //
- if (mode == DataType.RETURN_TYPE_WORKSPACE) {
- this.jTextFieldType.setText(DataType.WORKSPACE);
- this.jTextFieldSource.setText(Workspace.getCurrentWorkspace());
- this.jLabelBelong.setEnabled(false);
- this.jComboBoxExistingPackage.setEnabled(false);
- this.jLabelBaseName.setEnabled(false);
- this.jTextFieldBaseName.setEditable(false);
- this.jLabelGuid.setEnabled(false);
- this.jTextFieldGuid.setEnabled(false);
- this.jButtonGenerateGuid.setEnabled(false);
- this.jLabelVersion.setEnabled(false);
- this.jTextFieldVersion.setEnabled(false);
- this.jTextFieldFilePath
- .setToolTipText("<html>Input the workspace path, for example:<br>C:\\MyWorkspace</html>");
- this.jLabelDestinationFile.setText("New Workspace Path");
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelBelong = new JLabel();
- jLabelBelong.setBounds(new java.awt.Rectangle(15, 60, 190, 20));
- jLabelBelong.setText("Clone Package");
- jLabelVersion = new JLabel();
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 160, 190, 20));
- jLabelVersion.setText("Version");
- jLabelGuid = new JLabel();
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 135, 190, 20));
- jLabelGuid.setText("Guid");
- jLabelBaseName = new JLabel();
- jLabelBaseName.setBounds(new java.awt.Rectangle(15, 110, 190, 20));
- jLabelBaseName.setText("Base Name");
- jLabelDestinationFile = new JLabel();
- jLabelDestinationFile.setBounds(new java.awt.Rectangle(15, 85, 190, 20));
- jLabelDestinationFile.setText("Destination File Name");
- jLabelSource = new JLabel();
- jLabelSource.setBounds(new java.awt.Rectangle(15, 35, 190, 20));
- jLabelSource.setText("Source");
- jLabelType = new JLabel();
- jLabelType.setBounds(new java.awt.Rectangle(15, 10, 190, 20));
- jLabelType.setText("Type");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(540, 227));
- jContentPane.add(jLabelType, null);
- jContentPane.add(getJTextFieldType(), null);
- jContentPane.add(jLabelSource, null);
- jContentPane.add(getJTextFieldSource(), null);
- jContentPane.add(jLabelDestinationFile, null);
- jContentPane.add(getJTextFieldFilePath(), null);
- jContentPane.add(jLabelBaseName, null);
- jContentPane.add(getJTextFieldBaseName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelBelong, null);
- jContentPane.add(getJComboBoxExistingPackage(), null);
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonCancel) {
- this.setVisible(false);
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (this.check()) {
- try {
- //
- // Save to file
- //
- this.save();
- } catch (IOException e) {
- Log.wrn("Clone", e.getMessage());
- Log.err("Clone", e.getMessage());
- return;
- } catch (XmlException e) {
- Log.wrn("Clone", e.getMessage());
- Log.err("Clone", e.getMessage());
- return;
- } catch (Exception e) {
- Log.wrn("Clone", e.getMessage());
- Log.err("Clone", e.getMessage());
- return;
- }
- } else {
- return;
- }
- this.setVisible(false);
- }
-
- if (arg0.getSource() == this.jButtonGenerateGuid) {
- this.jTextFieldGuid.setText(Tools.generateUuidString());
- }
-
- //
- // Use different file ext for different clone target type
- //
- if (arg0.getSource() == this.jButtonBrowse) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
-
- if (mode == DataType.RETURN_TYPE_WORKSPACE) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- }
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())
- .getPath()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.MODULE_SURFACE_AREA_EXT));
- }
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.PACKAGE_SURFACE_AREA_EXT));
- }
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.PLATFORM_SURFACE_AREA_EXT));
- }
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldFilePath.setText(Tools.addPathExt(fc.getSelectedFile().getPath(), mode));
- }
- }
- }
-
- /**
- Check name, guid and version.
- If all of them are valid, save information to new id
-
- @retval true All name, guid and version are valid
- @retval false Any one of name, guid and version is invalid
-
- **/
- private boolean checkId(int mode) {
- String name = this.jTextFieldBaseName.getText();
- String guid = this.jTextFieldGuid.getText();
- String version = this.jTextFieldVersion.getText();
-
- //
- // Check Basename
- //
- if (isEmpty(name)) {
- Log.wrn("Clone", "The Name is required!");
- return false;
- }
- if (!DataValidation.isBaseName(name)) {
- Log
- .wrn("Clone",
- "<html>Incorrect data type for the Name, it must<br>be a single word, starting with an alpha character.</html>");
- return false;
- }
-
- //
- // Check Guid
- //
- if (isEmpty(guid)) {
- Log.wrn("Clone", "A Guid is required!!");
- return false;
- }
- if (!DataValidation.isGuid(guid)) {
- Log
- .wrn(
- "Clone",
- "<html>Incorrect data type for Guid, which must<br>be in registry format (8-4-4-4-12) for example:<br>d3adb123-eef1-466d-39ac-02febcaf5997</html>");
- return false;
- }
-
- //
- // Check Version
- //
- if (isEmpty(version)) {
- Log.wrn("Clone", "A Version must be entered!");
- return false;
- }
- if (!DataValidation.isVersion(version)) {
- Log
- .wrn(
- "Clone",
- "<html>Incorrect data type for Version, which must<br>be one or more digits, optionally followed by sequence<br>of one or more dot, one or more digits; examples:<br>1.0 1.0.1 12.25.256</html>");
- return false;
- }
-
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- String packageGuid = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getGuid();
- String packageVersion = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getVersion();
- if (GlobalData.findModuleId(guid, version, packageGuid, packageVersion) != null) {
- Log.wrn("Clone", "A module with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- if (GlobalData.findPackageId(guid, version) != null) {
- Log.wrn("Clone", "A package with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- if (GlobalData.findPlatformId(guid, version) != null) {
- Log.wrn("Clone", "A platform with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- //
- // Save information to id
- //
- newId.setName(this.jTextFieldBaseName.getText());
- newId.setGuid(this.jTextFieldGuid.getText());
- newId.setVersion(this.jTextFieldVersion.getText());
- newId.setPath(this.jTextFieldFilePath.getText());
-
- return true;
- }
-
- /**
- Check before save
-
- @retval true All check points are passed
- @retval false Any one of check points is failed
-
- **/
- private boolean check() {
- String src = this.oldId.getPath();
- String trg = this.jTextFieldFilePath.getText();
- File srcFile = new File(src);
- File trgFile = new File(trg);
-
- //
- // Common Check
- //
- if (!srcFile.exists()) {
- Log.wrn("Clone", "The source file does not exist!");
- return false;
- }
- if (isEmpty(trg)) {
- Log.wrn("Clone", "The destination file path must be entered!");
- return false;
- }
- if (src.equals(trg)) {
- Log.wrn("Clone", "The source and destination can not be same!");
- return false;
- }
- if (trgFile.exists()) {
- Log.wrn("Clone", "The destination already exists!");
- return false;
- }
-
- //
- // Check for workspace
- //
- if (mode == DataType.RETURN_TYPE_WORKSPACE) {
- if (trg.indexOf(src + DataType.FILE_SEPARATOR) == 0) {
- Log.wrn("Clone", "The new workspace can not be located within the current workspace!");
- return false;
- }
- }
-
- //
- // Check for Module
- //
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- trg = this.getModulePath();
- if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {
- Log.wrn("Clone", "The source and destination paths for cloning a module must be different!");
- return false;
- }
- trgFile = new File(trg);
- if (trgFile.exists()) {
- Log.wrn("Clone", "The target module already exists!");
- return false;
- }
-
- //
- // Check if path already exists
- // Currently we allow user to add multiple msa files in one same directory
- // Remove this checkpoint
- //
-// if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(trg), mode)) {
-// Log.wrn("Clone", "There already exists a same directory with a module");
-// return false;
-// }
-
- return checkId(mode);
- }
-
- //
- // Check for Package
- //
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- if (trg.indexOf(DataType.DOS_FILE_SEPARATOR) == -1 && trg.indexOf(DataType.UNIX_FILE_SEPARATOR) == -1) {
- Log.wrn("Clone", "The package name must include a path!");
- return false;
- }
- trg = this.getPackagePath();
- if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {
- Log.wrn("Clone", "The source and destination paths for cloning a package must be different!");
- return false;
- }
- trgFile = new File(trg);
- if (trgFile.exists()) {
- Log.wrn("Clone", "The target package already exists!");
- return false;
- }
- if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(trg), mode)) {
- Log.wrn("Clone", "There already exists a same directory with a package");
- return false;
- }
-
- return checkId(mode);
- }
-
- //
- // Check for Platform
- //
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- if (trg.indexOf(Workspace.getCurrentWorkspace()) != 0) {
- Log.wrn("Clone", "The platform clone must be located in the current workspace!");
- return false;
- }
- if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {
- Log.wrn("Clone", "The source and destination paths for cloning a platform must be different!");
- return false;
- }
- trgFile = new File(trg);
- if (trgFile.exists()) {
- Log.wrn("Clone", "The target platform already exists.");
- return false;
- }
- if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(trg), mode)) {
- Log.wrn("Clone", "There already exists a same directory with a platform");
- return false;
- }
-
- return checkId(mode);
- }
-
- return true;
- }
-
- /**
- Save clone target to new location
-
- @throws IOException
- @throws XmlException
- @throws Exception
-
- **/
- private void save() throws IOException, XmlException, Exception {
- String src = this.oldId.getPath();
- String trg = this.jTextFieldFilePath.getText();
- Vector<String> vFiles = new Vector<String>();
-
- //
- // Clone Workspace
- //
- if (mode == DataType.RETURN_TYPE_WORKSPACE) {
- FileOperation.copyFolder(src, trg);
- this.returnType = DataType.RETURN_TYPE_WORKSPACE;
- }
-
- //
- // Clone Module Surface Area
- //
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- //
- // Get target path from source path
- //
- trg = getModulePath();
- newId.setPath(trg);
- vFiles = wt.getAllFilesPathOfModule(src);
-
- String oldPackagePath = GlobalData.openingModuleList.getIdByPath(src).getPackageId().getPath();
- String newPackagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath();
-
- //
- // First copy all files to new directory
- //
- FileOperation.copyFile(src, trg);
- for (int index = 1; index < vFiles.size(); index++) {
- String oldFile = vFiles.get(index);
- String newFile = "";
- if (oldFile.indexOf(Tools.getFilePathOnly(src)) > -1) {
- //
- // The file is not include header
- //
- newFile = oldFile.replace(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg));
- } else if (oldFile.indexOf(Tools.getFilePathOnly(oldPackagePath)) > -1) {
- //
- // The file is include header
- //
- newFile = oldFile.replace(Tools.getFilePathOnly(oldPackagePath),
- Tools.getFilePathOnly(newPackagePath));
- }
-
- FileOperation.copyFile(oldFile, newFile);
- }
-
- //
- // Create new msa file
- //
- ModuleSurfaceArea msa = null;
- msa = OpenFile.openMsaFile(src);
-
- //
- // Update to memory
- //
- msa.getMsaHeader().setModuleName(newId.getName());
- msa.getMsaHeader().setGuidValue(newId.getGuid());
- msa.getMsaHeader().setVersion(newId.getVersion());
-
- //
- // Update <Cloned> Section
- //
- updateModuleClonedId(msa, oldId);
-
- //
- // Save to file
- //
- SaveFile.saveMsaFile(trg, msa);
-
- //
- // Update to platformId
- //
- this.setMid(new ModuleIdentification(newId,
- packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())));
-
- //
- // Open belonging package
- //
- PackageSurfaceArea psa = PackageSurfaceArea.Factory.newInstance();
- psa = OpenFile.openSpdFile(mid.getPackageId().getPath());
-
- //
- // Update the db file
- //
- wt.addModuleToPackage(mid, psa);
-
- //
- // Update GlobalData
- //
- GlobalData.vModuleList.addElement(mid);
- GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);
-
- this.returnType = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;
- }
-
- //
- // Clone Package Surface Area
- //
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- //
- // Get target path from source path
- //
- trg = this.getPackagePath();
- newId.setPath(trg);
- vFiles = wt.getAllFilesPathOfPakcage(src);
-
- //
- // First copy all files to new directory
- //
- FileOperation.copyFile(src, trg);
- for (int index = 1; index < vFiles.size(); index++) {
- String oldFile = vFiles.get(index);
- String newFile = vFiles.get(index).replace(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg));
- FileOperation.copyFile(oldFile, newFile);
- }
-
- //
- // Create new spd file
- //
- PackageSurfaceArea spd = null;
- spd = OpenFile.openSpdFile(src);
-
- //
- // Update to memory
- //
- spd.getSpdHeader().setPackageName(newId.getName());
- spd.getSpdHeader().setGuidValue(newId.getGuid());
- spd.getSpdHeader().setVersion(newId.getVersion());
-
- //
- // Update <Cloned> Section
- //
- updatePackageClonedId(spd, oldId);
-
- //
- // Save to file
- //
- SaveFile.saveSpdFile(trg, spd);
-
- //
- // Update to platformId
- //
- this.setPid(new PackageIdentification(newId));
-
- //
- // Update the db file
- //
- wt.addPackageToDatabase(pid);
-
- //
- // Update GlobalData
- //
- GlobalData.vPackageList.addElement(pid);
- GlobalData.openingPackageList.insertToOpeningPackageList(pid, spd);
-
- //
- // Add all cloned modules
- //
- Vector<String> modulePaths = GlobalData.getAllModulesOfPackage(pid.getPath());
- String modulePath = null;
- ModuleSurfaceArea msa = null;
-
- for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
- try {
- modulePath = modulePaths.get(indexJ);
- msa = OpenFile.openMsaFile(modulePath);
- } catch (IOException e) {
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());
- continue;
- } catch (XmlException e) {
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());
- continue;
- } catch (Exception e) {
- Log.err("Open Module Surface Area " + modulePath, "Invalid file type");
- continue;
- }
- Identification id = Tools.getId(modulePath, msa);
- mid = new ModuleIdentification(id, pid);
- GlobalData.vModuleList.addElement(mid);
- GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);
- }
-
- this.returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
- }
-
- //
- // Clone Platform Surface Area
- //
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- PlatformSurfaceArea fpd = null;
- fpd = OpenFile.openFpdFile(src);
-
- //
- // Update to memory
- //
- fpd.getPlatformHeader().setPlatformName(newId.getName());
- fpd.getPlatformHeader().setGuidValue(newId.getGuid());
- fpd.getPlatformHeader().setVersion(newId.getVersion());
-
- //
- // Update Cloned From element
- //
- updatePlatformClonedId(fpd, oldId);
-
- //
- // Save to file
- //
- SaveFile.saveFpdFile(trg, fpd);
-
- //
- // Update to platformId
- //
- this.setFid(new PlatformIdentification(newId));
-
- //
- // Update the db file
- //
- wt.addPlatformToDatabase(fid);
-
- //
- // Update GlobalData
- //
- GlobalData.vPlatformList.addElement(fid);
- GlobalData.openingPlatformList.insertToOpeningPlatformList(fid, fpd);
-
- this.returnType = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
- }
- vFiles = null;
- }
-
- /**
- Get the path of selected package
-
- @return String The path of selected package
-
- **/
- private String getSelectPackagePath() {
- return Tools.getFilePathOnly(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath());
- }
-
- /**
- Get the path of source module
- Since the path of source module is relative, make it up to full path.
-
- @return String The full path of source module
-
- **/
- private String getModulePath() {
- String trg = this.jTextFieldFilePath.getText();
- trg = Tools.addPathExt(trg, mode);
- trg = Tools.addFileSeparator(getSelectPackagePath()) + trg;
- Tools.convertPathToCurrentOsType(trg);
- return trg;
- }
-
- /**
- Get the path of source package
- Since the path of source package is relative, make it up to full path.
-
- @return String The full path of source package
-
- **/
- private String getPackagePath() {
- String trg = this.jTextFieldFilePath.getText();
- trg = Tools.addPathExt(trg, mode);
- trg = Tools.addFileSeparator(Workspace.getCurrentWorkspace()) + trg;
- trg = Tools.convertPathToCurrentOsType(trg);
- return trg;
- }
-
- /**
- Set msa file's <Cloned> section via given identification
-
- @param msa ModuleSurfaceArea for clone target
- @param id Identification of clone source
-
- **/
- private void updateModuleClonedId(ModuleSurfaceArea msa, Identification id) {
- //
- // Get PlatformDefinitions First
- //
- ModuleDefinitions pd = null;
- if (msa.getModuleDefinitions() == null) {
- pd = ModuleDefinitions.Factory.newInstance();
- msa.addNewModuleDefinitions();
- } else {
- pd = msa.getModuleDefinitions();
- }
-
- //
- // Get ClonedFrom then
- //
- ModuleDefinitions.ClonedFrom cf = null;
- BigInteger count = new BigInteger("-1");
- if (pd.getClonedFrom() == null) {
- cf = ModuleDefinitions.ClonedFrom.Factory.newInstance();
- } else {
- cf = pd.getClonedFrom();
- if (cf != null) {
- for (int index = 0; index < cf.getClonedList().size(); index++) {
- if (cf.getClonedList().get(index).getId() != null) {
- count = count.max(cf.getClonedList().get(index).getId());
- }
- }
- }
- }
-
- //
- // Set new Cloned item
- //
- ModuleDefinitions.ClonedFrom.Cloned c = ModuleDefinitions.ClonedFrom.Cloned.Factory.newInstance();
- c.setModuleGuid(id.getGuid());
- c.setModuleVersion(id.getVersion());
- c.setPackageGuid(wt.getPackageIdByModuleId(oldId).getGuid());
- c.setPackageVersion(wt.getPackageIdByModuleId(oldId).getVersion());
- c.setId(count.add(new BigInteger("1")));
- String guid = wt.getModuleFarGuid(oldId);
- if (guid != null && !guid.equals("")) {
- c.setFarGuid(guid);
- }
-
- cf.addNewCloned();
- cf.setClonedArray(cf.getClonedList().size() - 1, c);
- pd.addNewClonedFrom();
- pd.setClonedFrom(cf);
- msa.setModuleDefinitions(pd);
- }
-
- /**
- Set spd file's <Cloned> section via given identification
-
- @param spd PackageSurfaceArea for clone target
- @param id Identification of clone source
-
- **/
- private void updatePackageClonedId(PackageSurfaceArea spd, Identification id) {
- //
- // Get PlatformDefinitions First
- //
- PackageDefinitions pd = null;
- if (spd.getPackageDefinitions() == null) {
- pd = PackageDefinitions.Factory.newInstance();
- spd.addNewPackageDefinitions();
- } else {
- pd = spd.getPackageDefinitions();
- }
-
- //
- // Get ClonedFrom then
- //
- PackageDefinitions.ClonedFrom cf = null;
- BigInteger count = new BigInteger("-1");
- if (pd.getClonedFrom() == null) {
- cf = PackageDefinitions.ClonedFrom.Factory.newInstance();
- } else {
- cf = pd.getClonedFrom();
- if (cf != null) {
- for (int index = 0; index < cf.getClonedList().size(); index++) {
- if (cf.getClonedList().get(index).getId() != null) {
- count = count.max(cf.getClonedList().get(index).getId());
- }
- }
- }
- }
-
- //
- // Set new Cloned item
- //
- PackageDefinitions.ClonedFrom.Cloned c = PackageDefinitions.ClonedFrom.Cloned.Factory.newInstance();
- c.setPackageGuid(id.getGuid());
- c.setPackageVersion(id.getVersion());
- c.setId(count.add(new BigInteger("1")));
- String guid = wt.getPackageFarGuid(oldId);
- if (guid != null && !guid.equals("")) {
- c.setFarGuid(guid);
- }
-
- cf.addNewCloned();
- cf.setClonedArray(cf.getClonedList().size() - 1, c);
- pd.addNewClonedFrom();
- pd.setClonedFrom(cf);
- spd.setPackageDefinitions(pd);
- }
-
- /**
- Set fpd file's <Cloned> section via given identification
-
- @param fpd PlatformSurfaceArea for clone target
- @param id Identification of clone source
-
- **/
- private void updatePlatformClonedId(PlatformSurfaceArea fpd, Identification id) {
- //
- // Get PlatformDefinitions First
- //
- PlatformDefinitions pd = null;
- if (fpd.getPlatformDefinitions() == null) {
- pd = PlatformDefinitions.Factory.newInstance();
- fpd.addNewPlatformDefinitions();
- } else {
- pd = fpd.getPlatformDefinitions();
- }
-
- //
- // Get ClonedFrom then
- //
- PlatformDefinitions.ClonedFrom cf = null;
- BigInteger count = new BigInteger("-1");
- if (pd.getClonedFrom() == null) {
- cf = PlatformDefinitions.ClonedFrom.Factory.newInstance();
- } else {
- cf = pd.getClonedFrom();
- if (cf != null) {
- for (int index = 0; index < cf.getClonedList().size(); index++) {
- if (cf.getClonedList().get(index).getId() != null) {
- count = count.max(cf.getClonedList().get(index).getId());
- }
- }
- }
- }
-
- //
- // Set new Cloned item
- //
- PlatformDefinitions.ClonedFrom.Cloned c = PlatformDefinitions.ClonedFrom.Cloned.Factory.newInstance();
- c.setPlatformGuid(id.getGuid());
- c.setPlatformVersion(id.getVersion());
- c.setId(count.add(new BigInteger("1")));
- String guid = wt.getPlatformFarGuid(oldId);
- if (guid != null && !guid.equals("")) {
- c.setFarGuid(guid);
- }
-
- cf.addNewCloned();
- cf.setClonedArray(cf.getClonedList().size() - 1, c);
- pd.addNewClonedFrom();
- pd.setClonedFrom(cf);
- fpd.setPlatformDefinitions(pd);
- }
-
- /**
- Get PlatformIdentification
-
- @return PlatformIdentification
-
- **/
- public PlatformIdentification getFid() {
- return fid;
- }
-
- /**
- Set PlatformIdentification
-
- @param fid PlatformIdentification
-
- **/
- public void setFid(PlatformIdentification fid) {
- this.fid = fid;
- }
-
- /**
- Get ModuleIdentification
-
- @return ModuleIdentification
-
- **/
- public ModuleIdentification getMid() {
- return mid;
- }
-
- /**
- Set ModuleIdentification
-
- @param mid ModuleIdentification
-
- **/
- public void setMid(ModuleIdentification mid) {
- this.mid = mid;
- }
-
- /**
- Get PackageIdentification
-
- @return PackageIdentification
-
- **/
- public PackageIdentification getPid() {
- return pid;
- }
-
- /**
- Set PackageIdentification
-
- @param pid PackageIdentification
-
- **/
- public void setPid(PackageIdentification pid) {
- this.pid = pid;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java
deleted file mode 100644
index 69d47423a5..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java
+++ /dev/null
@@ -1,3789 +0,0 @@
-/** @file
-
- The main GUI for module editor.
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.WindowEvent;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JDesktopPane;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JInternalFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.JTabbedPane;
-import javax.swing.ToolTipManager;
-import javax.swing.event.MenuEvent;
-import javax.swing.event.MenuListener;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.TreePath;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.SaveFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.find.FindResult;
-import org.tianocore.frameworkwizard.common.ui.IDefaultMutableTreeNode;
-import org.tianocore.frameworkwizard.common.ui.IDesktopManager;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.ITree;
-import org.tianocore.frameworkwizard.far.createui.CreateStepOne;
-import org.tianocore.frameworkwizard.far.deleteui.DeleteStepOne;
-import org.tianocore.frameworkwizard.far.installui.InstallStepOne;
-import org.tianocore.frameworkwizard.far.updateui.UpdateStepOne;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.ui.ModuleBootModes;
-import org.tianocore.frameworkwizard.module.ui.ModuleBuildOptions;
-import org.tianocore.frameworkwizard.module.ui.ModuleDataHubs;
-import org.tianocore.frameworkwizard.module.ui.ModuleEvents;
-import org.tianocore.frameworkwizard.module.ui.ModuleExterns;
-import org.tianocore.frameworkwizard.module.ui.ModuleGuids;
-import org.tianocore.frameworkwizard.module.ui.ModuleHiiPackages;
-import org.tianocore.frameworkwizard.module.ui.ModuleHobs;
-import org.tianocore.frameworkwizard.module.ui.ModuleLibraryClassDefinitions;
-import org.tianocore.frameworkwizard.module.ui.ModulePCDs;
-import org.tianocore.frameworkwizard.module.ui.ModulePackageDependencies;
-import org.tianocore.frameworkwizard.module.ui.ModulePpis;
-import org.tianocore.frameworkwizard.module.ui.ModuleProtocols;
-import org.tianocore.frameworkwizard.module.ui.ModuleSourceFiles;
-import org.tianocore.frameworkwizard.module.ui.ModuleSystemTables;
-import org.tianocore.frameworkwizard.module.ui.ModuleVariables;
-import org.tianocore.frameworkwizard.module.ui.MsaHeader;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.packaging.ui.SpdGuidDecls;
-import org.tianocore.frameworkwizard.packaging.ui.SpdHeader;
-import org.tianocore.frameworkwizard.packaging.ui.SpdLibClassDecls;
-import org.tianocore.frameworkwizard.packaging.ui.SpdMsaFiles;
-import org.tianocore.frameworkwizard.packaging.ui.SpdPackageHeaders;
-import org.tianocore.frameworkwizard.packaging.ui.SpdPcdDefs;
-import org.tianocore.frameworkwizard.packaging.ui.SpdPpiDecls;
-import org.tianocore.frameworkwizard.packaging.ui.SpdProtocolDecls;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.platform.ui.FpdBuildOptions;
-import org.tianocore.frameworkwizard.platform.ui.FpdDynamicPcdBuildDefinitions;
-import org.tianocore.frameworkwizard.platform.ui.FpdFlash;
-import org.tianocore.frameworkwizard.platform.ui.FpdFrameworkModules;
-import org.tianocore.frameworkwizard.platform.ui.FpdHeader;
-import org.tianocore.frameworkwizard.platform.ui.FpdPlatformDefs;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-import org.tianocore.frameworkwizard.workspace.ui.SwitchWorkspace;
-import org.tianocore.frameworkwizard.toolchain.Preferences;
-
-/**
- The class is used to show main GUI of FrameworkWizard
- It extends IFrame implements MouseListener, TreeSelectionListener, ComponentListener and MenuListener
-
- **/
-public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListener, TreeSelectionListener,
- MenuListener {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7103240960573031772L;
-
- //
- // Set ToolTipText Show Time
- //
- static { ToolTipManager.sharedInstance().setDismissDelay(18000); }
-
- ///
- /// Used to record current operation target
- ///
- private int currentOpeningModuleIndex = -1;
-
- private int currentOpeningPackageIndex = -1;
-
- private int currentOpeningPlatformIndex = -1;
-
- ///
- /// Used to generate tree structure
- ///
- private IDefaultMutableTreeNode dmtnRoot = null;
-
- private IDefaultMutableTreeNode dmtnModuleDescription = null;
-
- private IDefaultMutableTreeNode dmtnPackageDescription = null;
-
- private IDefaultMutableTreeNode dmtnPlatformDescription = null;
-
- ///
- /// Used for UI
- ///
- private JPanel jContentPane = null;
-
- private JMenuBar jMenuBar = null;
-
- private JMenu jMenuFile = null;
-
- private JMenuItem jMenuItemFileNew = null;
-
- private JMenuItem jMenuItemFileRefresh = null;
-
- private JMenuItem jMenuItemFileSaveAs = null;
-
- private JMenuItem jMenuItemFileExit = null;
-
- private JMenu jMenuEdit = null;
-
- private JDesktopPane jDesktopPaneModule = null;
-
- private JDesktopPane jDesktopPanePackage = null;
-
- private JDesktopPane jDesktopPanePlatform = null;
-
- private JTabbedPane jTabbedPaneTree = null;
-
- private JTabbedPane jTabbedPaneEditor = null;
-
- private IDesktopManager iDesktopManager = new IDesktopManager();
-
- private JScrollPane jScrollPaneTree = null;
-
- private ITree iTree = null;
-
- private JMenu jMenuHelp = null;
-
- private JMenuItem jMenuItemHelpAbout = null;
-
- private JMenuItem jMenuItemEditDelete = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private JMenuItem jMenuItemFileSave = null;
-
- private JMenuItem jMenuItemFileClose = null;
-
- private JMenu jMenuTools = null;
-
- private JMenu jMenuWindow = null;
-
- private JPanel jPanelOperation = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JMenuItem jMenuItemFileOpen = null;
-
- private JMenuItem jMenuItemFileCloseAll = null;
-
- private JMenuItem jMenuItemFileSaveAll = null;
-
- private JMenuItem jMenuItemFilePageSetup = null;
-
- private JMenuItem jMenuItemFilePrint = null;
-
- private JMenuItem jMenuItemFileImport = null;
-
- private JMenuItem jMenuItemFileProperties = null;
-
- private JMenu jMenuFileRecentFiles = null;
-
- private JSplitPane jSplitPane = null;
-
- private JMenuItem jMenuItemEditUndo = null;
-
- private JMenuItem jMenuItemEditRedo = null;
-
- private JMenuItem jMenuItemEditCut = null;
-
- private JMenuItem jMenuItemEditCopy = null;
-
- private JMenuItem jMenuItemEditPaste = null;
-
- private JMenuItem jMenuItemEditSelectAll = null;
-
- private JMenuItem jMenuItemEditFindNext = null;
-
- private JMenu jMenuView = null;
-
- private JMenu jMenuViewToolbars = null;
-
- private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsFile = null;
-
- private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsEdit = null;
-
- private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsWindow = null;
-
- private JMenuItem jMenuItemViewStandard = null;
-
- private JMenuItem jMenuItemViewAdvanced = null;
-
- private JMenu jMenuProject = null;
-
- private JMenuItem jMenuItemProjectAdmin = null;
-
- private JMenuItem jMenuItemProjectChangeWorkspace = null;
-
- private JMenuItem jMenuItemToolsBuildPreferences = null;
-
- // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug = null;
-
- // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease = null;
-
- private JMenuItem jMenuItemToolsToolChainConfiguration = null;
-
- private JMenuItem jMenuItemToolsClone = null;
-
- private JMenuItem jMenuItemToolsCodeScan = null;
-
- private JMenuItem jMenuItemWindowDisplaySide = null;
-
- private JMenuItem jMenuItemWindowDisplayTopBottom = null;
-
- private JMenuItem jMenuItemViewXML = null;
-
- private JMenuItem jMenuItemWindowTabView = null;
-
- private JMenuItem jMenuItemWindowSource = null;
-
- private JMenuItem jMenuItemWindowXML = null;
-
- private JMenuItem jMenuItemWindowPreferences = null;
-
- private JMenuItem jMenuItemHelpContents = null;
-
- private JMenuItem jMenuItemHelpIndex = null;
-
- private JMenuItem jMenuItemHelpSearch = null;
-
- private JMenuItem jMenuItemProjectInstallFar = null;
-
- private JMenuItem jMenuItemProjectUpdateFar = null;
-
- private JMenuItem jMenuItemProjectRemoveFar = null;
-
- private JMenuItem jMenuItemProjectCreateFar = null;
-
- private JMenu jMenuEditFind = null;
-
- private JMenuItem jMenuItemEditFindPcd = null;
-
- private JMenuItem jMenuItemEditFindLibraryClass = null;
-
- private JMenuItem jMenuItemEditFindPpi = null;
-
- private JMenuItem jMenuItemEditFindProtocol = null;
-
- private JMenuItem jMenuItemEditFindGuid = null;
-
- private JMenuItem jMenuItemEditFindLibraryInstance = null;
-
- ///
- /// A static definition for this class itself
- ///
- private static FrameworkWizardUI fwui = null;
-
- private JMenuItem jMenuItemToolsGenerateGuidsXref = null;
-
- /**
- If the class hasn't an instnace, new one.
-
- @return FrameworkWizardUI The instance of this class
-
- **/
- public static FrameworkWizardUI getInstance(String[] args) {
- if (fwui == null) {
- fwui = new FrameworkWizardUI(args);
- }
- return fwui;
- }
-
- /**
- If the class hasn't an instnace, new one.
-
- @return FrameworkWizardUI The instance of this class
-
- **/
- public static FrameworkWizardUI getInstance() {
- return fwui;
- }
-
- /**
- This method initializes jMenuBar
-
- @return javax.swing.JMenuBar Main menu bar for the entire GUI
-
- **/
- private JMenuBar getjJMenuBar() {
- if (jMenuBar == null) {
- jMenuBar = new JMenuBar();
- jMenuBar.setPreferredSize(new java.awt.Dimension(0, 18));
- jMenuBar.add(getJMenuFile());
- jMenuBar.add(getJMenuEdit());
- jMenuBar.add(getJMenuView());
- jMenuBar.add(getJMenuProject());
- jMenuBar.add(getJMenuTools());
- jMenuBar.add(getJMenuWindow());
- jMenuBar.add(getJMenuHelp());
- }
- return jMenuBar;
- }
-
- /**
- This method initializes jSplitPane
-
- @return javax.swing.JSplitPane
-
- **/
- private JSplitPane getJSplitPane() {
- if (jSplitPane == null) {
- jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, getJTabbedPaneTree(), getJTabbedPaneEditor());
- jSplitPane.setBounds(new java.awt.Rectangle(0, 1, DataType.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT));
- jSplitPane.addComponentListener(this);
- }
- return jSplitPane;
- }
-
- /**
- This method initializes jTabbedPaneEditor
-
- @return javax.swing.JTabbedPane
-
- **/
- private JTabbedPane getJTabbedPaneEditor() {
- if (jTabbedPaneEditor == null) {
- jTabbedPaneEditor = new JTabbedPane();
- jTabbedPaneEditor.setBounds(new java.awt.Rectangle(DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jTabbedPaneEditor
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jTabbedPaneEditor.addTab("Module", null, getJDesktopPaneModule(), null);
- jTabbedPaneEditor.addTab("Package", null, getJDesktopPanePackage(), null);
- jTabbedPaneEditor.addTab("Platform", null, getJDesktopPanePlatform(), null);
- }
- return jTabbedPaneEditor;
- }
-
- /**
- This method initializes jTabbedPaneTree
-
- @return javax.swing.JTabbedPane
-
- **/
- private JTabbedPane getJTabbedPaneTree() {
- if (jTabbedPaneTree == null) {
- jTabbedPaneTree = new JTabbedPane();
- jTabbedPaneTree
- .setPreferredSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
- jTabbedPaneTree
- .setMinimumSize(new java.awt.Dimension(DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
- jTabbedPaneTree.addTab("Workspace Explorer", null, getJScrollPaneTree(), null);
- }
- return jTabbedPaneTree;
- }
-
- /**
- This method initializes jMenuFile
-
- @return javax.swing.JMenu jMenuModule
-
- **/
- private JMenu getJMenuFile() {
- if (jMenuFile == null) {
- //
- // Set jMenuFile's attributes
- //
- jMenuFile = new JMenu();
- jMenuFile.setText("File");
- jMenuFile.setMnemonic('F');
- jMenuFile.addMenuListener(this);
-
- //
- // Add sub menu items
- //
- jMenuFile.add(getJMenuItemFileNew());
- jMenuFile.add(getJMenuItemFileOpen());
- jMenuFile.add(getJMenuItemFileClose());
- jMenuFile.add(getJMenuItemFileCloseAll());
- jMenuFile.addSeparator();
-
- jMenuFile.add(getJMenuFileRecentFiles());
- jMenuFile.add(getJMenuItemFileSave());
- jMenuFile.add(getJMenuItemFileSaveAs());
- jMenuFile.add(getJMenuItemFileSaveAll());
- jMenuFile.addSeparator();
-
- jMenuFile.add(getJMenuItemFileRefresh());
- jMenuFile.addSeparator();
-
- jMenuFile.add(getJMenuItemFilePageSetup());
- jMenuFile.add(getJMenuItemFilePrint());
- jMenuFile.add(getJMenuItemFileImport());
- jMenuFile.add(getJMenuItemFileProperties());
-
- jMenuFile.add(getJMenuItemFileExit());
- }
- return jMenuFile;
- }
-
- /**
- This method initializes jMenuItemFileSaveAs
-
- @return javax.swing.JMenuItem jMenuItemFileSaveAs
-
- **/
- private JMenuItem getJMenuItemFileSaveAs() {
- if (jMenuItemFileSaveAs == null) {
- jMenuItemFileSaveAs = new JMenuItem();
- jMenuItemFileSaveAs.setText("Save As...");
- jMenuItemFileSaveAs.setMnemonic('a');
- jMenuItemFileSaveAs.addActionListener(this);
- jMenuItemFileSaveAs.setEnabled(false);
- jMenuItemFileSaveAs.setVisible(false);
- }
- return jMenuItemFileSaveAs;
- }
-
- /**
- This method initializes jMenuItemFileRefresh
-
- @return javax.swing.JMenuItem jMenuItemFileRefresh
-
- **/
- private JMenuItem getJMenuItemFileRefresh() {
- if (jMenuItemFileRefresh == null) {
- jMenuItemFileRefresh = new JMenuItem();
- jMenuItemFileRefresh.setText("Refresh");
- jMenuItemFileRefresh.setMnemonic('R');
- jMenuItemFileRefresh.addActionListener(this);
- jMenuItemFileRefresh.setVisible(true);
- }
- return jMenuItemFileRefresh;
- }
-
- /**
- This method initializes jMenuItemModuleExit
-
- @return javax.swing.JMenuItem jMenuItemModuleExit
-
- **/
- private JMenuItem getJMenuItemFileExit() {
- if (jMenuItemFileExit == null) {
- jMenuItemFileExit = new JMenuItem();
- jMenuItemFileExit.setText("Exit");
- jMenuItemFileExit.setMnemonic('x');
- jMenuItemFileExit.addActionListener(this);
- }
- return jMenuItemFileExit;
- }
-
- /**
- This method initializes jMenuEdit
-
- @return javax.swing.JMenu jMenuEdit
-
- **/
- private JMenu getJMenuEdit() {
- if (jMenuEdit == null) {
- //
- // Set jMenuEdit's attributes
- //
- jMenuEdit = new JMenu();
- jMenuEdit.setText("Edit");
- jMenuEdit.setMnemonic('E');
- jMenuEdit.setVisible(true);
-
- //
- // Add sub menu items
- //
- jMenuEdit.add(getJMenuItemEditUndo());
- jMenuEdit.add(getJMenuItemEditRedo());
- //jMenuEdit.addSeparator();
-
- jMenuEdit.add(getJMenuItemEditCut());
- jMenuEdit.add(getJMenuItemEditCopy());
- jMenuEdit.add(getJMenuItemEditPaste());
- jMenuEdit.add(getJMenuItemEditDelete());
- //jMenuEdit.addSeparator();
-
- jMenuEdit.add(getJMenuItemEditSelectAll());
- jMenuEdit.add(getJMenuEditFind());
- jMenuEdit.add(getJMenuItemEditFindNext());
- //jMenuEdit.addSeparator();
- }
- return jMenuEdit;
- }
-
- /**
- This method initializes jDesktopPane
-
- @return javax.swing.JDesktopPane jDesktopPane
-
- **/
- private JDesktopPane getJDesktopPaneModule() {
- if (jDesktopPaneModule == null) {
- jDesktopPaneModule = new JDesktopPane();
- jDesktopPaneModule
- .setBounds(new java.awt.Rectangle(DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPaneModule
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPaneModule.setDesktopManager(iDesktopManager);
- jDesktopPaneModule.addComponentListener(this);
- }
- return jDesktopPaneModule;
- }
-
- /**
- This method initializes jDesktopPane
-
- @return javax.swing.JDesktopPane jDesktopPane
-
- **/
- private JDesktopPane getJDesktopPanePackage() {
- if (jDesktopPanePackage == null) {
- jDesktopPanePackage = new JDesktopPane();
- jDesktopPanePackage
- .setBounds(new java.awt.Rectangle(DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPanePackage
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPanePackage.setDesktopManager(iDesktopManager);
- jDesktopPanePackage.addComponentListener(this);
- }
- return jDesktopPanePackage;
- }
-
- /**
- This method initializes jDesktopPane
-
- @return javax.swing.JDesktopPane jDesktopPane
-
- **/
- private JDesktopPane getJDesktopPanePlatform() {
- if (jDesktopPanePlatform == null) {
- jDesktopPanePlatform = new JDesktopPane();
- jDesktopPanePlatform
- .setBounds(new java.awt.Rectangle(
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPanePlatform
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPanePlatform.setDesktopManager(iDesktopManager);
- jDesktopPanePlatform.addComponentListener(this);
- }
- return jDesktopPanePlatform;
- }
-
- /**
- This method initializes jScrollPaneTree
-
- @return javax.swing.JScrollPane jScrollPaneTree
-
- **/
- private JScrollPane getJScrollPaneTree() {
- if (jScrollPaneTree == null) {
- jScrollPaneTree = new JScrollPane();
- jScrollPaneTree
- .setPreferredSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
- jScrollPaneTree
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH / 2,
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
- jScrollPaneTree.setViewportView(getITree());
- }
- return jScrollPaneTree;
- }
-
- /**
- This method initializes iTree
-
- @return org.tianocore.packaging.common.ui.ITree iTree
-
- **/
- private ITree getITree() {
- //
- //Before open a real module, use an empty root node for the tree
- //
- makeEmptyTree();
- return iTree;
- }
-
- /**
- This method initializes jMenuHelp
-
- @return javax.swing.JMenu jMenuHelp
-
- **/
- private JMenu getJMenuHelp() {
- if (jMenuHelp == null) {
- //
- // Set jMenuHelp's attributes
- //
- jMenuHelp = new JMenu();
- jMenuHelp.setText("Help");
- jMenuHelp.setMnemonic('H');
-
- //
- // Add sub menu items
- //
- jMenuHelp.add(getJMenuItemHelpContents());
- jMenuHelp.add(getJMenuItemHelpIndex());
- jMenuHelp.add(getJMenuItemHelpSearch());
-
- jMenuHelp.add(getJMenuItemHelpAbout());
- }
- return jMenuHelp;
- }
-
- /**
- This method initializes jMenuItemHelpAbout
-
- @return javax.swing.JMenuItem jMenuItemHelpAbout
-
- **/
- private JMenuItem getJMenuItemHelpAbout() {
- if (jMenuItemHelpAbout == null) {
- jMenuItemHelpAbout = new JMenuItem();
- jMenuItemHelpAbout.setText("About");
- jMenuItemHelpAbout.setMnemonic('A');
- jMenuItemHelpAbout.addActionListener(this);
- }
- return jMenuItemHelpAbout;
- }
-
- /**
- This method initializes jMenuItemEditDelete
-
- @return javax.swing.JMenuItem jMenuItemEditDelete
-
- **/
- private JMenuItem getJMenuItemEditDelete() {
- if (jMenuItemEditDelete == null) {
- jMenuItemEditDelete = new JMenuItem();
- jMenuItemEditDelete.setText("Delete");
- jMenuItemEditDelete.setMnemonic('D');
- jMenuItemEditDelete.setVisible(false);
- jMenuItemEditDelete.setEnabled(false);
- jMenuItemEditDelete.addActionListener(this);
- //
- //Disabled first when no module is open
- //
- jMenuItemEditDelete.setEnabled(false);
- }
- return jMenuItemEditDelete;
- }
-
- /**
- This method initializes jMenuFileNew
-
- @return javax.swing.JMenuItem jMenuFileNew
-
- **/
- private JMenuItem getJMenuItemFileNew() {
- if (jMenuItemFileNew == null) {
- jMenuItemFileNew = new JMenuItem();
- jMenuItemFileNew.setText("New...");
- jMenuItemFileNew.setMnemonic('N');
- jMenuItemFileNew.addActionListener(this);
- }
- return jMenuItemFileNew;
- }
-
- /**
- This method initializes jMenuItemFileSave
-
- @return javax.swing.JMenuItem jMenuItemModuleSave
-
- **/
- private JMenuItem getJMenuItemFileSave() {
- if (jMenuItemFileSave == null) {
- jMenuItemFileSave = new JMenuItem();
- jMenuItemFileSave.setText("Save");
- jMenuItemFileSave.setMnemonic('S');
- jMenuItemFileSave.addActionListener(this);
- jMenuItemFileSave.setEnabled(true);
- }
- return jMenuItemFileSave;
- }
-
- /**
- This method initializes jMenuItemModuleClose
-
- @return javax.swing.JMenuItem jMenuItemModuleClose
-
- **/
- private JMenuItem getJMenuItemFileClose() {
- if (jMenuItemFileClose == null) {
- jMenuItemFileClose = new JMenuItem();
- jMenuItemFileClose.setText("Close");
- jMenuItemFileClose.setMnemonic('C');
- jMenuItemFileClose.setEnabled(true);
- jMenuItemFileClose.addActionListener(this);
- }
- return jMenuItemFileClose;
- }
-
- /**
- This method initializes jMenuTools
- Reserved
-
- @return javax.swing.JMenu jMenuTools
-
- **/
- private JMenu getJMenuTools() {
- if (jMenuTools == null) {
- //
- // Set jMenuTools's attributes
- //
- jMenuTools = new JMenu();
- jMenuTools.setText("Tools");
- jMenuTools.setMnemonic('T');
- jMenuTools.addMenuListener(this);
-
- //
- // Add sub menu items
- //
-
- jMenuTools.add(getJMenuItemToolsClone());
- jMenuTools.add(getJMenuItemToolsCodeScan());
- jMenuTools.addSeparator();
-
- jMenuTools.add(getJMenuItemToolsToolChainConfiguration());
- jMenuTools.add(getJMenuItemToolsBuildPreferences());
- jMenuTools.addSeparator();
-
- jMenuTools.add(getJMenuItemToolsGenerateGuidsXref());
- }
- return jMenuTools;
- }
-
- /**
- This method initializes jMenuWindow
- Reserved
-
- @return javax.swing.JMenu jMenuWindow
-
- **/
- private JMenu getJMenuWindow() {
- if (jMenuWindow == null) {
- //
- // Set jMenuWindow's attribute
- //
- jMenuWindow = new JMenu();
- jMenuWindow.setText("Window");
- jMenuWindow.setMnemonic('W');
- jMenuWindow.setVisible(false);
-
- //
- // Add sub menu items
- //
- jMenuWindow.add(getJMenuItemWindowDisplaySide());
- jMenuWindow.add(getJMenuItemWindowDisplayTopBottom());
- jMenuWindow.addSeparator();
-
- jMenuWindow.add(getJMenuItemWindowTabView());
- jMenuWindow.addSeparator();
-
- jMenuWindow.add(getJMenuItemWindowSource());
- jMenuWindow.add(getJMenuItemWindowXML());
- jMenuWindow.addSeparator();
-
- jMenuWindow.add(getJMenuItemWindowPreferences());
- }
- return jMenuWindow;
- }
-
- /**
- This method initializes jPanelOperation
- Reserved
-
- @return javax.swing.JPanel jPanelOperation
-
- **/
- private JPanel getJPanelOperation() {
- if (jPanelOperation == null) {
- jPanelOperation = new JPanel();
- jPanelOperation.setLayout(null);
- jPanelOperation.setBounds(new java.awt.Rectangle(295, 520, 500, 25));
- jPanelOperation.add(getJButtonOk(), null);
- jPanelOperation.add(getJButtonCancel(), null);
- jPanelOperation.setVisible(false);
- }
- return jPanelOperation;
- }
-
- /**
- This method initializes jButtonOk
- Reserved
-
- @return javax.swing.JButton jButtonOk
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(395, 2, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.setEnabled(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
- Reserved
-
- @return javax.swing.JButton jButtonCancel
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(395, 2, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setEnabled(false);
- jButtonCancel.addActionListener(this);
- jButtonCancel.setVisible(false);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jMenuItemFileOpen
-
- @return javax.swing.JMenuItem jMenuItemFileOpen
-
- **/
- private JMenuItem getJMenuItemFileOpen() {
- if (jMenuItemFileOpen == null) {
- jMenuItemFileOpen = new JMenuItem();
- jMenuItemFileOpen.setText("Open...");
- jMenuItemFileOpen.setMnemonic('O');
- jMenuItemFileOpen.addActionListener(this);
- }
- return jMenuItemFileOpen;
- }
-
- /**
- This method initializes jMenuItemFileCloseAll
-
- @return javax.swing.JMenuItem jMenuItemFileOpen
-
- **/
- private JMenuItem getJMenuItemFileCloseAll() {
- if (jMenuItemFileCloseAll == null) {
- jMenuItemFileCloseAll = new JMenuItem();
- jMenuItemFileCloseAll.setText("Close All");
- jMenuItemFileCloseAll.setMnemonic('A');
- jMenuItemFileCloseAll.setEnabled(true);
- jMenuItemFileCloseAll.addActionListener(this);
- }
- return jMenuItemFileCloseAll;
- }
-
- /**
- This method initializes jMenuItemFileSaveAll
-
- @return javax.swing.JMenuItem jMenuItemFileSaveAll
-
- **/
- private JMenuItem getJMenuItemFileSaveAll() {
- if (jMenuItemFileSaveAll == null) {
- jMenuItemFileSaveAll = new JMenuItem();
- jMenuItemFileSaveAll.setText("Save All");
- jMenuItemFileSaveAll.setMnemonic('v');
- jMenuItemFileSaveAll.setEnabled(true);
- jMenuItemFileSaveAll.addActionListener(this);
- }
- return jMenuItemFileSaveAll;
- }
-
- /**
- This method initializes jMenuItemFilePageSetup
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemFilePageSetup() {
- if (jMenuItemFilePageSetup == null) {
- jMenuItemFilePageSetup = new JMenuItem();
- jMenuItemFilePageSetup.setText("Page Setup");
- jMenuItemFilePageSetup.setMnemonic('u');
- jMenuItemFilePageSetup.setEnabled(false);
- jMenuItemFilePageSetup.addActionListener(this);
- jMenuItemFilePageSetup.setVisible(false);
- }
- return jMenuItemFilePageSetup;
- }
-
- /**
- This method initializes jMenuItemFilePrint
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemFilePrint() {
- if (jMenuItemFilePrint == null) {
- jMenuItemFilePrint = new JMenuItem();
- jMenuItemFilePrint.setText("Print");
- jMenuItemFilePrint.setMnemonic('P');
- jMenuItemFilePrint.setEnabled(false);
- jMenuItemFilePrint.addActionListener(this);
- jMenuItemFilePrint.setVisible(false);
- }
- return jMenuItemFilePrint;
- }
-
- /**
- This method initializes jMenuItemFileImport
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemFileImport() {
- if (jMenuItemFileImport == null) {
- jMenuItemFileImport = new JMenuItem();
- jMenuItemFileImport.setText("Import");
- jMenuItemFileImport.setMnemonic('I');
- jMenuItemFileImport.setEnabled(false);
- jMenuItemFileImport.addActionListener(this);
- jMenuItemFileImport.setVisible(false);
- }
- return jMenuItemFileImport;
- }
-
- /**
- This method initializes jMenuItemFileProperties
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemFileProperties() {
- if (jMenuItemFileProperties == null) {
- jMenuItemFileProperties = new JMenuItem();
- jMenuItemFileProperties.setText("Properties");
- jMenuItemFileProperties.setMnemonic('t');
- jMenuItemFileProperties.setEnabled(false);
- jMenuItemFileProperties.addActionListener(this);
- jMenuItemFileProperties.setVisible(false);
- }
- return jMenuItemFileProperties;
- }
-
- /**
- This method initializes jMenuFileRecentFiles
-
- @return javax.swing.JMenu
-
- **/
- private JMenu getJMenuFileRecentFiles() {
- if (jMenuFileRecentFiles == null) {
- jMenuFileRecentFiles = new JMenu();
- jMenuFileRecentFiles.setText("Recent Files");
- jMenuFileRecentFiles.setMnemonic('F');
- jMenuFileRecentFiles.setEnabled(false);
- jMenuFileRecentFiles.addActionListener(this);
- jMenuFileRecentFiles.setVisible(false);
- }
- return jMenuFileRecentFiles;
- }
-
- /**
- This method initializes jMenuItemEditUndo
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditUndo() {
- if (jMenuItemEditUndo == null) {
- jMenuItemEditUndo = new JMenuItem();
- jMenuItemEditUndo.setText("Undo");
- jMenuItemEditUndo.setMnemonic('U');
- jMenuItemEditUndo.setEnabled(false);
- jMenuItemEditUndo.setVisible(false);
- jMenuItemEditUndo.addActionListener(this);
- }
- return jMenuItemEditUndo;
- }
-
- /**
- This method initializes jMenuItemEditRedo
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditRedo() {
- if (jMenuItemEditRedo == null) {
- jMenuItemEditRedo = new JMenuItem();
- jMenuItemEditRedo.setText("Redo");
- jMenuItemEditRedo.setMnemonic('R');
- jMenuItemEditRedo.setEnabled(false);
- jMenuItemEditRedo.setVisible(false);
- jMenuItemEditRedo.addActionListener(this);
- }
- return jMenuItemEditRedo;
- }
-
- /**
- This method initializes jMenuItemEditCut
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditCut() {
- if (jMenuItemEditCut == null) {
- jMenuItemEditCut = new JMenuItem();
- jMenuItemEditCut.setText("Cut");
- jMenuItemEditCut.setMnemonic('t');
- jMenuItemEditCut.setEnabled(false);
- jMenuItemEditCut.setVisible(false);
- jMenuItemEditCut.addActionListener(this);
- }
- return jMenuItemEditCut;
- }
-
- /**
- This method initializes jMenuItemEditCopy
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditCopy() {
- if (jMenuItemEditCopy == null) {
- jMenuItemEditCopy = new JMenuItem();
- jMenuItemEditCopy.setText("Copy");
- jMenuItemEditCopy.setMnemonic('C');
- jMenuItemEditCopy.setEnabled(false);
- jMenuItemEditCopy.setVisible(false);
- jMenuItemEditCopy.addActionListener(this);
- }
- return jMenuItemEditCopy;
- }
-
- /**
- This method initializes jMenuItemEditPaste
-
- return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditPaste() {
- if (jMenuItemEditPaste == null) {
- jMenuItemEditPaste = new JMenuItem();
- jMenuItemEditPaste.setText("Paste");
- jMenuItemEditPaste.setMnemonic('P');
- jMenuItemEditPaste.setEnabled(false);
- jMenuItemEditPaste.setVisible(false);
- jMenuItemEditPaste.addActionListener(this);
- }
- return jMenuItemEditPaste;
- }
-
- /**
- This method initializes jMenuItem
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditSelectAll() {
- if (jMenuItemEditSelectAll == null) {
- jMenuItemEditSelectAll = new JMenuItem();
- jMenuItemEditSelectAll.setText("Select All");
- jMenuItemEditSelectAll.setMnemonic('A');
- jMenuItemEditSelectAll.setEnabled(false);
- jMenuItemEditSelectAll.setVisible(false);
- jMenuItemEditSelectAll.addActionListener(this);
- }
- return jMenuItemEditSelectAll;
- }
-
- /**
- This method initializes jMenuItemEditFindNext
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditFindNext() {
- if (jMenuItemEditFindNext == null) {
- jMenuItemEditFindNext = new JMenuItem();
- jMenuItemEditFindNext.setText("Find Next");
- jMenuItemEditFindNext.setMnemonic('n');
- jMenuItemEditFindNext.setEnabled(false);
- jMenuItemEditFindNext.setVisible(false);
- jMenuItemEditFindNext.addActionListener(this);
- }
- return jMenuItemEditFindNext;
- }
-
- /**
- This method initializes jMenuView
-
- @return javax.swing.JMenu
-
- **/
- private JMenu getJMenuView() {
- if (jMenuView == null) {
- //
- // Set jMenuView's attributes
- //
- jMenuView = new JMenu();
- jMenuView.setText("View");
- jMenuView.setMnemonic('V');
- jMenuView.setVisible(false);
-
- //
- // Add sub menu items
- //
- jMenuView.add(getJMenuViewToolbars());
- jMenuView.add(getJMenuItemViewAdvanced());
- jMenuView.add(getJMenuItemViewStandard());
- jMenuView.add(getJMenuItemViewXML());
- }
- return jMenuView;
- }
-
- /**
- This method initializes jMenuViewToolbars
-
- @return javax.swing.JMenu
-
- **/
- private JMenu getJMenuViewToolbars() {
- if (jMenuViewToolbars == null) {
- jMenuViewToolbars = new JMenu();
- jMenuViewToolbars.setText("Toolbars");
- jMenuViewToolbars.setMnemonic('T');
-
- jMenuViewToolbars.add(getJCheckBoxMenuItemViewToolbarsFile());
- jMenuViewToolbars.add(getJCheckBoxMenuItemViewToolbarsEdit());
- jMenuViewToolbars.add(getJCheckBoxMenuItemViewToolbarsWindow());
- }
- return jMenuViewToolbars;
- }
-
- /**
- This method initializes jCheckBoxMenuItemViewToolbarsFile
-
- @return javax.swing.JCheckBoxMenuItem
-
- **/
- private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsFile() {
- if (jCheckBoxMenuItemViewToolbarsFile == null) {
- jCheckBoxMenuItemViewToolbarsFile = new JCheckBoxMenuItem();
- jCheckBoxMenuItemViewToolbarsFile.setText("File");
- jCheckBoxMenuItemViewToolbarsFile.setEnabled(false);
- jCheckBoxMenuItemViewToolbarsFile.addActionListener(this);
- }
- return jCheckBoxMenuItemViewToolbarsFile;
- }
-
- /**
- This method initializes jCheckBoxMenuItemViewToolbarsEdit
-
- @return javax.swing.JCheckBoxMenuItem
-
- **/
- private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsEdit() {
- if (jCheckBoxMenuItemViewToolbarsEdit == null) {
- jCheckBoxMenuItemViewToolbarsEdit = new JCheckBoxMenuItem();
- jCheckBoxMenuItemViewToolbarsEdit.setText("Edit");
- jCheckBoxMenuItemViewToolbarsEdit.setEnabled(false);
- jCheckBoxMenuItemViewToolbarsEdit.addActionListener(this);
- }
- return jCheckBoxMenuItemViewToolbarsEdit;
- }
-
- /**
- This method initializes jCheckBoxMenuItemViewToolbarsWindow
-
- @return javax.swing.JCheckBoxMenuItem
-
- **/
- private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsWindow() {
- if (jCheckBoxMenuItemViewToolbarsWindow == null) {
- jCheckBoxMenuItemViewToolbarsWindow = new JCheckBoxMenuItem();
- jCheckBoxMenuItemViewToolbarsWindow.setText("Window");
- jCheckBoxMenuItemViewToolbarsWindow.setEnabled(false);
- jCheckBoxMenuItemViewToolbarsWindow.addActionListener(this);
- }
- return jCheckBoxMenuItemViewToolbarsWindow;
- }
-
- /**
- This method initializes jMenuItemStandard
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemViewStandard() {
- if (jMenuItemViewStandard == null) {
- jMenuItemViewStandard = new JMenuItem();
- jMenuItemViewStandard.setText("Standard");
- jMenuItemViewStandard.setMnemonic('S');
- jMenuItemViewStandard.setEnabled(false);
- jMenuItemViewStandard.addActionListener(this);
- }
- return jMenuItemViewStandard;
- }
-
- /**
- This method initializes jMenuItemAdvanced
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemViewAdvanced() {
- if (jMenuItemViewAdvanced == null) {
- jMenuItemViewAdvanced = new JMenuItem();
- jMenuItemViewAdvanced.setText("Advanced");
- jMenuItemViewAdvanced.setMnemonic('A');
- jMenuItemViewAdvanced.setEnabled(false);
- jMenuItemViewAdvanced.addActionListener(this);
- }
- return jMenuItemViewAdvanced;
- }
-
- /**
- This method initializes jMenuProject
-
- @return javax.swing.JMenu
-
- **/
- private JMenu getJMenuProject() {
- if (jMenuProject == null) {
- //
- // Set jMenuProject's attributes
- //
- jMenuProject = new JMenu();
- jMenuProject.setText("Project");
- jMenuProject.setMnemonic('P');
-
- //
- // Add sub menu items
- //
- jMenuProject.add(getJMenuItemProjectAdmin());
-
- jMenuProject.add(getJMenuItemProjectChangeWorkspace());
- jMenuProject.addSeparator();
-
- jMenuProject.add(getJMenuItemProjectCreateFar());
- jMenuProject.add(getJMenuItemProjectInstallFar());
- jMenuProject.add(getJMenuItemProjectUpdateFar());
- jMenuProject.add(getJMenuItemProjectRemoveFar());
-
- }
- return jMenuProject;
- }
-
- /**
- This method initializes jMenuItemProjectAdmin
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemProjectAdmin() {
- if (jMenuItemProjectAdmin == null) {
- jMenuItemProjectAdmin = new JMenuItem();
- jMenuItemProjectAdmin.setText("Admin...");
- jMenuItemProjectAdmin.setMnemonic('A');
- jMenuItemProjectAdmin.setEnabled(false);
- jMenuItemProjectAdmin.addActionListener(this);
- jMenuItemProjectAdmin.setVisible(false);
- }
- return jMenuItemProjectAdmin;
- }
-
- /**
- This method initializes jMenuItemProjectChangeWorkspace
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemProjectChangeWorkspace() {
- if (jMenuItemProjectChangeWorkspace == null) {
- jMenuItemProjectChangeWorkspace = new JMenuItem();
- jMenuItemProjectChangeWorkspace.setText("Change WORKSPACE...");
- jMenuItemProjectChangeWorkspace.setMnemonic('W');
- jMenuItemProjectChangeWorkspace.setEnabled(true);
- jMenuItemProjectChangeWorkspace.addActionListener(this);
- }
- return jMenuItemProjectChangeWorkspace;
- }
-
- /**
- This method initializes jMenuProjectBuildPreferences
-
- @return javax.swing.JMenu
-
- **/
- private JMenuItem getJMenuItemToolsBuildPreferences() {
- if (jMenuItemToolsBuildPreferences == null) {
- jMenuItemToolsBuildPreferences = new JMenuItem();
- jMenuItemToolsBuildPreferences.setText("Build Preferences...");
- jMenuItemToolsBuildPreferences.setMnemonic('P');
- jMenuItemToolsBuildPreferences.setEnabled(true);
- jMenuItemToolsBuildPreferences.addActionListener(this);
- }
- return jMenuItemToolsBuildPreferences;
- }
-
- /**
- This method initializes jMenuItemToolsToolChainConfiguration
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemToolsToolChainConfiguration() {
- if (jMenuItemToolsToolChainConfiguration == null) {
- jMenuItemToolsToolChainConfiguration = new JMenuItem();
- jMenuItemToolsToolChainConfiguration.setText("Tool Chain Configuration...");
- jMenuItemToolsToolChainConfiguration.setMnemonic('C');
- jMenuItemToolsToolChainConfiguration.addActionListener(this);
- }
- return jMenuItemToolsToolChainConfiguration;
- }
-
- /**
- This method initializes jMenuItemToolsClone
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemToolsClone() {
- if (jMenuItemToolsClone == null) {
- jMenuItemToolsClone = new JMenuItem();
- jMenuItemToolsClone.setText("Clone...");
- jMenuItemToolsClone.setMnemonic('l');
- jMenuItemToolsClone.setEnabled(true);
- jMenuItemToolsClone.addActionListener(this);
- }
- return jMenuItemToolsClone;
- }
-
- /**
- This method initializes jMenuItemToolsCodeScan
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemToolsCodeScan() {
- if (jMenuItemToolsCodeScan == null) {
- jMenuItemToolsCodeScan = new JMenuItem();
- jMenuItemToolsCodeScan.setText("Code Scan...");
- jMenuItemToolsCodeScan.setMnemonic('S');
- jMenuItemToolsCodeScan.setEnabled(false);
- jMenuItemToolsCodeScan.addActionListener(this);
- jMenuItemToolsCodeScan.setVisible(false);
- }
- return jMenuItemToolsCodeScan;
- }
-
- /**
- This method initializes jMenuItemWindowSplitVertical
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowDisplaySide() {
- if (jMenuItemWindowDisplaySide == null) {
- jMenuItemWindowDisplaySide = new JMenuItem();
- jMenuItemWindowDisplaySide.setText("Display Side by Side");
- jMenuItemWindowDisplaySide.setMnemonic('S');
- jMenuItemWindowDisplaySide.setEnabled(false);
- jMenuItemWindowDisplaySide.addActionListener(this);
- }
- return jMenuItemWindowDisplaySide;
- }
-
- /**
- This method initializes jMenuItemWindowSplitHorizontal
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowDisplayTopBottom() {
- if (jMenuItemWindowDisplayTopBottom == null) {
- jMenuItemWindowDisplayTopBottom = new JMenuItem();
- jMenuItemWindowDisplayTopBottom.setText("Display Top and Bottom");
- jMenuItemWindowDisplayTopBottom.setMnemonic('B');
- jMenuItemWindowDisplayTopBottom.setEnabled(false);
- jMenuItemWindowDisplayTopBottom.addActionListener(this);
- }
- return jMenuItemWindowDisplayTopBottom;
- }
-
- /**
- This method initializes jMenuItemViewXML
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemViewXML() {
- if (jMenuItemViewXML == null) {
- jMenuItemViewXML = new JMenuItem();
- jMenuItemViewXML.setText("XML");
- jMenuItemViewXML.setMnemonic('X');
- jMenuItemViewXML.setEnabled(false);
- jMenuItemViewXML.addActionListener(this);
- }
- return jMenuItemViewXML;
- }
-
- /**
- This method initializes jMenuItemWindowTabView
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowTabView() {
- if (jMenuItemWindowTabView == null) {
- jMenuItemWindowTabView = new JMenuItem();
- jMenuItemWindowTabView.setText("Tab View");
- jMenuItemWindowTabView.setMnemonic('T');
- jMenuItemWindowTabView.setEnabled(false);
- jMenuItemWindowTabView.addActionListener(this);
- }
- return jMenuItemWindowTabView;
- }
-
- /**
- This method initializes jMenuItemWindowSource
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowSource() {
- if (jMenuItemWindowSource == null) {
- jMenuItemWindowSource = new JMenuItem();
- jMenuItemWindowSource.setText("Source");
- jMenuItemWindowSource.setMnemonic('S');
- jMenuItemWindowSource.setEnabled(false);
- jMenuItemWindowSource.addActionListener(this);
- }
- return jMenuItemWindowSource;
- }
-
- /**
- This method initializes jMenuItemWindowXML
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowXML() {
- if (jMenuItemWindowXML == null) {
- jMenuItemWindowXML = new JMenuItem();
- jMenuItemWindowXML.setText("XML");
- jMenuItemWindowXML.setMnemonic('X');
- jMenuItemWindowXML.setEnabled(false);
- jMenuItemWindowXML.addActionListener(this);
- }
- return jMenuItemWindowXML;
- }
-
- /**
- This method initializes jMenuItemWindowPreferences
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowPreferences() {
- if (jMenuItemWindowPreferences == null) {
- jMenuItemWindowPreferences = new JMenuItem();
- jMenuItemWindowPreferences.setText("Preferences");
- jMenuItemWindowPreferences.setMnemonic('P');
- jMenuItemWindowPreferences.setEnabled(false);
- jMenuItemWindowPreferences.addActionListener(this);
- }
- return jMenuItemWindowPreferences;
- }
-
- /**
- This method initializes jMenuItemHelpContents
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemHelpContents() {
- if (jMenuItemHelpContents == null) {
- jMenuItemHelpContents = new JMenuItem();
- jMenuItemHelpContents.setText("Contents");
- jMenuItemHelpContents.setMnemonic('C');
- jMenuItemHelpContents.setEnabled(false);
- jMenuItemHelpContents.addActionListener(this);
- jMenuItemHelpContents.setVisible(false);
- }
- return jMenuItemHelpContents;
- }
-
- /**
- This method initializes jMenuItemHelpIndex
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemHelpIndex() {
- if (jMenuItemHelpIndex == null) {
- jMenuItemHelpIndex = new JMenuItem();
- jMenuItemHelpIndex.setText("Index");
- jMenuItemHelpIndex.setMnemonic('I');
- jMenuItemHelpIndex.setEnabled(false);
- jMenuItemHelpIndex.addActionListener(this);
- jMenuItemHelpIndex.setVisible(false);
- }
- return jMenuItemHelpIndex;
- }
-
- /**
- This method initializes jMenuItemHelpSearch
-
- @return javax.swing.JMenuItem
-
- */
- private JMenuItem getJMenuItemHelpSearch() {
- if (jMenuItemHelpSearch == null) {
- jMenuItemHelpSearch = new JMenuItem();
- jMenuItemHelpSearch.setText("Search");
- jMenuItemHelpSearch.setMnemonic('S');
- jMenuItemHelpSearch.setEnabled(false);
- jMenuItemHelpSearch.addActionListener(this);
- jMenuItemHelpSearch.setVisible(false);
- }
- return jMenuItemHelpSearch;
- }
-
- /**
- * This method initializes jMenuItemToolsInstallPackage
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemProjectInstallFar() {
- if (jMenuItemProjectInstallFar == null) {
- jMenuItemProjectInstallFar = new JMenuItem();
- jMenuItemProjectInstallFar.setText("Install FAR...");
- jMenuItemProjectInstallFar.setMnemonic('I');
- jMenuItemProjectInstallFar.setEnabled(true);
- jMenuItemProjectInstallFar.addActionListener(this);
- }
- return jMenuItemProjectInstallFar;
- }
-
- /**
- * This method initializes jMenuItemToolsUpdatePackage
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemProjectUpdateFar() {
- if (jMenuItemProjectUpdateFar == null) {
- jMenuItemProjectUpdateFar = new JMenuItem();
- jMenuItemProjectUpdateFar.setText("Update FAR...");
- jMenuItemProjectUpdateFar.setMnemonic('U');
- jMenuItemProjectUpdateFar.setEnabled(true);
- jMenuItemProjectUpdateFar.addActionListener(this);
- jMenuItemProjectUpdateFar.setVisible(true);
- }
- return jMenuItemProjectUpdateFar;
- }
-
- /**
- * This method initializes jMenuItemRemovePackage
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemProjectRemoveFar() {
- if (jMenuItemProjectRemoveFar == null) {
- jMenuItemProjectRemoveFar = new JMenuItem();
- jMenuItemProjectRemoveFar.setText("Remove FAR...");
- jMenuItemProjectRemoveFar.setMnemonic('R');
- jMenuItemProjectRemoveFar.setEnabled(true);
- jMenuItemProjectRemoveFar.addActionListener(this);
- }
- return jMenuItemProjectRemoveFar;
- }
-
- /**
- * This method initializes jMenuItemProjectCreateFar
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemProjectCreateFar() {
- if (jMenuItemProjectCreateFar == null) {
- jMenuItemProjectCreateFar = new JMenuItem();
- jMenuItemProjectCreateFar.setText("Create FAR...");
- jMenuItemProjectCreateFar.setMnemonic('C');
- jMenuItemProjectCreateFar.addActionListener(this);
- }
- return jMenuItemProjectCreateFar;
- }
-
- /**
- * This method initializes jMenuEditFind
- *
- * @return javax.swing.JMenu
- */
- private JMenu getJMenuEditFind() {
- if (jMenuEditFind == null) {
- jMenuEditFind = new JMenu();
- jMenuEditFind.setText("Find");
- jMenuEditFind.setMnemonic('F');
-
- jMenuEditFind.add(getJMenuItemEditFindPpi());
- jMenuEditFind.add(getJMenuItemEditFindProtocol());
- jMenuEditFind.add(getJMenuItemEditFindGuid());
- jMenuEditFind.add(getJMenuItemEditFindPcd());
- jMenuEditFind.add(getJMenuItemEditFindLibraryClass());
- jMenuEditFind.add(getJMenuItemEditFindLibraryInstance());
- }
- return jMenuEditFind;
- }
-
- /**
- * This method initializes jMenuItemEditFindPcd
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindPcd() {
- if (jMenuItemEditFindPcd == null) {
- jMenuItemEditFindPcd = new JMenuItem();
- jMenuItemEditFindPcd.setText("All PCD entries");
- jMenuItemEditFindPcd.setMnemonic('P');
- jMenuItemEditFindPcd.addActionListener(this);
- }
- return jMenuItemEditFindPcd;
- }
-
- /**
- * This method initializes jMenuItemEditFindLibraryClass
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindLibraryClass() {
- if (jMenuItemEditFindLibraryClass == null) {
- jMenuItemEditFindLibraryClass = new JMenuItem();
- jMenuItemEditFindLibraryClass.setText("All Library Classes");
- jMenuItemEditFindLibraryClass.setMnemonic('C');
- jMenuItemEditFindLibraryClass.addActionListener(this);
- }
- return jMenuItemEditFindLibraryClass;
- }
-
- /**
- * This method initializes jMenuItemEditFindPpi
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindPpi() {
- if (jMenuItemEditFindPpi == null) {
- jMenuItemEditFindPpi = new JMenuItem();
- jMenuItemEditFindPpi.setText("All PPIs");
- jMenuItemEditFindPpi.setMnemonic('I');
- jMenuItemEditFindPpi.addActionListener(this);
- }
- return jMenuItemEditFindPpi;
- }
-
- /**
- * This method initializes jMenuItemEditFindProtocol
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindProtocol() {
- if (jMenuItemEditFindProtocol == null) {
- jMenuItemEditFindProtocol = new JMenuItem();
- jMenuItemEditFindProtocol.setText("All Protocols");
- jMenuItemEditFindProtocol.setMnemonic('r');
- jMenuItemEditFindProtocol.addActionListener(this);
- }
- return jMenuItemEditFindProtocol;
- }
-
- /**
- * This method initializes jMenuItemEditFindGuid
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindGuid() {
- if (jMenuItemEditFindGuid == null) {
- jMenuItemEditFindGuid = new JMenuItem();
- jMenuItemEditFindGuid.setText("All GUIDs");
- jMenuItemEditFindGuid.setMnemonic('G');
- jMenuItemEditFindGuid.addActionListener(this);
- }
- return jMenuItemEditFindGuid;
- }
-
- /**
- * This method initializes jMenuItemEditFindLibraryInstance
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindLibraryInstance() {
- if (jMenuItemEditFindLibraryInstance == null) {
- jMenuItemEditFindLibraryInstance = new JMenuItem();
- jMenuItemEditFindLibraryInstance.setText("All Library Instances");
- jMenuItemEditFindLibraryInstance.setMnemonic('n');
- jMenuItemEditFindLibraryInstance.addActionListener(this);
- jMenuItemEditFindLibraryInstance.setVisible(false);
- }
- return jMenuItemEditFindLibraryInstance;
- }
-
- /**
- * This method initializes jMenuItemProjectGenerateGuidsXref
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemToolsGenerateGuidsXref() {
- if (jMenuItemToolsGenerateGuidsXref == null) {
- jMenuItemToolsGenerateGuidsXref = new JMenuItem();
- jMenuItemToolsGenerateGuidsXref.setText("Generate guids.xref...");
- jMenuItemToolsGenerateGuidsXref.setMnemonic('G');
- jMenuItemToolsGenerateGuidsXref.addActionListener(this);
- }
- return jMenuItemToolsGenerateGuidsXref;
- }
-
- /* (non-Javadoc)
- * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])
- *
- * Main class, start the GUI
- *
- */
- public static void main(String[] args) {
- //
- // Start Main UI
- //
- FrameworkWizardUI module = FrameworkWizardUI.getInstance(args);
- module.setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public FrameworkWizardUI(String[] args) {
- super();
- init(args);
- }
-
- /**
- This method initializes this
-
-
- **/
- private void init(String[] args) {
- //
- // Set current workspace and check
- // Check if exists WORKSPACE
- //
- Workspace.setCurrentWorkspace(System.getenv("WORKSPACE"));
- this.checkWorkspace();
-
- //
- // Show splash screen
- //
- SplashScreen ss = new SplashScreen();
- ss.setVisible(true);
-
- //
- // Go through args to check if enable log
- //
- for (int index = 0; index < args.length; index++) {
- if (args[index].equals("--log") || args[index].equals("-l")) {
- Log.setSaveLog(true);
- }
- }
-
- //
- // Init Global Data
- //
- GlobalData.init();
-
- //
- // Close splash screen
- //
- ss.dispose();
-
- //
- // Init the frame
- //
- this.setSize(DataType.MAIN_FRAME_PREFERRED_SIZE_WIDTH, DataType.MAIN_FRAME_PREFERRED_SIZE_HEIGHT);
- this.setResizable(true);
- this.setJMenuBar(getjJMenuBar());
- this.setContentPane(getJContentPane());
- this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
- + Workspace.getCurrentWorkspace() + "]");
- this.setExitType(1);
-
- //
- // max the window
- //
- this.setExtendedState(JFrame.MAXIMIZED_BOTH);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJPanelOperation(), null);
- jContentPane.add(getJSplitPane(), null);
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- //
- // Operations of Menu
- //
- if (arg0.getSource() == this.jMenuItemFileNew) {
- this.fileNew();
- }
-
- if (arg0.getSource() == this.jMenuItemFileOpen) {
- this.open();
- }
-
- if (arg0.getSource() == this.jMenuItemFileClose) {
- this.close();
- }
-
- if (arg0.getSource() == this.jMenuItemFileCloseAll) {
- this.closeAll();
- this.refresh();
- this.makeEmptyTree();
- }
-
- if (arg0.getSource() == this.jMenuItemFileSave) {
- this.save();
- }
-
- if (arg0.getSource() == this.jMenuItemFileSaveAs) {
- this.saveAs();
- }
-
- if (arg0.getSource() == this.jMenuItemFileSaveAll) {
- this.saveAll();
- }
-
- if (arg0.getSource() == this.jMenuItemFileRefresh) {
- if (this.closeAll() == 0) {
- this.refresh();
- this.makeEmptyTree();
- }
- }
-
- if (arg0.getSource() == this.jMenuItemFileExit) {
- this.exit();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindPpi) {
- this.findPpi();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindProtocol) {
- this.findProtocol();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindGuid) {
- this.findGuid();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindPcd) {
- this.findPcd();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindLibraryClass) {
- this.findLibraryClass();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindLibraryInstance) {
- this.findLibraryInstance();
- }
-
- if (arg0.getSource() == jMenuItemToolsBuildPreferences) {
- configBuildPreferences();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectChangeWorkspace) {
- this.changeWorkspace();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectCreateFar) {
- this.createFar();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectInstallFar) {
- this.installFar();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectRemoveFar) {
- this.removeFar();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectUpdateFar) {
- this.updateFar();
- }
-
- if (arg0.getSource() == this.jMenuItemToolsClone) {
- this.cloneItem();
- }
-
- if (arg0.getSource() == this.jMenuItemToolsToolChainConfiguration) {
- this.setupToolChainConfiguration();
- }
-
- if (arg0.getSource() == this.jMenuItemToolsGenerateGuidsXref) {
- this.generateGuidsXref();
- }
-
- if (arg0.getSource() == this.jMenuItemHelpAbout) {
- About a = new About(this, true);
- int result = a.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- a.dispose();
- }
- }
- }
-
- /**
- Create an empty tree if no file is open
-
- **/
- private void makeEmptyTree() {
- //
- // Make root
- //
- dmtnRoot = new IDefaultMutableTreeNode("WORKSPACE", IDefaultMutableTreeNode.WORKSPACE, false, null, null);
-
- //
- // Make Module Description
- //
- dmtnModuleDescription = new IDefaultMutableTreeNode("Modules", IDefaultMutableTreeNode.MODULE_DESCRIPTION,
- false, null, dmtnRoot);
-
- //
- // First add package
- //
- if (GlobalData.vPackageList.size() > 0) {
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- IDefaultMutableTreeNode dmtnModulePackage = null;
- IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
- IDefaultMutableTreeNode dmtnModulePackageModule = null;
-
- dmtnModulePackage = new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index).getName(),
- IDefaultMutableTreeNode.MODULE_PACKAGE, false,
- GlobalData.vPackageList.elementAt(index),
- this.dmtnModuleDescription);
- dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
- IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,
- false, GlobalData.vPackageList.elementAt(index),
- this.dmtnModuleDescription);
- dmtnModulePackageModule = new IDefaultMutableTreeNode("Module",
- IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
- false, GlobalData.vPackageList.elementAt(index),
- this.dmtnModuleDescription);
- //
- // And then add each module in its package
- //
- Vector<ModuleIdentification> vModule = wt.getAllModules(GlobalData.vPackageList.elementAt(index));
- for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
- if (vModule.get(indexJ).isLibrary()) {
- dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ),
- this.dmtnModuleDescription));
- } else {
- dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ),
- this.dmtnModuleDescription));
- }
- }
- if (dmtnModulePackageModule.getChildCount() > 0) {
- dmtnModulePackage.add(dmtnModulePackageModule);
- }
- if (dmtnModulePackageLibrary.getChildCount() > 0) {
- dmtnModulePackage.add(dmtnModulePackageLibrary);
- }
-
- dmtnModuleDescription.add(dmtnModulePackage);
- }
- }
-
- //
- // Make Package Description
- //
- dmtnPackageDescription = new IDefaultMutableTreeNode("Packages", IDefaultMutableTreeNode.PACKAGE_DESCRIPTION,
- false, null, this.dmtnRoot);
- if (GlobalData.vPackageList.size() > 0) {
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- dmtnPackageDescription.add(new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index)
- .getName(),
- IDefaultMutableTreeNode.PACKAGE, false,
- GlobalData.vPackageList.elementAt(index),
- this.dmtnPackageDescription));
- }
- }
-
- //
- // Make Platform Description
- //
- dmtnPlatformDescription = new IDefaultMutableTreeNode("Platforms",
- IDefaultMutableTreeNode.PLATFORM_DESCRIPTION, false,
- null, this.dmtnRoot);
- if (GlobalData.vPlatformList.size() > 0) {
- for (int index = 0; index < GlobalData.vPlatformList.size(); index++) {
- dmtnPlatformDescription.add(new IDefaultMutableTreeNode(GlobalData.vPlatformList.elementAt(index)
- .getName(),
- IDefaultMutableTreeNode.PLATFORM, false,
- GlobalData.vPlatformList.elementAt(index),
- this.dmtnPlatformDescription));
- }
- }
-
- //
- // Add sub nodes to root node
- //
- dmtnRoot.add(dmtnModuleDescription);
- dmtnRoot.add(dmtnPackageDescription);
- dmtnRoot.add(dmtnPlatformDescription);
- iTree = new ITree(dmtnRoot);
- iTree.addMouseListener(this);
- iTree.addKeyListener(this);
- jScrollPaneTree.setViewportView(iTree);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to popup warning message to confirm quit
- *
- */
- public void windowClosing(WindowEvent arg0) {
- this.exit();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- * Override mouseClicked to check if need display popup menu
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- //
- // When double click
- //
- if (arg0.getClickCount() == 2) {
- doubleClickModuleTreeNode();
- }
- }
-
- public void mouseEntered(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void mouseExited(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void mousePressed(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void mouseReleased(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- /**
- Remove all Internal Frame of Module Desktop Pane
-
- **/
- private void cleanDesktopPaneModule() {
- if (jDesktopPaneModule != null) {
- JInternalFrame[] iif = this.jDesktopPaneModule.getAllFrames();
- for (int index = 0; index < iif.length; index++) {
- iif[index].dispose();
- }
- }
- }
-
- /**
- Remove all Internal Frame of package Desktop Pane
-
- **/
- private void cleanDesktopPanePackage() {
- if (jDesktopPanePlatform != null) {
- JInternalFrame[] iif = this.jDesktopPanePackage.getAllFrames();
- for (int index = 0; index < iif.length; index++) {
- iif[index].dispose();
- }
- }
- }
-
- /**
- Remove all Internal Frame of platform Desktop Pane
-
- **/
- private void cleanDesktopPanePlatform() {
- if (jDesktopPanePlatform != null) {
- JInternalFrame[] iif = this.jDesktopPanePlatform.getAllFrames();
- for (int index = 0; index < iif.length; index++) {
- iif[index].dispose();
- }
- }
- }
-
- /**
- Remove all Internal Frame of all Desktop Panes
-
- **/
- private void cleanDesktopPane() {
- cleanDesktopPaneModule();
- cleanDesktopPanePackage();
- cleanDesktopPanePlatform();
- }
-
- /**
- Set file filter as input ext
-
- @param ext
- @return
-
- **/
- private int getNewFilePath(String ext) {
- JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(ext));
- return fc.showSaveDialog(new JPanel());
- }
-
- /**
- Add a module to tree
-
- @param mid The module node to be added
-
- **/
- private void addModuleToTree(ModuleIdentification mid) {
- //
- // Add new MsaHeader node to the tree
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MODULE,
- false, mid, this.dmtnModuleDescription);
- //
- // First find the module belongs to which package
- //
- IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),
- IDefaultMutableTreeNode.MODULE_PACKAGE);
- //
- // To check if has module node or library node
- //
- IDefaultMutableTreeNode parentModuleNode = null;
- IDefaultMutableTreeNode parentLibraryNode = null;
- boolean hasModule = false;
- boolean hasLibrary = false;
- for (int index = 0; index < packageNode.getChildCount(); index++) {
- IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);
- if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {
- hasLibrary = true;
- parentLibraryNode = iNode;
- }
- if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
- hasModule = true;
- parentModuleNode = iNode;
- }
- }
-
- //
- // If is a module
- //
- if (!mid.isLibrary()) {
- //
- // Create parent node first if has no parent node
- //
- if (!hasModule) {
- parentModuleNode = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
- false, mid.getPackageId(), this.dmtnModuleDescription);
- iTree.addNode(packageNode, parentModuleNode);
- }
-
- iTree.addNode(parentModuleNode, node);
- }
-
- //
- // If is a Library
- //
- if (mid.isLibrary()) {
- //
- // Create parent node first if has no parent node
- //
- if (!hasLibrary) {
- parentLibraryNode = new IDefaultMutableTreeNode("Library",
- IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
- mid.getPackageId(), this.dmtnModuleDescription);
- iTree.addNode(packageNode, parentLibraryNode);
- }
-
- iTree.addNode(parentLibraryNode, node);
- }
- }
-
- /**
- Open Module
-
- @param path input file path
-
- **/
- private void openModule(String path, IDefaultMutableTreeNode belongNode) {
- ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(path);
- if (id == null) {
- //
- // The module is not in existing packages
- //
- Log.wrn("Open Module", "The module does not belong to any package in the current workspace!");
- return;
- }
-
- //
- // Make the node selected
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(belongNode, id, IDefaultMutableTreeNode.MODULE)));
-
- //
- // Update opening Module list information
- //
- if (!iTree.getSelectNode().isOpening()) {
- //
- // Insert sub node of module
- //
- insertModuleTreeNode(id, belongNode);
- iTree.getSelectNode().setOpening(true);
-
- //
- // Update opening module list
- //
- GlobalData.openingModuleList.setModuleOpen(id, true);
- Set<TreePath> temp = GlobalData.openingModuleList.getTreePathById(id);
- temp.add(iTree.getSelectionPath());
- GlobalData.openingModuleList.setTreePathById(id, temp);
- }
- //
- // Select msa header node and show it in editor panel
- //
- iTree
- .setSelectionPath(iTree
- .getPathOfNode(iTree
- .getNodeById(belongNode, id, IDefaultMutableTreeNode.MSA_HEADER)));
- showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, GlobalData.openingModuleList.getOpeningModuleById(id));
- this.currentOpeningModuleIndex = GlobalData.openingModuleList.findIndexOfListById(id);
- }
-
- /**
- Open Package
-
- @param path input file path
-
- **/
- private void openPackage(String path) {
- PackageIdentification id = GlobalData.openingPackageList.getIdByPath(path);
- if (id == null) {
- //
- // The package is not in current workspace
- //
- Log.wrn("Open Package", "The package has not been installed in the current workspace!");
- return;
- }
-
- //
- // Make the node selected
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id,
- IDefaultMutableTreeNode.PACKAGE)));
- //
- // Update opening package list information
- //
- if (!GlobalData.openingPackageList.getPackageOpen(id)) {
- //
- // Insert sub node of module
- //
- insertPackageTreeNode(id);
- iTree.getSelectNode().setOpening(true);
-
- //
- // Update opening module list
- //
- GlobalData.openingPackageList.setPackageOpen(id, true);
- Set<TreePath> temp = GlobalData.openingPackageList.getTreePathById(id);
- temp.add(iTree.getSelectionPath());
- GlobalData.openingPackageList.setTreePathById(id, temp);
- }
- //
- // Show spd header in editor panel
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id,
- IDefaultMutableTreeNode.SPD_HEADER)));
- showPackageElement(IDefaultMutableTreeNode.SPD_HEADER, GlobalData.openingPackageList.getOpeningPackageById(id));
- this.currentOpeningPackageIndex = GlobalData.openingPackageList.findIndexOfListById(id);
- }
-
- /**
- Open Package
-
- @param path input file path
-
- **/
- private void openPlatform(String path) {
- PlatformIdentification id = GlobalData.openingPlatformList.getIdByPath(path);
- if (id == null) {
- //
- // The platform is not in current workspace
- //
- Log.wrn("Open Platform", "The platform has not been installed in the current workspace!");
- return;
- }
-
- //
- // Make the node selected
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id,
- IDefaultMutableTreeNode.PLATFORM)));
- //
- // Update opening package list information
- //
- if (!GlobalData.openingPlatformList.getPlatformOpen(id)) {
- //
- // Insert sub node of module
- //
- insertPlatformTreeNode(id);
- iTree.getSelectNode().setOpening(true);
-
- //
- // Update opening module list
- //
- GlobalData.openingPlatformList.setPlatformOpen(id, true);
- Set<TreePath> temp = GlobalData.openingPlatformList.getTreePathById(id);
- temp.add(iTree.getSelectionPath());
- GlobalData.openingPlatformList.setTreePathById(id, temp);
- }
- //
- // Show fpd header in editor panel
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id,
- IDefaultMutableTreeNode.FPD_PLATFORMHEADER)));
- showPlatformElement(IDefaultMutableTreeNode.FPD_PLATFORMHEADER,
- GlobalData.openingPlatformList.getOpeningPlatformById(id));
- this.currentOpeningPlatformIndex = GlobalData.openingPlatformList.findIndexOfListById(id);
- }
-
- /**
- Save module
-
- **/
- private void saveModule(int index) {
- OpeningModuleType omt = GlobalData.openingModuleList.getOpeningModuleByIndex(index);
- if (omt.isNew()) {
- if (getNewFilePath(DataType.MODULE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
- return;
- }
- }
- try {
- SaveFile.saveMsaFile(omt.getId().getPath(), omt.getXmlMsa());
- GlobalData.openingModuleList.setNew(omt.getId(), false);
- GlobalData.openingModuleList.setModuleSaved(omt.getId(), true);
- } catch (Exception e) {
- Log.wrn("Save Module", e.getMessage());
- Log.err("Save Module", e.getMessage());
- }
- }
-
- /**
- Save package
-
- **/
- private void savePackage(int index) {
- OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index);
- if (opt.isNew()) {
- if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
- return;
- }
- }
- try {
- SaveFile.saveSpdFile(opt.getId().getPath(), opt.getXmlSpd());
- GlobalData.openingPackageList.setNew(opt.getId(), false);
- GlobalData.openingPackageList.setPackageSaved(opt.getId(), true);
- } catch (Exception e) {
- Log.wrn("Save Package", e.getMessage());
- Log.err("Save Package", e.getMessage());
- }
- }
-
- /**
- Save platform
-
- **/
- private void savePlatform(int index) {
- OpeningPlatformType opt = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index);
- if (opt.isNew()) {
- if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
- return;
- }
- }
- try {
- SaveFile.saveFpdFile(opt.getId().getPath(), opt.getXmlFpd());
- GlobalData.openingPlatformList.setNew(opt.getId(), false);
- GlobalData.openingPlatformList.setPlatformSaved(opt.getId(), true);
- } catch (Exception e) {
- Log.wrn("Save Package", e.getMessage());
- Log.err("Save Package", e.getMessage());
- }
- }
-
- public void componentResized(ComponentEvent arg0) {
- if (this.jSplitPane != null) {
- this.jSplitPane.setSize(this.getWidth() - DataType.MAIN_FRAME_WIDTH_SPACING,
- this.getHeight() - DataType.MAIN_FRAME_HEIGHT_SPACING);
- this.jSplitPane.validate();
- resizeDesktopPanel();
- }
- }
-
- /**
- Resize JDesktopPanel
-
- */
- private void resizeDesktopPanel() {
- resizeDesktopPanel(this.jDesktopPaneModule);
- resizeDesktopPanel(this.jDesktopPanePackage);
- resizeDesktopPanel(this.jDesktopPanePlatform);
- }
-
- /**
- Resize JDesktopPanel
-
- */
- private void resizeDesktopPanel(JDesktopPane jdk) {
- JInternalFrame[] iif = jdk.getAllFrames();
- for (int index = 0; index < iif.length; index++) {
- iif[index].setSize(jdk.getWidth(), jdk.getHeight());
- }
- }
-
- private void insertModuleTreeNode(Identification id, IDefaultMutableTreeNode belongNode) {
- iTree.addNode(new IDefaultMutableTreeNode("Module Header", IDefaultMutableTreeNode.MSA_HEADER, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode.MSA_SOURCEFILES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Library Class Definitions",
- IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS, true, id,
- belongNode));
- iTree
- .addNode(new IDefaultMutableTreeNode("Package Dependencies",
- IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Protocols", IDefaultMutableTreeNode.MSA_PROTOCOLS, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Events", IDefaultMutableTreeNode.MSA_EVENTS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Hobs", IDefaultMutableTreeNode.MSA_HOBS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Ppis", IDefaultMutableTreeNode.MSA_PPIS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Variables", IDefaultMutableTreeNode.MSA_VARIABLES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Boot Modes", IDefaultMutableTreeNode.MSA_BOOTMODES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("System Tables", IDefaultMutableTreeNode.MSA_SYSTEMTABLES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Data Hubs", IDefaultMutableTreeNode.MSA_DATAHUBS, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Hii Packages", IDefaultMutableTreeNode.MSA_HIIPACKAGES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Guids", IDefaultMutableTreeNode.MSA_GUIDS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("External Defintions", IDefaultMutableTreeNode.MSA_EXTERNS, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Pcd Coded", IDefaultMutableTreeNode.MSA_PCDS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode.MSA_BUILDOPTIONS, true, id, belongNode));
- }
-
- private void insertPackageTreeNode(Identification id) {
- IDefaultMutableTreeNode idmtTemp = this.dmtnPackageDescription;
- iTree.addNode(new IDefaultMutableTreeNode("Package Header", IDefaultMutableTreeNode.SPD_HEADER, true, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Library Class Declarations",
- IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS, true, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Msa Files", IDefaultMutableTreeNode.SPD_MSAFILES, false, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Package Includes", IDefaultMutableTreeNode.SPD_PACKAGEHEADERS, true,
- id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Guid Declarations", IDefaultMutableTreeNode.SPD_GUIDDECLARATIONS,
- true, id, idmtTemp));
- iTree
- .addNode(new IDefaultMutableTreeNode("Protocol Declarations",
- IDefaultMutableTreeNode.SPD_PROTOCOLDECLARATIONS, true, id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Ppi Declarations", IDefaultMutableTreeNode.SPD_PPIDECLARATIONS,
- true, id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Pcd Declarations", IDefaultMutableTreeNode.SPD_PCDDECLARATIONS,
- true, id, idmtTemp));
- //
- // Add modules in this package
- //
- IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
- IDefaultMutableTreeNode dmtnModulePackageModule = null;
-
- dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
- IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
- id, idmtTemp);
- dmtnModulePackageModule = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
- false, id, idmtTemp);
-
- Vector<ModuleIdentification> vModule = wt.getAllModules(new PackageIdentification(id));
- for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
- if (vModule.get(indexJ).isLibrary()) {
- dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ), idmtTemp));
- } else {
- dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ), idmtTemp));
- }
- }
- if (dmtnModulePackageModule.getChildCount() > 0) {
- iTree.addNode(dmtnModulePackageModule);
- }
- if (dmtnModulePackageLibrary.getChildCount() > 0) {
- iTree.addNode(dmtnModulePackageLibrary);
- }
- }
-
- private void insertPlatformTreeNode(Identification id) {
- IDefaultMutableTreeNode idmtTemp = this.dmtnPlatformDescription;
- iTree.addNode(new IDefaultMutableTreeNode("Platform Header", IDefaultMutableTreeNode.FPD_PLATFORMHEADER, true,
- id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Platform Definitions",
- IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS, true, id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Flash Information", IDefaultMutableTreeNode.FPD_FLASH, true, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Framework Modules", IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES,
- true, id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Dynamic PCD Build Declarations",
- IDefaultMutableTreeNode.FPD_PCDDYNAMICBUILDDECLARATIONS, true, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode.FPD_BUILDOPTIONS, true, id,
- idmtTemp));
-
- //
- // Add modules in this platform
- //
- IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
- IDefaultMutableTreeNode dmtnModulePackageModule = null;
-
- dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
- IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
- id, idmtTemp);
- dmtnModulePackageModule = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
- false, id, idmtTemp);
-
- Vector<ModuleIdentification> vModule = wt.getAllModules(new PlatformIdentification(id));
- for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
- if (vModule.get(indexJ).isLibrary()) {
- dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ), idmtTemp));
- } else {
- dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ), idmtTemp));
- }
- }
- if (dmtnModulePackageModule.getChildCount() > 0) {
- iTree.addNode(dmtnModulePackageModule);
- }
- if (dmtnModulePackageLibrary.getChildCount() > 0) {
- iTree.addNode(dmtnModulePackageLibrary);
- }
- }
-
- /**
- Operate when double click a tree node
-
- **/
- private void doubleClickModuleTreeNode() {
- Identification id = null;
- int intCategory = -1;
- String path = null;
- IDefaultMutableTreeNode belongNode = null;
-
- try {
- //
- // Get selected tree node
- //
- if (iTree.getSelectNode() != null) {
- id = iTree.getSelectNode().getId();
- }
-
- //
- // If id is null, return directly
- //
- if (id == null) {
- return;
- }
-
- intCategory = iTree.getSelectCategory();
- belongNode = iTree.getSelectNode().getBelongNode();
-
- //
- // If the node is not opened yet
- // Insert top level elements first
- //
- if (intCategory == IDefaultMutableTreeNode.MODULE) {
- path = iTree.getSelectNode().getId().getPath();
- openModule(path, belongNode);
- return;
- }
- if (intCategory == IDefaultMutableTreeNode.PACKAGE) {
- path = iTree.getSelectNode().getId().getPath();
- openPackage(path);
- return;
- }
- if (intCategory == IDefaultMutableTreeNode.PLATFORM) {
- path = iTree.getSelectNode().getId().getPath();
- openPlatform(path);
- return;
- }
-
- //
- // Show editor panel
- //
- if (intCategory >= IDefaultMutableTreeNode.MSA_HEADER && intCategory < IDefaultMutableTreeNode.SPD_HEADER) {
- showModuleElement(intCategory,
- GlobalData.openingModuleList.getOpeningModuleById(new ModuleIdentification(id)));
- this.currentOpeningModuleIndex = GlobalData.openingModuleList
- .findIndexOfListById(new ModuleIdentification(
- id));
- }
- if (intCategory >= IDefaultMutableTreeNode.SPD_HEADER
- && intCategory < IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
- showPackageElement(intCategory,
- GlobalData.openingPackageList.getOpeningPackageById(new PackageIdentification(id)));
- this.currentOpeningPackageIndex = GlobalData.openingPackageList
- .findIndexOfListById(new PackageIdentification(
- id));
- }
- if (intCategory >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
- showPlatformElement(
- intCategory,
- GlobalData.openingPlatformList
- .getOpeningPlatformById(new PlatformIdentification(id)));
- this.currentOpeningPlatformIndex = GlobalData.openingPlatformList
- .findIndexOfListById(new PlatformIdentification(
- id));
- }
- } catch (Exception e) {
- Log.err("double click category: " + intCategory);
- Log.err("double click belong node: " + belongNode.toString());
- Log.err("double click id path: " + id);
- Log.err("double click exception: " + e.getMessage());
- }
- }
-
- /**
- Show content of editor panel via selected element
-
- @param elementType
- @param fpd
-
- **/
- private void showPlatformElement(int elementType, OpeningPlatformType fpd) {
- this.cleanDesktopPanePlatform();
-
- switch (elementType) {
- case IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS:
- FpdPlatformDefs frmFpdPlatformDefs = new FpdPlatformDefs(fpd);
- getJDesktopPanePlatform().add(frmFpdPlatformDefs, 1);
- break;
- case IDefaultMutableTreeNode.FPD_PLATFORMHEADER:
- FpdHeader frmFpdHeader = new FpdHeader(fpd);
- getJDesktopPanePlatform().add(frmFpdHeader, 1);
- break;
- case IDefaultMutableTreeNode.FPD_FLASH:
- FpdFlash frmFpdFlash = new FpdFlash(fpd);
- getJDesktopPanePlatform().add(frmFpdFlash, 1);
- break;
- case IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES:
- FpdFrameworkModules frmFpdFrameworkModules = new FpdFrameworkModules(fpd);
- getJDesktopPanePlatform().add(frmFpdFrameworkModules, 1);
- break;
- case IDefaultMutableTreeNode.FPD_PCDDYNAMICBUILDDECLARATIONS:
- FpdDynamicPcdBuildDefinitions frmFpdDynamicPcdBuildDefinitions = new FpdDynamicPcdBuildDefinitions(fpd);
- getJDesktopPanePlatform().add(frmFpdDynamicPcdBuildDefinitions, 1);
- break;
- case IDefaultMutableTreeNode.FPD_BUILDOPTIONS:
- FpdBuildOptions frmFpdBuildOptions = new FpdBuildOptions(fpd);
- getJDesktopPanePlatform().add(frmFpdBuildOptions, 1);
- break;
- }
- this.jTabbedPaneEditor.setSelectedIndex(2);
- resizeDesktopPanel();
- }
-
- /**
- Show content of editor panel via selected element
-
- @param elementType
- @param spd
-
- */
- private void showPackageElement(int elementType, OpeningPackageType spd) {
- this.cleanDesktopPanePackage();
- Tools.dirForNewSpd = spd.getId().getPath();
- switch (elementType) {
- case IDefaultMutableTreeNode.SPD_HEADER:
- SpdHeader frmSpdHeader = new SpdHeader(spd);
- getJDesktopPanePackage().add(frmSpdHeader, 1);
- break;
- case IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS:
- SpdLibClassDecls frmSlcd = new SpdLibClassDecls(spd, this);
- getJDesktopPanePackage().add(frmSlcd, 1);
- break;
- case IDefaultMutableTreeNode.SPD_MSAFILES:
- SpdMsaFiles frmSmf = new SpdMsaFiles(spd, this);
- getJDesktopPanePackage().add(frmSmf, 1);
- break;
- case IDefaultMutableTreeNode.SPD_PACKAGEHEADERS:
- SpdPackageHeaders frmSph = new SpdPackageHeaders(spd, this);
- getJDesktopPanePackage().add(frmSph, 1);
- break;
- case IDefaultMutableTreeNode.SPD_GUIDDECLARATIONS:
- SpdGuidDecls frmSgd = new SpdGuidDecls(spd, this);
- getJDesktopPanePackage().add(frmSgd, 1);
- break;
- case IDefaultMutableTreeNode.SPD_PROTOCOLDECLARATIONS:
- SpdProtocolDecls frmSprod = new SpdProtocolDecls(spd, this);
- getJDesktopPanePackage().add(frmSprod, 1);
- break;
- case IDefaultMutableTreeNode.SPD_PPIDECLARATIONS:
- SpdPpiDecls frmSppid = new SpdPpiDecls(spd, this);
- getJDesktopPanePackage().add(frmSppid, 1);
- break;
- case IDefaultMutableTreeNode.SPD_PCDDECLARATIONS:
- SpdPcdDefs frmSpcdd = new SpdPcdDefs(spd, this);
- getJDesktopPanePackage().add(frmSpcdd, 1);
- break;
- }
- this.jTabbedPaneEditor.setSelectedIndex(1);
- resizeDesktopPanel();
- }
-
- /**
- Show content of editor panel via selected element
-
- @param elementType
- @param msa
-
- */
- private void showModuleElement(int elementType, OpeningModuleType msa) {
- this.cleanDesktopPaneModule();
- switch (elementType) {
- case IDefaultMutableTreeNode.MSA_HEADER:
- MsaHeader frmMsaHeader = new MsaHeader(msa);
- getJDesktopPaneModule().add(frmMsaHeader, 1);
- break;
- case IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS:
- ModuleLibraryClassDefinitions frmMlcd = new ModuleLibraryClassDefinitions(msa, this);
- getJDesktopPaneModule().add(frmMlcd, 1);
- break;
- case IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES:
- ModulePackageDependencies frmMpd = new ModulePackageDependencies(msa, this);
- getJDesktopPaneModule().add(frmMpd, 1);
- break;
- case IDefaultMutableTreeNode.MSA_SOURCEFILES:
- ModuleSourceFiles frmMsf = new ModuleSourceFiles(msa, this);
- getJDesktopPaneModule().add(frmMsf, 1);
- break;
- case IDefaultMutableTreeNode.MSA_PROTOCOLS:
- ModuleProtocols frmMp = new ModuleProtocols(msa, this);
- getJDesktopPaneModule().add(frmMp, 1);
- break;
- case IDefaultMutableTreeNode.MSA_EVENTS:
- ModuleEvents frmMe = new ModuleEvents(msa, this);
- getJDesktopPaneModule().add(frmMe, 1);
- break;
- case IDefaultMutableTreeNode.MSA_HOBS:
- ModuleHobs frmMh = new ModuleHobs(msa, this);
- getJDesktopPaneModule().add(frmMh, 1);
- break;
- case IDefaultMutableTreeNode.MSA_PPIS:
- ModulePpis frmMpp = new ModulePpis(msa, this);
- getJDesktopPaneModule().add(frmMpp, 1);
- break;
- case IDefaultMutableTreeNode.MSA_VARIABLES:
- ModuleVariables frmMv = new ModuleVariables(msa, this);
- getJDesktopPaneModule().add(frmMv, 1);
- break;
- case IDefaultMutableTreeNode.MSA_BOOTMODES:
- ModuleBootModes frmMbm = new ModuleBootModes(msa, this);
- getJDesktopPaneModule().add(frmMbm, 1);
- break;
- case IDefaultMutableTreeNode.MSA_SYSTEMTABLES:
- ModuleSystemTables frmMst = new ModuleSystemTables(msa, this);
- getJDesktopPaneModule().add(frmMst, 1);
- break;
- case IDefaultMutableTreeNode.MSA_DATAHUBS:
- ModuleDataHubs frmMdh = new ModuleDataHubs(msa, this);
- getJDesktopPaneModule().add(frmMdh, 1);
- break;
- case IDefaultMutableTreeNode.MSA_HIIPACKAGES:
- ModuleHiiPackages frmMf = new ModuleHiiPackages(msa, this);
- getJDesktopPaneModule().add(frmMf, 1);
- break;
- case IDefaultMutableTreeNode.MSA_GUIDS:
- ModuleGuids frmGuid = new ModuleGuids(msa, this);
- getJDesktopPaneModule().add(frmGuid, 1);
- break;
- case IDefaultMutableTreeNode.MSA_EXTERNS:
- ModuleExterns frmMex = new ModuleExterns(msa, this);
- getJDesktopPaneModule().add(frmMex, 1);
- break;
- case IDefaultMutableTreeNode.MSA_PCDS:
- ModulePCDs frmPcd = new ModulePCDs(msa, this);
- getJDesktopPaneModule().add(frmPcd, 1);
- break;
- case IDefaultMutableTreeNode.MSA_BUILDOPTIONS:
- ModuleBuildOptions frmMbo = new ModuleBuildOptions(msa, this);
- getJDesktopPaneModule().add(frmMbo, 1);
- break;
- }
- this.jTabbedPaneEditor.setSelectedIndex(0);
- resizeDesktopPanel();
- }
-
- //
- // Define operations of menu
- //
- /**
- New a file
-
- **/
- private void fileNew() {
- int result = -1;
- //
- // Selece new file type
- //
- NewFileChooser nfc = new NewFileChooser(this, true);
- result = nfc.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- nfc.dispose();
- return;
- } else if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- //
- // To new a module
- //
- SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
- result = smb.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- nfc.dispose();
- smb.dispose();
- return;
- } else if (result == DataType.RETURN_TYPE_OK) {
- ModuleIdentification mid = smb.getMid();
- if (mid != null) {
- //
- // Update package of workspace first
- //
- PackageSurfaceAreaDocument.PackageSurfaceArea psa = null;
- if (GlobalData.openingPackageList.existsPackage(mid.getPackageId())) {
- psa = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId());
- }
- try {
- wt.addModuleToPackage(mid, psa);
- } catch (IOException e) {
- Log.wrn("Update MsaFiles in Package", e.getMessage());
- Log.err("Update MsaFiles in Package", e.getMessage());
- return;
- } catch (XmlException e) {
- Log.wrn("Update MsaFiles in Package", e.getMessage());
- Log.err("Update MsaFiles in Package", e.getMessage());
- return;
- } catch (Exception e) {
- Log.wrn("Update MsaFiles in Package", e.getMessage());
- Log.err("Update MsaFiles in Package", e.getMessage());
- return;
- }
-
- //
- // Update Global Data
- //
- GlobalData.openingModuleList.insertToOpeningModuleList(mid, smb.getMsa());
- GlobalData.vModuleList.addElement(mid);
-
- //
- // Create new node on the tree
- //
- addModuleToTree(mid);
-
- //
- // Open the node
- //
- this.openModule(mid.getPath(), this.dmtnModuleDescription);
- }
- }
- } else if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- //
- // To new a package
- //
- SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
- result = smb.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- nfc.dispose();
- smb.dispose();
- return;
- } else if (result == DataType.RETURN_TYPE_OK) {
- PackageIdentification pid = smb.getPid();
- if (pid != null) {
- try {
- wt.addPackageToDatabase(smb.getPid());
- } catch (Exception e) {
- Log.err("addPackageToDatabase", e.getMessage());
- }
-
- //
- // Update Global Data
- //
- GlobalData.openingPackageList.insertToOpeningPackageList(pid, smb.getSpd());
- GlobalData.vPackageList.addElement(pid);
-
- //
- // Add to Module Description node
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(pid.getName(),
- IDefaultMutableTreeNode.MODULE_PACKAGE,
- false, pid, this.dmtnModuleDescription);
-
- iTree.addNode(dmtnModuleDescription, node);
-
- //
- // Add new SpdHeader node to the tree
- //
- node = new IDefaultMutableTreeNode(pid.getName(), IDefaultMutableTreeNode.PACKAGE, true, pid,
- this.dmtnPackageDescription);
- iTree.addNode(dmtnPackageDescription, node);
-
- this.openPackage(pid.getPath());
- }
- }
- } else if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- //
- // To new a platform
- //
- SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
- result = smb.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- nfc.dispose();
- smb.dispose();
- return;
- } else if (result == DataType.RETURN_TYPE_OK) {
- PlatformIdentification fid = smb.getFid();
- if (fid != null) {
- try {
- wt.addPlatformToDatabase(fid);
- } catch (Exception e) {
- Log.err("addPlatformToDatabase", e.getMessage());
- }
-
- //
- // Update global data
- //
- GlobalData.openingPlatformList.insertToOpeningPlatformList(fid, smb.getFpd());
- GlobalData.vPlatformList.addElement(fid);
- //
- // Add new SpdHeader node to the tree
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(fid.getName(),
- IDefaultMutableTreeNode.PLATFORM, true,
- fid, this.dmtnPlatformDescription);
- iTree.addNode(dmtnPlatformDescription, node);
- this.openPlatform(fid.getPath());
- }
- }
- }
- }
-
- /**
- Open a file
-
- **/
- private void open() {
- JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());
- fc.setAcceptAllFileFilterUsed(false);
- IFileFilter iffM = new IFileFilter(DataType.MODULE_SURFACE_AREA_EXT);
- IFileFilter iffP = new IFileFilter(DataType.PACKAGE_SURFACE_AREA_EXT);
- IFileFilter iffF = new IFileFilter(DataType.PLATFORM_SURFACE_AREA_EXT);
- fc.addChoosableFileFilter(iffM);
- fc.addChoosableFileFilter(iffP);
- fc.addChoosableFileFilter(iffF);
- fc.setFileFilter(iffM);
-
- int result = fc.showOpenDialog(new JPanel());
-
- if (result == JFileChooser.APPROVE_OPTION) {
- String path = fc.getSelectedFile().getPath();
- String match = path.substring(path.length() - 4);
- if (match.equals(DataType.FILE_EXT_SEPARATOR + DataType.MODULE_SURFACE_AREA_EXT)) {
- openModule(path, this.dmtnModuleDescription);
- } else if (match.equals(DataType.FILE_EXT_SEPARATOR + DataType.PACKAGE_SURFACE_AREA_EXT)) {
- openPackage(path);
- } else if (match.equals(DataType.FILE_EXT_SEPARATOR + DataType.PLATFORM_SURFACE_AREA_EXT)) {
- openPlatform(path);
- }
- }
- }
-
- /**
- Close files
-
- **/
- private void close() {
- TreePath item = null;
- switch (this.jTabbedPaneEditor.getSelectedIndex()) {
- //
- // Current is module
- //
- case 0:
- if (this.currentOpeningModuleIndex > -1) {
- if (!GlobalData.openingModuleList.getModuleSaved(currentOpeningModuleIndex)) {
- int result = showSaveDialog();
- if (result == JOptionPane.YES_OPTION) {
- this.save();
- }
- if (result == JOptionPane.NO_OPTION) {
- // Do nothing
- }
- if (result == JOptionPane.CANCEL_OPTION) {
- return;
- }
- }
-
- //
- // Remove all tree paths for the module
- //
- Set<TreePath> openingTreePaths = GlobalData.openingModuleList
- .getTreePathByIndex(currentOpeningModuleIndex);
- Iterator<TreePath> openingTreePathsIter = openingTreePaths.iterator();
- while (openingTreePathsIter.hasNext()) {
- item = openingTreePathsIter.next();
- iTree.getNodeByPath(item).setOpening(false);
- iTree.removeNodeChildrenByPath(item);
- }
-
- GlobalData.openingModuleList.reload(this.currentOpeningModuleIndex);
- GlobalData.openingModuleList.setModuleOpen(this.currentOpeningModuleIndex, false);
- GlobalData.openingModuleList.setModuleSaved(this.currentOpeningModuleIndex, true);
-
- this.cleanDesktopPaneModule();
- this.currentOpeningModuleIndex = -1;
- }
- break;
- //
- // Current is package
- //
- case 1:
- if (this.currentOpeningPackageIndex > -1) {
- if (!GlobalData.openingPackageList.getPackageSaved(currentOpeningPackageIndex)) {
- int result = showSaveDialog();
- if (result == JOptionPane.YES_OPTION) {
- this.save();
- }
- if (result == JOptionPane.NO_OPTION) {
- // Do nothing
- }
- if (result == JOptionPane.CANCEL_OPTION) {
- return;
- }
- }
-
- //
- // Remove all tree paths for the module
- //
- Set<TreePath> openingTreePaths = GlobalData.openingPackageList
- .getTreePathByIndex(currentOpeningPackageIndex);
- Iterator<TreePath> openingTreePathsIter = openingTreePaths.iterator();
- while (openingTreePathsIter.hasNext()) {
- item = openingTreePathsIter.next();
- iTree.getNodeByPath(item).setOpening(false);
- iTree.removeNodeChildrenByPath(item);
- }
-
- GlobalData.openingPackageList.reload(this.currentOpeningPackageIndex);
- GlobalData.openingPackageList.setPackageOpen(this.currentOpeningPackageIndex, false);
- GlobalData.openingPackageList.setPackageSaved(this.currentOpeningPackageIndex, true);
- this.cleanDesktopPanePackage();
- this.currentOpeningPackageIndex = -1;
- }
- break;
- //
- // Current is platform
- //
- case 2:
- if (this.currentOpeningPlatformIndex > -1) {
- if (!GlobalData.openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) {
- int result = showSaveDialog();
- if (result == JOptionPane.YES_OPTION) {
- this.save();
- }
- if (result == JOptionPane.NO_OPTION) {
- // Do nothing
- }
- if (result == JOptionPane.CANCEL_OPTION) {
- return;
- }
- }
-
- //
- // Remove all tree paths for the module
- //
- Set<TreePath> openingTreePaths = GlobalData.openingPlatformList
- .getTreePathByIndex(currentOpeningPlatformIndex);
- Iterator<TreePath> openingTreePathsIter = openingTreePaths.iterator();
- while (openingTreePathsIter.hasNext()) {
- item = openingTreePathsIter.next();
- iTree.getNodeByPath(item).setOpening(false);
- iTree.removeNodeChildrenByPath(item);
- }
-
- GlobalData.openingPlatformList.reload(this.currentOpeningPlatformIndex);
- GlobalData.openingPlatformList.setPlatformOpen(this.currentOpeningPlatformIndex, false);
- GlobalData.openingPlatformList.setPlatformSaved(this.currentOpeningPlatformIndex, true);
- this.cleanDesktopPanePlatform();
- this.currentOpeningPlatformIndex = -1;
- }
- break;
- }
- }
-
- /**
- Close all opening files and clean all showing internal frame
-
- **/
- private int closeAll() {
- int result = JOptionPane.NO_OPTION;
- if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved()
- || !GlobalData.openingPlatformList.isSaved()) {
- result = showSaveDialog();
- }
- if (result == JOptionPane.YES_OPTION) {
- this.saveAll();
- }
- if (result == JOptionPane.NO_OPTION) {
- //
- // Do nothing
- //
- }
- if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) {
- return -1;
- }
- this.cleanDesktopPane();
- GlobalData.openingModuleList.closeAll();
- GlobalData.openingPackageList.closeAll();
- GlobalData.openingPlatformList.closeAll();
-
- return 0;
- }
-
- /**
- Refresh all global data from disk to memory
-
- **/
- private void refresh() {
- GlobalData.init();
- }
-
- /**
- Save currentModule when press button OK
-
- **/
- private void save() {
- switch (this.jTabbedPaneEditor.getSelectedIndex()) {
- case 0:
- if (this.currentOpeningModuleIndex > -1) {
- saveModule(this.currentOpeningModuleIndex);
- }
- break;
- case 1:
- if (this.currentOpeningPackageIndex > -1) {
- savePackage(this.currentOpeningPackageIndex);
- }
- break;
- case 2:
- if (this.currentOpeningPlatformIndex > -1) {
- savePlatform(this.currentOpeningPlatformIndex);
- }
- break;
- }
- }
-
- private void saveAs() {
-
- }
-
- private void saveAll() {
- //
- // Save all modules
- //
- for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {
- if (!GlobalData.openingModuleList.getModuleSaved(index)) {
- saveModule(index);
- }
- }
-
- //
- // Save all packages
- //
- for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {
- if (!GlobalData.openingPackageList.getPackageSaved(index)) {
- savePackage(index);
- }
- }
-
- //
- // Save all platforms
- //
- for (int index = 0; index < GlobalData.openingPlatformList.size(); index++) {
- if (!GlobalData.openingPlatformList.getPlatformSaved(index)) {
- savePlatform(index);
- }
- }
- }
-
- /**
- To save changed items before exit.
-
- **/
- private void exit() {
- int result = JOptionPane.NO_OPTION;
- if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved()
- || !GlobalData.openingPlatformList.isSaved()) {
- result = showSaveDialog();
- }
- if (result == JOptionPane.YES_OPTION) {
- this.saveAll();
- } else if (result == JOptionPane.NO_OPTION) {
- // Do nothing
- } else if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) {
- return;
- }
- this.dispose();
- System.exit(0);
- }
-
- /**
- To find all defined PPIs in workspace
-
- **/
- private void findPpi() {
- FindResult fr = FindResult.getInstance("PPI");
- fr.setVisible(true);
- }
-
- /**
- To find all defined PROTOCOLs in workspace
-
- **/
- private void findProtocol() {
- FindResult fr = FindResult.getInstance("PROTOCOL");
- fr.setVisible(true);
- }
-
- /**
- To find all defined PROTOCOLs in workspace
-
- **/
- private void findGuid() {
- FindResult fr = FindResult.getInstance("GUID");
- fr.setVisible(true);
- }
-
- /**
- To find all defined PROTOCOLs in workspace
-
- **/
- private void findPcd() {
- FindResult fr = FindResult.getInstance("PCD");
- fr.setVisible(true);
- }
-
- /**
- To find all defined Library Classes in workspace
-
- **/
- private void findLibraryClass() {
- FindResult fr = FindResult.getInstance("LIBRARY_CLASS");
- fr.setVisible(true);
- }
-
- /**
- To find all defined Library Instances in workspace
-
- **/
- private void findLibraryInstance() {
- FindResult fr = FindResult.getInstance("LIBRARY_INSTANCE");
- fr.setVisible(true);
- }
-
- /**
- Switch current workspace to others
-
- **/
- private void changeWorkspace() {
- SwitchWorkspace sw = new SwitchWorkspace(this, true);
- int result = sw.showDialog();
- if (result == DataType.RETURN_TYPE_CANCEL) {
- return;
- } else if (result == DataType.RETURN_TYPE_OK) {
- //
- // Reinit whole window
- //
- this.closeAll();
- this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
- + Workspace.getCurrentWorkspace() + "]");
- //
- // Refrash the tree
- //
- this.refresh();
- this.makeEmptyTree();
- }
- sw.dispose();
- }
-
- /**
- To create a Far file from current workspace
-
- **/
- private void createFar() {
- CreateStepOne cso = new CreateStepOne(this, true);
- int result = cso.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- String strReturn = "Far Creation Completed!";
- JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- }
- cso.dispose();
- }
-
- /**
- To install a Far file to current workspace
-
- **/
- private void installFar() {
- InstallStepOne iso = new InstallStepOne(this, true);
- int result = iso.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- String strReturn = "<html>Far Installalation completed!<br>Refreshing the WORKSPACE!</html>";
- JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- this.closeAll();
- this.refresh();
- this.makeEmptyTree();
- }
- iso.dispose();
- }
-
- /**
- To remove a Far's items from current workspace
-
- **/
- private void removeFar() {
- DeleteStepOne dso = new DeleteStepOne(this, true);
- int result = dso.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- String strReturn = "<html>Far Deletion completed!<br>Refreshing the WORKSPACE!</html>";
- JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- this.closeAll();
- this.refresh();
- this.makeEmptyTree();
- }
- dso.dispose();
- }
-
- /**
- To update an existing Far file
-
- **/
- private void updateFar() {
- UpdateStepOne uso = new UpdateStepOne(this, true);
- int result = uso.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- String strReturn = "<html>Far Update completed!<br>Refreshing the WORKSPACE!</html>";
- JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- this.closeAll();
- this.refresh();
- this.makeEmptyTree();
- }
- uso.dispose();
- }
-
- /**
- Show Tool Chain Configuration Dialog to setup Tool Chain
-
- **/
- private void setupToolChainConfiguration() {
- ToolChainConfig tcc = ToolChainConfig.getInstance();
- tcc.showDialog();
- }
-
- private void configBuildPreferences() {
- Preferences bt = Preferences.getInstance();
- bt.showDialog();
- }
-
- /**
- Clone selected item
-
- **/
- private void cloneItem() {
- int mode = -1;
-
- //
- // Check if there is any item can be cloned
- //
- if (iTree.getSelectionPath() == null) {
- Log.wrn("Clone", "Please select a target to clone!");
- return;
- }
- int category = iTree.getSelectCategory();
- Identification id = iTree.getSelectNode().getId();
-
- if (category == IDefaultMutableTreeNode.WORKSPACE) {
- mode = DataType.RETURN_TYPE_WORKSPACE;
- id = null;
- }
- if ((category == IDefaultMutableTreeNode.MODULE)
- || (category >= IDefaultMutableTreeNode.MSA_HEADER && category < IDefaultMutableTreeNode.SPD_HEADER)) {
- mode = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;
- }
- if ((category == IDefaultMutableTreeNode.PACKAGE)
- || (category >= IDefaultMutableTreeNode.SPD_HEADER && category < IDefaultMutableTreeNode.FPD_PLATFORMHEADER)) {
- mode = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
- }
- if ((category == IDefaultMutableTreeNode.PLATFORM) || (category >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER)) {
- mode = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
- }
-
- Clone c = new Clone(this, true, mode, id);
- int result = c.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- c.dispose();
- }
- if (result == DataType.RETURN_TYPE_WORKSPACE) {
- Tools.showInformationMessage("Workspace Clone Completed!");
- }
- if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- Tools.showInformationMessage("Module Clone Completed!");
- addModuleToTree(c.getMid());
- }
- if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- Tools.showInformationMessage("Package Clone Completed!");
- //
- // Add new SpdHeader node to the tree
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(GlobalData.vPackageList.lastElement().getName(),
- IDefaultMutableTreeNode.PACKAGE, false,
- GlobalData.vPackageList.lastElement(),
- this.dmtnPackageDescription);
- iTree.addNode(this.dmtnPackageDescription, node);
- }
- if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- Tools.showInformationMessage("Platform Surface Area Clone Finished");
- //
- // Add new SpdHeader node to the tree
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(
- GlobalData.vPlatformList.lastElement().getName(),
- IDefaultMutableTreeNode.PLATFORM, false,
- GlobalData.vPlatformList.lastElement(),
- this.dmtnPlatformDescription);
- iTree.addNode(this.dmtnPlatformDescription, node);
- }
- if (result == DataType.RETURN_TYPE_OK) {
-
- }
- }
-
- public void valueChanged(TreeSelectionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void menuCanceled(MenuEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void menuDeselected(MenuEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void menuSelected(MenuEvent arg0) {
- if (arg0.getSource() == jMenuFile) {
- //
- // Enable close/close all if some files are opened
- //
- switch (this.jTabbedPaneEditor.getSelectedIndex()) {
- case 0:
- jMenuItemFileClose
- .setEnabled(GlobalData.openingModuleList
- .getModuleOpen(this.currentOpeningModuleIndex));
- jMenuItemFileSave
- .setEnabled(!GlobalData.openingModuleList
- .getModuleSaved(this.currentOpeningModuleIndex));
- break;
- case 1:
- jMenuItemFileClose
- .setEnabled(GlobalData.openingPackageList
- .getPackageOpen(this.currentOpeningPackageIndex));
- jMenuItemFileSave
- .setEnabled(!GlobalData.openingPackageList
- .getPackageSaved(this.currentOpeningPackageIndex));
- break;
- case 2:
- jMenuItemFileClose
- .setEnabled(GlobalData.openingPlatformList
- .getPlatformOpen(this.currentOpeningPlatformIndex));
- jMenuItemFileSave
- .setEnabled(!GlobalData.openingPlatformList
- .getPlatformSaved(this.currentOpeningPlatformIndex));
- break;
- }
- jMenuItemFileCloseAll.setEnabled(GlobalData.openingModuleList.isOpen()
- || GlobalData.openingPackageList.isOpen()
- || GlobalData.openingPlatformList.isOpen());
-
- //
- // Enable save/save all if some files are changed
- //
- jMenuItemFileSaveAll.setEnabled(!GlobalData.openingModuleList.isSaved()
- || !GlobalData.openingPackageList.isSaved()
- || !GlobalData.openingPlatformList.isSaved());
- }
-
- if (arg0.getSource() == jMenuTools) {
- //
- // Enable clone when select some items
- //
- if (iTree.getSelectionPath() == null) {
- jMenuItemToolsClone.setEnabled(false);
- } else {
- int category = iTree.getSelectCategory();
- if (category == IDefaultMutableTreeNode.MODULE_DESCRIPTION
- || category == IDefaultMutableTreeNode.PACKAGE_DESCRIPTION
- || category == IDefaultMutableTreeNode.PLATFORM_DESCRIPTION
- || category == IDefaultMutableTreeNode.MODULE_PACKAGE
- || category == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY
- || category == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
- jMenuItemToolsClone.setEnabled(false);
- } else {
- jMenuItemToolsClone.setEnabled(true);
- }
- }
- }
- }
-
- public void keyTyped(KeyEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void keyPressed(KeyEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void keyReleased(KeyEvent arg0) {
- if (arg0.getSource() == this.iTree) {
- if (arg0.getKeyCode() == KeyEvent.VK_ENTER) {
- this.doubleClickModuleTreeNode();
- }
- }
- }
-
- /**
- Search whole workspace and find all module's name and guid, and save them to a file
-
- **/
- private void generateGuidsXref() {
- //
- // Init File Chooser
- //
- JFileChooser fc = new JFileChooser();
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.setSelectedFile(new File(Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR
- + DataType.GUIDS_XREF_FILE_NAME));
- fc.setMultiSelectionEnabled(false);
-
- //
- // Get guids xref and save to file
- //
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- Vector<String> v = wt.getAllModuleGuidXref();
- if (v.size() < 1) {
- Log.wrn("No guids found!!!");
- return;
- }
- File f = fc.getSelectedFile();
- if (!f.exists()) {
- try {
- f.createNewFile();
- } catch (IOException e) {
- Log.wrn("Fail to create file", e.getMessage());
- Log.err("Fail to create file when generating guids.xref", e.getMessage());
- }
- }
- FileWriter fw = null;
- BufferedWriter bw = null;
- try {
- fw = new FileWriter(f);
- bw = new BufferedWriter(fw);
- for (int index = 0; index < v.size(); index++) {
- bw.write(v.get(index));
- bw.newLine();
- }
- bw.flush();
- fw.flush();
- bw.close();
- fw.close();
- } catch (IOException e) {
- Log.wrn("Fail to write file", e.getMessage());
- Log.err("Fail to write file when generating guids.xref", e.getMessage());
- return;
- }
-
- JOptionPane.showConfirmDialog(this, "File is created", "Generate guids.xref", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- }
- }
-
- /**
- Check if WORKSPACE Environment is valid
-
- **/
- private void checkWorkspace() {
- switch (Workspace.checkCurrentWorkspace()) {
- case Workspace.WORKSPACE_VALID:
- break;
- case Workspace.WORKSPACE_NOT_DEFINED:
- JOptionPane
- .showConfirmDialog(
- this,
- "WORKSPACE Environment Variable Is Not Defined, Please select a valid WORKSPACE directory. "
- + DataType.LINE_SEPARATOR
- + DataType.LINE_SEPARATOR
- + "NOTICE:"
- + DataType.LINE_SEPARATOR
- + "This does not change the System Environment Variable."
- + DataType.LINE_SEPARATOR
- + "It only applies to where the Wizard will manage modification and file creations.",
- "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- SwitchWorkspace sw = new SwitchWorkspace(this, true);
- int result = sw.showDialog();
- if (result == DataType.RETURN_TYPE_CANCEL) {
- this.dispose();
- System.exit(0);
- } else if (result == DataType.RETURN_TYPE_OK) {
- sw.dispose();
- break;
- }
- case Workspace.WORKSPACE_NOT_EXIST:
- JOptionPane.showConfirmDialog(this, "Defined WORKSPACE Is Not Existed", "Error",
- JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- this.dispose();
- System.exit(0);
- case Workspace.WORKSPACE_NOT_DIRECTORY:
- JOptionPane.showConfirmDialog(this, "Defined WORKSPACE Is Not A Directory", "Error",
- JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- this.dispose();
- System.exit(0);
- case Workspace.WORKSPACE_NOT_VALID:
- JOptionPane.showConfirmDialog(this, "WORKSPACE Environment Variable Is Not Valid", "Error",
- JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- this.dispose();
- System.exit(0);
- case Workspace.WORKSPACE_NO_TARGET_FILE:
- JOptionPane.showConfirmDialog(this, "Target.txt File Is Not Existed", "Error", JOptionPane.DEFAULT_OPTION,
- JOptionPane.ERROR_MESSAGE);
- this.dispose();
- System.exit(0);
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java
deleted file mode 100644
index 18cbdb8a8b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/** @file
-
- The file is used to show a new file chooser dialog
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JPanel;
-import javax.swing.JButton;
-import javax.swing.JRadioButton;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-
-public class NewFileChooser extends IDialog {
-
- /**
- Define class members
-
- **/
- private static final long serialVersionUID = -3657926400683618281L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonNext = null;
-
- private JButton jButtonCancel = null;
-
- private JRadioButton jRadioButtonModule = null;
-
- private JRadioButton jRadioButtonPackage = null;
-
- private JRadioButton jRadioButtonPlatform = null;
-
- private JRadioButton jRadioButtonBuildXml = null;
-
- private final ButtonGroup buttonGroup = new ButtonGroup();
-
- /**
- This is the default constructor
-
- **/
- public NewFileChooser() {
- super();
- init();
- }
-
- /**
- This is the default constructor
-
- **/
- public NewFileChooser(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- init();
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(90, 150, 80, 20));
- jButtonNext.setText("Next");
- jButtonNext.addActionListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(180, 150, 80, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jRadioButtonModule
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonModule() {
- if (jRadioButtonModule == null) {
- jRadioButtonModule = new JRadioButton();
- jRadioButtonModule.setText(DataType.MODULE_SURFACE_AREA);
- jRadioButtonModule.setBounds(new java.awt.Rectangle(20, 20, 240, 20));
- jRadioButtonModule.setSelected(true);
- }
- return jRadioButtonModule;
- }
-
- /**
- * This method initializes jRadioButtonPackage
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonPackage() {
- if (jRadioButtonPackage == null) {
- jRadioButtonPackage = new JRadioButton();
- jRadioButtonPackage.setText(DataType.PACKAGE_SURFACE_AREA);
- jRadioButtonPackage.setBounds(new java.awt.Rectangle(20, 50, 240, 20));
- }
- return jRadioButtonPackage;
- }
-
- /**
- * This method initializes jRadioButtonPlatform
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonPlatform() {
- if (jRadioButtonPlatform == null) {
- jRadioButtonPlatform = new JRadioButton();
- jRadioButtonPlatform.setText(DataType.PLATFORM_SURFACE_AREA);
- jRadioButtonPlatform.setBounds(new java.awt.Rectangle(20, 80, 240, 20));
- }
- return jRadioButtonPlatform;
- }
-
- /**
- * This method initializes jRadioButtonBuildXml
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonBuildXml() {
- if (jRadioButtonBuildXml == null) {
- jRadioButtonBuildXml = new JRadioButton();
- jRadioButtonBuildXml.setText(DataType.ANT_BUILD_FILE);
- jRadioButtonBuildXml.setBounds(new java.awt.Rectangle(20, 110, 240, 20));
- jRadioButtonBuildXml.setVisible(false);
- }
- return jRadioButtonBuildXml;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- NewFileChooser nfc = new NewFileChooser();
- nfc.setVisible(true);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init() {
- this.setSize(310, 220);
- this.setContentPane(getJContentPane());
- this.setTitle("Select New File Type");
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJRadioButtonModule(), null);
- jContentPane.add(getJRadioButtonPackage(), null);
- jContentPane.add(getJRadioButtonPlatform(), null);
- jContentPane.add(getJRadioButtonBuildXml(), null);
- buttonGroup.add(this.getJRadioButtonModule());
- buttonGroup.add(this.getJRadioButtonPackage());
- buttonGroup.add(this.getJRadioButtonPlatform());
- buttonGroup.add(this.getJRadioButtonBuildXml());
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonCancel) {
- this.setVisible(false);
- returnType = DataType.RETURN_TYPE_CANCEL;
- }
-
- if (arg0.getSource() == jButtonNext) {
- this.setVisible(false);
- if (this.jRadioButtonModule.isSelected()) {
- returnType = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;
- }
- if (this.jRadioButtonPackage.isSelected()) {
- returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
- }
- if (this.jRadioButtonPlatform.isSelected()) {
- returnType = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
- }
- if (this.jRadioButtonBuildXml.isSelected()) {
- returnType = DataType.RETURN_TYPE_BUILD_XML;
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java
deleted file mode 100644
index 6572067efe..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java
+++ /dev/null
@@ -1,809 +0,0 @@
-/** @file
-
- The file is used to let user choose to create module in an existing package
- or to create a new package first.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.Vector;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.MsaHeaderDocument;
-import org.tianocore.SpdHeaderDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformHeaderDocument.PlatformHeader;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.SaveFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-import javax.swing.JRadioButton;
-
-public class SelectModuleBelong extends IDialog {
-
- /**
- Define class members
-
- **/
- private static final long serialVersionUID = 4171355136991448972L;
-
- private JPanel jContentPane = null;
-
- private JComboBox jComboBoxExistingPackage = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private Vector<PackageIdentification> packages = null;
-
- private JLabel jLabelPackage = null;
-
- private JLabel jLabelFilePath = null;
-
- private JTextField jTextFieldFilePath = null;
-
- private JButton jButtonBrowse = null;
-
- private JLabel jLabelName = null;
-
- private JTextField jTextFieldName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JButton jButtonGen = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private ButtonGroup bg = new ButtonGroup();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private ModuleIdentification mid = null;
-
- private PackageIdentification pid = null;
-
- private PlatformIdentification fid = null;
-
- private ModuleSurfaceArea msa = null;
-
- private PackageSurfaceArea spd = null;
-
- private PlatformSurfaceArea fpd = null;
-
- private int mode = -1;
-
- private JLabel jLabelIsLibrary = null;
-
- private JRadioButton jRadioButtonYes = null;
-
- private JRadioButton jRadioButtonNo = null;
-
- /**
- * This method initializes jComboBoxExistingPackage
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxExistingPackage() {
- if (jComboBoxExistingPackage == null) {
- jComboBoxExistingPackage = new JComboBox();
- jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(140, 10, 340, 20));
- }
- return jComboBoxExistingPackage;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(310, 165, 80, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(395, 165, 80, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jTextFieldFilePath
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFilePath() {
- if (jTextFieldFilePath == null) {
- jTextFieldFilePath = new JTextField();
- jTextFieldFilePath.setBounds(new java.awt.Rectangle(140, 60, 250, 20));
- }
- return jTextFieldFilePath;
- }
-
- /**
- * This method initializes jButtonBrowse
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(395, 60, 85, 20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.addActionListener(this);
- }
- return jButtonBrowse;
- }
-
- /**
- * This method initializes jTextFieldModuleName
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldName() {
- if (jTextFieldName == null) {
- jTextFieldName = new JTextField();
- jTextFieldName.setBounds(new java.awt.Rectangle(140, 85, 340, 20));
- }
- return jTextFieldName;
- }
-
- /**
- * This method initializes jTextFieldGuid
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(140, 110, 250, 20));
- }
- return jTextFieldGuid;
- }
-
- /**
- * This method initializes jButtonGen
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonGen() {
- if (jButtonGen == null) {
- jButtonGen = new JButton();
- jButtonGen.setBounds(new java.awt.Rectangle(395, 110, 85, 20));
- jButtonGen.setText("GEN");
- jButtonGen.addActionListener(this);
- }
- return jButtonGen;
- }
-
- /**
- * This method initializes jTextFieldVersion
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(140, 135, 340, 20));
- }
- return jTextFieldVersion;
- }
-
- /**
- * This method initializes jRadioButtonYes
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonYes() {
- if (jRadioButtonYes == null) {
- jRadioButtonYes = new JRadioButton();
- jRadioButtonYes.setBounds(new java.awt.Rectangle(140, 35, 100, 20));
- jRadioButtonYes.setSelected(false);
- jRadioButtonYes.setText("Yes");
- }
- return jRadioButtonYes;
- }
-
- /**
- * This method initializes jRadioButtonNo
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonNo() {
- if (jRadioButtonNo == null) {
- jRadioButtonNo = new JRadioButton();
- jRadioButtonNo.setBounds(new java.awt.Rectangle(300, 35, 110, 20));
- jRadioButtonNo.setSelected(true);
- jRadioButtonNo.setText("No");
- }
- return jRadioButtonNo;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- SelectModuleBelong smb = new SelectModuleBelong();
- smb.setVisible(true);
- }
-
- /**
- * This is the default constructor
- */
- public SelectModuleBelong() {
- super();
- init();
- }
-
- /**
- * This is the default constructor
- */
- public SelectModuleBelong(IFrame parentFrame, boolean modal, int fileType) {
- super(parentFrame, modal);
- this.mode = fileType;
- init();
- initExistingPackage();
- if (mode != DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- this.jStarLabel1.setVisible(false);
- this.jLabelPackage.setVisible(false);
- this.jComboBoxExistingPackage.setVisible(false);
- this.jLabelIsLibrary.setVisible(false);
- this.jRadioButtonYes.setVisible(false);
- this.jRadioButtonNo.setVisible(false);
- upLocation(this.jStarLabel2, 50);
- upLocation(this.jStarLabel3, 50);
- upLocation(this.jStarLabel4, 50);
- upLocation(this.jStarLabel5, 50);
- upLocation(this.jLabelFilePath, 50);
- upLocation(this.jLabelName, 50);
- upLocation(this.jLabelGuid, 50);
- upLocation(this.jLabelVersion, 50);
- upLocation(this.jTextFieldFilePath, 50);
- upLocation(this.jTextFieldName, 50);
- upLocation(this.jTextFieldGuid, 50);
- upLocation(this.jTextFieldVersion, 50);
- upLocation(this.jButtonBrowse, 50);
- upLocation(this.jButtonGen, 50);
- }
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init() {
- this.setSize(500, 230);
- this.setContentPane(getJContentPane());
- this.setTitle("New");
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelIsLibrary = new JLabel();
- jLabelIsLibrary.setBounds(new java.awt.Rectangle(15, 35, 120, 20));
- jLabelIsLibrary.setText("Is this a Library");
- jLabelVersion = new JLabel();
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 135, 120, 20));
- jLabelVersion.setText("Version");
- jLabelGuid = new JLabel();
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 110, 120, 20));
- jLabelGuid.setText("Guid");
- jLabelName = new JLabel();
- jLabelName.setBounds(new java.awt.Rectangle(15, 85, 120, 20));
- jLabelName.setText("Module Name");
- jLabelFilePath = new JLabel();
- jLabelFilePath.setBounds(new java.awt.Rectangle(15, 60, 120, 20));
- jLabelFilePath.setText("File Path");
- jLabelPackage = new JLabel();
- jLabelPackage.setBounds(new java.awt.Rectangle(15, 10, 120, 20));
- jLabelPackage.setText("Choose a Package");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(490, 198));
- jContentPane.add(getJComboBoxExistingPackage(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(jLabelPackage, null);
- jContentPane.add(jLabelFilePath, null);
- jContentPane.add(getJTextFieldFilePath(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJTextFieldName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(getJButtonGen(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
-
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, 60));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(0, 85));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0, 110));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(0, 135));
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jLabelIsLibrary, null);
- jContentPane.add(getJRadioButtonYes(), null);
- jContentPane.add(getJRadioButtonNo(), null);
- bg.add(getJRadioButtonNo());
- bg.add(getJRadioButtonYes());
- }
- return jContentPane;
- }
-
- /**
- Query all existing packages and fill them into combox
-
- **/
- private void initExistingPackage() {
- packages = wt.getAllPackages();
- for (int index = 0; index < packages.size(); index++) {
- this.jComboBoxExistingPackage.addItem(packages.elementAt(index).getName());
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonCancel) {
- this.setVisible(false);
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (this.check()) {
- this.save();
- } else {
- return;
- }
- this.setVisible(false);
- this.returnType = DataType.RETURN_TYPE_OK;
- }
-
- if (arg0.getSource() == this.jButtonGen) {
- this.jTextFieldGuid.setText(Tools.generateUuidString());
- }
-
- if (arg0.getSource() == this.jButtonBrowse) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
-
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())
- .getPath()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.MODULE_SURFACE_AREA_EXT));
- }
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.PACKAGE_SURFACE_AREA_EXT));
- }
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.PLATFORM_SURFACE_AREA_EXT));
- }
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldFilePath.setText(Tools.addPathExt(fc.getSelectedFile().getPath(), mode));
- }
- }
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean check() {
- String path = this.jTextFieldFilePath.getText();
- path = Tools.addPathExt(path, mode);
- String guid = this.jTextFieldGuid.getText();
- String version = this.jTextFieldVersion.getText();
-
- //
- // Check if all required fields are not empty
- //
- if (isEmpty(path)) {
- Log.wrn("New File", "A File Path must be entered!");
- return false;
- }
- if (isEmpty(this.jTextFieldName.getText())) {
- Log.wrn("New File", "A Name must be entered");
- return false;
- }
- if (isEmpty(guid)) {
- Log.wrn("New File", "The Guid must be entered!");
- return false;
- }
- if (isEmpty(version)) {
- Log.wrn("New File", "A Version number must be entered!");
- return false;
- }
-
- //
- // Check if all fields have correct data types
- //
- if (!DataValidation.isBaseName(this.jTextFieldName.getText())) {
- Log.wrn("New File", "Incorrect data type for the Name!");
- return false;
- }
- if (!DataValidation.isGuid((guid))) {
- Log.wrn("New File", "Incorrect data type for Guid, which must be in registry format! (8-4-4-4-12)");
- return false;
- }
-
- //
- // Check if path is valid
- //
- File f = new File(path);
- if (!f.isAbsolute()) {
- Log.wrn("New File", "Please type a complete file path!");
- return false;
- }
- f = null;
-
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- //
- // Check if the module is already existed in current package
- //
- String packagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath();
- String modulePath = Tools.convertPathToCurrentOsType(path);
- Vector<String> msaFile = wt.getAllModulesOfPackage(packagePath);
-
- for (int index = 0; index < msaFile.size(); index++) {
- if (msaFile.elementAt(index).equals(modulePath)) {
- Log.wrn("New File", "This module is already exists in the selected package!");
- return false;
- }
- }
-
- //
- // Check if the module is in selected package
- //
- if (Tools.getFilePathOnly(modulePath).indexOf(Tools.getFilePathOnly(packagePath)) < 0) {
- Log.wrn("New File", "This module should be in the directory of selected package!");
- return false;
- }
-
- //
- // Check if Guid+Version is unique
- //
- String packageGuid = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getGuid();
- String packageVersion = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getVersion();
- if (GlobalData.findModuleId(guid, version, packageGuid, packageVersion) != null) {
- Log.wrn("New File", "A module with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- //
- // Check if the package is already existed in database
- //
- path = Tools.convertPathToCurrentOsType(path);
- Vector<PackageIdentification> vPackageList = wt.getAllPackages();
- if (vPackageList != null && vPackageList.size() > 0) {
- for (int index = 0; index < vPackageList.size(); index++) {
- if (vPackageList.get(index).getPath().equals(path)) {
- Log.wrn("New File", "This package is already exists in this workspace!");
- return false;
- }
- }
- }
-
- //
- // Check if path already exists
- //
- if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(path), mode)) {
- Log.wrn("New File", "There already exists a same directory with a package");
- return false;
- }
-
- //
- // Check if Guid+Version is unique
- //
- if (GlobalData.findPackageId(guid, version) != null) {
- Log.wrn("New File", "A package with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- //
- // Check if the platform is already existed in database
- //
- path = Tools.convertPathToCurrentOsType(path);
- Vector<PlatformIdentification> vPlatfromList = wt.getAllPlatforms();
- if (vPlatfromList != null && vPlatfromList.size() > 0) {
- for (int index = 0; index < vPlatfromList.size(); index++) {
- if (vPlatfromList.get(index).getPath().equals(path)) {
- Log.wrn("New File", "This platform is already exists in this workspace!");
- return false;
- }
- }
- }
-
- //
- // Check if path already exists
- //
- if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(path), mode)) {
- Log.wrn("New File", "There already exists a same directory with a platform");
- return false;
- }
-
- //
- // Check if Guid+Version is unique
- //
- if (GlobalData.findPlatformId(guid, version) != null) {
- Log.wrn("New File", "A platform with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- return true;
- }
-
- /**
- Save file
-
- **/
- public void save() {
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- this.saveModule();
- }
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- this.savePackage();
- }
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- this.savePlatform();
- }
- }
-
- /**
- Save all components of Msa Header
-
- **/
- private void saveModule() {
- msa = null;
- String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
-
- //
- // Save to memory
- //
- try {
- MsaHeaderDocument.MsaHeader msaHeader = null;
-
- msa = ModuleSurfaceArea.Factory.newInstance();
- msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
-
- msaHeader.setModuleName(this.jTextFieldName.getText());
- msaHeader.setGuidValue(this.jTextFieldGuid.getText());
- msaHeader.setVersion(this.jTextFieldVersion.getText());
- msaHeader.setModuleType(ModuleTypeDef.BASE);
-
- msa.setMsaHeader(msaHeader);
- } catch (Exception e) {
- Log.err("Save ModuleSurfaceArea Document", e.getMessage());
- return;
- }
-
- //
- // Save to real file
- //
- try {
- SaveFile.saveMsaFile(path, msa);
- } catch (Exception e) {
- Log.wrn("Save Module to file system", e.getMessage());
- Log.err("Save Module to file system", e.getMessage());
- return;
- }
-
- //
- // Save to identification
- //
- mid = new ModuleIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
- this.jTextFieldVersion.getText(), path, jRadioButtonYes.isSelected());
- mid.setPackageId(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()));
- }
-
- /**
- Save all components of Spd Header
-
- **/
- private void savePackage() {
- spd = null;
- String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
-
- //
- // Save to memory
- //
- try {
- SpdHeaderDocument.SpdHeader spdHeader = null;
-
- spd = PackageSurfaceArea.Factory.newInstance();
- spdHeader = SpdHeaderDocument.SpdHeader.Factory.newInstance();
-
- spdHeader.setPackageName(this.jTextFieldName.getText());
- spdHeader.setGuidValue(this.jTextFieldGuid.getText());
- spdHeader.setVersion(this.jTextFieldVersion.getText());
-
- spd.setSpdHeader(spdHeader);
- } catch (Exception e) {
- Log.wrn("Save Package Surface Area Description Document", e.getMessage());
- return;
- }
-
- //
- // Save to real file
- //
- try {
- SaveFile.saveSpdFile(path, spd);
-
- } catch (Exception e) {
- Log.wrn("Save Package to file system", e.getMessage());
- Log.err("Save Package to file system", e.getMessage());
- return;
- }
-
- //
- // Save to identification
- //
- pid = new PackageIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
- this.jTextFieldVersion.getText(), path);
- }
-
- /**
- Save all components of Fpd Header
-
- **/
- private void savePlatform() {
- fpd = null;
- String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
-
- //
- // Save to memory
- //
- try {
- PlatformHeader fpdHeader = null;
-
- fpd = PlatformSurfaceArea.Factory.newInstance();
- fpdHeader = PlatformHeader.Factory.newInstance();
-
- fpdHeader.setPlatformName(this.jTextFieldName.getText());
- fpdHeader.setGuidValue(this.jTextFieldGuid.getText());
- fpdHeader.setVersion(this.jTextFieldVersion.getText());
-
- fpd.setPlatformHeader(fpdHeader);
- } catch (Exception e) {
- Log.wrn("Save Framework Platform Description Document", e.getMessage());
- return;
- }
-
- //
- // Save to real file
- //
- try {
- SaveFile.saveFpdFile(path, fpd);
-
- } catch (Exception e) {
- Log.wrn("Save Platform to file system", e.getMessage());
- Log.err("Save Platform to file system", e.getMessage());
- return;
- }
-
- //
- // Save to identification
- //
- fid = new PlatformIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
- this.jTextFieldVersion.getText(), path);
- }
-
- public ModuleIdentification getMid() {
- return mid;
- }
-
- public PlatformIdentification getFid() {
- return fid;
- }
-
- public PackageIdentification getPid() {
- return pid;
- }
-
- private void upLocation(Component c, int size) {
- c.setLocation(c.getLocation().x, c.getLocation().y - size);
- }
-
- public PlatformSurfaceArea getFpd() {
- return fpd;
- }
-
- public ModuleSurfaceArea getMsa() {
- return msa;
- }
-
- public PackageSurfaceArea getSpd() {
- return spd;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SplashScreen.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SplashScreen.java
deleted file mode 100644
index 16fa4911de..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SplashScreen.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/** @file
-
- To show a splash screen when starting
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRootPane;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-
-public class SplashScreen extends IFrame {
-
- ///
- /// Serial Version UID
- ///
- private static final long serialVersionUID = 1077736364497801470L;
-
- private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,54"
-
- private JLabel jLabelImage = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel1 = null;
-
- private JLabel jLabel2 = null;
-
-
- /**
- * This is the default constructor
- */
- public SplashScreen() {
- super();
- init();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init() {
- this.setSize(320, 205);
- this.setUndecorated(true);
- this.setContentPane(getJContentPane());
- this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
- this.setTitle("Init");
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelImage = new JLabel();
- jLabelImage.setBounds(new java.awt.Rectangle(63, 20, 193, 58));
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/logo.gif")));
-
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(25, 120, 270, 20));
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel2.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
- jLabel2.setText("Initializing...");
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(3,166,270,20));
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
- jLabel1.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 8));
- jLabel1.setText("Copyright (c) 2006, Intel Corporation");
- jLabel = new JLabel();
- jLabel.setToolTipText("");
- jLabel.setBounds(new java.awt.Rectangle(25, 90, 270, 20));
- jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 18));
- jLabel.setText(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(320,199));
- jContentPane.setBackground(java.awt.SystemColor.inactiveCaptionText);
- jContentPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
- jContentPane.add(jLabel, null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(jLabelImage, null);
- }
- return jContentPane;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java
deleted file mode 100644
index cef7e85531..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/** @file
-
- The file is used to setup tool chain configuration
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.WindowEvent;
-import java.io.File;
-import java.io.IOException;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigId;
-import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigVector;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class ToolChainConfig extends IFrame implements ListSelectionListener, TableModelListener{
-
- ///
- /// Define Class Members
- ///
- private static final long serialVersionUID = 1486930966278269085L;
-
- private JPanel jContentPane = null;
-
- private JScrollPane jScrollPane = null;
-
- private DefaultTableModel model = null;
-
- private JTable jTable = null;
-
- private JButton jButtonOpen = null;
-
- private JButton jButtonSave = null;
-
- private JButton jButtonClose = null;
-
- private String toolsDir = Tools.addFileSeparator(Workspace.getCurrentWorkspace()) + "Tools"
- + DataType.FILE_SEPARATOR + "Conf";
-
- private String currentFile = Tools.addFileSeparator(toolsDir) + "tools_def.template";
-
- private ToolChainConfigVector vtcc = new ToolChainConfigVector();
-
- private JLabel jLabelName = null;
-
- private JTextField jTextFieldName = null;
-
- private JLabel jLabelValue = null;
-
- private JTextField jTextFieldValue = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private int selectedRow = -1;
-
- private JButton jButtonHelp = null;
-
- private static ToolChainConfig tcc = null;
-
- private ToolChainConfigHelp tcch = null;
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
-
- **/
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(15, 15, 555, 345));
- jScrollPane.setViewportView(getJTable());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
-
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Property");
- model.addColumn("Value");
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
- /**
- This method initializes jButtonOpen
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOpen() {
- if (jButtonOpen == null) {
- jButtonOpen = new JButton();
- jButtonOpen.setBounds(new java.awt.Rectangle(40, 405, 120, 20));
- jButtonOpen.setText("Open File");
- jButtonOpen.addActionListener(this);
- }
- return jButtonOpen;
- }
-
- /**
- This method initializes jButtonSave
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonSave() {
- if (jButtonSave == null) {
- jButtonSave = new JButton();
- jButtonSave.setBounds(new java.awt.Rectangle(170, 405, 120, 20));
- jButtonSave.setText("Save File");
- jButtonSave.addActionListener(this);
- }
- return jButtonSave;
- }
-
- /**
- This method initializes jButtonClose
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonClose() {
- if (jButtonClose == null) {
- jButtonClose = new JButton();
- jButtonClose.setBounds(new java.awt.Rectangle(490, 405, 80, 20));
- jButtonClose.setText("Close");
- jButtonClose.addActionListener(this);
- }
- return jButtonClose;
- }
-
- /**
- This method initializes jTextFieldName
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldName() {
- if (jTextFieldName == null) {
- jTextFieldName = new JTextField();
- jTextFieldName.setBounds(new java.awt.Rectangle(60, 365, 140, 20));
- }
- return jTextFieldName;
- }
-
- /**
- This method initializes jTextFieldValue
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldValue() {
- if (jTextFieldValue == null) {
- jTextFieldValue = new JTextField();
- jTextFieldValue.setBounds(new java.awt.Rectangle(250, 365, 140, 20));
- }
- return jTextFieldValue;
- }
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(400, 365, 80, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(490, 365, 80, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- * This method initializes jButtonHelp
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonHelp() {
- if (jButtonHelp == null) {
- jButtonHelp = new JButton();
- jButtonHelp.setBounds(new java.awt.Rectangle(300,405,120,20));
- jButtonHelp.setText("Help");
- jButtonHelp.addActionListener(this);
- }
- return jButtonHelp;
- }
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- public static ToolChainConfig getInstance() {
- if (tcc == null) {
- tcc = new ToolChainConfig();
- }
- return tcc;
- }
-
- /**
- * This is the default constructor
- */
- public ToolChainConfig() {
- super();
- init();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(600, 480);
- this.setContentPane(getJContentPane());
- this.setTitle("Tool Chain Configuration");
- this.centerWindow();
-
- //
- // Read default file
- //
- File f = new File(currentFile);
- if (f.exists()) {
- try {
- vtcc.removeAll();
- vtcc.parseFile(this.currentFile);
- this.setTitle("Tool Chain Configuration" + " [" + currentFile + "]");
- } catch (IOException e) {
- Log.log(this.currentFile + "Read Error", e.getMessage());
- e.printStackTrace();
- }
- } else {
- Log.log("File Open Error: ", this.currentFile + " File Not Found");
- }
-
- showTable();
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelValue = new JLabel();
- jLabelValue.setBounds(new java.awt.Rectangle(205, 365, 40, 20));
- jLabelValue.setText("Value");
- jLabelName = new JLabel();
- jLabelName.setBounds(new java.awt.Rectangle(15, 365, 40, 20));
- jLabelName.setText("Name");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonOpen(), null);
- jContentPane.add(getJButtonSave(), null);
- jContentPane.add(getJButtonClose(), null);
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJTextFieldName(), null);
- jContentPane.add(jLabelValue, null);
- jContentPane.add(getJTextFieldValue(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonHelp(), null);
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonClose) {
- this.exit();
- }
-
- if (arg0.getSource() == jButtonOpen) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);
- fc.addChoosableFileFilter(iff);
- fc.setCurrentDirectory(new File(toolsDir));
-
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- try {
- vtcc.removeAll();
- vtcc.parseFile(fc.getSelectedFile().getPath());
- currentFile = fc.getSelectedFile().getPath();
- this.setTitle("Tool Chain Configuration" + " [" + currentFile + "]");
- } catch (IOException e) {
- Log.wrn(this.currentFile + "Read Error", e.getMessage());
- Log.err(this.currentFile + "Read Error", e.getMessage());
- return;
- }
- this.showTable();
- }
- }
-
- if (arg0.getSource() == jButtonSave) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);
- fc.addChoosableFileFilter(iff);
- fc.setCurrentDirectory(new File(toolsDir));
-
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- currentFile = fc.getSelectedFile().getPath();
- currentFile = Tools.addPathExt(currentFile, DataType.RETURN_TYPE_TEXT);
- try {
- vtcc.saveFile(currentFile);
- } catch (IOException e) {
- Log.wrn(this.currentFile + "Write Error", e.getMessage());
- Log.err(this.currentFile + "Write Error", e.getMessage());
- return;
- }
- }
- }
-
- if (arg0.getSource() == jButtonAdd) {
- if (check()) {
- String[] row = { jTextFieldName.getText(), jTextFieldValue.getText() };
- this.vtcc.addToolChainConfigs(new ToolChainConfigId(row[0], row[1]));
- this.model.addRow(row);
- }
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- if (selectedRow > -1) {
- this.model.removeRow(selectedRow);
- this.vtcc.removeToolChainConfigs(selectedRow);
- selectedRow = -1;
- }
- }
-
- if (arg0.getSource() == jButtonHelp) {
- tcch = ToolChainConfigHelp.getInstance();
- tcch.setVisible(true);
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vtcc.size() > 0) {
- for (int index = 0; index < vtcc.size(); index++) {
- model.addRow(vtcc.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- //this.jScrollPane.setViewportView(this.jTable);
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Check if name or value is empty
-
- @return
-
- **/
- private boolean check() {
- if (isEmpty(this.jTextFieldName.getText())) {
- Log.wrn("Add Tool Chain", "The Property Name must be entered!");
- return false;
- }
-
- if (isEmpty(this.jTextFieldValue.getText())) {
- Log.wrn("Add Tool Chain", "The Property Value must be entered!");
- return false;
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- public void tableChanged(TableModelEvent arg0) {
- int row = arg0.getFirstRow();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- this.vtcc.getToolChainConfigs(row).setName(m.getValueAt(row, 0).toString());
- this.vtcc.getToolChainConfigs(row).setValue(m.getValueAt(row, 1).toString());
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to popup warning message to confirm quit
- *
- */
- public void windowClosing(WindowEvent arg0) {
- this.exit();
- }
-
- private void exit() {
- this.setVisible(false);
- if (tcch != null) {
- tcch.dispose();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java
deleted file mode 100644
index 0156cc902f..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JTextPane;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import javax.swing.JButton;
-
-
-public class ToolChainConfigHelp extends JFrame implements ActionListener {
-
- ///
- ///
- ///
- private static final long serialVersionUID = -6315081029366587222L;
-
- private JPanel jContentPane = null;
-
- private String helpContent = "";
-
- private JTextPane jTextPane = null;
-
- private JButton jButtonClose = null;
-
- private static ToolChainConfigHelp tcch = null;
-
- /**
- * This method initializes jTextPane
- *
- * @return javax.swing.JTextPane
- */
- private JTextPane getJTextPane() {
- if (jTextPane == null) {
- jTextPane = new JTextPane();
- jTextPane.setBounds(new java.awt.Rectangle(10,10,600,420));
- jTextPane.setBackground(new java.awt.Color(238,238,238));
- jTextPane.setEditable(false);
- helpContent = helpContent
- + "The template for the Property is: TARGET_TAGNAME_ARCH_COMMAND_ATTR" + DataType.UNIX_LINE_SEPARATOR
- + "The Value, is either a full path, full path and filename or a reserved word." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "TARGET - DEBUG and RELEASE are predefined, however the user may define one or more of their own TARGET types in this file." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "TAGNAME - HOST, MSFT, GCC, INTC are predefined, however the user may define one or more of their own TAGNAME keywords in this file." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "ARCH - EDK II supports IA32, X64, IPF and EBC at this time." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "COMMAND - Predefined command codes are listed in the tools_def.txt file, however the user can specify additional command codes for their one, non-standard tools." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "ATTR - Predefined Attributes are listed in the tools_def.txt file." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "NOTE: The TAGNAME: HOST is reserved and MUST be defined in order to build the included Tiano tools from their C source files. These tools have been built and tested using both Microsoft and GCC tool chains." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "NOTE: The \"*\" symbol may be used as a wildcard character in most of these fields, refer to the tools_def.txt and the \"EDK II Build and Packaging Architecture Specification\" for more details." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR;
-
- jTextPane.setText(helpContent);
- }
- return jTextPane;
- }
-
- /**
- * This method initializes jButtonClose
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonClose() {
- if (jButtonClose == null) {
- jButtonClose = new JButton();
- jButtonClose.setBounds(new java.awt.Rectangle(480,450,80,20));
- jButtonClose.setText("Close");
- jButtonClose.addActionListener(this);
- }
- return jButtonClose;
- }
-
- public static ToolChainConfigHelp getInstance() {
- if (tcch == null) {
- tcch = new ToolChainConfigHelp();
- }
- return tcch;
- }
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
- ToolChainConfigHelp tcch = new ToolChainConfigHelp();
- tcch.setVisible(true);
- }
-
- /**
- * This is the default constructor
- */
- public ToolChainConfigHelp() {
- super();
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(625, 520);
- this.setResizable(false);
- this.setTitle("How to Modify a Tool Chain Configuration");
- this.setContentPane(getJContentPane());
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextPane(), null);
- jContentPane.add(getJButtonClose(), null);
- }
- return jContentPane;
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonClose) {
- this.dispose();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java
deleted file mode 100644
index 03a64a69a6..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/** @file
-
- The file is used to define all used final variables
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-/**
- The class is used to define all used final variables
-
- **/
-public class DataType {
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
-
- }
-
- //
- // Define all return types
- //
- public static final int RETURN_TYPE_OK = 1;
-
- public static final int RETURN_TYPE_CANCEL = 2;
-
- public static final int RETURN_TYPE_NEXT = 3;
-
- public static final int RETURN_TYPE_BACK = 4;
-
- public static final int RETURN_TYPE_MODULE_SURFACE_AREA = 11;
-
- public static final int RETURN_TYPE_PACKAGE_SURFACE_AREA = 12;
-
- public static final int RETURN_TYPE_PLATFORM_SURFACE_AREA = 13;
-
- public static final int RETURN_TYPE_BUILD_XML = 14;
-
- public static final int RETURN_TYPE_WORKSPACE = 15;
-
- public static final int RETURN_TYPE_TEXT = 16;
-
- public static final int RETURN_TYPE_FAR_SURFACE_AREA = 17;
-
-
- //
- // Define all used final variables
- //
- public static final String DOS_LINE_SEPARATOR = "\r\n";
-
- public static final String UNIX_LINE_SEPARATOR = "\n";
-
- public static final String LINE_SEPARATOR = UNIX_LINE_SEPARATOR;
-
- public static final String HTML_LINE_SEPARATOR = "<br>";
-
- public static final String EMPTY_SELECT_ITEM = "----";
-
- public static final String DOS_FILE_SEPARATOR = "\\";
-
- public static final String UNIX_FILE_SEPARATOR = "/";
-
- //
- // Define xml files ext
- //
- public static final String COPY_OF = "Copy of ";
-
- public static final String FILE_EXT_SEPARATOR = ".";
-
- public static final String WORKSPACE = "Workspace";
-
- public static final String MODULE_SURFACE_AREA = "Module Surface Area Description";
-
- public static final String MODULE_SURFACE_AREA_EXT = "msa";
-
- public static final String MODULE_SURFACE_AREA_EXT_DESCRIPTION = MODULE_SURFACE_AREA + " (*."
- + MODULE_SURFACE_AREA_EXT + ")";
-
- public static final String PACKAGE_SURFACE_AREA = "Package Surface Area Description";
-
- public static final String PACKAGE_SURFACE_AREA_EXT = "spd";
-
- public static final String PACKAGE_SURFACE_AREA_EXT_DESCRIPTION = PACKAGE_SURFACE_AREA + " (*."
- + PACKAGE_SURFACE_AREA_EXT + ")";
-
- public static final String PLATFORM_SURFACE_AREA = "Platform Surface Area Description";
-
- public static final String PLATFORM_SURFACE_AREA_EXT = "fpd";
-
- public static final String PLATFORM_SURFACE_AREA_EXT_DESCRIPTION = PLATFORM_SURFACE_AREA + " (*."
- + PLATFORM_SURFACE_AREA_EXT + ")";
-
- public static final String ANT_BUILD_FILE = "ANT Build File";
-
- public static final String ANT_BUILD_FILE_EXT = "xml";
-
- public static final String ANT_BUILD_FILE_EXT_DESCRIPTION = ANT_BUILD_FILE + " (*." + ANT_BUILD_FILE_EXT + ")";
-
- public static final String TEXT_FILE = "Text File";
-
- public static final String TEXT_FILE_EXT = "txt";
-
- public static final String TEXT_FILE_EXT_DESCRIPTION = TEXT_FILE + " (*." + TEXT_FILE_EXT + ")";
-
- public static final String FAR_SURFACE_AREA = "Framework Archive";
-
- public static final String FAR_SURFACE_AREA_EXT = "far";
-
- public static final String FAR_SURFACE_AREA_EXT_DESCRIPTION = FAR_SURFACE_AREA + " (*." + FAR_SURFACE_AREA_EXT + ")";
- //
- // Define file separator for current OS
- //
- public static String FILE_SEPARATOR = System.getProperty("file.separator");
-
- //
- // Defien all used frame, container component's sizes
- //
- public static final int MAIN_FRAME_PREFERRED_SIZE_WIDTH = 800;
-
- public static final int MAIN_FRAME_PREFERRED_SIZE_HEIGHT = 600;
-
- public static final int MAIN_FRAME_MAX_SIZE_WIDTH = 1920;
-
- public static final int MAIN_FRAME_MAX_SIZE_HEIGHT = 1200;
-
- public static final int MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH = 790;
-
- public static final int MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT = 545;
-
- public static final int MAIN_FRAME_WIDTH_SPACING = MAIN_FRAME_PREFERRED_SIZE_WIDTH
- - MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH;
-
- public static final int MAIN_FRAME_HEIGHT_SPACING = MAIN_FRAME_PREFERRED_SIZE_HEIGHT
- - MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT;
-
- public static final int MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH = 273;
-
- public static final int MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT = 545;
-
- public static final int MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH = 515;
-
- public static final int MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT = 545;
-
- public static final int MAIN_FRAME_EDITOR_PANEL_LOCATION_X = 260;
-
- public static final int MAIN_FRAME_EDITOR_PANEL_LOCATION_Y = 1;
-
- public static final int SPACE_TO_RIGHT_FOR_GENERATE_BUTTON = 10;
-
- public static final int SPACE_TO_RIGHT_FOR_OK_BUTTON = 10;
-
- public static final int SPACE_TO_RIGHT_FOR_ADD_BUTTON = 200;
-
- public static final int SPACE_TO_RIGHT_FOR_REMOVE_BUTTON = 105;
-
- public static final int SPACE_TO_RIGHT_FOR_UPDATE_BUTTON = 10;
-
- public static final int SPACE_TO_BOTTOM_FOR_ADD_BUTTON = 30;
-
- public static final int SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON = 30;
-
- public static final int SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON = 30;
-
- public static final int SPACE_TO_RIGHT_FOR_CLOSE_BUTTON = 240;
-
- public static final int SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON = 25;
-
- public static final int SPACE_TO_RIGHT_FOR_PROTOCOL_NOTIFY = 25;
-
- public static final int LEFT_WIDTH = 160;
-
- public static final int LEFT_HEIGHT = 20;
-
- public static final int RIGHT_WIDTH = 320;
-
- public static final int RIGHT_HEIGHT = 20;
-
- public static final int RIGHT_MULTIPLE_HEIGHT = 4 * RIGHT_HEIGHT;
-
- public static final int BUTTON_GEN_WIDTH = 65;
-
- public static final int BUTTON_GEN_HEIGHT = 20;
-
- public static final int BUTTON_BROWSE_WIDTH = 65;
-
- public static final int BUTTON_BROWSE_HEIGHT = 20;
-
- public static final int BUTTON_ADD_WIDTH = 80;
-
- public static final int BUTTON_ADD_HEIGHT = 20;
-
- public static final int BUTTON_UPDATE_WIDTH = 80;
-
- public static final int BUTTON_UPDATE_HEIGHT = 20;
-
- public static final int BUTTON_REMOVE_WIDTH = 80;
-
- public static final int BUTTON_REMOVE_HEIGHT = 20;
-
- public static final int SCROLLBAR_WIDTH = 18;
-
- public static final int SCROLLBAR_HEIGHT = 18;
-
- //
- // Common Help Text
- // First defined here
- // Will be replaced by resource file later
- //
- public static final String SUP_ARCH_LIST_HELP_TEXT = "<html>Selecting a checkbox is a restriction of only the selected architectures;<br>If none of boxes are selected, all architectures are supported.<html>";
-
- //
- // Project name and version
- //
- public static final String PROJECT_NAME = "Framework Wizard";
-
- public static final String PROJECT_VERSION = "1.0";
-
- //
- // Sort Type
- //
- public static final int SORT_TYPE_ASCENDING = 1;
-
- public static final int SORT_TYPE_DESCENDING = 2;
-
- //
- // Module Type
- //
- public static final String MODULE_TYPE_LIBRARY = "Library";
-
- public static final String MODULE_TYPE_MODULE = "Module";
-
- //
- // Hex String Header
- //
- public static final String HEX_STRING_HEADER = "0x";
-
- //
- // The String of Boolean
- //
- public static final String TRUE = "True";
-
- public static final String FALSE = "False";
-
- //
- // The String for USAGE type
- //
- public final static String USAGE_TYPE_ALWAYS_CONSUMED = "ALWAYS_CONSUMED";
-
- public final static String USAGE_TYPE_SOMETIMES_CONSUMED = "SOMETIMES_CONSUMED";
-
- public final static String USAGE_TYPE_ALWAYS_PRODUCED = "ALWAYS_PRODUCED";
-
- public final static String USAGE_TYPE_SOMETIMES_PRODUCED = "SOMETIMES_PRODUCED";
-
- public final static String USAGE_TYPE_PRIVATE = "PRIVATE";
-
- public final static String USAGE_TYPE_TO_START = "TO_START";
-
- public final static String USAGE_TYPE_BY_START = "BY_START";
-
- //
- // The String for PCD type
- //
- public final static String PCD_ITEM_TYPE_FEATURE_FLAG = "FEATURE_FLAG";
-
- public final static String PCD_ITEM_TYPE_FIXED_AT_BUILD = "FIXED_AT_BUILD";
-
- public final static String PCD_ITEM_TYPE_PATCHABLE_IN_MODULE = "PATCHABLE_IN_MODULE";
-
- public final static String PCD_ITEM_TYPE_DYNAMIC = "DYNAMIC";
-
- public final static String PCD_ITEM_TYPE_DYNAMIC_EX = "DYNAMIC_EX";
-
- //
- // The String for PPI type
- //
- public final static String PPI_TYPE_PPI = "Ppi";
-
- public final static String PPI_TYPE_PPI_NOTIFY = "Ppi Notify";
-
- //
- // The String for Protocol type
- //
- public final static String PROTOCOL_TYPE_PROTOCOL = "Protocol";
-
- public final static String PROTOCOL_TYPE_PROTOCOL_NOTIFY = "Protocol Notify";
-
- //
- // The default file name for guids.xref file
- //
- public final static String GUIDS_XREF_FILE_NAME = "guids.xref";
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java
deleted file mode 100644
index 82724d4338..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java
+++ /dev/null
@@ -1,746 +0,0 @@
-/** @file
-
- The file is used to provides all kinds of Data Validation interface
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- The class is used to provides all kinds of data validation interface
-
- <p>All provided interfaces are in static mode</p>
-
- **/
-public class DataValidation {
-
- /**
- Reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
-
- }
-
- //
- // The below is used to check common data types
- //
-
- /**
- Check if the imput data is int
-
- @param strInt The input string which needs validation
-
- @retval true - The input is Int
- @retval false - The input is not Int
-
- **/
- public static boolean isInt(String strInt) {
- return isMatch("^-?[0-9]\\d*$", strInt);
- }
-
- /**
- Check if the input data is int and it is in the valid scope
- The scope is provided by String
-
- @param strNumber The input string which needs validation
- @param BeginNumber The left boundary of the scope
- @param EndNumber The right boundary of the scope
-
- @retval true - The input is Int and in the scope;
- @retval false - The input is not Int or not in the scope
-
- **/
- public static boolean isInt(String strNumber, int BeginNumber, int EndNumber) {
- //
- //Check if the input data is int first
- //
- if (!isInt(strNumber)) {
- return false;
- }
- //
- //And then check if the data is between the scope
- //
- Integer intTemp = new Integer(strNumber);
- if ((intTemp.intValue() < BeginNumber) || (intTemp.intValue() > EndNumber)) {
- return false;
- }
- return true;
- }
-
- /**
- Check if the input data is long int and it is in the valid scope
- The scope is provided by String
-
- @param strNumber The input string which needs validation
- @param BeginNumber The left boundary of the scope
- @param EndNumber The right boundary of the scope
-
- @retval true - The input is Int and in the scope;
- @retval false - The input is not Int or not in the scope
-
- **/
- public static boolean isLongInt(String strNumber, long BeginNumber, long EndNumber) throws Exception{
- //
- //Check if the input data is int first
- //
- if (!isInt(strNumber)) {
- return false;
- }
- //
- //And then check if the data is between the scope
- //
- try {
- Long intTemp = new Long(strNumber);
- if ((intTemp.longValue() < BeginNumber) || (intTemp.longValue() > EndNumber)) {
- return false;
- }
- }
- catch (Exception e) {
- throw e;
- }
-
- return true;
- }
- /**
- Check if the input data is int and it is in the valid scope
- The scope is provided by String
-
- @param strNumber The input string which needs validation
- @param strBeginNumber The left boundary of the scope
- @param strEndNumber The right boundary of the scope
-
- @retval true - The input is Int and in the scope;
- @retval false - The input is not Int or not in the scope
-
- **/
- public static boolean isInt(String strNumber, String strBeginNumber, String strEndNumber) {
- //
- //Check if all input data are int
- //
- if (!isInt(strNumber)) {
- return false;
- }
- if (!isInt(strBeginNumber)) {
- return false;
- }
- if (!isInt(strEndNumber)) {
- return false;
- }
- //
- //And then check if the data is between the scope
- //
- Integer intI = new Integer(strNumber);
- Integer intJ = new Integer(strBeginNumber);
- Integer intK = new Integer(strEndNumber);
- if ((intI.intValue() < intJ.intValue()) || (intI.intValue() > intK.intValue())) {
- return false;
- }
- return true;
- }
-
- /**
- Use regex to check if the input data is in valid format
-
- @param strPattern The input regex
- @param strMatcher The input data need be checked
-
- @retval true - The data matches the regex
- @retval false - The data doesn't match the regex
-
- **/
- public static boolean isMatch(String strPattern, String strMatcher) {
- Pattern pattern = Pattern.compile(strPattern);
- Matcher matcher = pattern.matcher(strMatcher);
-
- return matcher.find();
- }
-
- //
- // The below is used to check common customized data types
- //
-
- /**
- Check if the input data is UiNameType
-
- @param arg0 The input string need be checked
-
- @retval true - The input is UiNameType
- @retval false - The input is not UiNameType
-
- **/
- public static boolean isUiNameType(String arg0) {
- if (arg0.length() < 1) {
- return false;
- }
- return isMatch("[^ ].*", arg0);
- }
-
- /**
- Check if the input data is GuidType2
-
- @param arg0 The input string need be checked
-
- @retval true - The input is GuidType2
- @retval false - The input is not GuidType2
-
- **/
- public static boolean isGuidType2(String arg0) {
- return isMatch("[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}", arg0);
- }
-
- /**
- Check if the input data is Guid
-
- @param strGuid The input string need be checked
-
- @retval true - The input is Guid
- @retval false - The input is not Guid
-
- **/
- public static boolean isGuid(String arg0) {
- return isGuidType2(arg0);
- }
-
- /**
- Check if the input data is Version
-
- @param arg0 The input string need be checked
-
- @retval true - The input is Version
- @retval false - The input is not Version
-
- **/
- public static boolean isVersionDataType(String arg0) {
- return isMatch("\\d+(\\.\\d+)*", arg0);
- }
-
- /**
- Check if the input data is Sentence
-
- @param strSentence The input string need be checked
-
- @retval true - The input is Sentence
- @retval false - The input is not Sentence
-
- **/
- public static boolean isSentence(String arg0) {
- return isMatch("(\\w+\\W*)+( )+(\\W*\\w*\\W*\\s*)*", arg0);
- }
-
- /**
- Check if the input data is FileNameConventio
-
- @param strSentence The input string need be checked
-
- @retval true - The input is FileNameConventio
- @retval false - The input is not FileNameConventio
-
- **/
- public static boolean isFileNameConvention(String arg0) {
- return isMatch("[a-zA-Z](\\.?[-_a-zA-Z0-9]+)*", arg0);
- }
-
- /**
- Check if the input data is KeywordType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is KeywordType
- @retval false - The input is not KeywordType
-
- **/
- public static boolean isKeywordType(String arg0) {
- return isMatch("[a-zA-Z]+(_*[a-zA-Z0-9]*)*", arg0);
- }
-
- /**
- Check if the input data is FeatureFlagExpressionType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is FeatureFlagExpressionType
- @retval false - The input is not FeatureFlagExpressionType
-
- **/
- public static boolean isFeatureFlagExpressionType(String arg0) {
- return (arg0.length() >= 1);
- }
-
- /**
- Check if the input data is FeatureFlag
-
- @param strSentence The input string need be checked
-
- @retval true - The input is FeatureFlag
- @retval false - The input is not FeatureFlag
-
- **/
- public static boolean isFeatureFlag(String arg0) {
- return isFeatureFlagExpressionType(arg0);
- }
-
- /**
- Check if the input data is PathAndFilename
-
- @param strSentence The input string need be checked
-
- @retval true - The input is PathAndFilename
- @retval false - The input is not PathAndFilename
-
- **/
- public static boolean isPathAndFilename(String arg0) {
- return !arg0.equals("");
- }
-
- /**
- Check if the input data is ToolsNameConvention
-
- @param strSentence The input string need be checked
-
- @retval true - The input is ToolsNameConvention
- @retval false - The input is not ToolsNameConvention
-
- **/
- public static boolean isToolsNameConvention(String arg0) {
- return isMatch("[a-zA-Z][a-zA-Z0-9]*", arg0);
- }
-
- /**
- Check if the input data is C_NameType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is C_NameType
- @retval false - The input is not C_NameType
-
- **/
- public static boolean isC_NameType(String arg0) {
- return isMatch("(_)*[a-zA-Z]+((_)*[a-zA-Z0-9]*)*", arg0);
- }
-
- /**
- Check if the input data is HexWordArrayType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is HexWordArrayType
- @retval false - The input is not HexWordArrayType
-
- **/
- public static boolean isHexWordArrayType(String arg0) {
- return arg0.length() >=6 && isMatch("((\\s)*0x([a-fA-F0-9]){4}(,)?(\\s)*)+", arg0);
- }
-
- /**
- Check if the input data is Hex64BitDataType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is Hex64BitDataType
- @retval false - The input is not Hex64BitDataType
-
- **/
- public static boolean isHex64BitDataType(String arg0) {
- return isMatch("(0x)?[a-fA-F0-9]{1,16}", arg0);
- }
-
- /**
- Check if the input data is UnicodeString
-
- @param strSentence The input string need be checked
-
- @retval true - The input is UnicodeString
- @retval false - The input is not UnicodeString
-
- **/
- public static boolean isUnicodeString(String arg0) {
- return arg0.length() >= 3 && isMatch("(\\s)*L(\\:)?\"[^\"]*\"(\\s)*", arg0);
- }
-
- /**
- Check if the input data is HexByteArrayType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is HexByteArrayType
- @retval false - The input is not HexByteArrayType
-
- **/
- public static boolean isHexByteArrayType(String arg0) {
- return arg0.length() >= 4 && isMatch("((\\s)*0x([a-fA-F0-9]){2}(,)?(\\s)*)+", arg0);
- }
-
-
- /**
- Check if the input data is DateType
-
- @param strDateType The input string need be checked
-
- @retval true - The input is DateType
- @retval false - The input is not DateType
-
- **/
- public static boolean isDateType(String strDateType) {
- return isMatch("[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]", strDateType);
- }
-
- /**
- Check if the input data is DosPath
-
- @param strDosPath The input string need be checked
-
- @retval true - The input is DosPath
- @retval false - The input is not DosPath
-
- **/
- public static boolean isDosPath(String strDosPath) {
- return isMatch("([a-zA-Z]:\\\\)?(((\\\\?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\\\)?)*", strDosPath);
- }
-
- /**
- Check if the input data is UnixPath
-
- @param strUnixPath The input string need be checked
-
- @retval true - The input is UnixPath
- @retval false - The input is not UnixPath
-
- **/
- public static boolean isUnixPath(String strUnixPath) {
- return isMatch("(\\/)?(((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\/)?)*", strUnixPath);
- }
-
- /**
- Check if the input data is DirectoryNamingConvention
-
- @param strDirectoryNamingConvention The input string need be checked
-
- @retval true - The input is DirectoryNamingConvention
- @retval false - The input is not DirectoryNamingConvention
-
- **/
- public static boolean isDirectoryNamingConvention(String strDirectoryNamingConvention) {
- return (isDosPath(strDirectoryNamingConvention) || isUnixPath(strDirectoryNamingConvention));
- }
-
- /**
- Check if the input data is HexDoubleWordDataType
-
- @param strHexDoubleWordDataType The input string need be checked
-
- @retval true - The input is HexDoubleWordDataType
- @retval false - The input is not HexDoubleWordDataType
-
- **/
- public static boolean isHexDoubleWordDataType(String strHexDoubleWordDataType) {
- return isMatch("0x[a-fA-F0-9]{1,8}", strHexDoubleWordDataType);
- }
-
- /**
- Check if the input data is V1
-
- @param strV1 The input string need be checked
-
- @retval true - The input is V1
- @retval false - The input is not V1
-
- **/
- public static boolean isV1(String strV1) {
- return isMatch("((%[A-Z](_*[A-Z0-9]*)*%)+((((\\\\)?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\\\)?)*)", strV1);
- }
-
- /**
- Check if the input data is V2
-
- @param strV2 The input string need be checked
-
- @retval true - The input is V2
- @retval false - The input is not V2
-
- **/
- public static boolean isV2(String strV2) {
- return isMatch(
- "(($[A-Z](_*[A-Z0-9]*)*)+||($\\([A-Z](_*[A-Z0-9]*)*\\))+||($\\{[A-Z](_*[A-Z0-9]*)*\\})+)+(\\/)?(((((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\/)?)*)*)",
- strV2);
- }
-
- /**
- Check if the input data is VariableConvention
-
- @param strVariableConvention The input string need be checked
-
- @retval true - The input is VariableConvention
- @retval false - The input is not VariableConvention
-
- **/
- public static boolean isVariableConvention(String strVariableConvention) {
- return (isV1(strVariableConvention) || isV2(strVariableConvention));
- }
-
- /**
- Check if the input data is UCName
-
- @param strUCName The input string need be checked
-
- @retval true - The input is UCName
- @retval false - The input is not UCName
-
- **/
- public static boolean isUCName(String strUCName) {
- return isMatch("[A-Z]+(_*[A-Z0-9]*( )*)*", strUCName);
- }
-
- /**
- Check if the input data is HexByteDataType
-
- @param strHex64BitDataType The input string need be checked
-
- @retval true - The input is HexByteDataType
- @retval false - The input is not HexByteDataType
-
- **/
- public static boolean isHexByteDataType(String strHex64BitDataType) {
- return isMatch("(0x)?[a-fA-F0-9]{1,2}", strHex64BitDataType);
- }
-
- /**
- Check if the input data is HexWordDataType
-
- @param strHexWordDataType The input string need be checked
-
- @retval true - The input is HexWordDataType
- @retval false - The input is not HexWordDataType
-
- **/
- public static boolean isHexWordDataType(String strHexWordDataType) {
- return isMatch("0x[a-fA-F0-9]{1,4}", strHexWordDataType);
- }
-
- /**
- Check if the input data is OverrideID
-
- @param strOverrideID The input string need be checked
-
- @retval true - The input is OverrideID
- @retval false - The input is not OverrideID
-
- **/
- public static boolean isOverrideID(String strOverrideID) {
- return isInt(strOverrideID);
- }
-
- /**
- Check if the input data is Supported Architectures
-
- @param strSupportedArchitectures
- @retval true - The input is Supported Architectures
- @retval false - The input isn't Supported Architectures
-
- */
- public static boolean isSupportedArchitectures(String strSupportedArchitectures) {
- return isMatch("(ALL){1}|(((IA32)|((X64)|(IPF)|(EBC)){1}((,((IA32)|(X64)|(IPF)|(EBC)){1} ){0,2}))){1}",
- strSupportedArchitectures);
- }
-
- //
- //The below is used to check msaheader data type
- //
-
- /**
- Check if the input data is BaseName
-
- @param strBaseName The input string need be checked
-
- @retval true - The input is BaseName
- @retval false - The input is not BaseName
-
- **/
- public static boolean isBaseName(String arg0) {
- return isUiNameType(arg0);
- }
-
- /**
- Check if the input data is Version
-
- @param arg0 The input string need be checked
-
- @retval true - The input is Version
- @retval false - The input is not Version
-
- **/
- public static boolean isVersion(String arg0) {
- return isVersionDataType(arg0);
- }
-
- /**
- Check if the input data is Abstract
-
- @param strAbstract The input string need be checked
-
- @retval true - The input is Abstract
- @retval false - The input is not Abstract
-
- **/
- public static boolean isAbstract(String arg0) {
- return isSentence(arg0);
- }
-
- /**
- Check if the input data is Copyright
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is Copyright
- @retval false - The input is not Copyright
-
- **/
- public static boolean isCopyright(String arg0) {
- return !arg0.equals("");
- }
-
- /**
- Check if the input data is Specification
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is Specification
- @retval false - The input is not Specification
-
- **/
- public static boolean isSpecification(String arg0) {
- return isSentence(arg0);
- }
-
- //
- // The below is used to check ModuleDefinitions data types
- //
- /**
- Check if the input data is OutputFileBasename
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is OutputFileBasename
- @retval false - The input is not OutputFileBasename
-
- **/
- public static boolean isOutputFileBasename(String arg0) {
- return isFileNameConvention(arg0);
- }
-
- //
- // The below is used to check LibraryClass data types
- //
- /**
- Check if the input data is LibraryClass
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is LibraryClass
- @retval false - The input is not LibraryClass
-
- **/
- public static boolean isLibraryClass(String arg0) {
- return isKeywordType(arg0);
- }
-
- /**
- Check if the input data is RecommendedInstanceVersion
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is RecommendedInstanceVersion
- @retval false - The input is not RecommendedInstanceVersion
-
- **/
- public static boolean isRecommendedInstanceVersion(String arg0) {
- return isVersionDataType(arg0);
- }
-
- //
- // The below is used to check sourcefiles data types
- //
-
- /**
- Check if the input data is Filename
-
- @param strPath The input string need be checked
-
- @retval true - The input is Filename
- @retval false - The input is not Filename
-
- **/
- public static boolean isFilename(String arg0) {
- return isPathAndFilename(arg0);
- }
-
- /**
- Check if the input data is TagName
-
- @param strPath The input string need be checked
-
- @retval true - The input is TagName
- @retval false - The input is not TagName
-
- **/
- public static boolean isTagName(String arg0) {
- return isToolsNameConvention(arg0);
- }
-
- /**
- Check if the input data is ToolCode
-
- @param strPath The input string need be checked
-
- @retval true - The input is ToolCode
- @retval false - The input is not ToolCode
-
- **/
- public static boolean isToolCode(String arg0) {
- return isToolsNameConvention(arg0);
- }
-
- /**
- Check if the input data is ToolChainFamily
-
- @param strPath The input string need be checked
-
- @retval true - The input is ToolChainFamily
- @retval false - The input is not ToolChainFamily
-
- **/
- public static boolean isToolChainFamily(String arg0) {
- return isToolsNameConvention(arg0);
- }
-
- //
- // The below is used to check pcdcoded data types
- //
- /**
- Check if the input data is DefaultValueType
-
- @param strPath The input string need be checked
-
- @retval true - The input is DefaultValueType
- @retval false - The input is not DefaultValueType
-
- **/
- public static boolean isDefaultValueType(String arg0) {
- return isHex64BitDataType(arg0) || isUnicodeString(arg0) || isHexByteArrayType(arg0);
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java
deleted file mode 100644
index 7eae384c7d..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java
+++ /dev/null
@@ -1,1123 +0,0 @@
-/** @file
-
- The file is used to init all JComboBox items
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.util.Vector;
-
-public class EnumerationData {
- //
- // Static data for externs definitions
- //
- public final static String EXTERNS_PCD_IS_DRIVER = "Pcd Is Driver";
-
- public final static String EXTERNS_SPECIFICATION = "Specification";
-
- public final static String EXTERNS_IMAGE = "Image";
-
- public final static String EXTERNS_MODULE_ENTRY_POINT = "ModuleEntryPoint";
-
- public final static String EXTERNS_MODULE_UNLOAD_IMAGE = "ModuleUnloadImage";
-
- public final static String EXTERNS_LIBRARY = "Library";
-
- public final static String EXTERNS_CONSTRUCTOR = "Constructor";
-
- public final static String EXTERNS_DESTRUCTOR = "Destructor";
-
- public final static String EXTERNS_DRIVER = "Driver";
-
- public final static String EXTERNS_DRIVER_BINDING = "DriverBinding";
-
- public final static String EXTERNS_COMPONENT_NAME = "ComponentName";
-
- public final static String EXTERNS_DRIVER_CONFIG = "DriverConfig";
-
- public final static String EXTERNS_DRIVER_DIAG = "DriverDiag";
-
- public final static String EXTERNS_CALL_BACK = "Call Back";
-
- public final static String EXTERNS_VIRTUAL_ADDRESS_MAP_CALL_BACK = "VirtualAddressMap";
-
- public final static String EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK = "ExitBootServices";
-
- //
- // Static data for guid type
- //
- public final static String GUID_TYPE_DATA_HUB_RECORD = "DATA_HUB_RECORD";
-
- public final static String GUID_TYPE_EFI_EVENT = "EFI_EVENT";
-
- public final static String GUID_TYPE_EFI_SYSTEM_CONFIGURATION_TABLE = "EFI_SYSTEM_CONFIGURATION_TABLE";
-
- public final static String GUID_TYPE_EFI_VARIABLE = "EFI_VARIABLE";
-
- public final static String GUID_TYPE_GUID = "GUID";
-
- public final static String GUID_TYPE_HII_PACKAGE_LIST = "HII_PACKAGE_LIST";
-
- public final static String GUID_TYPE_HOB = "HOB";
-
- public final static String GUID_TYPE_TOKEN_SPACE_GUID = "TOKEN_SPACE_GUID";
-
- //
- // Static data for build targets
- //
- public final static String BUILD_TARGET_DEBUG = "DEBUG";
-
- public final static String BUILD_TARGET_RELEASE = "RELEASE";
-
- //
- // Common data
- //
- public Vector<String> vSupportedArchitectures = new Vector<String>();
-
- public Vector<String> vEnabled = new Vector<String>();
-
- public Vector<String> vBoolean = new Vector<String>();
-
- //
- // Used by Msa Header
- //
- public Vector<String> vModuleType = new Vector<String>();
-
- public Vector<String> vCompontentType = new Vector<String>();
-
- //
- // Used by Library Class Definitions
- //
- public Vector<String> vLibraryUsage = new Vector<String>();
-
- public Vector<String> vFrameworkModuleTypes = new Vector<String>();
-
- public Vector<String> vLibClassDef = new Vector<String>();
-
- public Vector<String> vLibClassDefBase = new Vector<String>();
-
- public Vector<String> vLibClassDefPei = new Vector<String>();
-
- public Vector<String> vLibClassDefPeim = new Vector<String>();
-
- public Vector<String> vLibClassDefDxeCore = new Vector<String>();
-
- public Vector<String> vLibClassDefDxeDriver = new Vector<String>();
-
- public Vector<String> vLibClassDefDxeSmmDriver = new Vector<String>();
-
- public Vector<String> vLibClassDefUefiDriver = new Vector<String>();
-
- //
- // Used by Source Files
- //
- public Vector<String> vSourceFilesToolChainFamily = new Vector<String>();
-
- public Vector<String> vSourceFilesFileType = new Vector<String>();
-
- public Vector<String> vToolCode = new Vector<String>();
-
- //
- // Used by Package Dependencies
- //
- public Vector<String> vPackageUsage = new Vector<String>();
-
- //
- // Used by Protocols
- //
- public Vector<String> vProtocolUsage = new Vector<String>();
-
- public Vector<String> vProtocolNotifyUsage = new Vector<String>();
-
- public Vector<String> vProtocolType = new Vector<String>();
-
- //
- // Used by Events
- //
- public Vector<String> vEventType = new Vector<String>();
-
- public Vector<String> vEventUsage = new Vector<String>();
-
- public Vector<String> vEventGroup = new Vector<String>();
-
- //
- // Used by Hobs
- //
- public Vector<String> vHobType = new Vector<String>();
-
- public Vector<String> vHobUsage = new Vector<String>();
-
- //
- // Used by Ppis
- //
- public Vector<String> vPpiType = new Vector<String>();
-
- public Vector<String> vPpiUsage = new Vector<String>();
-
- public Vector<String> vPpiNotifyUsage = new Vector<String>();
-
- //
- // Used by Variable
- //
- public Vector<String> vVariableUsage = new Vector<String>();
-
- //
- // Used by Boot Mode
- //
- public Vector<String> vBootModeNames = new Vector<String>();
-
- public Vector<String> vBootModeUsage = new Vector<String>();
-
- //
- // Used by System Tables
- //
- public Vector<String> vSystemTableUsage = new Vector<String>();
-
- //
- // Used by Data Hubs
- //
- public Vector<String> vDataHubUsage = new Vector<String>();
-
- //
- // Used by Hii Packages
- //
- public Vector<String> vHiiPackageUsage = new Vector<String>();
-
- //
- // Used by Guid
- //
- public Vector<String> vGuidUsage = new Vector<String>();
-
- //
- // Used by Externs
- //
- public Vector<String> vExternTypes = new Vector<String>();
-
- public Vector<String> vPcdDriverTypes = new Vector<String>();
-
- //
- // Used by Pcd
- //
- public Vector<String> vPcdItemTypes = new Vector<String>();
-
- public Vector<String> vPcdUsage = new Vector<String>();
-
- //
- // Used by Build Options
- //
- public Vector<String> vBuildTargets = new Vector<String>();
-
- public EnumerationData() {
- init();
- }
-
- private void init() {
- //
- // Init common data first
- //
- initSupportedArchitectures();
- initEnabled();
- initBoolean();
-
- //
- // Used by Msa header
- //
- initModuleType();
-
- //
- // Used by Library Class Definitions
- //
- initLibraryUsage();
- initFrameworkModuleTypes();
- initLibClassDefBase();
- initLibClassDefPei();
- initLibClassDefPeim();
- initLibClassDefDxeCore();
- initLibClassDefDxeDriver();
- initLibClassDefDxeSmmDriver();
- initLibClassDefUefiDriver();
- initLibClassDef();
-
- //
- // Used by Library Class Definitions
- //
- initSourceFilesToolChainFamily();
- initSourceFilesFileType();
- initToolCode();
-
- //
- // Used by Package Dependencies
- //
- initPackageUsage();
-
- //
- // Used by Protocols
- //
- initProtocolType();
- initProtocolUsage();
- initProtocolNotifyUsage();
-
- //
- // Used by Events
- //
- initEventType();
- initEventUsage();
- initEventGroup();
-
- //
- // Used by Hobs
- //
- initHobType();
- initHobUsage();
-
- //
- // Used by Ppis
- //
- initPpiType();
- initPpiUsage();
- initPpiNotifyUsage();
-
- //
- // Used by Variable
- //
- initVariableUsage();
-
- //
- // Used by Boot Mode
- //
- initBootModeNames();
- initBootModeUsage();
-
- //
- // Used by System Tables
- //
- initSystemTableUsage();
-
- //
- // Used by Data Hubs
- //
- initDataHubUsage();
-
- //
- // Used by Hii Packages
- //
- initHiiPackages();
-
- //
- // Used by Guid
- //
- initGuidUsage();
-
- //
- // Used by Externs
- //
- initExternTypes();
- initPcdDriverTypes();
-
- //
- // Used by Pcd
- //
- initPcdItemTypes();
- initPcdUsage();
-
- //
- // Used by Build Option
- //
- initBuildTargets();
- }
-
- private void initEnabled() {
- vEnabled.removeAllElements();
- vEnabled.addElement("Disabled");
- vEnabled.addElement("Enabled");
- }
-
- private void initBoolean() {
- vBoolean.removeAllElements();
- vBoolean.addElement(DataType.FALSE);
- vBoolean.addElement(DataType.TRUE);
- }
-
- private void initModuleType() {
- vModuleType.removeAllElements();
- vModuleType.addElement("BASE");
- vModuleType.addElement("SEC");
- vModuleType.addElement("PEI_CORE");
- vModuleType.addElement("PEIM");
- vModuleType.addElement("DXE_CORE");
- vModuleType.addElement("DXE_DRIVER");
- vModuleType.addElement("DXE_RUNTIME_DRIVER");
- vModuleType.addElement("DXE_SAL_DRIVER");
- vModuleType.addElement("DXE_SMM_DRIVER");
- vModuleType.addElement("TOOL");
- vModuleType.addElement("UEFI_DRIVER");
- vModuleType.addElement("UEFI_APPLICATION");
- vModuleType.addElement("USER_DEFINED");
- Sort.sortVectorString(vModuleType, DataType.SORT_TYPE_ASCENDING);
- }
-
- // private void initComponentType() {
- // vCompontentType.removeAllElements();
- // vCompontentType.addElement("APRIORI");
- // vCompontentType.addElement("LIBRARY");
- // vCompontentType.addElement("FV_IMAGE_FILE");
- // vCompontentType.addElement("BS_DRIVER");
- // vCompontentType.addElement("RT_DRIVER");
- // vCompontentType.addElement("SAL_RT_DRIVER");
- // vCompontentType.addElement("PE32_PEIM");
- // vCompontentType.addElement("PIC_PEIM");
- // vCompontentType.addElement("COMBINED_PEIM_DRIVER");
- // vCompontentType.addElement("PEI_CORE");
- // vCompontentType.addElement("DXE_CORE");
- // vCompontentType.addElement("APPLICATION");
- // vCompontentType.addElement("BS_DRIVER_EFI");
- // vCompontentType.addElement("SHELLAPP");
- // }
-
- private void initSupportedArchitectures() {
- vSupportedArchitectures.removeAllElements();
- vSupportedArchitectures.addElement("EBC");
- vSupportedArchitectures.addElement("IA32");
- vSupportedArchitectures.addElement("X64");
- vSupportedArchitectures.addElement("IPF");
- vSupportedArchitectures.addElement("ARM");
- vSupportedArchitectures.addElement("PPC");
- }
-
- private void initLibraryUsage() {
- vLibraryUsage.removeAllElements();
- vLibraryUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vLibraryUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vLibraryUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vLibraryUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vLibraryUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initFrameworkModuleTypes() {
- vFrameworkModuleTypes.removeAllElements();
- vFrameworkModuleTypes.addElement("BASE");
- vFrameworkModuleTypes.addElement("SEC");
- vFrameworkModuleTypes.addElement("PEI_CORE");
- vFrameworkModuleTypes.addElement("PEIM");
- vFrameworkModuleTypes.addElement("DXE_CORE");
- vFrameworkModuleTypes.addElement("DXE_DRIVER");
- vFrameworkModuleTypes.addElement("DXE_RUNTIME_DRIVER");
- vFrameworkModuleTypes.addElement("DXE_SAL_DRIVER");
- vFrameworkModuleTypes.addElement("DXE_SMM_DRIVER");
- vFrameworkModuleTypes.addElement("UEFI_DRIVER");
- vFrameworkModuleTypes.addElement("UEFI_APPLICATION");
- vFrameworkModuleTypes.addElement("USER_DEFINED");
- Sort.sortVectorString(vFrameworkModuleTypes, DataType.SORT_TYPE_ASCENDING);
- }
-
- private void initLibClassDef() {
- vLibClassDef.removeAllElements();
- for (int index = 0; index < vLibClassDefBase.size(); index++) {
- vLibClassDef.addElement(vLibClassDefBase.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefPei.size(); index++) {
- vLibClassDef.addElement(vLibClassDefPei.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefPeim.size(); index++) {
- vLibClassDef.addElement(vLibClassDefPeim.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefDxeCore.size(); index++) {
- vLibClassDef.addElement(vLibClassDefDxeCore.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefDxeDriver.size(); index++) {
- vLibClassDef.addElement(vLibClassDefDxeDriver.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefDxeSmmDriver.size(); index++) {
- vLibClassDef.addElement(vLibClassDefDxeSmmDriver.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefUefiDriver.size(); index++) {
- vLibClassDef.addElement(vLibClassDefUefiDriver.elementAt(index));
- }
- }
-
- private void initLibClassDefBase() {
- vLibClassDefBase.removeAllElements();
- vLibClassDefBase.addElement("BaseLib");
- vLibClassDefBase.addElement("BaseMemoryLib");
- vLibClassDefBase.addElement("CacheMaintenanceLib");
- vLibClassDefBase.addElement("DebugLib");
- vLibClassDefBase.addElement("IoLib");
- vLibClassDefBase.addElement("PcdLib");
- vLibClassDefBase.addElement("PciCf8Lib");
- vLibClassDefBase.addElement("PciExpressLib");
- vLibClassDefBase.addElement("PciLib");
- vLibClassDefBase.addElement("PeCoffGetEntryPointLib");
- vLibClassDefBase.addElement("PeCoffLib");
- vLibClassDefBase.addElement("PerformanceLib");
- vLibClassDefBase.addElement("PrintLib");
- vLibClassDefBase.addElement("SmbusLib");
- vLibClassDefBase.addElement("TimerLib");
- }
-
- private void initLibClassDefPei() {
- vLibClassDefPei.removeAllElements();
- vLibClassDefPei.addElement("PeiCoreEntryPoint");
- }
-
- private void initLibClassDefPeim() {
- vLibClassDefPeim.removeAllElements();
- vLibClassDefPeim.addElement("BaseMemoryLib");
- vLibClassDefPeim.addElement("DebugLib");
- vLibClassDefPeim.addElement("HobLib");
- vLibClassDefPeim.addElement("IoLib");
- vLibClassDefPeim.addElement("MemoryAllocationLib");
- vLibClassDefPeim.addElement("PcdLib");
- vLibClassDefPeim.addElement("PeiCoreLib");
- vLibClassDefPeim.addElement("PeiServicesTablePointerLib");
- vLibClassDefPeim.addElement("PeimEntryPoint");
- vLibClassDefPeim.addElement("ReportStatusCodeLib");
- vLibClassDefPeim.addElement("ResourcePublicationLib");
- vLibClassDefPeim.addElement("SmbusLib");
- }
-
- private void initLibClassDefDxeCore() {
- vLibClassDefDxeCore.removeAllElements();
- vLibClassDefDxeCore.addElement("DxeCoreEntryPoint");
- vLibClassDefDxeCore.addElement("HobLib");
- }
-
- private void initLibClassDefDxeDriver() {
- vLibClassDefDxeDriver.removeAllElements();
- vLibClassDefDxeDriver.addElement("DxeServicesTableLib");
- vLibClassDefDxeDriver.addElement("HiiLib");
- vLibClassDefDxeDriver.addElement("HobLib");
- vLibClassDefDxeDriver.addElement("IoLib");
- vLibClassDefDxeDriver.addElement("MemoryAllocationLib");
- vLibClassDefDxeDriver.addElement("PcdLib");
- vLibClassDefDxeDriver.addElement("ReportStatusCodeLib");
- vLibClassDefDxeDriver.addElement("SmbusLib");
- vLibClassDefDxeDriver.addElement("UefiBootServicesTableLib");
- vLibClassDefDxeDriver.addElement("UefiDecompressLib");
- vLibClassDefDxeDriver.addElement("UefiRuntimeServicesTableLib");
- }
-
- private void initLibClassDefDxeSmmDriver() {
- vLibClassDefDxeSmmDriver.removeAllElements();
- vLibClassDefDxeSmmDriver.addElement("DxeSmmDriverEntryPoint");
- }
-
- private void initLibClassDefUefiDriver() {
- vLibClassDefUefiDriver.removeAllElements();
- vLibClassDefUefiDriver.addElement("BaseMemoryLib");
- vLibClassDefUefiDriver.addElement("DebugLib");
- vLibClassDefUefiDriver.addElement("DevicePathLib");
- vLibClassDefUefiDriver.addElement("UefiDriverEntryPoint");
- vLibClassDefUefiDriver.addElement("UefiDriverModelLib");
- vLibClassDefUefiDriver.addElement("UefiLib");
- }
-
- private void initSourceFilesToolChainFamily() {
- vSourceFilesToolChainFamily.removeAllElements();
- vSourceFilesToolChainFamily.addElement("MSFT");
- vSourceFilesToolChainFamily.addElement("INTC");
- vSourceFilesToolChainFamily.addElement("GCC");
- }
-
- private void initSourceFilesFileType() {
- vSourceFilesFileType.removeAllElements();
- vSourceFilesFileType.addElement("CCODE");
- vSourceFilesFileType.addElement("CHEADER");
- vSourceFilesFileType.addElement("ASMHEADER");
- vSourceFilesFileType.addElement("ASM");
- vSourceFilesFileType.addElement("UNI");
- vSourceFilesFileType.addElement("TXT");
- vSourceFilesFileType.addElement("DXS");
- vSourceFilesFileType.addElement("BMP");
- vSourceFilesFileType.addElement("VFR");
- vSourceFilesFileType.addElement("BINARY");
- vSourceFilesFileType.addElement("FV");
- vSourceFilesFileType.addElement("FFS");
- vSourceFilesFileType.addElement("EFI");
- }
-
- private void initToolCode() {
- vToolCode.removeAllElements();
- vToolCode.addElement(DataType.EMPTY_SELECT_ITEM);
- // vToolCode.addElement("Build_CCode");
- // vToolCode.addElement("Build_AUTOGEN");
- // vToolCode.addElement("Build_DPX");
- // vToolCode.addElement("Build_ASM");
- // vToolCode.addElement("Build_Assembly");
- // vToolCode.addElement("Build_Gcc_Assembly");
- // vToolCode.addElement("Build_IPF_Assembly_Code");
- // vToolCode.addElement("Build_IPF_PP_Code");
- // vToolCode.addElement("Build_Library");
- // vToolCode.addElement("Build_UNI");
- // vToolCode.addElement("Build_Unicode_Database");
- // vToolCode.addElement("Build_VFR");
- // vToolCode.addElement("Build_DUMMY");
- vToolCode.addElement("CC");
- vToolCode.addElement("DLINK");
- vToolCode.addElement("SLINK");
- vToolCode.addElement("PP");
- vToolCode.addElement("ASM");
- vToolCode.addElement("ASMLINK");
- vToolCode.addElement("ASL");
- }
-
- private void initPackageUsage() {
- vPackageUsage.removeAllElements();
- vPackageUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vPackageUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- }
-
- private void initProtocolUsage() {
- vProtocolUsage.removeAllElements();
- vProtocolUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_TO_START);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_BY_START);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initProtocolType() {
- vProtocolType.removeAllElements();
- vProtocolType.addElement(DataType.PROTOCOL_TYPE_PROTOCOL);
- vProtocolType.addElement(DataType.PROTOCOL_TYPE_PROTOCOL_NOTIFY);
- }
-
- private void initEventType() {
- vEventType.removeAllElements();
- vEventType.addElement("CreateEvents");
- vEventType.addElement("SignalEvents");
- }
-
- private void initEventUsage() {
- vEventUsage.removeAllElements();
- vEventUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vEventUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vEventUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vEventUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vEventUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initEventGroup() {
- vEventGroup.removeAllElements();
- vEventGroup.addElement("EVENT_GROUP_GUID");
- vEventGroup.addElement("EVENT_TYPE_PERIODIC_TIMER");
- vEventGroup.addElement("EVENT_TYPE_RELATIVE_TIMER");
- }
-
- private void initHobType() {
- vHobType.removeAllElements();
- vHobType.addElement("PHIT");
- vHobType.addElement("MEMORY_ALLOCATION");
- vHobType.addElement("RESOURCE_DESCRIPTOR");
- vHobType.addElement("GUID_EXTENSION");
- vHobType.addElement("FIRMWARE_VOLUME");
- vHobType.addElement("CPU");
- vHobType.addElement("POOL");
- vHobType.addElement("CAPSULE_VOLUME");
- }
-
- private void initHobUsage() {
- vHobUsage.removeAllElements();
- vHobUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vHobUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vHobUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vHobUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vHobUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initPpiType() {
- vPpiType.removeAllElements();
- vPpiType.addElement(DataType.PPI_TYPE_PPI);
- vPpiType.addElement(DataType.PPI_TYPE_PPI_NOTIFY);
- }
-
- private void initPpiUsage() {
- vPpiUsage.removeAllElements();
- vPpiUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vPpiUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vPpiUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vPpiUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vPpiUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initPpiNotifyUsage() {
- vPpiNotifyUsage.removeAllElements();
- vPpiNotifyUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- }
-
- private void initProtocolNotifyUsage() {
- vProtocolNotifyUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- }
-
- private void initVariableUsage() {
- vVariableUsage.removeAllElements();
- vVariableUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vVariableUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vVariableUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vVariableUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vVariableUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initBootModeNames() {
- vBootModeNames.removeAllElements();
- vBootModeNames.addElement("FULL");
- vBootModeNames.addElement("MINIMAL");
- vBootModeNames.addElement("NO_CHANGE");
- vBootModeNames.addElement("DIAGNOSTICS");
- vBootModeNames.addElement("DEFAULT");
- vBootModeNames.addElement("S2_RESUME");
- vBootModeNames.addElement("S3_RESUME");
- vBootModeNames.addElement("S4_RESUME");
- vBootModeNames.addElement("S5_RESUME");
- vBootModeNames.addElement("FLASH_UPDATE");
- vBootModeNames.addElement("RECOVERY_FULL");
- vBootModeNames.addElement("RECOVERY_MINIMAL");
- vBootModeNames.addElement("RECOVERY_NO_CHANGE");
- vBootModeNames.addElement("RECOVERY_DIAGNOSTICS");
- vBootModeNames.addElement("RECOVERY_DEFAULT");
- vBootModeNames.addElement("RECOVERY_S2_RESUME");
- vBootModeNames.addElement("RECOVERY_S3_RESUME");
- vBootModeNames.addElement("RECOVERY_S4_RESUME");
- vBootModeNames.addElement("RECOVERY_S5_RESUME");
- vBootModeNames.addElement("RECOVERY_FLASH_UPDATE");
- }
-
- private void initBootModeUsage() {
- vBootModeUsage.removeAllElements();
- vBootModeUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vBootModeUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vBootModeUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vBootModeUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- }
-
- private void initSystemTableUsage() {
- vSystemTableUsage.removeAllElements();
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initDataHubUsage() {
- vDataHubUsage.removeAllElements();
- vDataHubUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vDataHubUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vDataHubUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vDataHubUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vDataHubUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initHiiPackages() {
- vHiiPackageUsage.removeAllElements();
- vHiiPackageUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vHiiPackageUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vHiiPackageUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initGuidUsage() {
- vGuidUsage.removeAllElements();
- vGuidUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vGuidUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vGuidUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vGuidUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vGuidUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initExternTypes() {
- vExternTypes.removeAllElements();
-
- vExternTypes.addElement(EnumerationData.EXTERNS_SPECIFICATION);
- vExternTypes.addElement(EnumerationData.EXTERNS_IMAGE);
- vExternTypes.addElement(EnumerationData.EXTERNS_DRIVER);
- vExternTypes.addElement(EnumerationData.EXTERNS_LIBRARY);
- vExternTypes.addElement(EnumerationData.EXTERNS_CALL_BACK);
- }
-
- private void initPcdDriverTypes() {
- vPcdDriverTypes.removeAllElements();
- vPcdDriverTypes.addElement("PEI_PCD_DRIVER");
- vPcdDriverTypes.addElement("DXE_PCD_DRIVER");
- }
-
- private void initPcdItemTypes() {
- vPcdItemTypes.removeAllElements();
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG);
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_FIXED_AT_BUILD);
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_PATCHABLE_IN_MODULE);
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC);
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC_EX);
- }
-
- private void initPcdUsage() {
- vPcdUsage.removeAllElements();
- vPcdUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vPcdUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vPcdUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vPcdUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- }
-
- private void initBuildTargets() {
- vBuildTargets.removeAllElements();
- vBuildTargets.addElement(EnumerationData.BUILD_TARGET_DEBUG);
- vBuildTargets.addElement(EnumerationData.BUILD_TARGET_RELEASE);
- }
-
- public Vector<String> getvCompontentType() {
- return vCompontentType;
- }
-
- public void setvCompontentType(Vector<String> componentType) {
- vCompontentType = componentType;
- }
-
- public Vector<String> getVModuleType() {
- return vModuleType;
- }
-
- public void setVModuleType(Vector<String> moduleType) {
- vModuleType = moduleType;
- }
-
- public Vector<String> getVLibraryUsage() {
- return vLibraryUsage;
- }
-
- public void setVLibClassDefUsage(Vector<String> libClassDefUsage) {
- vLibraryUsage = libClassDefUsage;
- }
-
- public Vector<String> getVLibClassDef() {
- return vLibClassDef;
- }
-
- public void setVLibClassDef(Vector<String> libClassDef) {
- vLibClassDef = libClassDef;
- }
-
- public Vector<String> getVCompontentType() {
- return vCompontentType;
- }
-
- public void setVCompontentType(Vector<String> compontentType) {
- vCompontentType = compontentType;
- }
-
- public Vector<String> getVLibClassDefBase() {
- return vLibClassDefBase;
- }
-
- public void setVLibClassDefBase(Vector<String> libClassDefBase) {
- vLibClassDefBase = libClassDefBase;
- }
-
- public Vector<String> getVLibClassDefDxeCore() {
- return vLibClassDefDxeCore;
- }
-
- public void setVLibClassDefDxeCore(Vector<String> libClassDefDxeCore) {
- vLibClassDefDxeCore = libClassDefDxeCore;
- }
-
- public Vector<String> getVLibClassDefDxeDriver() {
- return vLibClassDefDxeDriver;
- }
-
- public void setVLibClassDefDxeDriver(Vector<String> libClassDefDxeDriver) {
- vLibClassDefDxeDriver = libClassDefDxeDriver;
- }
-
- public Vector<String> getVLibClassDefDxeSmmDriver() {
- return vLibClassDefDxeSmmDriver;
- }
-
- public void setVLibClassDefDxeSmmDriver(Vector<String> libClassDefDxeSmmDriver) {
- vLibClassDefDxeSmmDriver = libClassDefDxeSmmDriver;
- }
-
- public Vector<String> getVLibClassDefPei() {
- return vLibClassDefPei;
- }
-
- public void setVLibClassDefPei(Vector<String> libClassDefPei) {
- vLibClassDefPei = libClassDefPei;
- }
-
- public Vector<String> getVLibClassDefPeim() {
- return vLibClassDefPeim;
- }
-
- public void setVLibClassDefPeim(Vector<String> libClassDefPeim) {
- vLibClassDefPeim = libClassDefPeim;
- }
-
- public Vector<String> getVLibClassDefUefiDriver() {
- return vLibClassDefUefiDriver;
- }
-
- public void setVLibClassDefUefiDriver(Vector<String> libClassDefUefiDriver) {
- vLibClassDefUefiDriver = libClassDefUefiDriver;
- }
-
- public Vector<String> getVSourceFilesFileType() {
- return vSourceFilesFileType;
- }
-
- public void setVSourceFilesFileType(Vector<String> sourceFilesFileType) {
- vSourceFilesFileType = sourceFilesFileType;
- }
-
- public Vector<String> getVSourceFilesToolChainFamily() {
- return vSourceFilesToolChainFamily;
- }
-
- public void setVSourceFilesToolChainFamily(Vector<String> sourceFilesToolChainFamily) {
- vSourceFilesToolChainFamily = sourceFilesToolChainFamily;
- }
-
- public void setVLibraryUsage(Vector<String> libraryUsage) {
- vLibraryUsage = libraryUsage;
- }
-
- public Vector<String> getVProtocolNotifyUsage() {
- return vProtocolNotifyUsage;
- }
-
- public void setVProtocolNotifyUsage(Vector<String> protocolNotifyUsage) {
- vProtocolNotifyUsage = protocolNotifyUsage;
- }
-
- public Vector<String> getVProtocolUsage() {
- return vProtocolUsage;
- }
-
- public void setVProtocolUsage(Vector<String> protocolUsage) {
- vProtocolUsage = protocolUsage;
- }
-
- public Vector<String> getVSupportedArchitectures() {
- return vSupportedArchitectures;
- }
-
- public void setVSupportedArchitectures(Vector<String> supportedArchitectures) {
- vSupportedArchitectures = supportedArchitectures;
- }
-
- public Vector<String> getVProtocolType() {
- return vProtocolType;
- }
-
- public void setVProtocolType(Vector<String> protocolType) {
- vProtocolType = protocolType;
- }
-
- public Vector<String> getVEventGroup() {
- return vEventGroup;
- }
-
- public void setVEventGroup(Vector<String> eventGroup) {
- vEventGroup = eventGroup;
- }
-
- public Vector<String> getVEventType() {
- return vEventType;
- }
-
- public void setVEventType(Vector<String> eventType) {
- vEventType = eventType;
- }
-
- public Vector<String> getVEventUsage() {
- return vEventUsage;
- }
-
- public void setVEventUsage(Vector<String> eventUsage) {
- vEventUsage = eventUsage;
- }
-
- public Vector<String> getVEnabled() {
- return vEnabled;
- }
-
- public void setVEnabled(Vector<String> enabled) {
- vEnabled = enabled;
- }
-
- public Vector<String> getVHobType() {
- return vHobType;
- }
-
- public void setVHobType(Vector<String> hobType) {
- vHobType = hobType;
- }
-
- public Vector<String> getVHobUsage() {
- return vHobUsage;
- }
-
- public void setVHobUsage(Vector<String> hobUsage) {
- vHobUsage = hobUsage;
- }
-
- public Vector<String> getVPpiNotifyUsage() {
- return vPpiNotifyUsage;
- }
-
- public void setVPpiNotifyUsage(Vector<String> ppiNotifyUsage) {
- vPpiNotifyUsage = ppiNotifyUsage;
- }
-
- public Vector<String> getVPpiType() {
- return vPpiType;
- }
-
- public void setVPpiType(Vector<String> ppiType) {
- vPpiType = ppiType;
- }
-
- public Vector<String> getVPpiUsage() {
- return vPpiUsage;
- }
-
- public void setVPpiUsage(Vector<String> ppiUsage) {
- vPpiUsage = ppiUsage;
- }
-
- public Vector<String> getVVariableUsage() {
- return vVariableUsage;
- }
-
- public void setVVariableUsage(Vector<String> variableUsage) {
- vVariableUsage = variableUsage;
- }
-
- public Vector<String> getVBootModeNames() {
- return vBootModeNames;
- }
-
- public void setVBootModeNames(Vector<String> bootModeNames) {
- vBootModeNames = bootModeNames;
- }
-
- public Vector<String> getVBootModeUsage() {
- return vBootModeUsage;
- }
-
- public void setVBootModeUsage(Vector<String> bootModeUsage) {
- vBootModeUsage = bootModeUsage;
- }
-
- public Vector<String> getVSystemTableUsage() {
- return vSystemTableUsage;
- }
-
- public void setVSystemTableUsage(Vector<String> systemTableUsage) {
- vSystemTableUsage = systemTableUsage;
- }
-
- public Vector<String> getVDataHubUsage() {
- return vDataHubUsage;
- }
-
- public void setVDataHubUsage(Vector<String> dataHubUsage) {
- vDataHubUsage = dataHubUsage;
- }
-
- public Vector<String> getVGuidUsage() {
- return vGuidUsage;
- }
-
- public void setVGuidUsage(Vector<String> guidUsage) {
- vGuidUsage = guidUsage;
- }
-
- public Vector<String> getVHiiPackageUsage() {
- return vHiiPackageUsage;
- }
-
- public void setVHiiPackageUsage(Vector<String> hiiPackageUsage) {
- vHiiPackageUsage = hiiPackageUsage;
- }
-
- public Vector<String> getVPcdItemTypes() {
- return vPcdItemTypes;
- }
-
- public void setVPcdItemTypes(Vector<String> pcdItemTypes) {
- vPcdItemTypes = pcdItemTypes;
- }
-
- public Vector<String> getVExternTypes() {
- return vExternTypes;
- }
-
- public void setVExternTypes(Vector<String> externTypes) {
- vExternTypes = externTypes;
- }
-
- public Vector<String> getVPcdDriverTypes() {
- return vPcdDriverTypes;
- }
-
- public void setVPcdDriverTypes(Vector<String> pcdDriverTypes) {
- vPcdDriverTypes = pcdDriverTypes;
- }
-
- public Vector<String> getVBoolean() {
- return vBoolean;
- }
-
- public void setVBoolean(Vector<String> boolean1) {
- vBoolean = boolean1;
- }
-
- public Vector<String> getVFrameworkModuleTypes() {
- return vFrameworkModuleTypes;
- }
-
- public void setVFrameworkModuleTypes(Vector<String> frameworkModuleTypes) {
- vFrameworkModuleTypes = frameworkModuleTypes;
- }
-
- public Vector<String> getVPackageUsage() {
- return vPackageUsage;
- }
-
- public void setVPackageUsage(Vector<String> packageUsage) {
- vPackageUsage = packageUsage;
- }
-
- public Vector<String> getVToolCode() {
- return vToolCode;
- }
-
- public void setVToolCode(Vector<String> toolCode) {
- vToolCode = toolCode;
- }
-
- public Vector<String> getVPcdUsage() {
- return vPcdUsage;
- }
-
- public void setVPcdUsage(Vector<String> pcdUsage) {
- vPcdUsage = pcdUsage;
- }
-
- public Vector<String> getVBuildTargets() {
- return vBuildTargets;
- }
-
- public void setVBuildTargets(Vector<String> buildTargets) {
- vBuildTargets = buildTargets;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java
deleted file mode 100644
index 7f15de8f89..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/** @file
-
- The file is used to provides interfaces for file operations
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-
-public class FileOperation {
-
- /**
-
- @param args
- * @throws Exception
-
- **/
- public static void main(String[] args) throws Exception {
- FileOperation.newFolder("C:\\aaa\\aaa\\aaa\\aaa\\aaa");
- }
-
- /**
- To new a folder
-
- @param folderPath The folder path to be created
- @throws Exception
-
- **/
- public static void newFolder(String folderPath) throws Exception {
- folderPath = Tools.convertPathToCurrentOsType(folderPath);
- File f = new File(folderPath);
- f.mkdirs();
- }
-
- /**
- Delete a file
-
- @param filePath The file path to be deleted
- @throws Exception
-
- **/
- public static void delFile(String filePath) throws Exception {
- File f = new File(filePath);
- if (f.exists()) {
- f.delete();
- }
- }
-
- /**
- Delete a folder and all its files
-
- @param filePath The name of the folder which need be deleted
- @throws Exception
-
- **/
- public static void delFolder(String filePath) throws Exception {
- File f = new File(filePath);
- if (!f.exists()) {
- return;
- }
- if (!f.isDirectory()) {
- return;
- }
- delFolder(f);
- }
-
- /**
- Delete a folder and all its files
-
- @param fleFolderName The name of the folder which need be deleted
-
- @retval true - Delete successfully
- @retval false - Delete successfully
-
- **/
- private static boolean delFolder(File fileName) throws Exception {
- boolean blnIsDeleted = true;
-
- File[] aryAllFiles = fileName.listFiles();
-
- for (int indexI = 0; indexI < aryAllFiles.length; indexI++) {
- if (blnIsDeleted) {
- if (aryAllFiles[indexI].isDirectory()) {
- //
- //If is a directory, recursively call this function to delete sub folders
- //
- blnIsDeleted = delFolder(aryAllFiles[indexI]);
- } else if (aryAllFiles[indexI].isFile()) {
- //
- //If is a file, delete it
- //
- if (!aryAllFiles[indexI].delete()) {
- blnIsDeleted = false;
- }
- }
- }
- }
- if (blnIsDeleted) {
- fileName.delete();
- }
- return blnIsDeleted;
- }
-
- /**
- Copy a file
-
- @param oldPath
- @param newPath
- @throws Exception
-
- **/
- public static void copyFile(String oldPath, String newPath) throws Exception {
- oldPath = Tools.convertPathToCurrentOsType(oldPath);
- newPath = Tools.convertPathToCurrentOsType(newPath);
-
- int byteCount = 0;
- File oldFile = new File(oldPath);
-
- File newFile = new File(Tools.getFilePathOnly(newPath));
- if (!newFile.exists()) {
- newFolder(Tools.getFilePathOnly(newPath));
- }
-
- if (oldFile.exists()) {
- InputStream is = new FileInputStream(oldPath);
- FileOutputStream fos = new FileOutputStream(newPath);
- byte[] buffer = new byte[1024];
-
- while ((byteCount = is.read(buffer)) != -1) {
- fos.write(buffer, 0, byteCount);
- }
-
- is.close();
- }
- }
-
- /**
- Copy a folder
-
- @param oldPath
- @param newPath
- @throws Exception
-
- **/
- public static void copyFolder(String oldPath, String newPath) throws Exception {
- File oldFile = new File(oldPath);
-
- //
- // Create new file path first
- //
- newFolder(newPath);
-
- String[] files = oldFile.list();
- File temp = null;
- for (int index = 0; index < files.length; index++) {
- if (oldPath.endsWith(DataType.FILE_SEPARATOR)) {
- temp = new File(oldPath + files[index]);
- } else {
- temp = new File(oldPath + DataType.FILE_SEPARATOR + files[index]);
- }
-
- if (temp.isFile()) {
- FileInputStream fis = new FileInputStream(temp);
- FileOutputStream fos = new FileOutputStream(newPath + DataType.FILE_SEPARATOR
- + (temp.getName()).toString());
- byte[] b = new byte[1024 * 5];
- int len;
- while ((len = fis.read(b)) != -1) {
- fos.write(b, 0, len);
- }
- fos.flush();
- fos.close();
- fis.close();
- }
- if (temp.isDirectory()) {
- copyFolder(oldPath + DataType.FILE_SEPARATOR + files[index], newPath + DataType.FILE_SEPARATOR
- + files[index]);
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java
deleted file mode 100644
index ed175e5343..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/** @file
- The file is used to provide initializing global data.
-
- Copyright (c) 2006, 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.
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.io.IOException;
-import java.util.Vector;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.MsaFilesDocument.MsaFiles;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleList;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageList;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformList;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class GlobalData {
-
- public static FrameworkDatabase fdb = null;
-
- public static OpeningModuleList openingModuleList = new OpeningModuleList();
-
- public static OpeningPackageList openingPackageList = new OpeningPackageList();
-
- public static OpeningPlatformList openingPlatformList = new OpeningPlatformList();
-
- public static Vector<ModuleIdentification> vModuleList = new Vector<ModuleIdentification>();
-
- public static Vector<PackageIdentification> vPackageList = new Vector<PackageIdentification>();
-
- public static Vector<PlatformIdentification> vPlatformList = new Vector<PlatformIdentification>();
-
- public static void init() {
- initDatabase();
- initPackage();
- initPlatform();
- initModule();
- }
-
- public static void initDatabase() {
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
- try {
- fdb = OpenFile.openFrameworkDb(strFrameworkDbFilePath);
- } catch (XmlException e) {
- Log.err("Open Framework Database " + strFrameworkDbFilePath, e.getMessage());
- return;
- } catch (Exception e) {
- Log.err("Open Framework Database " + strFrameworkDbFilePath, "Invalid file type");
- return;
- }
- }
-
- public static void initModule() {
- vModuleList = new Vector<ModuleIdentification>();
- openingModuleList = new OpeningModuleList();
-
- ModuleSurfaceArea msa = null;
- Vector<String> modulePaths = new Vector<String>();
- Identification id = null;
- ModuleIdentification mid = null;
- String packagePath = null;
- String modulePath = null;
-
- //
- // For each package, get all modules list
- //
- if (vPackageList.size() > 0) {
- for (int indexI = 0; indexI < vPackageList.size(); indexI++) {
- packagePath = vPackageList.elementAt(indexI).getPath();
- modulePaths = getAllModulesOfPackage(packagePath);
-
- for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
- try {
- modulePath = modulePaths.get(indexJ);
- msa = OpenFile.openMsaFile(modulePath);
-
- } catch (IOException e) {
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());
- continue;
- } catch (XmlException e) {
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());
- continue;
- } catch (Exception e) {
- Log.err("Open Module Surface Area " + modulePath, "Invalid file type");
- continue;
- }
- id = Tools.getId(modulePath, msa);
- mid = new ModuleIdentification(id, vPackageList.elementAt(indexI));
- vModuleList.addElement(mid);
- openingModuleList.insertToOpeningModuleList(mid, msa);
- }
- }
- Sort.sortModules(vModuleList, DataType.SORT_TYPE_ASCENDING);
- }
- }
-
- public static void initPackage() {
- vPackageList = new Vector<PackageIdentification>();
- openingPackageList = new OpeningPackageList();
- if (fdb != null) {
- for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR
- + fdb.getPackageList().getFilenameArray(index).getStringValue();
- path = Tools.convertPathToCurrentOsType(path);
- PackageSurfaceArea spd = null;
- PackageIdentification id = null;
- try {
- spd = OpenFile.openSpdFile(path);
- } catch (IOException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- continue;
- } catch (XmlException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- continue;
- } catch (Exception e) {
- Log.err("Open Package Surface Area " + path, "Invalid file type");
- continue;
- }
- id = Tools.getId(path, spd);
- vPackageList.addElement(id);
- openingPackageList.insertToOpeningPackageList(id, spd);
- }
- Sort.sortPackages(vPackageList, DataType.SORT_TYPE_ASCENDING);
- }
- }
-
- public static void initPlatform() {
- vPlatformList = new Vector<PlatformIdentification>();
- openingPlatformList = new OpeningPlatformList();
-
- if (fdb != null) {
- for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR
- + fdb.getPlatformList().getFilenameArray(index).getStringValue();
- path = Tools.convertPathToCurrentOsType(path);
- PlatformSurfaceArea fpd = null;
- PlatformIdentification id = null;
- try {
- fpd = OpenFile.openFpdFile(path);
- } catch (IOException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- continue;
- } catch (XmlException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- continue;
- } catch (Exception e) {
- Log.err("Open Platform Surface Area " + path, "Invalid file type");
- continue;
- }
- id = Tools.getId(path, fpd);
- vPlatformList.addElement(new PlatformIdentification(id));
- openingPlatformList.insertToOpeningPlatformList(id, fpd);
- }
- Sort.sortPlatforms(vPlatformList, DataType.SORT_TYPE_ASCENDING);
- }
- }
-
- /**
- Get all modules' paths from one package
-
- @return a Vector with all modules' path
-
- **/
- public static Vector<String> getAllModulesOfPackage(String path) {
- Vector<String> modulePath = new Vector<String>();
- try {
- MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();
- if (files != null) {
- for (int index = 0; index < files.getFilenameList().size(); index++) {
- String msaPath = files.getFilenameList().get(index);
- msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;
- msaPath = Tools.convertPathToCurrentOsType(msaPath);
- modulePath.addElement(msaPath);
- }
- }
- } catch (IOException e) {
- Log.err("Get all modules from a package " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Get all modules from a package " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Get all modules from a package " + path, e.getMessage());
- }
- return modulePath;
- }
-
- /**
- Get a module id
-
- @param moduleGuid
- @param moduleVersion
- @param packageGuid
- @param packageVersion
- @return
-
- **/
- public static ModuleIdentification findModuleId(String moduleGuid, String moduleVersion, String packageGuid,
- String packageVersion) {
- ModuleIdentification mid = null;
- for (int index = 0; index < vModuleList.size(); index++) {
- if (vModuleList.elementAt(index).equals(moduleGuid, moduleVersion, packageGuid, packageVersion)) {
- mid = vModuleList.elementAt(index);
- break;
- }
- }
- return mid;
- }
-
- /**
- Get a package id
-
- @param packageGuid
- @param packageVersion
- @return
-
- **/
- public static PackageIdentification findPackageId(String packageGuid, String packageVersion) {
- PackageIdentification pid = null;
- for (int index = 0; index < vPackageList.size(); index++) {
- if (vPackageList.elementAt(index).equals(packageGuid, packageVersion)) {
- pid = vPackageList.elementAt(index);
- break;
- }
- }
- return pid;
- }
-
- /**
- Get a platform id
-
- @param platformGuid
- @param platformVersion
- @return
-
- **/
- public static PlatformIdentification findPlatformId(String platformGuid, String platformVersion) {
- PlatformIdentification pid = null;
- for (int index = 0; index < vPlatformList.size(); index++) {
- if (vPlatformList.elementAt(index).equals(platformGuid, platformVersion)) {
- pid = vPlatformList.elementAt(index);
- break;
- }
- }
- return pid;
- }
-
- /**
-
- @param relativePath
- @param mode
- @return
-
- **/
- public static boolean isDuplicateRelativePath(String relativePath, int mode) {
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- for (int index = 0; index < vModuleList.size(); index++) {
- String path = vModuleList.elementAt(index).getPath();
- if (Tools.getFilePathOnly(path).equals(relativePath)) {
- return true;
- }
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- for (int index = 0; index < vPackageList.size(); index++) {
- String path = vPackageList.elementAt(index).getPath();
- if (Tools.getFilePathOnly(path).equals(relativePath)) {
- return true;
- }
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- for (int index = 0; index < vPlatformList.size(); index++) {
- String path = vPlatformList.elementAt(index).getPath();
- if (Tools.getFilePathOnly(path).equals(relativePath)) {
- return true;
- }
- }
- }
-
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java
deleted file mode 100644
index 57ba11b9af..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/** @file
-
- The file is used to override DefaultTableModel to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import javax.swing.table.DefaultTableModel;
-
-public class IDefaultTableModel extends DefaultTableModel {
-
- ///
- ///
- ///
- private static final long serialVersionUID = -1782544418084080185L;
-
- public IDefaultTableModel() {
- super();
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableModel#isCellEditable(int, int)
- *
- */
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IFileFilter.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IFileFilter.java
deleted file mode 100644
index 8194a316c6..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IFileFilter.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/** @file
-
- The file is used to override FileFilter to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-
-import javax.swing.filechooser.FileFilter;
-
-/**
- The class is used to override FileFilter to provides customized interfaces
-
- **/
-public class IFileFilter extends FileFilter {
-
- private String strExt;
-
- /**
- Reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- This is the default constructor
-
- @param ext
-
- **/
- public IFileFilter(String ext) {
- this.strExt = ext;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
- *
- * Override method "accept"
- *
- */
- public boolean accept(File file) {
- if (file.isDirectory()) {
- return true;
- }
- String strFileName = file.getName();
- int intIndex = strFileName.lastIndexOf('.');
- if (intIndex > 0 && intIndex < strFileName.length() - 1) {
- String strExtension = strFileName.substring(intIndex + 1).toLowerCase();
- if (strExtension.equals(strExt))
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.filechooser.FileFilter#getDescription()
- *
- * Override method "getDescription" to config description via different file type
- *
- */
- public String getDescription() {
- if (strExt.equals(DataType.MODULE_SURFACE_AREA_EXT))
- return DataType.MODULE_SURFACE_AREA_EXT_DESCRIPTION;
- if (strExt.equals(DataType.PACKAGE_SURFACE_AREA_EXT))
- return DataType.PACKAGE_SURFACE_AREA_EXT_DESCRIPTION;
- if (strExt.equals(DataType.PLATFORM_SURFACE_AREA_EXT))
- return DataType.PLATFORM_SURFACE_AREA_EXT_DESCRIPTION;
- if (strExt.equals(DataType.TEXT_FILE_EXT))
- return DataType.TEXT_FILE_EXT_DESCRIPTION;
- if (strExt.equals(DataType.FAR_SURFACE_AREA_EXT))
- return DataType.FAR_SURFACE_AREA_EXT_DESCRIPTION;
- return "";
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/Identification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/Identification.java
deleted file mode 100644
index 03717b560b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/Identification.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/** @file
-
- The file is used to save basic information
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.Identifications;
-
-public class Identification {
-
- ///
- /// Define class members
- ///
- private String name;
-
- private String guid;
-
- private String version;
-
- private String path;
-
- public Identification(String name, String guid, String version) {
- this.name = name;
- this.guid = guid;
- this.version = version;
- }
-
- public Identification() {
-
- }
-
- public Identification(String name, String guid, String version, String path) {
- this.name = name;
- this.guid = guid;
- this.version = version;
- this.path = path;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof Identification) {
- Identification id = (Identification) obj;
- if (path.equals(id.path)) {
- return true;
- }
- return false;
- } else {
- return super.equals(obj);
- }
- }
-
- public boolean equalsWithGuid(Object obj) {
- if (obj instanceof Identification) {
- Identification id = (Identification) obj;
- if (guid.equalsIgnoreCase(id.guid)) {
- if (version == null || id.version == null) {
- return true;
- } else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")) {
- return true;
- } else if (version.equalsIgnoreCase(id.version)) {
- return true;
- }
- }
- return false;
- } else {
- return super.equals(obj);
- }
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public String getName() {
- return name;
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getPath() {
- return path;
- }
-
- public int hashCode() {
- return guid.toLowerCase().hashCode();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningFileType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningFileType.java
deleted file mode 100644
index 9811c19868..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningFileType.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/** @file
-
- The file is used to define common opening file type
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import javax.swing.tree.TreePath;
-
-
-public class OpeningFileType {
- //
- // Define class members
- //
- private boolean isSaved = true;
-
- private boolean isNew = false;
-
- private boolean isOpen = false;
-
- private Set<TreePath> treePath = new LinkedHashSet<TreePath>();
-
- public OpeningFileType() {
-
- }
-
- public boolean isNew() {
- return isNew;
- }
-
- public void setNew(boolean isNew) {
- this.isNew = isNew;
- }
-
- public boolean isSaved() {
- return isSaved;
- }
-
- public void setSaved(boolean isSaved) {
- this.isSaved = isSaved;
- }
-
- public boolean isOpen() {
- return isOpen;
- }
-
- public void setOpen(boolean isOpen) {
- this.isOpen = isOpen;
- }
-
- public Set<TreePath> getTreePath() {
- return treePath;
- }
-
- public void setTreePath(Set<TreePath> treePath) {
- this.treePath = treePath;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java
deleted file mode 100644
index c98d6f95b5..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/** @file
-
- The file is used to define opening module list
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.tree.TreePath;
-
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-public class OpeningModuleList {
- private Vector<OpeningModuleType> vOpeningModuleList = new Vector<OpeningModuleType>();
-
- public OpeningModuleList() {
-
- }
-
- public Vector<OpeningModuleType> getVOpeningModuleList() {
- return vOpeningModuleList;
- }
-
- public void setVOpeningModuleList(Vector<OpeningModuleType> openingModuleList) {
- vOpeningModuleList = openingModuleList;
- }
-
- public void insertToOpeningModuleList(ModuleIdentification id, ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {
- vOpeningModuleList.addElement(new OpeningModuleType(id, xmlMsa));
- }
-
- public OpeningModuleType getOpeningModuleByIndex(int index) {
- if (index > -1 && index < vOpeningModuleList.size()) {
- return vOpeningModuleList.elementAt(index);
- }
- return null;
- }
-
- public OpeningModuleType getOpeningModuleById(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningModuleList.elementAt(index);
- }
- return null;
- }
-
- public int findIndexOfListById(ModuleIdentification id) {
- for (int index = 0; index < vOpeningModuleList.size(); index++) {
- if (vOpeningModuleList.elementAt(index).getId().equals(id)) {
- return index;
- }
- }
- return -1;
- }
-
- public void removeFromOpeningModuleListByIndex(int index) {
- if (index > -1 && index < vOpeningModuleList.size()) {
- vOpeningModuleList.removeElementAt(index);
- }
- }
-
- public void removeFromOpeningModuleListById(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningModuleList.removeElementAt(findIndexOfListById(id));
- }
- }
-
- public void removeAllFromOpeningModuleList() {
- vOpeningModuleList.removeAllElements();
- }
-
- public ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleSurfaceAreaFromId(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).getXmlMsa();
- }
- return null;
- }
-
- public boolean existsModule(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return true;
- }
- return false;
- }
-
- public void setModuleSaved(ModuleIdentification id, boolean isSaved) {
- setModuleSaved(findIndexOfListById(id), isSaved);
- }
-
- public void setModuleSaved(int index, boolean isSaved) {
- if (index > -1) {
- vOpeningModuleList.elementAt(index).setSaved(isSaved);
- }
- }
-
- public boolean getModuleSaved(ModuleIdentification id) {
- return getModuleSaved(findIndexOfListById(id));
- }
-
- public boolean getModuleSaved(int index) {
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).isSaved();
- }
- return true;
- }
-
- public void setModuleOpen(ModuleIdentification id, boolean isOpen) {
- setModuleOpen(findIndexOfListById(id), isOpen);
- }
-
- public void setModuleOpen(int index, boolean isOpen) {
- if (index > -1) {
- vOpeningModuleList.elementAt(index).setOpen(isOpen);
- }
- }
-
- public boolean getModuleOpen(ModuleIdentification id) {
- return getModuleOpen(findIndexOfListById(id));
- }
-
- public boolean getModuleOpen(int index) {
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).isOpen();
- }
- return false;
- }
-
- public void setTreePathById(ModuleIdentification id, Set<TreePath> treePath) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningModuleList.elementAt(index).setTreePath(treePath);
- }
- }
-
- public Set<TreePath> getTreePathById(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public Set<TreePath> getTreePathByIndex(int index) {
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public ModuleIdentification getIdByPath(String path) {
- ModuleIdentification id = new ModuleIdentification(null, null, null, path);
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).getId();
- }
- return null;
- }
-
- public ModuleIdentification getIdByGuidVersion(String guid, String version) {
- for (int index = 0; index < vOpeningModuleList.size(); index++) {
- ModuleIdentification id = vOpeningModuleList.elementAt(index).getId();
- if (version != null) {
- if (id.getGuid().equals(guid) && id.getVersion().equals(version)) {
- return id;
- }
- } else {
- if (id.getGuid().equals(guid)) {
- return id;
- }
- }
- }
- return null;
- }
-
- public void setNew(ModuleIdentification id, boolean isNew) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningModuleList.elementAt(index).setNew(isNew);
- }
- }
-
- public void closeAll() {
- for (int index = 0; index < this.size(); index++) {
- this.setModuleOpen(index, false);
- this.setModuleSaved(index, true);
- }
- }
-
- public int size() {
- return vOpeningModuleList.size();
- }
-
- public boolean isSaved() {
- for (int index = 0; index < this.size(); index++) {
- if (!this.getModuleSaved(index)) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isOpen() {
- for (int index = 0; index < this.size(); index++) {
- if (this.getModuleOpen(index)) {
- return true;
- }
- }
- return false;
- }
-
- public void reload(int index) {
- if (index > -1) {
- vOpeningModuleList.elementAt(index).reload();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.java
deleted file mode 100644
index 3ff29a94d3..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/** @file
-
- The file is used to define opening module type
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-public class OpeningModuleType extends OpeningFileType{
- //
- // Define class members
- //
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa = null;
-
- private ModuleIdentification id = null;
-
- public OpeningModuleType() {
-
- }
-
- public OpeningModuleType(ModuleIdentification identification, ModuleSurfaceAreaDocument.ModuleSurfaceArea msa) {
- this.id = identification;
- this.xmlMsa = msa;
- }
-
- public ModuleSurfaceAreaDocument.ModuleSurfaceArea getXmlMsa() {
- return xmlMsa;
- }
-
- public void setXmlMsa(ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {
- this.xmlMsa = xmlMsa;
- }
-
- public ModuleIdentification getId() {
- return id;
- }
-
- public void setId(ModuleIdentification id) {
- this.id = id;
- }
-
- public void reload() {
- if (this.id != null) {
- String path = id.getPath();
- if (path.length() > 0) {
- try {
- this.xmlMsa = OpenFile.openMsaFile(id.getPath());
- } catch (IOException e) {
- Log.err("Open Module Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Module Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Module Surface Area " + path, "Invalid file type");
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java
deleted file mode 100644
index 0db75176ba..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/** @file
-
- The file is used to define opening package list
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.tree.TreePath;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class OpeningPackageList {
- private Vector<OpeningPackageType> vOpeningPackageList = new Vector<OpeningPackageType>();
-
- public OpeningPackageList() {
-
- }
-
- public Vector<OpeningPackageType> getVOpeningPackageList() {
- return vOpeningPackageList;
- }
-
- public void setVOpeningPackageList(Vector<OpeningPackageType> openingPackageList) {
- vOpeningPackageList = openingPackageList;
- }
-
- public void insertToOpeningPackageList(PackageIdentification id, PackageSurfaceAreaDocument.PackageSurfaceArea xmlMsa) {
- vOpeningPackageList.addElement(new OpeningPackageType(id, xmlMsa));
- }
-
- public OpeningPackageType getOpeningPackageByIndex(int index) {
- if (index > -1 && index < vOpeningPackageList.size()) {
- return vOpeningPackageList.elementAt(index);
- }
- return null;
- }
-
- public OpeningPackageType getOpeningPackageById(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPackageList.elementAt(index);
- }
- return null;
- }
-
- public int findIndexOfListById(PackageIdentification id) {
- for (int index = 0; index < vOpeningPackageList.size(); index++) {
- if (vOpeningPackageList.elementAt(index).getId().equals(id)) {
- return index;
- }
- }
- return -1;
- }
-
- public void removeFromOpeningPackageListByIndex(int index) {
- if (index > -1 && index < vOpeningPackageList.size()) {
- vOpeningPackageList.removeElementAt(index);
- }
- }
-
- public void removeFromOpeningPackageListById(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPackageList.removeElementAt(findIndexOfListById(id));
- }
- }
-
- public void removeAllFromOpeningPackageList() {
- vOpeningPackageList.removeAllElements();
- }
-
- public PackageSurfaceAreaDocument.PackageSurfaceArea getPackageSurfaceAreaFromId(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).getXmlSpd();
- }
- return null;
- }
-
- public boolean existsPackage(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return true;
- }
- return false;
- }
-
- public void setPackageSaved(PackageIdentification id, boolean isSaved) {
- setPackageSaved(findIndexOfListById(id), isSaved);
- }
-
- public void setPackageSaved(int index, boolean isSaved) {
- if (index > -1) {
- vOpeningPackageList.elementAt(index).setSaved(isSaved);
- }
- }
-
- public boolean getPackageSaved(PackageIdentification id) {
- return getPackageSaved(findIndexOfListById(id));
- }
-
- public boolean getPackageSaved(int index) {
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).isSaved();
- }
- return true;
- }
-
- public void setPackageOpen(PackageIdentification id, boolean isOpem) {
- setPackageOpen(findIndexOfListById(id), isOpem);
- }
-
- public void setPackageOpen(int index, boolean isOpem) {
- if (index > -1) {
- vOpeningPackageList.elementAt(index).setOpen(isOpem);
- }
- }
-
- public boolean getPackageOpen(PackageIdentification id) {
- return getPackageOpen(findIndexOfListById(id));
- }
-
- public boolean getPackageOpen(int index) {
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).isOpen();
- }
- return false;
- }
-
- public void setTreePathById(PackageIdentification id, Set<TreePath> treePath) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPackageList.elementAt(index).setTreePath(treePath);
- }
- }
-
- public Set<TreePath> getTreePathById(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public Set<TreePath> getTreePathByIndex(int index) {
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public PackageIdentification getIdByPath(String path) {
- PackageIdentification id = new PackageIdentification(null, null, null, path);
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).getId();
- }
- return null;
- }
-
- public PackageIdentification getIdByGuidVersion(String guid, String version) {
- for (int index = 0; index < vOpeningPackageList.size(); index++) {
- PackageIdentification id = vOpeningPackageList.elementAt(index).getId();
- if (version != null) {
- if (id.getGuid().equals(guid) && id.getVersion().equals(version)) {
- return id;
- }
- } else {
- if (id.getGuid().equals(guid)) {
- return id;
- }
- }
- }
- return null;
- }
-
- public void setNew(PackageIdentification id, boolean isNew) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPackageList.elementAt(index).setNew(isNew);
- }
- }
-
- public void closeAll() {
- for (int index = 0; index < this.size(); index++) {
- this.setPackageOpen(index, false);
- this.setPackageSaved(index, true);
- }
- }
-
- public int size() {
- return vOpeningPackageList.size();
- }
-
- public boolean isSaved() {
- for (int index = 0; index < this.size(); index++) {
- if (!this.getPackageSaved(index)) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isOpen() {
- for (int index = 0; index < this.size(); index++) {
- if (this.getPackageOpen(index)) {
- return true;
- }
- }
- return false;
- }
-
- public void reload(int index) {
- if (index > -1) {
- vOpeningPackageList.elementAt(index).reload();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java
deleted file mode 100644
index 22f3ce311d..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/** @file
-
- The file is used to define opening package type
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class OpeningPackageType extends OpeningFileType {
- //
- // Define class members
- //
- private PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd = null;
-
- private PackageIdentification id = null;
-
- public OpeningPackageType() {
-
- }
-
- public OpeningPackageType(PackageIdentification identification, PackageSurfaceAreaDocument.PackageSurfaceArea spd) {
- this.id = identification;
- this.xmlSpd = spd;
- }
-
- public PackageSurfaceAreaDocument.PackageSurfaceArea getXmlSpd() {
- return xmlSpd;
- }
-
- public void setXmlSpd(PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd) {
- this.xmlSpd = xmlSpd;
- }
-
- public PackageIdentification getId() {
- return id;
- }
-
- public void setId(PackageIdentification id) {
- this.id = id;
- }
-
- public void reload() {
- if (this.id != null) {
- String path = id.getPath();
- if (path.length() > 0) {
- try {
- this.xmlSpd = OpenFile.openSpdFile(id.getPath());
- } catch (IOException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Package Surface Area " + path, "Invalid file type");
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformList.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformList.java
deleted file mode 100644
index a2ce431c0b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformList.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/** @file
-
- The file is used to define opening package list
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.tree.TreePath;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class OpeningPlatformList {
-
- private Vector<OpeningPlatformType> vOpeningPlatformList = new Vector<OpeningPlatformType>();
-
- public OpeningPlatformList() {
-
- }
-
- public Vector<OpeningPlatformType> getVOpeningPlatformList() {
- return vOpeningPlatformList;
- }
-
- public void setVOpeningPlatformList(Vector<OpeningPlatformType> openingPlatformList) {
- vOpeningPlatformList = openingPlatformList;
- }
-
- public void insertToOpeningPlatformList(PlatformIdentification id, PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {
- vOpeningPlatformList.addElement(new OpeningPlatformType(id, xmlFpd));
- }
-
- public OpeningPlatformType getOpeningPlatformByIndex(int index) {
- if (index > -1 && index < vOpeningPlatformList.size()) {
- return vOpeningPlatformList.elementAt(index);
- }
- return null;
- }
-
- public OpeningPlatformType getOpeningPlatformById(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index);
- }
- return null;
- }
-
- public int findIndexOfListById(PlatformIdentification id) {
- for (int index = 0; index < vOpeningPlatformList.size(); index++) {
- if (vOpeningPlatformList.elementAt(index).getId().equals(id)) {
- return index;
- }
- }
- return -1;
- }
-
- public void removeFromOpeningPlatformListByIndex(int index) {
- if (index > -1 && index < vOpeningPlatformList.size()) {
- vOpeningPlatformList.removeElementAt(index);
- }
- }
-
- public void removeFromOpeningPlatformListById(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPlatformList.removeElementAt(findIndexOfListById(id));
- }
- }
-
- public void removeAllFromOpeningPlatformList() {
- vOpeningPlatformList.removeAllElements();
- }
-
- public PlatformSurfaceAreaDocument.PlatformSurfaceArea getPlatformSurfaceAreaFromId(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).getXmlFpd();
- }
- return null;
- }
-
- public boolean existsPlatform(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return true;
- }
- return false;
- }
-
-
- public void setPlatformSaved(PlatformIdentification id, boolean isSaved) {
- setPlatformSaved(findIndexOfListById(id), isSaved);
- }
-
- public void setPlatformSaved(int index, boolean isSaved) {
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).setSaved(isSaved);
- }
- }
-
- public boolean getPlatformSaved(PlatformIdentification id) {
- return getPlatformSaved(findIndexOfListById(id));
- }
-
- public boolean getPlatformSaved(int index) {
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).isSaved();
- }
- return true;
- }
-
- public void setPlatformOpen(PlatformIdentification id, boolean isOpen) {
- setPlatformOpen(findIndexOfListById(id), isOpen);
- }
-
- public void setPlatformOpen(int index, boolean isOpen) {
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).setOpen(isOpen);
- }
- }
-
- public boolean getPlatformOpen(PlatformIdentification id) {
- return getPlatformOpen(findIndexOfListById(id));
- }
-
- public boolean getPlatformOpen(int index) {
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).isOpen();
- }
- return false;
- }
-
- public void setTreePathById(PlatformIdentification id, Set<TreePath> treePath) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).setTreePath(treePath);
- }
- }
-
- public Set<TreePath> getTreePathById(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public Set<TreePath> getTreePathByIndex(int index) {
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public PlatformIdentification getIdByPath(String path) {
- PlatformIdentification id = new PlatformIdentification(null, null, null, path);
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).getId();
- }
- return null;
- }
-
- public void setNew(PlatformIdentification id, boolean isNew) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).setNew(isNew);
- }
- }
-
- public void closeAll() {
- for (int index = 0; index < this.size(); index++) {
- this.setPlatformOpen(index, false);
- this.setPlatformSaved(index, true);
- }
- }
-
- public int size() {
- return vOpeningPlatformList.size();
- }
-
- public boolean isSaved() {
- for (int index = 0; index < this.size(); index++) {
- if (!this.getPlatformSaved(index)) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isOpen() {
- for (int index = 0; index < this.size(); index++) {
- if (this.getPlatformOpen(index)) {
- return true;
- }
- }
- return false;
- }
-
- public void reload(int index) {
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).reload();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformType.java
deleted file mode 100644
index 7a822c91c8..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformType.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/** @file
-
- The file is used to define opening platform type
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class OpeningPlatformType extends OpeningFileType {
- //
- // Define class members
- //
- private PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd = null;
-
- private PlatformIdentification id = null;
-
- public OpeningPlatformType() {
-
- }
-
- public OpeningPlatformType(PlatformIdentification identification, PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this.id = identification;
- this.xmlFpd = fpd;
- }
-
- public PlatformSurfaceAreaDocument.PlatformSurfaceArea getXmlFpd() {
- return xmlFpd;
- }
-
- public void setXmlFpd(PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {
- this.xmlFpd = xmlFpd;
- }
-
- public PlatformIdentification getId() {
- return id;
- }
-
- public void setId(PlatformIdentification id) {
- this.id = id;
- }
-
- public void reload() {
- if (this.id != null) {
- String path = id.getPath();
- if (path.length() > 0) {
- try {
- this.xmlFpd = OpenFile.openFpdFile(id.getPath());
- } catch (IOException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Platform Surface Area " + path, "Invalid file type");
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigId.java
deleted file mode 100644
index f446693004..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigId.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file
-
- The file is used to define Tool Chain Configuration Identification
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-public class ToolChainConfigId {
-
- public static final String COMMENTS = "#";
-
- public static final String EQUALS = "=";
-
- private String name = "";
-
- private String value = "";
-
- public ToolChainConfigId(String strName, String strValue) {
- this.name = strName;
- this.value = strValue;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public boolean equals(ToolChainConfigId id) {
- if (this.name.equals(id.name)) {
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java
deleted file mode 100644
index 49aac3d074..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/** @file
-
- The file is used to define Tool Chain Configuration Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Vector;
-
-public class ToolChainConfigVector {
-
- private Vector<ToolChainConfigId> vToolChainConfigs = new Vector<ToolChainConfigId>();
-
- public int findToolChainConfigs(ToolChainConfigId sfi) {
- for (int index = 0; index < vToolChainConfigs.size(); index++) {
- if (vToolChainConfigs.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findToolChainConfigs(String name) {
- for (int index = 0; index < vToolChainConfigs.size(); index++) {
- if (vToolChainConfigs.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public ToolChainConfigId getToolChainConfigs(int index) {
- if (index > -1) {
- return vToolChainConfigs.elementAt(index);
- } else {
- return null;
- }
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getToolChainConfigs(index).getName());
- v.addElement(getToolChainConfigs(index).getValue());
- return v;
- }
-
- public void addToolChainConfigs(ToolChainConfigId arg0) {
- vToolChainConfigs.addElement(arg0);
- }
-
- public void updateToolChainConfigs(ToolChainConfigId arg0, int arg1) {
- vToolChainConfigs.setElementAt(arg0, arg1);
- }
-
- public void removeToolChainConfigs(ToolChainConfigId arg0) {
- int index = findToolChainConfigs(arg0);
- if (index > -1) {
- vToolChainConfigs.removeElementAt(index);
- }
- }
-
- public void removeToolChainConfigs(int index) {
- if (index > -1 && index < this.size()) {
- vToolChainConfigs.removeElementAt(index);
- }
- }
-
- public void removeAll() {
- vToolChainConfigs = new Vector<ToolChainConfigId>();
- }
-
- public Vector<String> getToolChainConfigsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vToolChainConfigs.size(); index++) {
- v.addElement(vToolChainConfigs.get(index).getName());
- }
- return v;
- }
-
- public Vector<String> getToolChainConfigsValue() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vToolChainConfigs.size(); index++) {
- v.addElement(vToolChainConfigs.get(index).getValue());
- }
- return v;
- }
-
- public int size() {
- return this.vToolChainConfigs.size();
- }
-
- public void saveFile(String file) throws IOException {
- if (size() > 0) {
- FileWriter fw = new FileWriter(file);
- BufferedWriter bw = new BufferedWriter(fw);
- for (int index = 0; index < size(); index++) {
- String line = this.getToolChainConfigs(index).getName() + " " + ToolChainConfigId.EQUALS + " "
- + this.getToolChainConfigs(index).getValue();
- bw.write(line);
- bw.newLine();
- }
- bw.flush();
- bw.close();
- fw.close();
- }
- }
-
- /**
-
- @param file
- @throws IOException
- @throws FileNotFoundException
-
- **/
- public void parseFile(String file) throws IOException {
- FileReader fr = new FileReader(file);
- BufferedReader br = new BufferedReader(fr);
- String line = br.readLine();
- while (line != null) {
- parseLine(line);
- line = br.readLine();
- }
- }
-
- /**
- Parse the input string and add name, value to vector
-
- @param line
-
- **/
- private void parseLine(String line) {
- String name = "";
- String value = "";
- if (line.indexOf(ToolChainConfigId.COMMENTS) != 0 && line.indexOf(ToolChainConfigId.EQUALS) > -1) {
- name = line.substring(0, line.indexOf(ToolChainConfigId.EQUALS)).trim();
- value = line.substring(line.indexOf(ToolChainConfigId.EQUALS) + 1).trim();
- this.addToolChainConfigs(new ToolChainConfigId(name, value));
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java
deleted file mode 100644
index 49a7a3615b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/** @file
-
- The file is used to provides static interfaces to save log and error information
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import javax.swing.JOptionPane;
-
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-/**
- The class is used to provides static interfaces to save log and error information
-
- **/
-public class Log {
- //
- //Log file directory path
- //
- private static String strLogDir = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + "Tools"
- + DataType.FILE_SEPARATOR + "Logs";
-
- //
- //Log file
- //
- private static File fleLogFile = null;
-
- //
- //Wrn file
- //
- private static File fleWrnFile = null;
-
- //
- //Err file
- //
- private static File fleErrFile = null;
-
- //
- //Log file name
- //
- private static String strLogFileName = strLogDir + DataType.FILE_SEPARATOR + "frameworkwizard.log";
-
- //
- //Wrn file name
- //
- private static String strWrnFileName = strLogDir + DataType.FILE_SEPARATOR + "frameworkwizard.wrn";
-
- //
- //Err file name
- //
- private static String strErrFileName = strLogDir + DataType.FILE_SEPARATOR + "frameworkwizard.err";
-
- //
- //Flag for create log or not
- //
- private static boolean isSaveLog = false;
-
- /**
- Main class, used for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- try {
- //Log.log("Test", "test");
- //Log.err("Test1", "test1");
- Log
- .wrn("aaa bbbbbb cccccccccccc ddddddddddd eeeeeeeeee fffffffffff gggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhhhhh iiiii jjjj kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk lll mmm nn poooooooooooooooooooooooooooooooooooooooooooop");
- Log.wrn("Incorrect data type for ModuleEntryPoint");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToLogFile to save log item and log information to log file
-
- @param strItem The log item
- @param strLog The log information
-
- **/
- public static void log(String strItem, String strLog) {
- try {
- writeToLogFile(strItem + ":" + strLog);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToLogFile to save log information to log file
-
- @param strLog The log information
-
- **/
- public static void log(String strLog) {
- try {
- writeToLogFile(strLog);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToWrnFile to save wrn item and wrn information to wrn file
-
- @param strItem The wrn item
- @param strLog The wrn information
-
- **/
- public static void wrn(String strItem, String strWrn) {
- try {
- writeToWrnFile("Warning when " + strItem + "::" + strWrn);
- showWrnMessage(strWrn);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToWrnFile to save wrn information to wrn file
-
- @param strLog The wrn information
-
- **/
- public static void wrn(String strWrn) {
- try {
- writeToWrnFile("Warning::" + strWrn);
- showWrnMessage("Warning::" + strWrn);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToErrFile to save err item and err information to err file
-
- @param strItem The err item
- @param strLog The err information
-
- **/
- public static void err(String strItem, String strErr) {
- try {
- writeToErrFile("Error when " + strItem + "::" + strErr);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToErrFile to save err information to err file
-
- @param strLog The err information
-
- **/
- public static void err(String strErr) {
- try {
- writeToErrFile("Error::" + strErr);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Brings up a dialog to show err message
- When the message's length > defined max length, wrap the text to the next line.
-
- @param strErr The input data of err message
-
- **/
- private static void showWrnMessage(String strErr) {
- String strReturn = Tools.wrapStringByWord(strErr);
- JOptionPane.showConfirmDialog(FrameworkWizardUI.getInstance(), strReturn, "Warning",
- JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- }
-
- /**
- Open log file and write log information
-
- @param strLog The log information
- @throws IOException
-
- **/
- private static void writeToLogFile(String strLog) throws Exception {
- if (isSaveLog) {
- try {
- createLogDir();
- if (fleLogFile == null) {
- fleLogFile = new File(strLogFileName);
- fleLogFile.delete();
- fleLogFile.createNewFile();
- }
- FileOutputStream fos = new FileOutputStream(fleLogFile, true);
- fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.flush();
- fos.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- Open wrn file and write wrn information
-
- @param strLog The log information
- * @throws Exception
-
- **/
- private static void writeToWrnFile(String strLog) throws Exception {
- if (isSaveLog) {
- try {
- createLogDir();
- if (fleWrnFile == null) {
- fleWrnFile = new File(strWrnFileName);
- fleWrnFile.delete();
- fleWrnFile.createNewFile();
- }
- FileOutputStream fos = new FileOutputStream(fleWrnFile, true);
- fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.flush();
- fos.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- Open err file and write err information
-
- @param strLog The log information
- @throws IOException
-
- **/
- private static void writeToErrFile(String strLog) throws Exception {
- if (isSaveLog) {
- try {
- createLogDir();
- if (fleErrFile == null) {
- fleErrFile = new File(strErrFileName);
- fleErrFile.delete();
- fleErrFile.createNewFile();
- }
- FileOutputStream fos = new FileOutputStream(fleErrFile, true);
- fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.flush();
- fos.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- Check if directory for Logs exists or not
- Create the directory if it doesn't exist
- * @throws Exception
-
- **/
- private static void createLogDir() throws Exception {
- File f = new File(strLogDir);
- if (!f.exists()) {
- FileOperation.newFolder(strLogDir);
- }
- }
-
- public static boolean isSaveLog() {
- return isSaveLog;
- }
-
- public static void setSaveLog(boolean isSaveLog) {
- Log.isSaveLog = isSaveLog;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/OpenFile.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/OpenFile.java
deleted file mode 100644
index 32eec68258..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/OpenFile.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/** @file
-
- The file provides interface to open xml file.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.FrameworkDatabaseDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-
-public class OpenFile {
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Open specificed Msa file and read its content
-
- @param strMsaFilePath The input data of Msa File Path
-
- **/
- public static ModuleSurfaceArea openMsaFile(String strMsaFilePath) throws IOException, XmlException, Exception {
- Log.log("Open Msa", strMsaFilePath);
- File msaFile = new File(strMsaFilePath);
- ModuleSurfaceAreaDocument xmlMsaDoc = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaFile);
- return xmlMsaDoc.getModuleSurfaceArea();
- }
-
- /**
- Open specificed Spd file and read its content
-
- @param strSpdFilePath The input data of Spd File Path
-
- **/
- public static PackageSurfaceArea openSpdFile(String strSpdFilePath) throws IOException, XmlException, Exception {
- Log.log("Open Spd", strSpdFilePath);
- File spdFile = new File(strSpdFilePath);
- PackageSurfaceAreaDocument xmlSpdDoc = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(spdFile);
- return xmlSpdDoc.getPackageSurfaceArea();
- }
-
- /**
- Open specificed Fpd file and read its content
-
- @param strFpdFilePath The input data of Fpd File Path
-
- **/
- public static PlatformSurfaceArea openFpdFile(String strFpdFilePath) throws IOException, XmlException,
- Exception {
- Log.log("Open Fpd", strFpdFilePath);
- File fpdFile = new File(strFpdFilePath);
- PlatformSurfaceAreaDocument xmlFpdDoc = null;
- xmlFpdDoc = (PlatformSurfaceAreaDocument) XmlObject.Factory.parse(fpdFile);
- return xmlFpdDoc.getPlatformSurfaceArea();
- }
-
- /**
-
- Open specificed Framework Database file and read its content
-
- */
- public static FrameworkDatabase openFrameworkDb(String strDbFilePath) throws IOException, XmlException, Exception {
- Log.log("Open Framework Database", strDbFilePath);
- File db = new File(strDbFilePath);
- FrameworkDatabaseDocument xmlDb = null;
- xmlDb = (FrameworkDatabaseDocument) XmlObject.Factory.parse(db);
- return xmlDb.getFrameworkDatabase();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java
deleted file mode 100644
index 13e6786ca7..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/** @file
-
- The file provides interface to save xml file.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.tianocore.FrameworkDatabaseDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-
-public class SaveFile {
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
-
- }
-
- private static void createDirectory(String path) throws Exception {
- File f = new File(path);
- path = f.getParent();
- FileOperation.newFolder(path);
- }
-
- /**
- Save file as msa
-
- **/
- public static void saveMsaFile(String path, ModuleSurfaceArea msa) throws Exception {
- //
- // Create the file's directory first
- //
- createDirectory(path);
-
- //
- // Remove all empty top level elements
- //
- XmlObject o = msa.getLibraryClassDefinitions();
- if (o != null) {
- if (msa.getLibraryClassDefinitions().getLibraryClassList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getSourceFiles();
- if (o != null) {
- if (msa.getSourceFiles().getFilenameList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getPackageDependencies();
- if (o != null) {
- if (msa.getPackageDependencies().getPackageList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getProtocols();
- if (o != null) {
- if (msa.getProtocols().getProtocolList().size() <= 0
- && msa.getProtocols().getProtocolNotifyList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getEvents();
- if (o != null) {
- if (msa.getEvents().getCreateEvents() != null || msa.getEvents().getSignalEvents() != null) {
- if (msa.getEvents().getCreateEvents() != null && msa.getEvents().getCreateEvents().getEventTypesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- if (msa.getEvents().getSignalEvents() != null && msa.getEvents().getSignalEvents().getEventTypesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- } else {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getHobs();
- if (o != null) {
- if (msa.getHobs().getHobTypesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getPPIs();
- if (o != null) {
- if (msa.getPPIs().getPpiList().size() <= 0 && msa.getPPIs().getPpiNotifyList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getVariables();
- if (o != null) {
- if (msa.getVariables().getVariableList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getBootModes();
- if (o != null) {
- if (msa.getBootModes().getBootModeList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getSystemTables();
- if (o != null) {
- if (msa.getSystemTables().getSystemTableCNamesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getDataHubs();
- if (o != null) {
- if (msa.getDataHubs().getDataHubRecordList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getHiiPackages();
- if (o != null) {
- if (msa.getHiiPackages().getHiiPackageList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getGuids();
- if (o != null) {
- if (msa.getGuids().getGuidCNamesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getExterns();
- if (o != null) {
- if (msa.getExterns().getExternList().size() <= 0 && msa.getExterns().getSpecificationList().size() <= 0
- && msa.getExterns().getPcdIsDriver() == null) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getPcdCoded();
- if (o != null) {
- if (msa.getPcdCoded().getPcdEntryList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- ModuleSurfaceAreaDocument msaDoc = ModuleSurfaceAreaDocument.Factory.newInstance();
- File f = new File(path);
-
- //
- //Init namespace
- //
- XmlCursor cursor = XmlConfig.setupXmlCursor(msa.newCursor());
-
- //
- //Config file format
- //
- XmlOptions options = XmlConfig.setupXmlOptions();
-
- //
- //Create finial doc
- //
- msaDoc.addNewModuleSurfaceArea();
- msaDoc.setModuleSurfaceArea((ModuleSurfaceArea) cursor.getObject());
- //
- //Save the file
- //
- msaDoc.save(f, options);
- cursor.dispose();
- }
-
- /**
- Save file as spd
-
- **/
- public static void saveSpdFile(String path, PackageSurfaceArea spd) throws Exception {
- //
- // Create the file's directory first
- //
- createDirectory(path);
-
- PackageSurfaceAreaDocument spdDoc = PackageSurfaceAreaDocument.Factory.newInstance();
- File f = new File(path);
-
- //
- //Init namespace
- //
- XmlCursor cursor = XmlConfig.setupXmlCursor(spd.newCursor());
-
- //
- //Config file format
- //
- XmlOptions options = XmlConfig.setupXmlOptions();
-
- //
- //Create finial doc
- //
- spdDoc.addNewPackageSurfaceArea();
- spdDoc.setPackageSurfaceArea((PackageSurfaceArea) cursor.getObject());
- //
- //Save the file
- //
- spdDoc.save(f, options);
- cursor.dispose();
- }
-
- /**
- Save file as fpd
-
- **/
- public static void saveFpdFile(String path, PlatformSurfaceArea fpd) throws Exception {
- //
- // Create the file's directory first
- //
- createDirectory(path);
-
- PlatformSurfaceAreaDocument fpdDoc = PlatformSurfaceAreaDocument.Factory.newInstance();
- File f = new File(path);
-
- //
- //Init namespace
- //
- XmlCursor cursor = XmlConfig.setupXmlCursor(fpd.newCursor());
-
- //
- //Config file format
- //
- XmlOptions options = XmlConfig.setupXmlOptions();
-
- //
- //Create finial doc
- //
- fpdDoc.addNewPlatformSurfaceArea();
- fpdDoc.setPlatformSurfaceArea((PlatformSurfaceArea) cursor.getObject());
- //
- //Save the file
- //
- fpdDoc.save(f, options);
- cursor.dispose();
- }
-
- /**
- Save file as framework db
-
- **/
- public static void saveDbFile(String path, FrameworkDatabase db) throws Exception {
- FrameworkDatabaseDocument dbDoc = FrameworkDatabaseDocument.Factory.newInstance();
- File f = new File(path);
-
- //
- //Init namespace
- //
- XmlCursor cursor = XmlConfig.setupXmlCursor(db.newCursor());
-
- //
- //Config file format
- //
- XmlOptions options = XmlConfig.setupXmlOptions();
-
- //
- //Create finial doc
- //
- dbDoc.addNewFrameworkDatabase();
- dbDoc.setFrameworkDatabase((FrameworkDatabase) cursor.getObject());
-
- //
- //Save the file
- //
- dbDoc.save(f, options);
- cursor.dispose();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Sort.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Sort.java
deleted file mode 100644
index 65a345ab5b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Sort.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/** @file
-
- The file is used to provide all kinds of sorting method
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class Sort {
-
- /**
- Sort all elements in the vector as the specific sort type
-
- @param v The vector need to be sorted
- @param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending
-
- **/
- public static void sortVectorString(Vector<String> v, int mode) {
- if (v != null) {
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- String temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all elements of vector and return sorted sequence
-
- @param v The vector need to be sorted
- @param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending
- @return Vector<Integer> The sorted sequence
-
- **/
- public static Vector<Integer> getVectorSortSequence(Vector<String> v, int mode) {
- Vector<Integer> vSequence = new Vector<Integer>();
- //
- // Init sequence
- //
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- vSequence.addElement(index);
- }
- }
-
- //
- // sort and get new sequence
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- //
- // Swap strings
- //
- String tempStr = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(tempStr, indexJ);
-
- //
- // Swap sequences
- //
- int tempInt = vSequence.get(indexI);
- vSequence.setElementAt(vSequence.get(indexJ), indexI);
- vSequence.setElementAt(tempInt, indexJ);
- }
- }
- }
-
- return vSequence;
- }
-
- /**
- Sort all elements of vector as input sequence
-
- @param v The vector need to be sorted
- @param vSequence The sort sequence should be followed
-
- **/
- public static void sortVectorString(Vector<String> v, Vector<Integer> vSequence) {
- if (v != null && vSequence != null && v.size() == vSequence.size()) {
- Vector<String> tempV = new Vector<String>();
- for (int index = 0; index < v.size(); index++) {
- tempV.addElement(v.get(index));
- }
- for (int index = 0; index < v.size(); index++) {
- v.setElementAt(tempV.get(vSequence.get(index)), index);
- }
- }
- }
-
- /**
- Sort all modules
-
- @param v
- @param mode
-
- **/
- public static void sortModules(Vector<ModuleIdentification> v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- ModuleIdentification temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all packages
-
- @param v
- @param mode
-
- **/
- public static void sortPackages(Vector<PackageIdentification> v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PackageIdentification temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all platforms
-
- @param v
- @param mode
-
- **/
- public static void sortPlatforms(Vector<PlatformIdentification> v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PlatformIdentification temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all pcd entries
-
- @param v
- @param mode
-
- **/
- public static void sortPcds(PcdVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getPcd(indexJ).getName().compareTo(v.getPcd(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getPcd(indexI).getName().compareTo(v.getPcd(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PcdIdentification temp = v.getPcd(indexI);
- v.setPcd(v.getPcd(indexJ), indexI);
- v.setPcd(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all ppi entries
-
- @param v
- @param mode
-
- **/
- public static void sortPpis(PpisVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getPpis(indexJ).getName().compareTo(v.getPpis(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getPpis(indexI).getName().compareTo(v.getPpis(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PpisIdentification temp = v.getPpis(indexI);
- v.setPpis(v.getPpis(indexJ), indexI);
- v.setPpis(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all protocol entries
-
- @param v
- @param mode
-
- **/
- public static void sortProtocols(ProtocolsVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getProtocols(indexJ).getName().compareTo(v.getProtocols(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getProtocols(indexI).getName().compareTo(v.getProtocols(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- ProtocolsIdentification temp = v.getProtocols(indexI);
- v.setProtocols(v.getProtocols(indexJ), indexI);
- v.setProtocols(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all guid entries
-
- @param v
- @param mode
-
- **/
- public static void sortGuids(GuidsVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getGuids(indexJ).getName().compareTo(v.getGuids(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getGuids(indexI).getName().compareTo(v.getGuids(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- GuidsIdentification temp = v.getGuids(indexI);
- v.setGuids(v.getGuids(indexJ), indexI);
- v.setGuids(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all pcd coded entries
-
- @param v
- @param mode
-
- **/
- public static void sortPcdCodeds(PcdCodedVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getPcdCoded(indexJ).getName().compareTo(v.getPcdCoded(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getPcdCoded(indexI).getName().compareTo(v.getPcdCoded(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PcdCodedIdentification temp = v.getPcdCoded(indexI);
- v.setPcdCoded(v.getPcdCoded(indexJ), indexI);
- v.setPcdCoded(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all pcd coded entries
-
- @param v
- @param mode
-
- **/
- public static void sortLibraryClass(LibraryClassVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getLibraryClass(indexJ).getLibraryClassName().compareTo(
- v.getLibraryClass(indexI)
- .getLibraryClassName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getLibraryClass(indexI).getLibraryClassName().compareTo(
- v.getLibraryClass(indexJ)
- .getLibraryClassName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- LibraryClassIdentification temp = v.getLibraryClass(indexI);
- v.setLibraryClass(v.getLibraryClass(indexJ), indexI);
- v.setLibraryClass(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all objects of a vector based on the object's "toString"
-
- @param v
- @param mode
-
- **/
- public static void sortObjectVector(Vector<Object> v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).toString().compareTo(v.get(indexI).toString()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).toString().compareTo(v.get(indexJ).toString()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- Object temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java
deleted file mode 100644
index 3eb9b85455..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java
+++ /dev/null
@@ -1,715 +0,0 @@
-/** @file
-
- The file is used to provides some useful interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.awt.Component;
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-import java.util.Vector;
-
-import javax.swing.DefaultListModel;
-import javax.swing.JComboBox;
-import javax.swing.JList;
-import javax.swing.JOptionPane;
-import javax.swing.JTable;
-
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.MsaHeaderDocument.MsaHeader;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformHeaderDocument.PlatformHeader;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.SpdHeaderDocument.SpdHeader;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-/**
- The class is used to provides some useful interfaces
-
- **/
-public class Tools {
-
- //
- // The dir user selected to create new package in
- //
- public static String dirForNewSpd = null;
-
- /**
- Get current date and time and format it as "yyyy-MM-dd HH:mm"
-
- @return formatted current date and time
-
- **/
- public static String getCurrentDateTime() {
- Date now = new Date(System.currentTimeMillis());
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- return sdf.format(now);
- }
-
- /**
- Generate a UUID
-
- @return the created UUID
-
- **/
- public static String generateUuidString() {
- return UUID.randomUUID().toString();
- }
-
- /**
- Use current file separator in the path
-
- @param strPath
- @return
-
- **/
- public static String convertPathToCurrentOsType(String strPath) {
- strPath = strPath.replace(DataType.DOS_FILE_SEPARATOR, DataType.FILE_SEPARATOR);
- strPath = strPath.replace(DataType.UNIX_FILE_SEPARATOR, DataType.FILE_SEPARATOR);
- return strPath;
- }
-
- /**
- Use Unix file separator in the path
-
- @param strPath
- @return
-
- **/
- public static String convertPathToUnixType(String strPath) {
- strPath = strPath.replace(DataType.DOS_FILE_SEPARATOR, DataType.UNIX_FILE_SEPARATOR);
- return strPath;
- }
-
- /**
- Use Dos file separator in the path
-
- @param strPath
- @return
-
- **/
- public static String convertPathToDosType(String strPath) {
- strPath = strPath.replace(DataType.UNIX_FILE_SEPARATOR, DataType.DOS_FILE_SEPARATOR);
- return strPath;
- }
-
- /**
- Get all system properties and output to the console
-
- **/
- public static void getSystemProperties() {
- System.out.println(System.getProperty("java.class.version"));
- System.out.println(System.getProperty("java.class.path"));
- System.out.println(System.getProperty("java.ext.dirs"));
- System.out.println(System.getProperty("os.name"));
- System.out.println(System.getProperty("os.arch"));
- System.out.println(System.getProperty("os.version"));
- System.out.println(System.getProperty("file.separator"));
- System.out.println(System.getProperty("path.separator"));
- System.out.println(System.getProperty("line.separator"));
- System.out.println(System.getProperty("user.name"));
- System.out.println(System.getProperty("user.home"));
- System.out.println(System.getProperty("user.dir"));
- System.out.println(System.getProperty("PATH"));
-
- System.out.println(System.getenv("PROCESSOR_REVISION"));
- }
-
- /**
- Generate selection items for JComboBox by input vector
-
- **/
- public static void generateComboBoxByVector(JComboBox jcb, Vector<String> vector) {
- if (jcb != null) {
- jcb.removeAllItems();
- }
- if (vector != null) {
- for (int index = 0; index < vector.size(); index++) {
- jcb.addItem(vector.elementAt(index));
- }
- }
- }
-
- /**
- Generate selection items for JList by input vector
-
- **/
- public static void generateListByVector(JList jl, Vector<String> vector) {
- if (jl != null) {
- DefaultListModel listModel = (DefaultListModel) jl.getModel();
- listModel.removeAllElements();
-
- if (vector != null) {
- for (int index = 0; index < vector.size(); index++) {
- listModel.addElement(vector.get(index));
- }
- }
-
- if (listModel.size() > 0) {
- jl.setSelectedIndex(0);
- }
- }
- }
-
- /**
- Get path only from a path
-
- @param filePath
- @return
-
- **/
- public static String getFilePathOnly(String filePath) {
- String path = filePath.substring(0, filePath.length() - getFileNameOnly(filePath).length());
- if (path.endsWith(DataType.FILE_SEPARATOR)) {
- path = path.substring(0, path.length() - DataType.FILE_SEPARATOR.length());
- }
-
- return path;
- }
-
- /**
- Get file name from a path
-
- @param filePath
- @return
-
- **/
- public static String getFileNameOnly(String filePath) {
- File f = new File(filePath);
- return f.getAbsoluteFile().getName();
- }
-
- public static String getFileNameWithoutExt(String filePath) {
- filePath = getFileNameOnly(filePath);
- filePath = filePath.substring(0, filePath.lastIndexOf(DataType.FILE_EXT_SEPARATOR));
- return filePath;
- }
-
- /**
- Get relative path
-
- @param wholePath
- @param commonPath
- @return wholePath - commonPath
-
- **/
- public static String getRelativePath(String wholePath, String commonPath) {
- String path = "";
- int i = 0;
- i = wholePath.indexOf(commonPath);
- if (i > -1) {
- i = i + commonPath.length();
- } else {
- return "";
- }
- path = wholePath.substring(i);
- //
- // remove file separator of head
- //
- if (path.indexOf(DataType.DOS_FILE_SEPARATOR) == 0) {
- path = path.substring(0 + DataType.DOS_FILE_SEPARATOR.length());
- }
- if (path.indexOf(DataType.UNIX_FILE_SEPARATOR) == 0) {
- path = path.substring(0 + DataType.DOS_FILE_SEPARATOR.length());
- }
- //
- // remove file separator of rear
- //
- if (path.length() > 0
- && path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {
- path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
- }
- if (path.length() > 0
- && path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {
- path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
- }
- //
- // convert to UNIX format
- //
- path = Tools.convertPathToUnixType(path);
- return path;
- }
-
- /**
- Convert List ot Vector
-
- @param list
- @return
-
- **/
- public static Vector<String> convertListToVector(List list) {
- Vector<String> v = new Vector<String>();
- if (list != null && list.size() > 0) {
- for (int index = 0; index < list.size(); index++) {
- v.addElement(list.get(index).toString());
- }
- }
- return v;
- }
-
- /**
- Convert a Vector to a String, separator with ", "
-
- @param v
- @return
-
- **/
- public static String convertVectorToString(Vector<String> v) {
- String s = "";
- for (int index = 0; index < v.size(); index++) {
- s = s + v.elementAt(index).toString() + ", ";
- }
- if (s.length() > 0) {
- s = s.substring(0, s.length() - ", ".length());
- }
- return s;
- }
-
- /**
- Convert a List to a String
-
- @param list
- @return
-
- **/
- public static String convertListToString(List list) {
- return Tools.convertVectorToString(Tools.convertListToVector(list));
- }
-
- /**
- If the input path missing ext, append the ext to the path
-
- @param path
- @param type
- @return
-
- **/
- public static String addPathExt(String path, int type) {
- String match = "";
- if (type == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.MODULE_SURFACE_AREA_EXT;
- }
- if (type == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.PACKAGE_SURFACE_AREA_EXT;
- }
- if (type == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.PLATFORM_SURFACE_AREA_EXT;
- }
- if (type == DataType.RETURN_TYPE_TEXT) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.TEXT_FILE_EXT;
- }
- if (type == DataType.RETURN_TYPE_FAR_SURFACE_AREA) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.FAR_SURFACE_AREA_EXT;
- }
- if (path.length() <= match.length()) {
- path = path + match;
- return path;
- }
- if (!(path.substring(path.length() - match.length())).equals(match)) {
- path = path + match;
- }
- return path;
- }
-
- /**
- Show a message box
-
- @param arg0
-
- **/
- public static void showInformationMessage(String arg0) {
- JOptionPane.showConfirmDialog(FrameworkWizardUI.getInstance(), arg0, "Info", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
- }
-
- /**
- if the string doesn't end with a file separator, append it to the string
-
- @param arg0
- @return
-
- **/
- public static String addFileSeparator(String arg0) {
- if (!arg0.endsWith(DataType.FILE_SEPARATOR)) {
- arg0 = arg0 + DataType.FILE_SEPARATOR;
- }
- return arg0;
- }
-
- /**
- Wrap single line long input string to multiple short line string by word
-
- @param arg0 input string
- @return wraped string
-
- **/
- public static String wrapStringByWord(String arg0) {
- int intMaxLength = 40;
- String strReturn = "";
- String strTemp = "";
- boolean isCopied = true;
-
- if (arg0 == null) {
- return "";
- }
- if (arg0.length() <= 0) {
- return "";
- }
-
- //
- // Convert string to array by " "
- //
- String s[] = arg0.split(" ");
- if (arg0.indexOf(" ") == -1) {
- s[0] = arg0;
- }
-
- //
- // Add each string of array one by one
- //
- for (int index = 0; index < s.length; index++) {
- String ss = s[index];
- isCopied = false;
- //
- // The word length > defined line length
- //
- if (ss.length() > intMaxLength) {
- //
- // Finish previous line
- //
- if (!isCopied) {
- strReturn = strReturn + strTemp + DataType.LINE_SEPARATOR;
- strTemp = "";
- }
- //
- // Separater to short lines
- //
- while (ss.length() > 0) {
- if (ss.length() > intMaxLength) {
- strReturn = strReturn + s[index].substring(0, intMaxLength - 1) + DataType.UNIX_LINE_SEPARATOR;
- ss = ss.substring(intMaxLength);
- isCopied = true;
- } else {
- strTemp = ss;
- ss = "";
- isCopied = false;
- }
- }
- } else {
- if ((strTemp + " " + ss).length() <= intMaxLength) {
- strTemp = strTemp + " " + ss;
- continue;
- } else {
- strReturn = strReturn + strTemp + DataType.LINE_SEPARATOR;
- if ((index == s.length - 1) && (!ss.equals(""))) {
- strReturn = strReturn + ss;
- } else {
- strTemp = ss + " ";
- }
- isCopied = true;
- }
- }
- }
-
- if (!isCopied) {
- strReturn = strReturn + strTemp;
- }
-
- return strReturn;
- }
-
- public static String convertUnicodeHexStringToString(String str) {
- //
- // Handle if str is null or empty
- //
- if (str == null) {
- return "";
- }
- if (str.equals("")) {
- return "";
- }
-
- String returnString = "";
- String[] strArray = str.split(" ");
- for (int index = 0; index < strArray.length; index++) {
- String s = strArray[index];
- if (s.length() == 6 && s.indexOf(DataType.HEX_STRING_HEADER) == 0) {
- s = s.substring(DataType.HEX_STRING_HEADER.length());
- } else {
- Log.err("convertUnicodeHexStringToString", "Incorrect input string: " + str);
- continue;
- }
- //
- // Change hex to dec
- //
- int dec = Integer.parseInt(s, 16);
-
- returnString = returnString + (char) (dec);
- }
- return returnString;
- }
-
- /**
- Convert input string to unicode hex string
-
- @param str input string
- @return unicode hex string
-
- **/
- public static String convertStringToUnicodeHexString(String str) {
- //
- // Handle if str is null or empty
- //
- if (str == null) {
- return "";
- }
- if (str.equals("")) {
- return "";
- }
-
- //
- // convert string to hex string
- //
- String hexString = "";
- for (int index = 0; index < str.length(); index++) {
- int codePoint = str.codePointAt(index);
- String s = Integer.toHexString(codePoint);
- //
- // Make the string to four length
- //
- if (s.length() == 3) {
- s = "0" + s;
- } else if (s.length() == 2) {
- s = "00" + s;
- } else if (s.length() == 1) {
- s = "000" + s;
- }
-
- //
- // Add the string to return hex string
- //
- hexString = hexString + DataType.HEX_STRING_HEADER + s + " ";
- }
-
- //
- // return hex string
- //
- return hexString.trim();
- }
-
- public static ModuleIdentification getId(String path, ModuleSurfaceArea msa) {
- MsaHeader head = msa.getMsaHeader();
- String name = head.getModuleName();
- String guid = head.getGuidValue();
- String version = head.getVersion();
- ModuleIdentification id = new ModuleIdentification(name, guid, version, path);
- return id;
- }
-
- public static PackageIdentification getId(String path, PackageSurfaceArea spd) {
- SpdHeader head = spd.getSpdHeader();
- String name = head.getPackageName();
- String guid = head.getGuidValue();
- String version = head.getVersion();
- PackageIdentification id = new PackageIdentification(name, guid, version, path);
- return id;
- }
-
- public static PlatformIdentification getId(String path, PlatformSurfaceArea fpd) {
- PlatformHeader head = fpd.getPlatformHeader();
- String name = head.getPlatformName();
- String guid = head.getGuidValue();
- String version = head.getVersion();
- PlatformIdentification id = new PlatformIdentification(name, guid, version, path);
- return id;
- }
-
- /**
- * To reset the width of input component via container width
- *
- * @param c
- * @param containerWidth
- *
- */
- public static void resizeComponentWidth(Component c, int containerWidth, int preferredWidth) {
- int newWidth = c.getPreferredSize().width + (containerWidth - preferredWidth);
- if (newWidth < c.getPreferredSize().width) {
- newWidth = c.getPreferredSize().width;
- }
- c.setSize(new java.awt.Dimension(newWidth, c.getHeight()));
- c.validate();
- }
-
- /**
- * To reset the height of input component via container height
- *
- * @param c
- * @param containerHeight
- *
- */
- public static void resizeComponentHeight(Component c, int containerHeight, int preferredHeight) {
- int newHeight = c.getPreferredSize().height + (containerHeight - preferredHeight);
- if (newHeight < c.getPreferredSize().height) {
- newHeight = c.getPreferredSize().height;
- }
- c.setSize(new java.awt.Dimension(c.getWidth(), newHeight));
- c.validate();
- }
-
- /**
- * To reset the size of input component via container size
- *
- * @param c
- * @param containerWidth
- * @param containerHeight
- *
- */
- public static void resizeComponent(Component c, int containerWidth, int containerHeight, int preferredWidth,
- int preferredHeight) {
- resizeComponentWidth(c, containerWidth, preferredWidth);
- resizeComponentHeight(c, containerHeight, preferredHeight);
- }
-
- /**
- To adjust each column's width to meet the table's size
-
- @param t the table need to be adjusted
- @param width the new width of the table
-
- **/
- public static void resizeTableColumn(JTable t, int width) {
- if (t != null) {
- int columnCount = t.getColumnCount();
- for (int index = 0; index < columnCount; index++) {
- t.getColumn(t.getColumnName(index)).setPreferredWidth(width / columnCount);
- }
- }
- }
-
- /**
- * To relocate the input component
- *
- * @param c
- * @param containerWidth
- * @param spaceToRight
- *
- */
- public static void relocateComponentX(Component c, int containerWidth, int preferredWidth, int spaceToRight) {
- int intGapToRight = spaceToRight + c.getPreferredSize().width;
- int newLocationX = containerWidth - intGapToRight;
- if (newLocationX < preferredWidth - intGapToRight) {
- newLocationX = preferredWidth - intGapToRight;
- }
- c.setLocation(newLocationX, c.getLocation().y);
- c.validate();
- }
-
- /**
- * To relocate the input component
- *
- * @param c
- * @param containerHeight
- * @param spaceToBottom
- *
- */
- public static void relocateComponentY(Component c, int containerHeight, int preferredHeight, int spaceToBottom) {
- int intGapToBottom = spaceToBottom + c.getPreferredSize().height;
- int newLocationY = containerHeight - intGapToBottom;
- if (newLocationY < preferredHeight - spaceToBottom) {
- newLocationY = preferredHeight - spaceToBottom;
- }
- c.setLocation(c.getLocation().x, newLocationY);
- c.validate();
- }
-
- /**
- * To relocate the input component
- *
- * @param c
- * @param containerWidth
- * @param containerHeight
- * @param spaceToBottom
- * @param spaceToRight
- *
- */
- public static void relocateComponent(Component c, int containerWidth, int containerHeight, int preferredWidht,
- int preferredHeight, int spaceToRight, int spaceToBottom) {
- relocateComponentX(c, containerWidth, preferredWidht, spaceToRight);
- relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);
- }
-
- /**
- Move the component to the center of screen
-
- @param c
- @param width
-
- **/
- public static void centerComponent(Component c, int width) {
- c.setLocation(width / 2 - c.getWidth() / 2, c.getLocation().y);
- c.validate();
- }
-
- /**
- Move the component to the center of screen and adjust the y location
-
- @param c
- @param width
-
- **/
- public static void centerComponent(Component c, int width, int containerHeight, int preferredHeight,
- int spaceToBottom) {
- relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);
- centerComponent(c, width);
- }
-
- /**
- Find the count of searchString in wholeString
-
- @param wholeString
- @param searchString
- @return
-
- **/
- public static int getSpecificStringCount(String wholeString, String searchString) {
- int count = 0;
- count = wholeString.split(searchString).length;
- return count;
- }
-
- /**
- * Check the input data is empty or not
- *
- * @param strValue
- * The input data which need be checked
- *
- * @retval true - The input data is empty
- * @retval fals - The input data is not empty
- *
- */
- public static boolean isEmpty(String strValue) {
- if (strValue == null) {
- return true;
- }
- if (strValue.length() > 0) {
- return false;
- }
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/XmlConfig.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/XmlConfig.java
deleted file mode 100644
index db7b58d1d9..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/XmlConfig.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
-
- The file is used to config XML file format
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlOptions;
-
-public class XmlConfig {
- public static XmlCursor setupXmlCursor(XmlCursor cursor) {
- String uri = "http://www.TianoCore.org/2006/Edk2.0";
- cursor.push();
- cursor.toNextToken();
- cursor.insertNamespace("", uri);
- cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
- cursor.pop();
- return cursor;
- }
-
- public static XmlOptions setupXmlOptions() {
- XmlOptions options = new XmlOptions();
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- return options;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java
deleted file mode 100644
index de67728dfc..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java
+++ /dev/null
@@ -1,1050 +0,0 @@
-/** @file
-
- The file is used to provide Find funtions in workspace
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.util.Vector;
-
-import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;
-import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass;
-import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PcdDeclarationsDocument.PcdDeclarations.PcdEntry;
-import org.tianocore.PpiDeclarationsDocument.PpiDeclarations;
-import org.tianocore.ProtocolDeclarationsDocument.ProtocolDeclarations;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Sort;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class Find {
-
- private final static String SEPERATOR = ".";
-
- /**
- Get all ppi entries from workspace
-
- @return
-
- **/
- public static PpisVector getAllPpisVector() {
- PpisVector pv = new PpisVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- PpisIdentification pid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getPPIs() != null) {
- if (msa.getPPIs().getPpiList().size() > 0) {
- for (int index = 0; index < msa.getPPIs().getPpiList().size(); index++) {
- String arg0 = msa.getPPIs().getPpiList().get(index).getPpiCName();
- String arg1 = DataType.PPI_TYPE_PPI;
- String arg2 = null;
- if (msa.getPPIs().getPpiList().get(index).getUsage() != null) {
- arg2 = msa.getPPIs().getPpiList().get(index).getUsage().toString();
- }
-
- String arg3 = msa.getPPIs().getPpiList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiList().get(index)
- .getSupArchList());
- String arg5 = msa.getPPIs().getPpiList().get(index).getHelpText();
-
- pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getPpiDeclarations() != null) {
- for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()
- .size(); indexOfPpis++) {
- if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()
- .equals(arg0)) {
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- pv.addPpis(pid);
- }
- }
- if (msa.getPPIs().getPpiNotifyList().size() > 0) {
- for (int index = 0; index < msa.getPPIs().getPpiNotifyList().size(); index++) {
- String arg0 = msa.getPPIs().getPpiNotifyList().get(index).getPpiNotifyCName();
- String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;
- String arg2 = null;
- if (msa.getPPIs().getPpiNotifyList().get(index).getUsage() != null) {
- arg2 = msa.getPPIs().getPpiNotifyList().get(index).getUsage().toString();
- }
-
- String arg3 = msa.getPPIs().getPpiNotifyList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiNotifyList().get(index)
- .getSupArchList());
- String arg5 = msa.getPPIs().getPpiNotifyList().get(index).getHelpText();
-
- pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getPpiDeclarations() != null) {
- for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()
- .size(); indexOfPpis++) {
- if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()
- .equals(arg0)) {
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- pv.addPpis(pid);
- }
- }
- }
- }
- }
- //
- // Go through all defined ppi to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getPpiDeclarations() != null) {
- for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList().size(); indexOfPpis++) {
- boolean isFound = false;
- PpiDeclarations.Entry e = spd.getPpiDeclarations().getEntryList().get(indexOfPpis);
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- if (e.getCName().equals(pv.getPpis(indexOfPv).getName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- String arg0 = e.getCName();
- String arg1 = "";
- String arg2 = "";
- String arg3 = "";
- Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());
- String arg5 = e.getHelpText();
-
- pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(null);
- pid.setDeclaredBy(packageId);
- pv.addPpis(pid);
- }
- }
- }
- }
- Sort.sortPpis(pv, DataType.SORT_TYPE_ASCENDING);
- return pv;
- }
-
- /**
- Re-org all ppi entries for find table
-
- @return
-
- **/
- public static Vector<PpiId> getAllPpisForFind() {
- Vector<PpiId> ppi = new Vector<PpiId>();
- PpisVector pv = Find.getAllPpisVector();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- isAdded = false;
- PpisIdentification pvId = pv.getPpis(indexOfPv);
-
- //
- // First check if produced or not
- //
- if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Get the sting "PackageName.ModuleName"
- //
- String tmp = "";
- if (pvId.getBelongModule() != null) {
- tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfPpi = 0; indexOfPpi < ppi.size(); indexOfPpi++) {
- PpiId ppiId = ppi.get(indexOfPpi);
-
- if (pvId.getName().equals(ppiId.getName())) {
- if (isProduced) {
- ppi.get(indexOfPpi).setProducedModules(ppiId.getProducedModules() + "<br>" + tmp);
- } else if (!isProduced) {
- ppi.get(indexOfPpi).setConsumedModules(ppiId.getConsumedModules() + "<br>" + tmp);
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- if (isProduced) {
- ppi
- .addElement(new PpiId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy().getName()));
- } else if (!isProduced) {
- ppi
- .addElement(new PpiId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy().getName()));
- }
- }
- }
-
- return ppi;
- }
-
- /**
- Get all protocol entries from workspace
-
- @return
-
- **/
- public static ProtocolsVector getAllProtocolsVector() {
- ProtocolsVector pv = new ProtocolsVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- ProtocolsIdentification pid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getProtocols() != null) {
- if (msa.getProtocols().getProtocolList().size() > 0) {
- for (int index = 0; index < msa.getProtocols().getProtocolList().size(); index++) {
- String arg0 = msa.getProtocols().getProtocolList().get(index).getProtocolCName();
- String arg1 = DataType.PROTOCOL_TYPE_PROTOCOL;
- String arg2 = null;
- if (msa.getProtocols().getProtocolList().get(index).getUsage() != null) {
- arg2 = msa.getProtocols().getProtocolList().get(index).getUsage().toString();
- }
-
- String arg3 = msa.getProtocols().getProtocolList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolList()
- .get(index).getSupArchList());
- String arg5 = msa.getProtocols().getProtocolList().get(index).getHelpText();
-
- pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getProtocolDeclarations() != null) {
- for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()
- .getEntryList().size(); indexOfProtocols++) {
- if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)
- .getCName().equals(arg0)) {
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
- pv.addProtocols(pid);
- }
- }
- if (msa.getProtocols().getProtocolNotifyList().size() > 0) {
- for (int index = 0; index < msa.getProtocols().getProtocolNotifyList().size(); index++) {
- String arg0 = msa.getProtocols().getProtocolNotifyList().get(index)
- .getProtocolNotifyCName();
- String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;
- String arg2 = null;
- if (msa.getProtocols().getProtocolNotifyList().get(index).getUsage() != null) {
- arg2 = msa.getProtocols().getProtocolNotifyList().get(index).getUsage().toString();
- }
-
- String arg3 = msa.getProtocols().getProtocolNotifyList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolNotifyList()
- .get(index).getSupArchList());
- String arg5 = msa.getProtocols().getProtocolNotifyList().get(index).getHelpText();
-
- pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getProtocolDeclarations() != null) {
- for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()
- .getEntryList().size(); indexOfProtocols++) {
- if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)
- .getCName().equals(arg0)) {
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- pv.addProtocols(pid);
- }
- }
- }
- }
- }
- //
- // Go through all defined protocols to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getProtocolDeclarations() != null) {
- for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations().getEntryList().size(); indexOfProtocols++) {
- boolean isFound = false;
- ProtocolDeclarations.Entry e = spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols);
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- if (e.getCName().equals(pv.getProtocols(indexOfPv).getName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- String arg0 = e.getCName();
- String arg1 = "";
- String arg2 = "";
- String arg3 = "";
- Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());
- String arg5 = e.getHelpText();
-
- pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(null);
- pid.setDeclaredBy(packageId);
- pv.addProtocols(pid);
- }
- }
- }
- }
- Sort.sortProtocols(pv, DataType.SORT_TYPE_ASCENDING);
- return pv;
- }
-
- /**
- Re-org all protocol entries for find table
-
- @return
-
- **/
- public static Vector<ProtocolId> getAllProtocolsForFind() {
- Vector<ProtocolId> protocol = new Vector<ProtocolId>();
- ProtocolsVector pv = Find.getAllProtocolsVector();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- isAdded = false;
- ProtocolsIdentification pvId = pv.getProtocols(indexOfPv);
-
- //
- // First check if produced or not
- //
- if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Get the sting "PackageName.ModuleName"
- //
- String tmp = "";
- if (pvId.getBelongModule() != null) {
- tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfProtocol = 0; indexOfProtocol < protocol.size(); indexOfProtocol++) {
- ProtocolId protocolId = protocol.get(indexOfProtocol);
-
- if (pvId.getName().equals(protocolId.getName())) {
- if (isProduced) {
- protocol.get(indexOfProtocol)
- .setProducedModules(protocolId.getProducedModules() + "<br>" + tmp);
- } else if (!isProduced) {
- protocol.get(indexOfProtocol)
- .setConsumedModules(protocolId.getConsumedModules() + "<br>" + tmp);
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- if (isProduced) {
- protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy()
- .getName()));
- } else if (!isProduced) {
- protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy()
- .getName()));
- }
- }
- }
-
- return protocol;
- }
-
- /**
- Get all protocol entries from workspace
-
- @return
-
- **/
- public static GuidsVector getAllGuidsVector() {
- GuidsVector gv = new GuidsVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- GuidsIdentification gid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getGuids() != null) {
- if (msa.getGuids().getGuidCNamesList().size() > 0) {
- for (int index = 0; index < msa.getGuids().getGuidCNamesList().size(); index++) {
- String arg0 = msa.getGuids().getGuidCNamesList().get(index).getGuidCName();
- String arg1 = null;
- if (msa.getGuids().getGuidCNamesList().get(index).getUsage() != null) {
- arg1 = msa.getGuids().getGuidCNamesList().get(index).getUsage().toString();
- }
-
- String arg2 = msa.getGuids().getGuidCNamesList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(msa.getGuids().getGuidCNamesList()
- .get(index).getSupArchList());
- String arg4 = msa.getGuids().getGuidCNamesList().get(index).getHelpText();
-
- gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
- gid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getGuidDeclarations() != null) {
- for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList()
- .size(); indexOfGuids++) {
- if (spd.getGuidDeclarations().getEntryList().get(indexOfGuids).getCName()
- .equals(arg0)) {
- gid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (gid.getDeclaredBy() == null) {
- gid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- gv.addGuids(gid);
- }
- }
- }
- }
- }
- //
- // Go through all defined guids to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getGuidDeclarations() != null) {
- for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList().size(); indexOfGuids++) {
- boolean isFound = false;
- GuidDeclarations.Entry e = spd.getGuidDeclarations().getEntryList().get(indexOfGuids);
- for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {
- if (e.getCName().equals(gv.getGuids(indexOfGv).getName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- String arg0 = e.getCName();
- String arg1 = "";
- String arg2 = "";
- Vector<String> arg3 = Tools.convertListToVector(e.getSupArchList());
- String arg4 = e.getHelpText();
-
- gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
- gid.setBelongModule(null);
- gid.setDeclaredBy(packageId);
- gv.addGuids(gid);
- }
- }
- }
- }
- Sort.sortGuids(gv, DataType.SORT_TYPE_ASCENDING);
- return gv;
- }
-
- /**
- Re-org all guid entries for find table
-
- @return
-
- **/
- public static Vector<GuidId> getAllGuidsForFind() {
- Vector<GuidId> guid = new Vector<GuidId>();
- GuidsVector gv = Find.getAllGuidsVector();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {
- isAdded = false;
- GuidsIdentification gvId = gv.getGuids(indexOfGv);
-
- //
- // First check if produced or not
- //
- if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Get the sting "PackageName.ModuleName"
- //
- String tmp = "";
- if (gvId.getBelongModule() != null) {
- tmp = gvId.getBelongModule().getPackageId().getName() + SEPERATOR + gvId.getBelongModule().getName();
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfGuid = 0; indexOfGuid < guid.size(); indexOfGuid++) {
- GuidId guidId = guid.get(indexOfGuid);
-
- if (gvId.getName().equals(guidId.getName())) {
- if (isProduced) {
- guid.get(indexOfGuid).setProducedModules(guidId.getProducedModules() + "<br>" + tmp);
- } else if (!isProduced) {
- guid.get(indexOfGuid).setConsumedModules(guidId.getConsumedModules() + "<br>" + tmp);
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- if (isProduced) {
- guid.addElement(new GuidId(gvId.getName(), "GUID", tmp, null, gvId.getDeclaredBy().getName()));
- } else if (!isProduced) {
- guid.addElement(new GuidId(gvId.getName(), "GUID", null, tmp, gvId.getDeclaredBy().getName()));
- }
- }
- }
-
- return guid;
- }
-
- /**
- Get all pcd coded entries from workspace
-
- @return
-
- **/
- public static PcdCodedVector getAllPcdCodedVector() {
- PcdCodedVector pv = new PcdCodedVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- PcdCodedIdentification pid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getPcdCoded() != null) {
- if (msa.getPcdCoded().getPcdEntryList().size() > 0) {
- for (int index = 0; index < msa.getPcdCoded().getPcdEntryList().size(); index++) {
-
- String arg0 = msa.getPcdCoded().getPcdEntryList().get(index).getCName();
- String arg1 = msa.getPcdCoded().getPcdEntryList().get(index).getTokenSpaceGuidCName();
-
- String arg2 = msa.getPcdCoded().getPcdEntryList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(msa.getPcdCoded().getPcdEntryList()
- .get(index).getSupArchList());
-
- String arg4 = msa.getPcdCoded().getPcdEntryList().get(index).getDefaultValue();
- String arg5 = msa.getPcdCoded().getPcdEntryList().get(index).getHelpText();
- String arg6 = null;
- if (msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType() != null) {
- arg6 = msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType().toString();
- }
- String arg7 = null;
- if (msa.getPcdCoded().getPcdEntryList().get(index).getUsage() != null) {
- arg7 = msa.getPcdCoded().getPcdEntryList().get(index).getUsage().toString();
- }
- pid = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getPcdDeclarations() != null) {
- for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList()
- .size(); indexOfPcds++) {
- PcdEntry pcdEntry = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);
- if (pcdEntry.getCName().equals(arg0)) {
- pid.setTokenSpaceGuidCName(pcdEntry.getTokenSpaceGuidCName());
- pid.setToken(pcdEntry.getToken().toString());
- pid.setDatumType(pcdEntry.getDatumType().toString());
- pid.setValue(pcdEntry.getDefaultValue());
- pid.setUsage(Tools.convertListToString(pcdEntry.getValidUsage()));
- pid.setHelp(pcdEntry.getHelpText());
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- pv.addPcdCoded(pid);
- }
- }
- }
- }
- }
- //
- // Go through all defined pcds to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getPcdDeclarations() != null) {
- for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList().size(); indexOfPcds++) {
- boolean isFound = false;
- PcdEntry e = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- if (e.getCName().equals(pv.getPcdCoded(indexOfPv).getName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- pid = new PcdCodedIdentification("", "", "", null, "", "", null, null);
- pid.setName(e.getCName());
- pid.setTokenSpaceGuidCName(e.getTokenSpaceGuidCName());
- pid.setToken(e.getToken().toString());
- pid.setDatumType(e.getDatumType().toString());
- pid.setValue(e.getDefaultValue());
- pid.setUsage(Tools.convertListToString(e.getValidUsage()));
- pid.setHelp(e.getHelpText());
- pid.setDeclaredBy(packageId);
-
- pid.setBelongModule(null);
- pv.addPcdCoded(pid);
- }
- }
- }
- }
- Sort.sortPcdCodeds(pv, DataType.SORT_TYPE_ASCENDING);
- return pv;
- }
-
- /**
-
- @param pv
- @return
-
- **/
- public static Vector<PcdFindResultId> getAllPcdCodedForFind(PcdCodedVector pv) {
- Vector<PcdFindResultId> pcd = new Vector<PcdFindResultId>();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- isAdded = false;
- PcdCodedIdentification pvId = pv.getPcdCoded(indexOfPv);
-
- //
- // First check if produced or not
- //
- if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfGuid = 0; indexOfGuid < pcd.size(); indexOfGuid++) {
- PcdFindResultId pcdId = pcd.get(indexOfGuid);
-
- if (pvId.getName().equals(pcdId.getName())) {
- if (isProduced) {
- pcd.get(indexOfGuid).addProducedModules(pvId.getBelongModule());
- } else if (!isProduced) {
- pcd.get(indexOfGuid).addConsumedModules(pvId.getBelongModule());
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- PcdFindResultId pcdId = new PcdFindResultId(pvId.getName(), "PCD", pvId.getSupArchList(),
- pvId.getHelp(), null, pvId.getDeclaredBy());
- pcdId.setTokenSpaceGuidCName(pvId.getTokenSpaceGuidCName());
- pcdId.setToken(pvId.getToken());
- pcdId.setDatumType(pvId.getDatumType());
- pcdId.setValue(pvId.getValue());
- pcdId.setUsage(pvId.getUsage());
-
- pcd.addElement(pcdId);
- }
- }
-
- return pcd;
- }
-
- /**
- Get all library class entries from workspace
-
- @return
-
- **/
- public static LibraryClassVector getAllLibraryClassVector() {
- LibraryClassVector lcv = new LibraryClassVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- LibraryClassIdentification lcid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getLibraryClassDefinitions() != null) {
- LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();
- if (lcd.getLibraryClassList().size() > 0) {
- for (int index = 0; index < lcd.getLibraryClassList().size(); index++) {
- String name = lcd.getLibraryClassList().get(index).getKeyword();
- String usage = null;
- if (lcd.getLibraryClassList().get(index).getUsage() != null) {
- usage = lcd.getLibraryClassList().get(index).getUsage().toString();
- }
- String version = lcd.getLibraryClassList().get(index).getRecommendedInstanceVersion();
- String guid = lcd.getLibraryClassList().get(index).getRecommendedInstanceGuid();
- String featureFlag = lcd.getLibraryClassList().get(index).getFeatureFlag();
- Vector<String> arch = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
- .getSupArchList());
- Vector<String> module = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
- .getSupModuleList());
- String help = lcd.getLibraryClassList().get(index).getHelpText();
- lcid = new LibraryClassIdentification(name, usage, version, guid, arch, featureFlag,
- module, help);
- lcid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getLibraryClassDeclarations() != null) {
- for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd
- .getLibraryClassDeclarations()
- .getLibraryClassList()
- .size(); indexOfLibraryClass++) {
- LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList()
- .get(indexOfLibraryClass);
- if (lc.getName().equals(name)) {
- lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));
- lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));
- lcid.setHelp(lc.getHelpText());
- lcid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (lcid.getDeclaredBy() == null) {
- lcid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- lcv.addLibraryClass(lcid);
- }
- }
- }
- }
- }
- //
- // Go through all defined pcds to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getLibraryClassDeclarations() != null) {
- for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd.getLibraryClassDeclarations()
- .getLibraryClassList().size(); indexOfLibraryClass++) {
- boolean isFound = false;
- LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass);
- for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {
- if (lc.getName().equals(lcv.getLibraryClass(indexOfLcv).getLibraryClassName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- lcid = new LibraryClassIdentification("", null, "", "", null, "", null, "");
- lcid.setLibraryClassName(lc.getName());
- lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));
- lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));
- lcid.setHelp(lc.getHelpText());
- lcid.setDeclaredBy(packageId);
-
- lcid.setBelongModule(null);
- lcv.addLibraryClass(lcid);
- }
- }
- }
- }
- Sort.sortLibraryClass(lcv, DataType.SORT_TYPE_ASCENDING);
- return lcv;
- }
-
- /**
- Re-org all guid entries for find table
-
- @return
-
- **/
- public static Vector<FindResultId> getAllLibraryClassForFind(LibraryClassVector lcv) {
- Vector<FindResultId> libraryClass = new Vector<FindResultId>();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {
- isAdded = false;
- LibraryClassIdentification lcvId = lcv.getLibraryClass(indexOfLcv);
-
- //
- // First check if produced or not
- //
- if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {
- FindResultId frId = libraryClass.get(indexOfGuid);
-
- if (lcvId.getLibraryClassName().equals(frId.getName())) {
- if (isProduced) {
- libraryClass.get(indexOfGuid).addProducedModules(lcvId.getBelongModule());
- } else if (!isProduced) {
- libraryClass.get(indexOfGuid).addConsumedModules(lcvId.getBelongModule());
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- libraryClass.addElement(new FindResultId(lcvId.getLibraryClassName(), "Library Class",
- lcvId.getSupArchList(), lcvId.getHelp(),
- lcvId.getSupModuleList(), lcvId.getDeclaredBy()));
- }
- }
-
- return libraryClass;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java
deleted file mode 100644
index de6526b10c..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java
+++ /dev/null
@@ -1,651 +0,0 @@
-/** @file
-
- The file is used to show a table with all defined PPIs
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.WindowEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingConstants;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableCellRenderer;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
-
-public class FindResult extends IFrame implements TableModelListener, ListSelectionListener, MouseListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -2448484533878401714L;
-
- //
- // Define class members
- //
- private JTable jTable = null;
-
- private JPanel jContentPane = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JButton jButtonClose = null;
-
- //
- // Not used by UI
- //
- private IDefaultTableModel model = null;
-
- private String method = "";
-
- private static FindResult findPpisResult = null;
-
- private static FindResult findProtocolsResult = null;
-
- private static FindResult findGuidsResult = null;
-
- private static FindResult findPcdsResult = null;
-
- private static FindResult findLibraryClassResult = null;
-
- private int selectedRow = -1;
-
- private LibraryClassVector lcv = null;
-
- private Vector<FindResultId> vLibraryClassFindResult = null;
-
- private PcdCodedVector pv = null;
-
- private Vector<PcdFindResultId> vPcdFindResult = null;
-
- private JButton jButtonReload = null;
-
- private JPanel jPanelOperation = null;
-
- /**
- * This is the default constructor
- */
- public FindResult(String method) {
- super();
- init(method);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init(String method) {
- this.setSize(600, 500);
- this.setContentPane(getJScrollPane());
- this.setTitle("Find Result");
- this.setResizable(true);
- this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- this.centerWindow();
-
- //
- // max the window
- //
- //this.setExtendedState(JFrame.MAXIMIZED_BOTH);
- this.method = method;
- this.showTable();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJScrollPaneTable(), null);
- jContentPane.add(getJPanelOperation(), null);
- jContentPane.setPreferredSize(new java.awt.Dimension(585, 445));
- }
- return jContentPane;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(0, 0, 585, 395));
- jScrollPaneTable.setPreferredSize(new Dimension(585, 395));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
-
- model.addColumn("Name");
- model.addColumn("Type");
- model.addColumn("Produced by");
- model.addColumn("Consumed by");
- model.addColumn("Declared by");
-
- jTable.getColumn("Name").setCellRenderer(new MyTableCellRenderer());
- jTable.getColumn("Type").setCellRenderer(new MyTableCellRenderer());
- jTable.getColumn("Produced by").setCellRenderer(new MyTableCellRenderer());
- jTable.getColumn("Consumed by").setCellRenderer(new MyTableCellRenderer());
- jTable.getColumn("Declared by").setCellRenderer(new MyTableCellRenderer());
-
- int columnWidth = (this.getSize().width - 28) / 5;
- jTable.getColumn("Name").setPreferredWidth(columnWidth);
- jTable.getColumn("Type").setPreferredWidth(columnWidth);
- jTable.getColumn("Produced by").setPreferredWidth(columnWidth);
- jTable.getColumn("Consumed by").setPreferredWidth(columnWidth);
- jTable.getColumn("Declared by").setPreferredWidth(columnWidth);
- }
- return jTable;
- }
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonClose() {
- if (jButtonClose == null) {
- jButtonClose = new JButton();
- jButtonClose.setText("Close");
- jButtonClose.addActionListener(this);
- jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonClose.setBounds(new java.awt.Rectangle(90, 0, 80, 20));
- }
- return jButtonClose;
- }
-
- public static FindResult getInstance(String method) {
- if (method.equals("PPI")) {
- if (findPpisResult == null) {
- findPpisResult = new FindResult(method);
- }
- findPpisResult.init(method);
- return findPpisResult;
- }
-
- if (method.equals("PROTOCOL")) {
- if (findProtocolsResult == null) {
- findProtocolsResult = new FindResult(method);
- }
- findProtocolsResult.init(method);
- return findProtocolsResult;
- }
-
- if (method.equals("GUID")) {
- if (findGuidsResult == null) {
- findGuidsResult = new FindResult(method);
- }
- findGuidsResult.init(method);
- return findGuidsResult;
- }
-
- if (method.equals("PCD")) {
- if (findPcdsResult == null) {
- findPcdsResult = new FindResult(method);
- }
- findPcdsResult.init(method);
- return findPcdsResult;
- }
-
- if (method.equals("LIBRARY_CLASS")) {
- if (findLibraryClassResult == null) {
- findLibraryClassResult = new FindResult(method);
- }
- findLibraryClassResult.init(method);
- return findLibraryClassResult;
- }
-
- return null;
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
- this.jTable.repaint();
- this.jTable.updateUI();
-
- if (this.method.equals("PPI")) {
- Vector<PpiId> vPpi = Find.getAllPpisForFind();
-
- if (vPpi.size() > 0) {
-
- for (int index = 0; index < vPpi.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vPpi.elementAt(index).getName());
- v.addElement(vPpi.elementAt(index).getType());
- String strProducedModules = vPpi.elementAt(index).getProducedModules();
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- String strConsumedModules = vPpi.elementAt(index).getConsumedModules();
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- v.addElement(vPpi.elementAt(index).getDeclaredBy());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find PPIs", "No PPI found!!!");
- }
- }
-
- if (this.method.equals("PROTOCOL")) {
- Vector<ProtocolId> vProtocol = Find.getAllProtocolsForFind();
-
- if (vProtocol.size() > 0) {
-
- for (int index = 0; index < vProtocol.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vProtocol.elementAt(index).getName());
- v.addElement(vProtocol.elementAt(index).getType());
- String strProducedModules = vProtocol.elementAt(index).getProducedModules();
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- String strConsumedModules = vProtocol.elementAt(index).getConsumedModules();
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- v.addElement(vProtocol.elementAt(index).getDeclaredBy());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find PROTOCOLs", "No PROTOCOL found!!!");
- }
- }
-
- if (this.method.equals("GUID")) {
- Vector<GuidId> vGuid = Find.getAllGuidsForFind();
-
- if (vGuid.size() > 0) {
-
- for (int index = 0; index < vGuid.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vGuid.elementAt(index).getName());
- v.addElement("GUID");
- String strProducedModules = vGuid.elementAt(index).getProducedModules();
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- String strConsumedModules = vGuid.elementAt(index).getConsumedModules();
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- v.addElement(vGuid.elementAt(index).getDeclaredBy());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find GUIDs", "No GUID found!!!");
- }
- }
-
- if (this.method.equals("PCD")) {
- pv = Find.getAllPcdCodedVector();
- vPcdFindResult = Find.getAllPcdCodedForFind(pv);
-
- if (vPcdFindResult.size() > 0) {
-
- for (int index = 0; index < vPcdFindResult.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vPcdFindResult.elementAt(index).getName());
- v.addElement(vPcdFindResult.elementAt(index).getType());
-
- //
- // Generate Produced Modules List
- //
- String strProducedModules = "";
- Vector<ModuleIdentification> vModule = vPcdFindResult.elementAt(index).getProducedModules();
- for (int indexOfPM = 0; indexOfPM < vModule.size(); indexOfPM++) {
- strProducedModules = strProducedModules + "<br>"
- + vModule.get(indexOfPM).getPackageId().getName() + "."
- + vModule.get(indexOfPM).getName();
- }
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- //
- // Generate Consumed Modules List
- //
- String strConsumedModules = "";
- vModule = vPcdFindResult.elementAt(index).getConsumedModules();
- for (int indexOfCM = 0; indexOfCM < vModule.size(); indexOfCM++) {
- strConsumedModules = strConsumedModules + "<br>"
- + vModule.get(indexOfCM).getPackageId().getName() + "."
- + vModule.get(indexOfCM).getName();
- }
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- //
- // Add declare package name
- //
- v.addElement(vPcdFindResult.elementAt(index).getDeclaredBy().getName());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find PCDs", "No PCD found!!!");
- }
- }
-
- if (this.method.equals("LIBRARY_CLASS")) {
- lcv = Find.getAllLibraryClassVector();
- vLibraryClassFindResult = Find.getAllLibraryClassForFind(lcv);
-
- if (vLibraryClassFindResult.size() > 0) {
- for (int index = 0; index < vLibraryClassFindResult.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vLibraryClassFindResult.elementAt(index).getName());
- v.addElement(vLibraryClassFindResult.elementAt(index).getType());
-
- //
- // Generate Produced Modules List
- //
- String strProducedModules = "";
- Vector<ModuleIdentification> vModule = vLibraryClassFindResult.elementAt(index)
- .getProducedModules();
- for (int indexOfPM = 0; indexOfPM < vModule.size(); indexOfPM++) {
- strProducedModules = strProducedModules + "<br>"
- + vModule.get(indexOfPM).getPackageId().getName() + "."
- + vModule.get(indexOfPM).getName();
- }
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- //
- // Generate Consumed Modules List
- //
- String strConsumedModules = "";
- vModule = vLibraryClassFindResult.elementAt(index).getConsumedModules();
- for (int indexOfCM = 0; indexOfCM < vModule.size(); indexOfCM++) {
- strConsumedModules = strConsumedModules + "<br>"
- + vModule.get(indexOfCM).getPackageId().getName() + "."
- + vModule.get(indexOfCM).getName();
- }
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- v.addElement(vLibraryClassFindResult.elementAt(index).getDeclaredBy().getName());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find Library Classes", "No Library Class found!!!");
- }
- }
-
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == this.jButtonClose) {
- this.dispose();
- }
-
- if (arg0.getSource() == this.jButtonReload) {
- this.showTable();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.centerComponent(this.jPanelOperation, intCurrentWidth, intCurrentHeight, intPreferredHeight,
- DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);
- Tools.resizeTableColumn(this.jTable, this.getSize().width - 28);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- if (this.method.equals("LIBRARY_CLASS")) {
- FindResultDetailInfo frdi = new FindResultDetailInfo(vLibraryClassFindResult.elementAt(selectedRow));
- frdi.setVisible(true);
- }
- if (this.method.equals("PCD")) {
- FindResultDetailInfo frdi = new FindResultDetailInfo(vPcdFindResult.elementAt(selectedRow));
- frdi.setVisible(true);
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to popup warning message to confirm quit
- *
- */
- public void windowClosing(WindowEvent arg0) {
- this.dispose();
- }
-
- class MyTableCellRenderer extends DefaultTableCellRenderer {
- ///
- /// Define Class Serial Version UID
- ///
- private static final long serialVersionUID = -2082787479305255946L;
-
- public void setValue(Object value) {
- this.setVerticalAlignment(SwingConstants.TOP);
- super.setValue(value);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * This method initializes jButtonReload
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonReload() {
- if (jButtonReload == null) {
- jButtonReload = new JButton();
- jButtonReload.setText("Reload");
- jButtonReload.addActionListener(this);
- jButtonReload.setBounds(new java.awt.Rectangle(0, 0, 80, 20));
- jButtonReload.setPreferredSize(new java.awt.Dimension(80, 20));
- }
- return jButtonReload;
- }
-
- /**
- * This method initializes jPanelOperation
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelOperation() {
- if (jPanelOperation == null) {
- jPanelOperation = new JPanel();
- jPanelOperation.setLayout(null);
- jPanelOperation.setBounds(new java.awt.Rectangle(300, 415, 170, 20));
- jPanelOperation.setPreferredSize(new java.awt.Dimension(170, 20));
- jPanelOperation.add(getJButtonClose(), null);
- jPanelOperation.add(getJButtonReload(), null);
- }
- return jPanelOperation;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java
deleted file mode 100644
index 278ac1d964..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java
+++ /dev/null
@@ -1,657 +0,0 @@
-/** @file
-
- The file is used to show detailed information of one of find results
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.WindowEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;
-import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo;
-import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData;
-import org.tianocore.FrameworkModulesDocument.FrameworkModules;
-import org.tianocore.LibrariesDocument.Libraries;
-import org.tianocore.LibrariesDocument.Libraries.Instance;
-import org.tianocore.LibraryClassDocument.LibraryClass;
-import org.tianocore.ModuleSADocument.ModuleSA;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;
-import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData;
-import org.tianocore.PcdCodedDocument.PcdCoded;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class FindResultDetailInfo extends IFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -4888295869041881282L;
-
- private JPanel jContentPane = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTextArea jTextArea = null;
-
- private JButton jButtonClose = null;
-
- //
- // Not for UI
- //
- private static String TAB = " ";
-
- private String reportContent = "";
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(5, 5, 535, 280));
- jScrollPane.setPreferredSize(new java.awt.Dimension(535, 280));
- jScrollPane.setViewportView(getJTextArea());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonClose
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonClose() {
- if (jButtonClose == null) {
- jButtonClose = new JButton();
- jButtonClose.setBounds(new java.awt.Rectangle(240, 290, 80, 20));
- jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonClose.addActionListener(this);
- jButtonClose.setText("Close");
- }
- return jButtonClose;
- }
-
- /**
-
- @param lci
-
- **/
- public FindResultDetailInfo(FindResultId frid) {
- super();
- init();
- this.setTitle(frid.getName());
- this.jTextArea.setText(createReport(frid));
- this.jTextArea.setSelectionStart(0);
- this.jTextArea.setSelectionEnd(0);
- }
-
- /**
-
- @param lci
-
- **/
- public FindResultDetailInfo(PcdFindResultId frid) {
- super();
- init();
- this.setTitle(frid.getName());
- this.jTextArea.setText(createReport(frid));
- this.jTextArea.setSelectionStart(0);
- this.jTextArea.setSelectionEnd(0);
- }
-
- /**
- Create detailed information report for pcd
-
- @param frid
- @return
-
- **/
- private String createReport(PcdFindResultId frid) {
- String name = frid.getName();
-
- //
- // Write Pcd Name
- //
- writeReportLn("PCD C Name: " + name);
-
- //
- // Wrtie Declared package
- //
- writeReportLn("Declared in Package: " + frid.getDeclaredBy().getName() + " ("
- + Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace()) + ")");
-
- //
- // Write Token Space
- //
- writeReportLn("Token Space: " + frid.getTokenSpaceGuidCName());
-
- //
- // Write Token
- //
- writeReportLn("Token: " + frid.getToken());
-
- //
- // Write Datum Type
- //
- writeReportLn("Datum Type: " + frid.getDatumType());
-
- //
- // Write Default Value
- //
- writeReportLn("Default Value: " + frid.getValue());
-
- //
- // Write Usages
- //
- writeReportLn("Valid Usages: " + frid.getUsage());
-
- //
- // Write Help Text
- //
- writeReportLn("Help Text: ");
- writeReportLn(TAB + frid.getHelp());
-
- //
- // Write an Empty Line
- //
- writeReportLn("");
-
- //
- // Wriet all modules which use this PCD:
- //
- writeReportLn("Modules Coded to Use This PCD: ");
-
- Vector<ModuleIdentification> vModules = frid.getConsumedModules();
- if (vModules != null) {
- for (int index = 0; index < vModules.size(); index++) {
- //
- // Write Module Name and Path
- //
- writeReportLn(TAB + vModules.get(index).getName() + " ("
- + Tools.getRelativePath(vModules.get(index).getPath(), Workspace.getCurrentWorkspace())
- + ")");
-
- //
- // Write Module Pcd Info
- //
- ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(vModules.get(index));
- if (msa != null) {
- PcdCoded pcdCoded = msa.getPcdCoded();
- if (pcdCoded != null) {
- for (int indexOfPcd = 0; indexOfPcd < pcdCoded.getPcdEntryList().size(); indexOfPcd++) {
- if (pcdCoded.getPcdEntryList().get(indexOfPcd).getCName().equals(name)) {
- //
- // Write Pcd Item Type
- //
- writeReportLn(TAB + TAB + "PcdItemType: "
- + pcdCoded.getPcdEntryList().get(indexOfPcd).getPcdItemType().toString());
-
- //
- // Write Help Text
- //
- writeReportLn(TAB + TAB + "Help Text: ");
- writeReportLn(TAB + TAB + TAB
- + pcdCoded.getPcdEntryList().get(indexOfPcd).getHelpText());
- }
- }
- }
- }
-
- //
- // Write an Empty Line
- //
- writeReportLn("");
- }
- }
-
- //
- // Write an Empty Line
- //
- writeReportLn("");
-
- //
- // Write All Platforms Specifing this PCD
- //
- writeReportLn("Platforms Specifing this PCD: ");
-
- for (int index = 0; index < GlobalData.openingPlatformList.size(); index++) {
- PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index).getXmlFpd();
- PlatformIdentification pid = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index).getId();
-
- String tmp = "";
- //
- // Get Non-Dynamic Pcd
- //
- FrameworkModules fm = fpd.getFrameworkModules();
- if (fm != null) {
- for (int indexOfModuleSa = 0; indexOfModuleSa < fm.getModuleSAList().size(); indexOfModuleSa++) {
- ModuleSA msa = fm.getModuleSAList().get(indexOfModuleSa);
- if (msa != null) {
- PcdBuildDefinition p = msa.getPcdBuildDefinition();
- if (p != null) {
- if (p.getPcdDataList() != null) {
-
- for (int indexOfPcd = 0; indexOfPcd < p.getPcdDataList().size(); indexOfPcd++) {
- PcdData pd = p.getPcdDataList().get(indexOfPcd);
- //
- // Find this PCD
- //
- if (pd.getCName().equals(name)) {
- //
- // Write Module Sa Info
- //
- ModuleIdentification moduleSaId = GlobalData
- .findModuleId(
- msa.getModuleGuid(),
- msa
- .getModuleVersion(),
- msa.getPackageGuid(),
- msa
- .getPackageVersion());
- tmp = tmp
- + TAB
- + TAB
- + "Module: "
- + moduleSaId.getName()
- + " ("
- + Tools.getRelativePath(moduleSaId.getPath(),
- Workspace.getCurrentWorkspace()) + ")"
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Implementation: " + pd.getItemType().toString()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Specified / Implementation Value: "
- + pd.getValue() + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + DataType.UNIX_LINE_SEPARATOR;
- }
- }
- }
- }
- }
- }
- }
-
- //
- // Get Dynamic Pcd
- //
- DynamicPcdBuildDefinitions dpbd = fpd.getDynamicPcdBuildDefinitions();
- if (dpbd != null) {
- for (int indexOfDpbd = 0; indexOfDpbd < dpbd.getPcdBuildDataList().size(); indexOfDpbd++) {
- PcdBuildData pbd = dpbd.getPcdBuildDataList().get(indexOfDpbd);
- if (pbd != null) {
- if (pbd.getCName().equals(name)) {
- //
- // Write Dynamic Pcd Build Definition
- //
- tmp = tmp + TAB + TAB + "Dynamic Pcd Build Definition: " + DataType.UNIX_LINE_SEPARATOR;
- if (pbd.getSkuInfoList() != null) {
- for (int indexOfPcd = 0; indexOfPcd < pbd.getSkuInfoList().size(); indexOfPcd++) {
- SkuInfo si = pbd.getSkuInfoList().get(indexOfPcd);
- if (si != null) {
- tmp = tmp + TAB + TAB + TAB + "Sku Id: " + si.getSkuId().toString()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Variable Name: " + si.getVariableName()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Variable GUID: " + si.getVariableGuid()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Variable Offset: " + si.getVariableOffset()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Hii Default Value: " + si.getHiiDefaultValue()
- + DataType.UNIX_LINE_SEPARATOR;
- }
- }
- }
- }
- }
- }
- }
-
- //
- // If not empty, write this platform info
- //
- if (!Tools.isEmpty(tmp)) {
- tmp = TAB + "Platform: " + pid.getName() + " ("
- + Tools.getRelativePath(pid.getPath(), Workspace.getCurrentWorkspace()) + ")"
- + DataType.UNIX_LINE_SEPARATOR + tmp;
- this.writeReportLn(tmp);
- }
- }
-
- return reportContent;
- }
-
- //
- // Create detailed information report for library
- //
- /**
-
- @param frid
- @return
-
- **/
- private String createReport(FindResultId frid) {
- String tmp = "";
- String name = frid.getName();
-
- //
- // Write Class Name
- //
- writeReportLn(name);
-
- //
- // Write Provided Package
- //
- writeReportLn(TAB + "Provided by: " + frid.getDeclaredBy().getName() + " ("
- + Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace()) + ")");
-
- //
- // Write Header File
- //
- PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(frid.getDeclaredBy());
- tmp = Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace());
- writeReportLn(TAB + "Header File: " + Tools.getFilePathOnly(tmp)
- + wt.getHeaderFileFromPackageByLibraryClassName(spd, name));
-
- //
- // Write Supported Module Types
- //
- writeReportLn(TAB + "Supported Module Types: " + Tools.convertVectorToString(frid.getModuleType()));
-
- //
- // Write Supported Arch
- //
- writeReportLn(TAB + "Supported Architectures: " + Tools.convertVectorToString(frid.getArch()));
-
- //
- // Write Help Text
- //
- writeReportLn(TAB + "Help Text: ");
- writeReportLn(TAB + TAB + frid.getHelp());
-
- //
- // Write an empty line
- //
- writeReportLn("");
-
- //
- // Write Instances
- //
- writeReportLn("Library Instances:");
-
- //
- // Write Instances One by One
- //
- for (int index = 0; index < frid.getProducedModules().size(); index++) {
- ModuleIdentification mid = frid.getProducedModules().get(index);
- ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);
- if (msa != null) {
- //
- // Write Instance Name
- //
- if (msa.getMsaHeader() != null) {
- writeReportLn(TAB + msa.getMsaHeader().getModuleName());
- }
-
- //
- // Write Msa File Name
- //
- writeReportLn(TAB + TAB + "Provided by: "
- + Tools.getRelativePath(mid.getPath(), Workspace.getCurrentWorkspace()));
-
- //
- // Find the produced library class
- //
- if (msa.getLibraryClassDefinitions() != null) {
- for (int indexL = 0; indexL < msa.getLibraryClassDefinitions().getLibraryClassList().size(); indexL++) {
- LibraryClass lc = msa.getLibraryClassDefinitions().getLibraryClassList().get(indexL);
- if (lc.getKeyword().equals(name)) {
- //
- // Write Supported Module Types
- //
- writeReportLn(TAB + TAB + "Supported Module Types: "
- + Tools.convertListToString(lc.getSupModuleList()));
-
- //
- // Write Supported Arch
- //
- writeReportLn(TAB + TAB + "Supported Architectures: "
- + Tools.convertListToString(lc.getSupArchList()));
-
- //
- // Write Help Text
- //
- writeReportLn(TAB + TAB + "Help Text: ");
- writeReportLn(TAB + TAB + (lc.getHelpText() == null ? "" : lc.getHelpText()));
- }
- }
- }
-
- }
- }
-
- //
- // Write an empty line
- //
- writeReportLn("");
-
- //
- // Write all modules which consumed this library
- //
- writeReportLn("Modules Requiring " + name + ":");
- for (int index = 0; index < frid.getConsumedModules().size(); index++) {
- //
- // Write
- //
- writeReportLn(TAB
- + frid.getConsumedModules().get(index).getName()
- + " ("
- + Tools.getRelativePath(frid.getConsumedModules().get(index).getPath(),
- Workspace.getCurrentWorkspace()) + ")");
- }
-
- //
- // Write an empty line
- //
- writeReportLn("");
-
- //
- // Write platforms using the library class instances
- //
- writeReportLn("Platforms Using " + name + ":");
-
- //
- // Write Instances One by One as Using Platforms
- //
- for (int index = 0; index < frid.getProducedModules().size(); index++) {
- ModuleIdentification mid = frid.getProducedModules().get(index);
-
- //
- // Write Instance Name
- //
- writeReportLn(TAB + mid.getName());
-
- //
- // Go through each platform one by one
- //
- for (int indexOfPlatform = 0; indexOfPlatform < GlobalData.openingPlatformList.size(); indexOfPlatform++) {
- PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)
- .getXmlFpd();
- PlatformIdentification pid = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)
- .getId();
- Vector<ModuleIdentification> vModuleSa = new Vector<ModuleIdentification>();
- if (fpd != null) {
- FrameworkModules fm = fpd.getFrameworkModules();
- if (fm != null) {
- for (int indexOfModule = 0; indexOfModule < fm.getModuleSAList().size(); indexOfModule++) {
- ModuleSA msa = fm.getModuleSAList().get(indexOfModule);
- if (msa != null) {
- Libraries l = msa.getLibraries();
- if (l != null) {
- if (l.getInstanceList() != null) {
- for (int indexOfInstance = 0; indexOfInstance < l.getInstanceList().size(); indexOfInstance++) {
- Instance i = l.getInstanceList().get(indexOfInstance);
- if (mid.equals(i.getModuleGuid(), i.getModuleVersion(), i.getPackageGuid(),
- i.getPackageVersion())) {
- ModuleIdentification moduleSaId = GlobalData
- .findModuleId(
- msa
- .getModuleGuid(),
- msa
- .getModuleVersion(),
- msa
- .getPackageGuid(),
- msa
- .getPackageVersion());
- if (moduleSaId != null) {
- vModuleSa.addElement(moduleSaId);
- }
- }
- }
- }
- }
- }
- }
-
- //
- // Get finded moduleSa in this spd
- //
- if (vModuleSa.size() > 0) {
- writeReportLn(TAB + TAB + pid.getName() + " ("
- + Tools.getRelativePath(pid.getPath(), Workspace.getCurrentWorkspace()) + ")");
- for (int indexOfModuleSa = 0; indexOfModuleSa < vModuleSa.size(); indexOfModuleSa++) {
- writeReportLn(TAB
- + TAB
- + TAB
- + vModuleSa.elementAt(indexOfModuleSa).getName()
- + " ("
- + Tools.getRelativePath(vModuleSa.elementAt(indexOfModuleSa).getPath(),
- Workspace.getCurrentWorkspace()) + ")");
- }
- }
- }
- }
- }
- writeReportLn("");
- }
-
- return this.reportContent;
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init() {
- this.setSize(550, 380);
- this.setContentPane(getJContentPane());
- this.setTitle("JFrame");
- this.setResizable(true);
- this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- this.centerWindow();
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(550, 350));
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonClose(), null);
-
- jContentPane.setPreferredSize(new java.awt.Dimension(550, 340));
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to popup warning message to confirm quit
- *
- */
- public void windowClosing(WindowEvent arg0) {
- this.dispose();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPane, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.centerComponent(this.jButtonClose, intCurrentWidth, intCurrentHeight, intPreferredHeight,
- DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == this.jButtonClose) {
- this.dispose();
- }
- }
-
- private void writeReportLn(String line) {
- this.reportContent = this.reportContent + line + DataType.LINE_SEPARATOR;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java
deleted file mode 100644
index 3784fb3839..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/** @file
-
- The file is used to define GUID Identification used by find function
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class FindResultId {
-
- private String name = "";
-
- private String type = "";
-
- private Vector<String> arch = new Vector<String>();
-
- private Vector<String> moduleType = new Vector<String>();
-
- private String help = "";
-
- private Vector<ModuleIdentification> producedModules = new Vector<ModuleIdentification>();
-
- private Vector<ModuleIdentification> consumedModules = new Vector<ModuleIdentification>();
-
- private PackageIdentification declaredBy = null;
-
- public FindResultId(String strName, String strType, Vector<String> vArch, String strHelp, Vector<String> vModuleType, PackageIdentification pDeclaredBy) {
- this.name = (strName == null ? "" : strName);
- this.type = (strType == null ? "" : strType);
- this.arch = (vArch == null ? this.arch : vArch);
- this.help = (strHelp == null ? "" : strHelp);
- this.moduleType = (vModuleType == null ? this.moduleType : vModuleType);
- this.declaredBy = pDeclaredBy;
- }
-
- public Vector<String> getArch() {
- return arch;
- }
-
- public void setArch(Vector<String> arch) {
- this.arch = arch;
- }
-
- public Vector<ModuleIdentification> getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(Vector<ModuleIdentification> consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public void addConsumedModules(ModuleIdentification consumedModule) {
- if (consumedModule != null) {
- this.consumedModules.addElement(consumedModule);
- }
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<ModuleIdentification> getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(Vector<ModuleIdentification> producedModules) {
- this.producedModules = producedModules;
- }
-
- public void addProducedModules(ModuleIdentification producedModule) {
- if (producedModule != null) {
- this.producedModules.addElement(producedModule);
- }
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Vector<String> getModuleType() {
- return moduleType;
- }
-
- public void setModuleType(Vector<String> moduleType) {
- this.moduleType = moduleType;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/GuidId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/GuidId.java
deleted file mode 100644
index 2533108e4a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/GuidId.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
-
- The file is used to define GUID Identification used by find function
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class GuidId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public GuidId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/LibraryClassId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/LibraryClassId.java
deleted file mode 100644
index a31cb38ade..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/LibraryClassId.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
-
- The file is used to define Library Class Identification used by find function
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class LibraryClassId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public LibraryClassId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdFindResultId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdFindResultId.java
deleted file mode 100644
index 88e46c48cf..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdFindResultId.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
-
- The file is used to define Pcd Identification used by find function
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class PcdFindResultId extends FindResultId {
-
- private String tokenSpaceGuidCName = null;
-
- private String token = null;
-
- private String datumType = null;
-
- private String value = null;
-
- private String usage = null;
-
- public PcdFindResultId(String strName, String strType, Vector<String> vArch, String strHelp, Vector<String> vModuleType, PackageIdentification pDeclaredBy) {
- super(strName, strType, vArch, strHelp, vModuleType, pDeclaredBy);
- }
-
- public String getDatumType() {
- return datumType;
- }
-
- public void setDatumType(String datumType) {
- this.datumType = datumType;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public String getTokenSpaceGuidCName() {
- return tokenSpaceGuidCName;
- }
-
- public void setTokenSpaceGuidCName(String tokenSpaceGuidCName) {
- this.tokenSpaceGuidCName = tokenSpaceGuidCName;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdId.java
deleted file mode 100644
index 4982109068..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdId.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
-
- The file is used to define GUID Identification used by find function
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class PcdId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public PcdId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PpiId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PpiId.java
deleted file mode 100644
index d4782c4012..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PpiId.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
-
- The file is used to define PPI Identification used by find function
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class PpiId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public PpiId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/ProtocolId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/ProtocolId.java
deleted file mode 100644
index 69bcbec984..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/ProtocolId.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
-
- The file is used to define PROTOCOL Identification used by find function
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class ProtocolId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public ProtocolId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
deleted file mode 100644
index d02c121433..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/** @file
-
- The file is used to provid 6 kinds of arch in one jpanel
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.util.Vector;
-
-import javax.swing.JCheckBox;
-import javax.swing.JPanel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-
-public class ArchCheckBox extends JPanel {
-
- ///
- /// Define class members
- ///
- private static final long serialVersionUID = 4792669775676953990L;
-
- private JCheckBox jCheckBoxIa32 = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JCheckBox jCheckBoxEbc = null;
-
- private JCheckBox jCheckBoxArm = null;
-
- private JCheckBox jCheckBoxPpc = null;
-
- /**
- * This method initializes jCheckBoxIa32
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIa32() {
- if (jCheckBoxIa32 == null) {
- jCheckBoxIa32 = new JCheckBox();
- jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
- jCheckBoxIa32.setText("IA32");
- jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxIa32;
- }
-
- /**
- * This method initializes jCheckBoxX64
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBoxIpf
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
- jCheckBoxIpf.setText("IPF");
- jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxIpf;
- }
-
- /**
- * This method initializes jCheckBoxEbc
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxEbc() {
- if (jCheckBoxEbc == null) {
- jCheckBoxEbc = new JCheckBox();
- jCheckBoxEbc.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
- jCheckBoxEbc.setText("EBC");
- jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxEbc;
- }
-
- /**
- * This method initializes jCheckBoxArm
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxArm() {
- if (jCheckBoxArm == null) {
- jCheckBoxArm = new JCheckBox();
- jCheckBoxArm.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
- jCheckBoxArm.setText("ARM");
- jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxArm;
- }
-
- /**
- * This method initializes jCheckBoxPpc
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPpc() {
- if (jCheckBoxPpc == null) {
- jCheckBoxPpc = new JCheckBox();
- jCheckBoxPpc.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
- jCheckBoxPpc.setText("PPC");
- jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxPpc;
- }
-
- /**
- * This is the default constructor
- */
- public ArchCheckBox() {
- super();
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(320, 20);
- this.setLayout(null);
- this.add(getJCheckBoxIa32(), null);
- this.add(getJCheckBoxX64(), null);
- this.add(getJCheckBoxIpf(), null);
- this.add(getJCheckBoxEbc(), null);
- this.add(getJCheckBoxArm(), null);
- this.add(getJCheckBoxPpc(), null);
- this.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
-
- public Vector<String> getSelectedItemsVector() {
- Vector<String> v = new Vector<String>();
- if (this.jCheckBoxIa32.isSelected() && this.jCheckBoxIa32.isEnabled()) {
- v.addElement(jCheckBoxIa32.getText());
- }
- if (this.jCheckBoxX64.isSelected() && this.jCheckBoxX64.isEnabled()) {
- v.addElement(jCheckBoxX64.getText());
- }
- if (this.jCheckBoxIpf.isSelected() && this.jCheckBoxIpf.isEnabled()) {
- v.addElement(jCheckBoxIpf.getText());
- }
- if (this.jCheckBoxEbc.isSelected() && this.jCheckBoxEbc.isEnabled()) {
- v.addElement(jCheckBoxEbc.getText());
- }
- if (this.jCheckBoxArm.isSelected() && this.jCheckBoxArm.isEnabled()) {
- v.addElement(jCheckBoxArm.getText());
- }
- if (this.jCheckBoxPpc.isSelected() && this.jCheckBoxPpc.isEnabled()) {
- v.addElement(jCheckBoxPpc.getText());
- }
- return v;
- }
-
- public String getSelectedItemsString() {
- String s = "";
- if (this.jCheckBoxIa32.isSelected() && this.jCheckBoxIa32.isEnabled()) {
- s = s + jCheckBoxIa32.getText() + " ";
- }
- if (this.jCheckBoxX64.isSelected() && this.jCheckBoxX64.isEnabled()) {
- s = s + jCheckBoxX64.getText() + " ";
- }
- if (this.jCheckBoxIpf.isSelected() && this.jCheckBoxIpf.isEnabled()) {
- s = s + jCheckBoxIpf.getText() + " ";
- }
- if (this.jCheckBoxEbc.isSelected() && this.jCheckBoxEbc.isEnabled()) {
- s = s + jCheckBoxEbc.getText() + " ";
- }
- if (this.jCheckBoxArm.isSelected() && this.jCheckBoxArm.isEnabled()) {
- s = s + jCheckBoxArm.getText() + " ";
- }
- if (this.jCheckBoxPpc.isSelected() && this.jCheckBoxPpc.isEnabled()) {
- s = s + jCheckBoxPpc.getText() + " ";
- }
- return s.trim();
- }
-
- public void setAllItemsSelected(boolean isSelected) {
- this.jCheckBoxIa32.setSelected(isSelected);
- this.jCheckBoxX64.setSelected(isSelected);
- this.jCheckBoxIpf.setSelected(isSelected);
- this.jCheckBoxEbc.setSelected(isSelected);
- this.jCheckBoxArm.setSelected(isSelected);
- this.jCheckBoxPpc.setSelected(isSelected);
- }
-
- public void setSelectedItems(Vector<String> v) {
- setAllItemsSelected(false);
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
- this.jCheckBoxIa32.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
- this.jCheckBoxIpf.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxX64.getText())) {
- this.jCheckBoxX64.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
- this.jCheckBoxEbc.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxArm.getText())) {
- this.jCheckBoxArm.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
- this.jCheckBoxPpc.setSelected(true);
- continue;
- }
- }
- }
- }
-
- public void setAllItemsEnabled(boolean isEnabled) {
- this.jCheckBoxIa32.setEnabled(isEnabled);
- this.jCheckBoxX64.setEnabled(isEnabled);
- this.jCheckBoxIpf.setEnabled(isEnabled);
- this.jCheckBoxEbc.setEnabled(isEnabled);
- this.jCheckBoxArm.setEnabled(isEnabled);
- this.jCheckBoxPpc.setEnabled(isEnabled);
- }
-
- public void setEnabledItems(Vector<String> v) {
- setAllItemsEnabled(false);
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
- this.jCheckBoxIa32.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
- this.jCheckBoxIpf.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxX64.getText())) {
- this.jCheckBoxX64.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
- this.jCheckBoxEbc.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxArm.getText())) {
- this.jCheckBoxArm.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
- this.jCheckBoxPpc.setEnabled(true);
- continue;
- }
- }
- }
- }
-
- public void setDisabledItems(Vector<String> v) {
- setAllItemsEnabled(true);
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
- this.jCheckBoxIa32.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
- this.jCheckBoxIpf.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxX64.getText())) {
- this.jCheckBoxX64.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
- this.jCheckBoxEbc.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxArm.getText())) {
- this.jCheckBoxArm.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
- this.jCheckBoxPpc.setEnabled(false);
- continue;
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ExitConfirm.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ExitConfirm.java
deleted file mode 100644
index 836ed7b386..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ExitConfirm.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/** @file
-
- The file is used to popup a exit confirmation window when program exists
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-/**
- The class is used to popup a exit confirmation window when program exists
- It extends JDialog and implements ActionListener and WindowListener
-
- **/
-public class ExitConfirm extends JDialog implements ActionListener, WindowListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -5875921789385911029L;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelMessage = null;
-
- private JLabel jLabelResume = null;
-
- private JLabel jLabelExit = null;
-
- private JButton jButtonResume = null;
-
- private JButton jButtonExit = null;
-
- public boolean isCancel = false;
-
- /**
- This method initializes jButtonResume
-
- @return javax.swing.JButton jButtonResume
-
- **/
- private JButton getJButtonResume() {
- if (jButtonResume == null) {
- jButtonResume = new JButton();
- jButtonResume.setText("Resume");
- jButtonResume.setSize(new java.awt.Dimension(90, 20));
- jButtonResume.setLocation(new java.awt.Point(150, 105));
- jButtonResume.setMnemonic('R');
- jButtonResume.addActionListener(this);
- }
- return jButtonResume;
- }
-
- /**
- This method initializes jButtonExit
-
- @return javax.swing.JButton jButtonExit
-
- **/
- private JButton getJButtonExit() {
- if (jButtonExit == null) {
- jButtonExit = new JButton();
- jButtonExit.setText("Exit");
- jButtonExit.setSize(new java.awt.Dimension(90, 20));
- jButtonExit.setLocation(new java.awt.Point(260, 105));
- jButtonExit.setMnemonic('x');
- jButtonExit.addActionListener(this);
- }
- return jButtonExit;
- }
-
- /**
- Main clasee, reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- This is the default constructor
-
- **/
- public ExitConfirm(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- initialize();
- }
-
- /**
- This method initializes this
-
- @return void
-
- **/
- private void initialize() {
- this.setSize(500, 170);
- this.setTitle("Exit");
- this.setResizable(false);
- this.setContentPane(getJContentPane());
- this.addWindowListener(this);
- //
- //Set DO_NOTHING_ON_CLOSE when click Close button on title bar
- //
- this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- centerWindow();
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelExit = new JLabel();
- jLabelExit.setSize(new java.awt.Dimension(450, 20));
- jLabelExit.setLocation(new java.awt.Point(25, 70));
- jLabelResume = new JLabel();
- jLabelResume.setSize(new java.awt.Dimension(450, 20));
- jLabelResume.setLocation(new java.awt.Point(25, 40));
- jLabelMessage = new JLabel();
- jLabelMessage.setSize(new java.awt.Dimension(450, 20));
- jLabelMessage.setLocation(new java.awt.Point(25, 10));
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(jLabelMessage, null);
- jContentPane.add(jLabelResume, null);
- jContentPane.add(jLabelExit, null);
- jContentPane.add(getJButtonResume(), null);
- jContentPane.add(getJButtonExit(), null);
- }
- return jContentPane;
- }
-
- /**
- Call setWarningMessage to set messages of frame when it is used for Setup
-
- **/
- public void setSetupMessage() {
- String strTitle = "Exit Setup";
- String strMessage = "Setup is not complete. If you quit now, the program will not be installed.";
- String strResume = "You may run the setup program at a later time to complete the installation.";
- String strExit = "To continue installing, click Resume. To quit the Setup program, click Exit.";
- setWarningMessage(strTitle, strMessage, strResume, strExit);
- }
-
- /**
- Call setWarningMessage to set messages of frame when it is used for Module Main GUI
-
- **/
- public void setModuleMessage() {
- String strTitle = "Exit";
- String strMessage = "Do you really want to quit now?";
- String strResume = "All unsaved module information will be lost.";
- String strExit = "To continue editing the module, click Resume. To quit the program, click Exit.";
- setWarningMessage(strTitle, strMessage, strResume, strExit);
- }
-
- /**
- Set message information via input data
-
- @param strTitle The title value
- @param strMessage The main message value
- @param strResume The resume message value
- @param strExit The exit message value
-
- **/
- private void setWarningMessage(String strTitle, String strMessage, String strResume, String strExit) {
- this.setTitle(strTitle);
- jLabelMessage.setText(strMessage);
- jLabelResume.setText(strResume);
- jLabelExit.setText(strExit);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listern all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- //
- //Set isCancel true when click button "Exit"
- //
- Object obj = arg0.getSource();
- if (obj == jButtonResume) {
- isCancel = false;
- }
- if (obj == jButtonExit) {
- isCancel = true;
- }
- this.setVisible(false);
- }
-
- /**
- Make the window in the center of the screen
-
- **/
- private void centerWindow() {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- public void windowActivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowClosed(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowClosing(WindowEvent arg0) {
- isCancel = false;
- this.setVisible(false);
- }
-
- public void windowDeactivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowDeiconified(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowIconified(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowOpened(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java
deleted file mode 100644
index c5a51fd3e6..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/** @file
-
- The file is used to override JComboBox to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.JComboBox;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-
-/**
- The class is used to override JComboBox to provides customized interfaces
- It extends JComboBox implements KeyListener, MouseListener and FocusListener
-
-
-
- **/
-public class IComboBox extends JComboBox implements KeyListener, MouseListener, FocusListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1940262568168458911L;
-
- public void focusGained(FocusEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
- *
- * Override focusLost to exit edit mode
- *
- */
- public void focusLost(FocusEvent arg0) {
- this.closeEdit();
- }
-
- /**
- Main class, used for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- JFrame jf = new JFrame();
- jf.setSize(500, 200);
- JPanel jp = new JPanel();
- jp.setLayout(null);
- IComboBox icb = new IComboBox();
- jp.add(icb, null);
- jf.setContentPane(jp);
- jf.setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public IComboBox() {
- super();
- init();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(320, 20);
- this.setEditable(false);
- this.editor.addActionListener(this);
- this.addMouseListener(this);
- this.addKeyListener(this);
- this.getEditor().getEditorComponent().addKeyListener(this);
- this.getEditor().getEditorComponent().addFocusListener(this);
- this.setToolTipText("<html>Double Click to add an entry, then finish by press ENTER.<br>"
- + "Selecting DELETE will remove selected entry.</html>");
- }
-
- public void keyPressed(KeyEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
- *
- * Override keyReleased to listen key action
- *
- */
- public void keyReleased(KeyEvent arg0) {
- //
- //Add new item to list when press ENTER
- //
- if (arg0.getSource() == this.getEditor().getEditorComponent()) {
- if (arg0.getKeyCode() == KeyEvent.VK_ENTER) {
- String strCurrentText = this.getEditor().getItem().toString().trim();
- if (strCurrentText.length() == 0) {
- if (this.getItemCount() > 0) {
- this.setSelectedIndex(0);
- }
- } else {
- this.addItem(strCurrentText);
- this.setSelectedItem(strCurrentText);
- }
- this.setEditable(false);
- }
-
- if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE) {
- closeEdit();
- }
- }
-
- if (arg0.getSource() == this) {
- //
- //Remove item from the list when press DEL
- //
- if (arg0.getKeyCode() == KeyEvent.VK_DELETE) {
- int intSelected = this.getSelectedIndex();
- if (intSelected > -1) {
- this.removeItemAt(this.getSelectedIndex());
- if (this.getItemCount() > 0) {
- this.setSelectedIndex(0);
- } else {
- this.removeAllItems();
- }
- }
- }
- }
- }
-
- public void keyTyped(KeyEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- * Override mouseClicked to enter edit mode when double click mouse
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- this.setEditable(true);
- this.getEditor().setItem("");
- }
- }
-
- public void mouseEntered(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mousePressed(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Exit edit mode
-
- **/
- private void closeEdit() {
- this.setEditable(false);
- this.getEditor().setItem("");
- }
-
- /**
- Set the input item as selected
-
- @param item the item which is needed to be set selected
-
- **/
- public void setSelectedItem(Object item) {
- boolean isFind = false;
- //
- // If the input value is not in the default list, add it to the list
- //
- if (item != null) {
- for (int index = 0; index < this.getItemCount(); index++) {
- if (this.getItemAt(index).equals(item)) {
- isFind = true;
- break;
- }
- }
- //
- // Add this item to IComboBox if not found
- //
- if (!isFind && !item.toString().equals("")) {
- super.addItem(item);
- }
- }
-
- //
- // Call super function to set the item selected.
- //
- super.setSelectedItem(item);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDefaultMutableTreeNode.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDefaultMutableTreeNode.java
deleted file mode 100644
index 4708191ac9..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDefaultMutableTreeNode.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/** @file
-
-
- The file is used to override DefaultMutableTreeNode to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-
-/**
- The class is used to override DefaultMutableTreeNode to provides customized interfaces
- It extends DefaultMutableTreeNode
-
-
-
- **/
-public class IDefaultMutableTreeNode extends DefaultMutableTreeNode {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1947340717458069548L;
-
- //
- // Static final definitions for all kinds of node
- //
- public static final int MSA_HEADER = 100;
-
- public static final int MSA_LIBRARYCLASSDEFINITIONS = 101;
-
- public static final int MSA_PACKAGEDEPENDENCIES = 102;
-
- public static final int MSA_SOURCEFILES = 103;
-
- public static final int MSA_PROTOCOLS = 104;
-
- public static final int MSA_EVENTS = 105;
-
- public static final int MSA_HOBS = 106;
-
- public static final int MSA_PPIS = 107;
-
- public static final int MSA_VARIABLES = 108;
-
- public static final int MSA_BOOTMODES = 109;
-
- public static final int MSA_SYSTEMTABLES = 110;
-
- public static final int MSA_DATAHUBS = 111;
-
- public static final int MSA_HIIPACKAGES = 112;
-
- public static final int MSA_GUIDS = 113;
-
- public static final int MSA_EXTERNS = 114;
-
- public static final int MSA_PCDS = 115;
-
- public static final int MSA_BUILDOPTIONS = 117;
-
- public static final int MSA_USEREXTENSIONS = 118;
-
- public static final int MSA_MODULEDEFINITIONS = 119;
-
- public static final int SPD_HEADER = 200;
-
- public static final int SPD_LIBRARYCLASSDECLARATIONS = 201;
-
- public static final int SPD_MSAFILES = 202;
-
- public static final int SPD_PACKAGEHEADERS = 203;
-
- public static final int SPD_GUIDDECLARATIONS = 204;
-
- public static final int SPD_PROTOCOLDECLARATIONS = 205;
-
- public static final int SPD_PPIDECLARATIONS = 206;
-
- public static final int SPD_PCDDECLARATIONS = 207;
-
- public static final int SPD_PACKAGEDEFINITIONS = 208;
-
- public static final int SPD_INDUSTRYSTDINCLUDES = 209;
-
- public static final int FPD_PLATFORMHEADER = 300;
-
- public static final int FPD_FLASH = 301;
-
- public static final int FPD_FRAMEWORKMODULES = 302;
-
- public static final int FPD_PCDDYNAMICBUILDDECLARATIONS = 303;
-
- public static final int FPD_BUILDOPTIONS = 304;
-
- public static final int FPD_PLATFORMDEFINITIONS = 305;
-
- public static final int WORKSPACE = 0;
-
- public static final int MODULE_DESCRIPTION = 1;
-
- public static final int PACKAGE_DESCRIPTION = 2;
-
- public static final int PLATFORM_DESCRIPTION = 3;
-
- public static final int MODULE = 4;
-
- public static final int PACKAGE = 5;
-
- public static final int PLATFORM = 6;
-
- public static final int MODULE_PACKAGE = 7;
-
- public static final int MODULE_PACKAGE_LIBRARY = 8;
-
- public static final int MODULE_PACKAGE_MODULE = 9;
-
- //
- //Static final definitions for operation
- //
- public static final int OPERATION_NULL = 0;
-
- public static final int OPERATION_ADD = 1;
-
- public static final int OPERATION_UPDATE = 2;
-
- public static final int OPERATION_DELETE = 4;
-
- public static final int OPERATION_ADD_UPDATE = 3;
-
- public static final int OPERATION_ADD_DELETE = 5;
-
- public static final int OPERATION_UPDATE_DELETE = 6;
-
- public static final int OPERATION_ADD_UPDATE_DELETE = 7;
-
- //
- //Define 4 node attributes
- //
- private int category = 0;
-
- private String nodeName = "";
-
- private boolean isOpening = false;
-
- private Identification id = null;
-
- private IDefaultMutableTreeNode belongNode = null;
-
- /**
- This is the default constructor
-
- **/
- public IDefaultMutableTreeNode() {
- super();
- }
-
- /**
- This is the overrided constructor
- Init clase members with input data
-
- @param strNodeName The name of node
- @param intCategory The category of node
- @param bolIsOpened to identify if the node is opening or not
- @param identification The Identification of node
-
- **/
- public IDefaultMutableTreeNode(String strNodeName, int intCategory, boolean bolIsOpening,
- Identification identification, IDefaultMutableTreeNode idmtBelongNode) {
- super(strNodeName);
- this.nodeName = strNodeName;
- this.category = intCategory;
- this.isOpening = bolIsOpening;
- this.id = identification;
- this.belongNode = idmtBelongNode;
- }
-
- /**
- Get category of node
-
- @return The category of node
-
- **/
- public int getCategory() {
- return category;
- }
-
- /**
- Set category of node
-
- @param category The input data of node category
-
- **/
- public void setCategory(int category) {
- this.category = category;
- }
-
- /**
- Get name of node
-
- @return The name of node
-
- **/
- public String getNodeName() {
- return nodeName;
- }
-
- /**
- Set name of node
-
- @param nodeName The input data of node name
-
- **/
- public void setNodeName(String nodeName) {
- this.nodeName = nodeName;
- }
-
- /**
- Get identification of node
-
- @return
-
- **/
- public Identification getId() {
- return id;
- }
-
- /**
- Set identification of node
-
- @param id
-
- **/
- public void setId(Identification id) {
- this.id = id;
- }
-
- /**
- get isOpening of node
-
- @return
-
- **/
- public boolean isOpening() {
- return isOpening;
- }
-
- /**
- Set isOpening of node
-
- @param isOpening
-
- **/
- public void setOpening(boolean isOpening) {
- this.isOpening = isOpening;
- }
-
- public String toString() {
- return this.nodeName;
- }
-
- public IDefaultMutableTreeNode getBelongNode() {
- return belongNode;
- }
-
- public void setBelongNode(IDefaultMutableTreeNode belongNode) {
- this.belongNode = belongNode;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDesktopManager.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDesktopManager.java
deleted file mode 100644
index dc668e7ed3..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDesktopManager.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
-
- The file is used to override DefaultDesktopManager to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import javax.swing.DefaultDesktopManager;
-import javax.swing.JComponent;
-
-/**
- The class is used to override DefaultDesktopManager to provides customized interfaces
- It extends DefaultDesktopManager
-
-
-
- **/
-public class IDesktopManager extends DefaultDesktopManager {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -4596986878722011062L;
-
- /**
- Main class, reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.DesktopManager#dragFrame(javax.swing.JComponent, int, int)
- *
- * Override dragFrame to do nothing to forbid internalframe to be draged
- *
- */
- public void dragFrame(JComponent f, int newX, int newY) {
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.DesktopManager#endDraggingFrame(javax.swing.JComponent)
- *
- * Override endDraggingFrame to do nothing to forbid internalframe to be draged
- *
- */
- public void endDraggingFrame(JComponent f) {
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.DesktopManager#beginResizingFrame(javax.swing.JComponent, int)
- *
- * Override beginResizingFrame to do nothing to forbid internalframe to be draged
- *
- */
- public void beginResizingFrame(JComponent f, int direction) {
-
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java
deleted file mode 100644
index 1fc7c4c156..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/** @file
-
- The file is used to override Dialog to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JDialog;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Tools;
-
-/**
- The class is used to override Dialog to provides customized interfaces
- It extends JDialog implements ActionListener
-
-
-
- **/
-public class IDialog extends JDialog implements ActionListener {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7692623863358631984L;
- //
- //Define class members
- //
- private boolean isEdited = false;
-
- public int returnType = DataType.RETURN_TYPE_CANCEL;
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Main class, used for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- IDialog id = new IDialog();
- id.setVisible(true);
- }
-
- /**
- This is the default constructor
- **/
- public IDialog() {
- super();
- initialize();
- }
-
- /**
- This is the override constructor
-
- @param parentFrame The parent frame which open the dialog
- @param modal true means the dialog is modal dialog; false means the dialog is not modal dialog
- **/
- public IDialog(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- initialize();
- }
-
- /**
- This is the override constructor
-
- @param parentFrame The parent frame which open the dialog
- @param modal true means the dialog is modal dialog; false means the dialog is not modal dialog
- **/
- public IDialog(IDialog parentFrame, boolean modal) {
- super(parentFrame, modal);
- initialize();
- }
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
- this.setResizable(false);
- }
-
- /**
- Start the dialog at the center of screen
-
- @param intWidth The width of the dialog
- @param intHeight The height of the dialog
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the dialog at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
- /**
- Get if the dialog has been edited
-
- @retval true - The dialog has been edited
- @retval false - The dialog hasn't been edited
-
- **/
- public boolean isEdited() {
- return isEdited;
- }
-
- /**
- Set if the dialog has been edited
-
- @param isEdited The input data which identify if the dialog has been edited
-
- **/
- public void setEdited(boolean isEdited) {
- this.isEdited = isEdited;
- }
-
- /**
- Check the input data is empty or not
-
- @param strValue The input data which need be checked
-
- @retval true - The input data is empty
- @retval fals - The input data is not empty
-
- **/
- public boolean isEmpty(String strValue) {
- return Tools.isEmpty(strValue);
- }
-
- /**
- Display the dialog
-
- **/
- public int showDialog() {
- this.setVisible(true);
- return returnType;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java
deleted file mode 100644
index 5f3341f696..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/** @file
-
- The file is used to override Frame to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-
-import org.tianocore.frameworkwizard.common.Tools;
-
-/**
- The class is used to override Frame to provides customized interfaces
- It extends JFrame implements ActionListener and WindowListener
-
- **/
-public class IFrame extends JFrame implements ActionListener, WindowListener, ComponentListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -3324138961029300427L;
-
- //
- //Define class members
- //
- private ExitConfirm ec = null;
-
- //
- // To indicate the status while quit
- // 0 - When setup (Default)
- // 1 - Whne editing module
- //
- private int intExitType = 0;
-
- /**
- Main class, used for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- IFrame i = new IFrame();
- i.setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public IFrame() {
- super();
- initialize();
- }
-
- /**
- This method initializes this
-
- **/
- public void initialize() {
- this.setResizable(false);
- this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- this.addWindowListener(this);
- this.addComponentListener(this);
- }
-
- /**
- Start the dialog at the center of screen
-
- @param intWidth The width of the dialog
- @param intHeight The height of the dialog
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window full of the screen
-
- **/
- protected void maxWindow() {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation(0, 0);
- this.setSize(d);
- }
-
- /**
- Start the dialog at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
- /**
- Set the exit window type
-
- @param ExitType The input data of ExitType
-
- **/
- protected void setExitType(int ExitType) {
- this.intExitType = ExitType;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to call this.onDisvisible()
- *
- */
- public void windowClosing(WindowEvent arg0) {
- //this.onDisvisible();
- }
-
- public void windowOpened(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowClosed(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowIconified(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowDeiconified(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowActivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowDeactivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Define the actions when exit
-
- **/
- public void onExit() {
- ec = new ExitConfirm(this, true);
- //
- //Show different warning message via different ExitType
- //
- switch (intExitType) {
- case 0:
- ec.setSetupMessage();
- break;
- case 1:
- ec.setModuleMessage();
- break;
- }
- ec.setVisible(true);
- if (ec.isCancel) {
- this.dispose();
- System.exit(0);
- }
- }
-
- /**
- Define the actions when disvisible
-
- **/
- public void onDisvisible() {
- ec = new ExitConfirm(this, true);
- //
- //Show different warning message via different ExitType
- //
- switch (intExitType) {
- case 0:
- ec.setSetupMessage();
- break;
- case 1:
- ec.setModuleMessage();
- break;
- }
- ec.setVisible(true);
- if (ec.isCancel) {
- this.dispose();
- }
- }
-
- public int showSaveDialog() {
- return JOptionPane.showConfirmDialog(this, "Save all changed files?", "Save", JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.WARNING_MESSAGE);
- }
-
- /**
- Check the input data is empty or not
-
- @param strValue The input data which need be checked
-
- @retval true - The input data is empty
- @retval fals - The input data is not empty
-
- **/
- public boolean isEmpty(String strValue) {
- return Tools.isEmpty(strValue);
- }
-
- /**
- Display the dialog
-
- **/
- public void showDialog() {
- this.setVisible(true);
- }
-
- public void componentResized(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentMoved(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentShown(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentHidden(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java
deleted file mode 100644
index f0d018605d..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/** @file
-
- The file is used to override JInternalFrame to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.JDesktopPane;
-import javax.swing.JFrame;
-import javax.swing.JInternalFrame;
-import javax.swing.JPanel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-
-import org.tianocore.frameworkwizard.common.Tools;
-
-/**
- * The class is used to override JInternalFrame to provides customized
- * interfaces It extends JInternalFrame implements ActionListener
- *
- *
- *
- */
-public class IInternalFrame extends JInternalFrame implements ActionListener, ComponentListener, ItemListener,
- FocusListener, ListSelectionListener, TableModelListener, MouseListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -609841772384875886L;
-
- //
- // Define class members
- //
- private boolean isEdited = false;
-
- /**
- * Main class, used for test
- *
- * @param args
- *
- */
- public static void main(String[] args) {
- JFrame jf = new JFrame();
- JPanel jp = new JPanel();
- JDesktopPane jdp = new JDesktopPane();
- IInternalFrame itf = new IInternalFrame();
- jdp.add(itf, 1);
- jf.setContentPane(jp);
- jf.setVisible(true);
- }
-
- /**
- * This is the default constructor
- *
- */
- public IInternalFrame() {
- super();
- initialize();
- }
-
- /**
- * This method initializes this
- *
- */
- private void initialize() {
- this.setBounds(new java.awt.Rectangle(0, 0, 520, 545));
- this.setMinimumSize(new java.awt.Dimension(520, 545));
- this.addComponentListener(this);
- }
-
- /**
- * Get if the InternalFrame has been edited
- *
- * @retval true - The InternalFrame has been edited
- * @retval false - The InternalFrame hasn't been edited
- *
- */
- public boolean isEdited() {
- return isEdited;
- }
-
- /**
- * Set if the InternalFrame has been edited
- *
- * @param isEdited
- * The input data which identify if the InternalFrame has been
- * edited
- *
- */
- public void setEdited(boolean isEdited) {
- this.isEdited = isEdited;
- }
-
- /**
- * Check the input data is empty or not
- *
- * @param strValue
- * The input data which need be checked
- *
- * @retval true - The input data is empty
- * @retval fals - The input data is not empty
- *
- */
- public boolean isEmpty(String strValue) {
- return Tools.isEmpty(strValue);
- }
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void componentHidden(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentMoved(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentResized(ComponentEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void componentShown(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void showStandard() {
-
- }
-
- public void showAdvanced() {
-
- }
-
- public void showXML() {
-
- }
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void focusGained(FocusEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void focusLost(FocusEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void valueChanged(ListSelectionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseClicked(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mousePressed(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ITree.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ITree.java
deleted file mode 100644
index 252c34ff72..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ITree.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/** @file
-
- The file is used to override JTree to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
-
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-
-/**
- The class is used to override JTree to provides customized interfaces
- It extends JTree
-
- **/
-public class ITree extends JTree {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7907086164518295327L;
-
- //
- // Define class members
- //
- DefaultTreeModel treeModel = null;
-
- /**
- This is the default constructor
-
- **/
- public ITree() {
- super();
- }
-
- /**
- This is the overrided constructor
- Init class members with input data
-
- @param iDmtRoot The root node of the tree
-
- **/
- public ITree(IDefaultMutableTreeNode iDmtRoot) {
- super(iDmtRoot);
- treeModel = (DefaultTreeModel) this.getModel();
- }
-
- /**
- Get category of selected node
-
- @return The category of selected node
-
- **/
- public int getSelectCategory() {
- int intCategory = 0;
- TreePath path = this.getSelectionPath();
- IDefaultMutableTreeNode node = (IDefaultMutableTreeNode) path.getLastPathComponent();
- intCategory = node.getCategory();
- return intCategory;
- }
-
- /**
- Add input node as child node for current selected node
-
- @param strNewNode The name of the node which need be added
-
- **/
- public void addNode(String strNewNode) {
- DefaultMutableTreeNode parentNode = null;
- DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(strNewNode);
- newNode.setAllowsChildren(true);
- TreePath parentPath = this.getSelectionPath();
-
- /**
- * Get parent node of new node
- */
- parentNode = (DefaultMutableTreeNode) (parentPath.getLastPathComponent());
-
- /**
- * Insert new node
- */
- treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());
- this.scrollPathToVisible(new TreePath(newNode.getPath()));
- }
-
- /**
- Add input node as child node for current selected node
-
- @param newNode The node need be added
-
- **/
- public void addNode(IDefaultMutableTreeNode newNode) {
- IDefaultMutableTreeNode parentNode = null;
- newNode.setAllowsChildren(true);
- TreePath parentPath = this.getSelectionPath();
- parentNode = (IDefaultMutableTreeNode) (parentPath.getLastPathComponent());
- treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());
- this.scrollPathToVisible(new TreePath(newNode.getPath()));
- }
-
- /**
- Add input node as child node for current selected node
-
- @param newNode The node need be added
-
- **/
- public void addNode(IDefaultMutableTreeNode parentNode, IDefaultMutableTreeNode newNode) {
- treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());
- this.scrollPathToVisible(new TreePath(newNode.getPath()));
- }
-
- /**
- Remove the selected node
-
- @param strRemovedNode
-
- **/
- public void removeSelectedNode() {
- TreePath treePath = this.getSelectionPath();
- removeNodeByPath(treePath);
- }
-
- /**
- Remove the node by tree path
-
- @param strRemovedNode
-
- **/
- public void removeNodeByPath(TreePath treePath) {
- if (treePath != null) {
- DefaultMutableTreeNode selectionNode = (DefaultMutableTreeNode) treePath.getLastPathComponent();
- TreeNode parent = (TreeNode) selectionNode.getParent();
- if (parent != null) {
- treeModel.removeNodeFromParent(selectionNode);
- }
- }
- }
-
- /**
- Return a node by input tree path
-
- @param treePath
- @return
-
- **/
- public IDefaultMutableTreeNode getNodeByPath(TreePath treePath) {
- if (treePath != null) {
- IDefaultMutableTreeNode selectionNode = (IDefaultMutableTreeNode) treePath.getLastPathComponent();
- return selectionNode;
- }
- return null;
- }
-
- /**
- Remove all child nodes under current node
-
- **/
- public void removeNodeChildrenByPath(TreePath treePath) {
- if (treePath != null) {
- DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) treePath.getLastPathComponent();
- for (int index = currentNode.getChildCount() - 1; index > -1; index--) {
- treeModel.removeNodeFromParent((DefaultMutableTreeNode) currentNode.getChildAt(index));
- }
- }
- }
-
- /**
- Remove all nodes of the tree
-
- **/
- public void removeAllNode() {
- DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) treeModel.getRoot();
- rootNode.removeAllChildren();
- treeModel.reload();
- }
-
- public IDefaultMutableTreeNode getSelectNode() {
- TreePath treepath = this.getSelectionPath();
- IDefaultMutableTreeNode selectionNode = null;
- if (treepath != null) {
- selectionNode = (IDefaultMutableTreeNode) treepath.getLastPathComponent();
- }
- return selectionNode;
- }
-
- public IDefaultMutableTreeNode getNodeById(IDefaultMutableTreeNode node, Identification id) {
- for (int index = 0; index < node.getChildCount(); index++) {
- IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) node.getChildAt(index);
- if (iNode.getId().equals(id)) {
- return iNode;
- }
- }
- return null;
- }
-
- public IDefaultMutableTreeNode getNodeById(IDefaultMutableTreeNode node, Identification id, int category) {
- for (int index = 0; index < node.getChildCount(); index++) {
- IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) node.getChildAt(index);
- if (iNode.getId().equals(id) && iNode.getCategory() == category) {
- return iNode;
- }
- IDefaultMutableTreeNode childNode = getNodeById(iNode, id, category);
- if (childNode != null) {
- return childNode;
- }
- }
- return null;
- }
-
- public TreePath getPathOfNode(IDefaultMutableTreeNode node) {
- if (node != null) {
- TreePath treePath = new TreePath(treeModel.getPathToRoot(node));
- return treePath;
- }
- return null;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/StarLabel.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/StarLabel.java
deleted file mode 100644
index 3641df0373..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/StarLabel.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/** @file
-
- The file is used to override JLabel to provides customized interfaces
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import javax.swing.JLabel;
-
-/**
- The class is used to override JLabel to provides customized interfaces
-
-
-
- **/
-public class StarLabel extends JLabel {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6702981027831543919L;
-
- /**
- Main class, reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- This is the default constructor
-
- **/
- public StarLabel() {
- super();
- init();
- }
-
- /**
- To create a RED, BOLD and 14 size "*"
-
- **/
- private void init() {
- this.setText("*");
- this.setSize(new java.awt.Dimension(10, 20));
- this.setForeground(java.awt.Color.red);
- this.setFont(new java.awt.Font("DialogInput", java.awt.Font.BOLD, 14));
- this.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java
deleted file mode 100644
index 6fbdf03ddd..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/** @file
-
- The file is used to override JList to create a List with CheckBox item
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-import java.util.Vector;
-
-import javax.swing.JList;
-
-public class ICheckBoxList extends JList {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -2843059688070447632L;
-
- protected ICheckBoxListCellRenderer cellrenderer = new ICheckBoxListCellRenderer();
-
- protected ICheckBoxListener listener = new ICheckBoxListener(this);
-
- protected ICheckBoxListModel model = new ICheckBoxListModel();
-
- /**
- This the default Constructor
-
- **/
- public ICheckBoxList() {
- this(null);
- }
-
- /**
- This the override constructor to create checkbox item with input vector
-
- @param options
-
- **/
- public ICheckBoxList(Vector<ICheckBoxListItem> items) {
- if (items != null) {
- for (int index = 0; index < items.size(); index++) {
- model.addElement(items.elementAt(index));
- }
- }
-
- //
- // If there exists at least one item, set first item selected.
- //
- if (model.size() > 0) {
- ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);
- listItem.setSelected(true);
- }
- this.setCellRenderer(cellrenderer);
- this.setModel(model);
- this.addMouseListener(listener);
- this.addKeyListener(listener);
- }
-
- /**
- Set all items of the CheckBoxList component.
-
- @param items
-
- **/
- public void setAllItems(Vector<String> items) {
- if (items != null) {
- model.removeAllElements();
- for (int index = 0; index < items.size(); index++) {
- model.addElement(new ICheckBoxListItem(items.elementAt(index)));
- }
- }
-
- //
- // If there exists at least one item, set first item selected.
- //
- if (model.size() > 0) {
- ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);
- listItem.setSelected(true);
- }
- }
-
- /**
- Get All Checked Items of the CheckBoxList component.
-
- @return All Checked Items
- **/
- public Vector<ICheckBoxListItem> getAllCheckedItems() {
- Vector<ICheckBoxListItem> result = new Vector<ICheckBoxListItem>();
-
- for (int i = 0; i < this.getModel().getSize(); i++) {
- if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
- result.addElement((ICheckBoxListItem) this.getModel().getElementAt(i));
- }
- }
- return result;
- }
-
- /**
- Get All Checked Items index of the CheckBoxList component.
-
- @return All Checked Items index
- **/
- public Vector<Integer> getAllCheckedItemsIndex() {
- Vector<Integer> result = new Vector<Integer>();
-
- for (int i = 0; i < this.getModel().getSize(); i++) {
- if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
- result.addElement(i);
- }
- }
- return result;
- }
-
- /**
- Get All Checked Items String of the CheckBoxList component.
-
- @return Vector
- **/
- public Vector<String> getAllCheckedItemsString() {
- Vector<String> result = new Vector<String>();
-
- for (int i = 0; i < this.getModel().getSize(); i++) {
- if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
- result.addElement(((ICheckBoxListItem) this.getModel().getElementAt(i)).text);
- }
- }
- return result;
- }
-
- /**
- Get All Items String of the CheckBoxList component.
-
- @return Vector
- **/
- public Vector<String> getAllItemsString() {
- Vector<String> result = new Vector<String>();
-
- for (int i = 0; i < this.getModel().getSize(); i++) {
- result.addElement(((ICheckBoxListItem) this.getModel().getElementAt(i)).text);
- }
- return result;
- }
-
- /**
- Set Checked status for all input items.
-
- **/
- public void initCheckedItem(boolean bool, Vector<String> items) {
- if (items != null && items.size() != 0) {
- for (int indexI = 0; indexI < items.size(); indexI++) {
- for (int indexJ = 0; indexJ < model.size(); indexJ++) {
- if (items.elementAt(indexI).equals(model.getAllElements().elementAt(indexJ).getText())) {
- ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(indexJ);
- listItem.setChecked(bool);
- break;
- }
- }
- }
- }
-
- //
- // If there exists at least one item, set first item selected.
- //
- if (model.size() > 0) {
- ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);
- listItem.setSelected(true);
- }
-
- this.validate();
- }
-
- /**
- Set all items of the compontent checked
-
- **/
- public void setAllItemsChecked() {
- initCheckedItem(true, this.getAllItemsString());
- }
-
- /**
- Set all items of the compontent unchecked
-
- **/
- public void setAllItemsUnchecked() {
- initCheckedItem(false, this.getAllItemsString());
- }
-
- /**
- Remove all items of list
-
- **/
- public void removeAllItem() {
- model.removeAllElements();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListCellRenderer.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListCellRenderer.java
deleted file mode 100644
index 1b022fc908..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListCellRenderer.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/** @file
-
- The file is used to create cell renderer for CheckBoxList Item
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.border.*;
-
-class ICheckBoxListCellRenderer extends JCheckBox implements ListCellRenderer {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1718072217181674870L;
-
- protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
-
- /**
- This is the default Constructor
-
- **/
- public ICheckBoxListCellRenderer() {
- super();
- setOpaque(true);
- setBorder(noFocusBorder);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
- * Override to get attribute of the ICheckListCellRenderer
- *
- */
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
- boolean cellHasFocus) {
- ICheckBoxListItem item = (ICheckBoxListItem) value;
-
- setComponentOrientation(list.getComponentOrientation());
-
- if (item.isChecked()) {
- setBackground(list.getSelectionBackground());
- setForeground(list.getSelectionForeground());
- } else {
- if (isSelected) {
- setBackground(Color.LIGHT_GRAY);
- setForeground(list.getForeground());
- } else {
- setBackground(list.getBackground());
- setForeground(list.getForeground());
- }
- }
-
- if (value instanceof ICheckBoxListItem) {
- setText(item.getText());
- setSelected(item.isChecked());
- } else {
- setIcon(null);
- setText((value == null) ? "" : value.toString());
- }
-
- setEnabled(list.isEnabled());
- setFont(list.getFont());
-
- return this;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java
deleted file mode 100644
index a087887e2f..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
-
- The file is used to create list item for CheckBox list
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-public class ICheckBoxListItem {
-
- //
- // Define Class Members
- //
- protected String text;
-
- protected boolean checked;
-
- protected boolean selected;
-
- /**
- This is the default constructor to set check box item string
-
- @param text
-
- **/
- public ICheckBoxListItem(String text) {
- this.text = text;
- }
-
- /**
- This is the override constructor to set check box item string and checked status
-
- @param text
- @param checked
-
- **/
- public ICheckBoxListItem(String text, boolean checked) {
- this.text = text;
- this.checked = checked;
- }
-
- /**
- set the checked status
- if true, set false
- if false, set true
-
- **/
- public void invertChecked() {
- checked = !checked;
- }
-
- public boolean isChecked() {
- return checked;
- }
-
- public void setChecked(boolean checked) {
- this.checked = checked;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public boolean isSelected() {
- return selected;
- }
-
- public void setSelected(boolean selected) {
- this.selected = selected;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListModel.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListModel.java
deleted file mode 100644
index f3bbe8a3a0..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListModel.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/** @file
-
- The file is used to override DefaultListModel to create ICheckBoxListModel
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-import javax.swing.*;
-import java.util.Vector;
-
-public class ICheckBoxListModel extends DefaultListModel {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8617800969723991017L;
-
- /**
- This is the default Constructor for the CheckBoxListModel object
-
- **/
- public ICheckBoxListModel() {
- }
-
- /**
- override DefaultListModel's add method
-
- @param index
- @param item
-
- **/
- public void add(int index, ICheckBoxListItem item) {
- super.add(index, item);
- }
-
- /**
- Add one item at tail
-
- @param item
-
- **/
- public void addElement(ICheckBoxListItem item) {
- super.addElement(item);
- }
-
- /**
- Get all elements of the list
-
- **/
- public Vector<ICheckBoxListItem> getAllElements() {
- Vector<ICheckBoxListItem> items = new Vector<ICheckBoxListItem>();
- ICheckBoxListItem[] objs = new ICheckBoxListItem[this.size()];
- this.copyInto(objs);
- for (int i = 0; i < size(); i++) {
- items.addElement(objs[i]);
- }
- return items;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListener.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListener.java
deleted file mode 100644
index e95d279e59..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListener.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/** @file
-
- The file is used to create listener for Checkbox List
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-import java.awt.event.*;
-
-class ICheckBoxListener implements MouseListener, KeyListener {
-
- protected ICheckBoxList iCheckboxlist;
-
- /**
- This is the default constructor
-
- @param parent
-
- **/
- public ICheckBoxListener(ICheckBoxList parent) {
- iCheckboxlist = parent;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
- * Override to deal with keyReleased event
- *
- *
- */
- public void keyReleased(KeyEvent e) {
- Object[] selectedValues = iCheckboxlist.getSelectedValues();
- int[] selectedIndices = iCheckboxlist.getSelectedIndices();
-
- for (int index = 0; index < selectedValues.length; index++) {
- ICheckBoxListItem item = (ICheckBoxListItem) selectedValues[index];
-
- if (iCheckboxlist.isEnabled()) {
- if (e.getKeyCode() == KeyEvent.VK_SPACE) {
- //
- //if press space key, then reverse all selected item.
- //
- item.invertChecked();
- }
- ((ICheckBoxListModel) iCheckboxlist.getModel()).setElementAt(item, selectedIndices[index]);
- }
- }
- }
-
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- * Override to deal with mouse clicked event
- *
- */
- public void mouseClicked(MouseEvent e) {
- int index = iCheckboxlist.locationToIndex(e.getPoint());
- ICheckBoxListItem item = null;
- item = (ICheckBoxListItem) iCheckboxlist.getModel().getElementAt(index);
-
- if (item != null && iCheckboxlist.isEnabled()) {
- item.invertChecked();
- ((ICheckBoxListModel) iCheckboxlist.getModel()).setElementAt(item, index);
- }
- }
-
- public void mousePressed(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void keyPressed(KeyEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void keyTyped(KeyEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java
deleted file mode 100644
index b8a6d40b0e..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class AggregationOperation {
-
- public static synchronized List<PackageIdentification> union(List<PackageIdentification> list1,
- List<PackageIdentification> list2) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- result.addAll(list1);
- Iterator<PackageIdentification> iter = list2.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (!belongs(item, result)) {
- result.add(item);
- }
- }
- return result;
- }
-
- public static synchronized List<PackageIdentification> intersection(List<PackageIdentification> list1,
- List<PackageIdentification> list2) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<PackageIdentification> iter = list1.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (belongs(item, list2)) {
- result.add(item);
- }
- }
- return result;
- }
-
- public static synchronized List<PackageIdentification> minus(List<PackageIdentification> list1,
- List<PackageIdentification> list2) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<PackageIdentification> iter = list1.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (!belongs(item, list2)) {
- result.add(item);
- }
- }
- return result;
- }
-
- public static synchronized boolean belongs(PackageIdentification o, List<PackageIdentification> list) {
- Iterator<PackageIdentification> iter = list.iterator();
- while (iter.hasNext()) {
- if (iter.next().equalsWithGuid(o)) {
- return true;
- }
- }
- return false;
- }
-
- public static synchronized List<PackageIdentification> getExistedItems(PackageIdentification o,
- List<PackageIdentification> list) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<PackageIdentification> iter = list.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (item.equalsWithGuid(o)) {
- result.add(item);
- }
- }
- return result;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java
deleted file mode 100644
index 730e385c74..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file
-
- The file is used to distribute Far
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class DistributeRule {
- static PackageQuery pkgQ = new PackageQuery();
-
- static WorkspaceTools wsTools = new WorkspaceTools();
-
- static List<PackageIdentification> farPkgList = new ArrayList<PackageIdentification>();
-
- public static List<PackageIdentification> installFarCheck(Far far) {
-
- Far myFar = far;
- List<PackageIdentification> pkgDepList = new ArrayList<PackageIdentification>();
- List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();
- List<PackageIdentification> depResultList = new ArrayList<PackageIdentification>();
- //
- // Get Far packages list;
- //
- try {
- farPkgList = myFar.manifest.getPackageList();
- Iterator pkgItems = farPkgList.iterator();
- while (pkgItems.hasNext()) {
- PackageIdentification id = (PackageIdentification) pkgItems.next();
- pkgDepList = myFar.getPackageDependencies(id);
- depResultList = AggregationOperation.union(depResultList, pkgDepList);
- }
- dbPkgList = vectorToList(wsTools.getAllPackages());
-
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
-
- //
- // Check does the dependence meet the requirement.
- //
- List<PackageIdentification> resultList = AggregationOperation.minus(depResultList,
- AggregationOperation.union(farPkgList,
- dbPkgList));
-
- return resultList;
-
- }
-
- // public void installPackgCheck (PackageIdentification pkgId, String pkgPath){
- // List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();
- // dbPkgList = vectorToList(wsTools.getAllPackages());
- // //
- // // Install far's package one by one.
- // //
- // if ((AggregationOperation.getExistItems(pkgId, dbPkgList))){
- //
- // }
- // }
-
- public void UpdatCheck(String orgFar, String destFar) {
-
- }
-
- public static List<PackageIdentification> vectorToList(Vector vec) {
- List<PackageIdentification> set = new ArrayList<PackageIdentification>();
- Iterator vecItem = vec.iterator();
- while (vecItem.hasNext()) {
- set.add((PackageIdentification) vecItem.next());
- }
- return set;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java
deleted file mode 100644
index ad04dc7fcd..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/** @file
-
- The file is used to create far file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class Far {
- //
- // Class member Manifest
- //
- public Manifest manifest = null;
-
- //
- // Jar file
- //
- private JarFile jf = null;
-
- private File jarFile = null;
-
- //
- // Jar outputStream.
- //
- static public JarOutputStream jos = null;
-
- public Far(File jarFile) {
- this.jarFile = jarFile;
- }
-
- //
- // For install/updat jar
- //
- public Far(JarFile farFile) throws Exception {
- jf = farFile;
- this.manifest = new Manifest(getManifestFile());
- }
-
- public void creatFar(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,
- Set<String> fileFilter, FarHeader fHeader) throws Exception {
- jos = new JarOutputStream(new FileOutputStream(jarFile));
-
- //
- // Generate Manifest and get file lists
- //
- this.manifest = new Manifest();
- this.manifest.setFarHeader(fHeader);
- this.manifest.createManifest(pkgList, plfList, fileFilter);
-
- this.manifest.hibernateToFile();
-
- //
- // Write Mainifest file to JAR.
- //
- if (this.manifest.mfFile != null) {
- writeToJar(this.manifest.mfFile, jos);
- }
-
- //
- // Write all files to JAR
- //
- Set<File> files = this.manifest.files;
- Iterator<File> iter = files.iterator();
- while (iter.hasNext()) {
- writeToJar(iter.next(), jos);
- }
- jos.close();
- }
-
- private void writeToJar(File file, JarOutputStream jos) throws Exception {
- byte[] buffer = new byte[(int) file.length()];
- FileInputStream fInput = new FileInputStream(file);
- JarEntry entry = new JarEntry(
- Tools
- .convertPathToUnixType(Tools
- .getRelativePath(file.getPath(),
- Workspace.getCurrentWorkspace())));
- jos.putNextEntry(entry);
- fInput.read(buffer);
- jos.write(buffer);
- fInput.close();
- }
-
- public void InstallFar(String dir) throws Exception {
- List<FarFileItem> allFile = manifest.getAllFileItem();
- extract(allFile, dir);
- }
-
- public void InstallFar(Map<PlatformIdentification, File> plfMap, Map<PackageIdentification, File> pkgMap)
- throws Exception {
- Set<PlatformIdentification> plfKeys = plfMap.keySet();
- Iterator<PlatformIdentification> plfIter = plfKeys.iterator();
- while (plfIter.hasNext()) {
- PlatformIdentification item = plfIter.next();
- extract(this.manifest.getPlatformContents(item), plfMap.get(item).getPath());
- }
-
- Set<PackageIdentification> pkgKeys = pkgMap.keySet();
- Iterator<PackageIdentification> pkgIter = pkgKeys.iterator();
- while (pkgIter.hasNext()) {
- PackageIdentification item = pkgIter.next();
- installPackage(item, pkgMap.get(item));
- }
- jf.close();
- }
-
- public void installPackage(PackageIdentification packageId, File installPath) throws Exception {
- List<FarFileItem> contents = this.manifest.getPackageContents(packageId);
- extract(contents, installPath.getPath());
- }
-
- public InputStream getManifestFile() throws Exception {
- JarEntry je = null;
- for (Enumeration e = jf.entries(); e.hasMoreElements();) {
- je = (JarEntry) e.nextElement();
- if (je.getName().equalsIgnoreCase(Manifest.mfFileName))
- return jf.getInputStream(je);
- }
- return null;
- }
-
- public void createFar() {
-
- }
-
- public boolean hibernateToFile() {
- return true;
- }
-
- public void extract(List<FarFileItem> allFile, String dir) throws Exception {
-
- Iterator filesItem = allFile.iterator();
- FarFileItem ffItem;
- JarEntry je;
- new File(dir).mkdirs();
- dir += File.separatorChar;
- while (filesItem.hasNext()) {
- try {
- ffItem = (FarFileItem) filesItem.next();
- je = jf.getJarEntry(Tools.convertPathToUnixType(ffItem.getDefaultPath()));
- InputStream entryStream = jf.getInputStream(je);
- File file = new File(dir + ffItem.getRelativeFilename());
- file.getParentFile().mkdirs();
- try {
- //
- // Create the output file (clobbering the file if it
- // exists).
- //
- FileOutputStream outputStream = new FileOutputStream(file);
-
- try {
- //
- // Read the entry data and write it to the output
- // file.
- //
- int fileLen = (int)je.getSize();
- byte[] buffer = new byte[fileLen];
- int len = entryStream.read(buffer);
- if (len < fileLen){
- File tempFile = new File("tempFile");
- FileOutputStream fos = new FileOutputStream(tempFile);
- fos.write(buffer, 0, len);
- while (len < fileLen){
- int tempLen = entryStream.read(buffer);
- len = len + tempLen;
- fos.write(buffer, 0, tempLen);
- }
- fos.close();
- FileInputStream fin = new FileInputStream(tempFile);
- fin.read(buffer);
- tempFile.delete();
- }
- //
- // Check Md5
- //
- if (!ffItem.getMd5Value().equalsIgnoreCase(FarMd5.md5(buffer))){
- throw new Exception (ffItem.getRelativeFilename() + " MD5 Checksum is invaild!");
- }
- outputStream.write(buffer);
- } finally {
- outputStream.close();
- }
- } finally {
- entryStream.close();
- }
-
- } finally {
- }
- }
-
- }
-
- public void addFileToFar(File file, JarOutputStream farOuputStream, String workDir) {
-
- }
-
- /**
- *
- * @param pkgId
- * @return
- */
- public List<PackageIdentification> getPackageDependencies(PackageIdentification pkgId) {
- String[] entry = new String[2];
- PackageQuery pkgQ = new PackageQuery();
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
-
- entry = this.manifest.getPackgeSpd(pkgId);
- if (entry == null) {
- return result;
- }
- if (entry[0] != null) {
- try {
- JarEntry je;
- je = jf.getJarEntry(Tools.convertPathToUnixType(entry[1] + File.separatorChar + entry[0]));
- List<String> masList = pkgQ.getPackageMsaList(jf.getInputStream(je));
- Iterator item = masList.iterator();
- while (item.hasNext()) {
- je = jf.getJarEntry(Tools.convertPathToUnixType(entry[1] + File.separatorChar + item.next()));
- List<PackageIdentification> pkgIdList = pkgQ.getModuleDependencies(jf.getInputStream(je));
- Iterator pkgItem = pkgIdList.iterator();
- while (pkgItem.hasNext()) {
- PackageIdentification id = (PackageIdentification) pkgItem.next();
- if (!AggregationOperation.belongs(id, result)) {
- result.add(id);
- }
- }
- }
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
- return result;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java
deleted file mode 100644
index 0e6cc4a679..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/** @file
-
- The file is used to save information of <FarFile> item.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-public class FarFileItem {
-
- private String relativeFilename;
-
- private String md5Value;
-
- private String defaultPath;
-
- public FarFileItem(String relativeFilename, String md5Value) {
- this.relativeFilename = relativeFilename;
- this.md5Value = md5Value;
- }
-
- public String getMd5Value() {
- return md5Value;
- }
-
- public String getRelativeFilename() {
- return relativeFilename;
- }
-
- public void setMd5Value(String md5Value) {
- this.md5Value = md5Value;
- }
-
- public void setRelativeFilename(String relativeFilename) {
- this.relativeFilename = relativeFilename;
- }
-
- public String getDefaultPath() {
- return defaultPath;
- }
-
- public void setDefaultPath(String defaultPath) {
- this.defaultPath = defaultPath;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java
deleted file mode 100644
index dd4f22690e..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/** @file
-
- The file is used to save <farPackage> information.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-public class FarHeader {
- //
- // class member
- //
- private String farName;
-
- private String guidValue;
-
- private String version;
-
- private String abstractStr;
-
- private String description;
-
- private String copyright;
-
- private String license;
-
- private String specification;
-
- public String getAbstractStr() {
- return abstractStr;
- }
-
- public void setAbstractStr(String abstractStr) {
- this.abstractStr = abstractStr;
- }
-
- public String getCopyright() {
- return copyright;
- }
-
- public void setCopyright(String copyright) {
- this.copyright = copyright;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getFarName() {
- return farName;
- }
-
- public void setFarName(String farName) {
- this.farName = farName;
- }
-
- public String getGuidValue() {
- return guidValue;
- }
-
- public void setGuidValue(String guidValue) {
- this.guidValue = guidValue;
- }
-
- public String getLicense() {
- return license;
- }
-
- public void setLicense(String license) {
- this.license = license;
- }
-
- public String getSpecification() {
- return specification;
- }
-
- public void setSpecification(String specification) {
- this.specification = specification;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java
deleted file mode 100644
index babc9e3d92..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
-
- The file is used to save information of Far item.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-public class FarIdentification {
-
- private String guid;
-
- private String md5Value;
-
- private String path;
-
- public FarIdentification(String guid, String md5Value, String path) {
- this.guid = guid;
- this.md5Value = md5Value;
- this.path = path;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getMd5Value() {
- return md5Value;
- }
-
- public void setMd5Value(String md5Value) {
- this.md5Value = md5Value;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public String toString() {
- return path + " [" + guid + "]";
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java
deleted file mode 100644
index 04a2fb0a35..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.tianocore.frameworkwizard.far;
-
-import java.io.Reader;
-import java.util.Map;
-import java.util.Set;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public interface FarInterface {
-
- public Reader getManifestFile();
-
- public void hibernateToFile();
-
- public boolean extract(Map<PackageIdentification, String> packagePathes,
- Map<PlatformIdentification, String> platformPathes);
-
- public Set<PackageIdentification> getPackageDependencies(PackageIdentification packageId);
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java
deleted file mode 100644
index 0269fcf6cd..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
-
- The file is used to caculate file MD5 value.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.security.MessageDigest;
-
-public class FarMd5 {
-
- static public String md5(File file) throws Exception {
- byte[] buffer = new byte[(int) file.length()];
- FileInputStream fInput = new FileInputStream(file);
- fInput.read(buffer);
- fInput.close();
- return md5(buffer);
-
- }
-
- static public String md5(byte[] buffer) throws Exception {
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5 = md.digest(buffer);
- return new String(String.format("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", md5[0], md5[1], md5[2], md5[3], md5[4],
- md5[5], md5[6], md5[7], md5[8], md5[9], md5[10], md5[11], md5[12], md5[13],
- md5[14], md5[15]));
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java
deleted file mode 100644
index aca9041c78..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/** @file
-
- The file is used to save <farPackage> information.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.util.List;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class FarPackage {
- //
- // Class member
- //
- private FarFileItem farFile;
-
- private String guidValue;
-
- private String version;
-
- private String defaultPath;
-
- private List<FarPlatformItem> farPlatformList;
-
- private List<FarFileItem> contentList;
-
- public String getDefaultPath() {
- return defaultPath;
- }
-
- public void setDefaultPath(String defaultPath) {
- this.defaultPath = defaultPath;
- }
-
- public FarFileItem getFarFile() {
- return farFile;
- }
-
- public void setFarFile(FarFileItem farFile) {
- this.farFile = farFile;
- }
-
- public List<FarPlatformItem> getFarPlatformList() {
- return farPlatformList;
- }
-
- public void setFarPlatformList(List<FarPlatformItem> farPlatformList) {
- this.farPlatformList = farPlatformList;
- }
-
- public String getGuidValue() {
- return guidValue;
- }
-
- public void setGuidValue(String guidValue) {
- this.guidValue = guidValue;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public List<FarFileItem> getContentList() {
- return this.contentList;
- }
-
- public void setContentList(List<FarFileItem> contentList) {
- this.contentList = contentList;
- }
-
- public boolean isIdentityPkg(PackageIdentification pkgId) {
- //File file = new File(farFile.getRelativeFilename());
- if (pkgId.getGuid().equalsIgnoreCase(guidValue) && pkgId.getVersion().equalsIgnoreCase(version)) {
- return true;
- }
- return false;
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java
deleted file mode 100644
index e3c2f1c733..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
-
- The file is used to save <farPlatform> information.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class FarPlatformItem {
- //
- // class member
- //
- private FarFileItem farFile;
-
- private String guidValue;
-
- private String version;
-
- public FarFileItem getFarFile() {
- return farFile;
- }
-
- public void setFarFile(FarFileItem farFile) {
- this.farFile = farFile;
- }
-
- public String getGuidValue() {
- return guidValue;
- }
-
- public void setGuidValue(String guidValue) {
- this.guidValue = guidValue;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public boolean isIdentityPlf(PlatformIdentification plfId) {
- if (plfId.getGuid() == guidValue && plfId.getVersion() == version) {
- return true;
- }
- return false;
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java
deleted file mode 100644
index bd1b7942f3..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.tianocore.frameworkwizard.far;
-
-public class FarStringDefinition {
-
- ///
- /// Definition for all step's title string
- ///
- public static final String CREATE_STEP_ONE_TITLE =
- "Create Framework Archive(FAR) - Step 1: Set FAR's basic information";
- public static final String CREATE_STEP_TWO_TITLE =
- "Create Framework Archive(FAR) - Step 2: Choose Packages and/or Platforms";
- public static final String CREATE_STEP_THREE_TITLE =
- "Create Framework Archive(FAR) - Step 3: Set file filter";
- public static final String CREATE_STEP_FOUR_TITLE =
- "Create Framework Archive(FAR) - Step 4: Choose target file and finish";
-
- public static final String DELETE_STEP_ONE_TITLE =
- "Delete Framework Archive(FAR) - Step 1: Choose FAR from current WORKSPACE";
- public static final String DELETE_STEP_TWO_TITLE =
- "Delete Framework Archive(FAR) - Step 2: Choose delete mode and finish";
-
- public static final String UPDATE_STEP_ONE_TITLE =
- "Update Framework Archive(FAR) - Step 1: Browse FAR file";
- public static final String UPDATE_STEP_TWO_TITLE =
- "Update Framework Archive(FAR) - Step 2: Summary";
-
- public static final String INSTALL_STEP_ONE_TITLE =
- "Install Framework Archive(FAR) - Step 1: Select FAR file";
- public static final String INSTALL_STEP_TWO_TITLE =
- "Install Framework Archive(FAR) - Step 2: Set path for packages and/or platforms";
-
- ///
- ///
- ///
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java
deleted file mode 100644
index 89fb5b6d42..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java
+++ /dev/null
@@ -1,960 +0,0 @@
-/** @file
-
- The file is used to create Far's manifest file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class Manifest implements ManifestInterface {
- // /
- // / manifest document
- // /
- Document manifestDoc = null;
-
- // /
- // / Manfiest file element name
- // /
- final static String mfFileName = "FrameworkArchiveManifest.xml";
-
- //
- // Header
- //
- final static String farHeader = "FarHeader";
-
- final static String farHeader_FarName = "FarName";
-
- final static String farHeader_Abstract = "Abstract";
-
- final static String farHeader_Description = "Description";
-
- final static String farHeader_CopyRight = "Copyright";
-
- final static String farHeader_License = "License";
-
- final static String farHeader_Specification = "Specification";
-
- //
- // Package list
- //
- final static String farPackageList = "FarPackageList";
-
- final static String farPlatformList = "FarPlatformList";
-
- final static String contents = "Contents";
-
- final static String userExtensions = "UserExtensions";
-
- //
- // Common node name
- //
-
- final static String guidValue = "GuidValue";
-
- final static String version = "Version";
-
- //
- // FarPackage node name
- //
- final static String farPackageList_FarPackage = "FarPackage";
-
- final static String farPackage_FarfileName = "FarFilename";
-
- final static String farPackage_DefaultPath = "DefaultPath";
-
- final static String farPlatformList_FarPlatform = "FarPlatform";
-
- final static String farFileName_FarGuid = "FarGuid";
-
- final static String farFileName_Md5sum = "Md5sum";
-
- //
- // manifest header information.
- //
- FarHeader fhInfo = new FarHeader();
-
- //
- // FarPackage list
- //
- List<FarPackage> fPkgList = new ArrayList<FarPackage>();
-
- //
- // FarPlatform list
- //
- List<FarPlatformItem> fPlfList = new ArrayList<FarPlatformItem>();
-
- Set<File> files = new LinkedHashSet<File>();
-
- //
- // Manifest file
- //
- public File mfFile = null;
-
- public FarHeader getHeader() {
- return fhInfo;
- }
-
- public Manifest() throws Exception {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- Document document = dombuilder.newDocument();
- this.manifestDoc = document;
-
- }
-
- public Manifest(InputStream manifestInputStream) throws Exception {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- try {
- if (manifestInputStream != null) {
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- this.manifestDoc = dombuilder.parse(manifestInputStream);
- parseManifest();
- }
-
- } catch (Exception e) {
- //
- // Will change to throw Wizader exception.
- //
- throw new Exception(e.getMessage());
- }
- }
-
- public void setFarHeader(FarHeader fHeader) {
- this.fhInfo = fHeader;
- }
-
- public void createManifest(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,
- Set<String> fileFilter) throws Exception {
-
- //
- // Add Package and it's contents to FarPackageList.
- //
- Iterator<PackageIdentification> pkgItem = pkgList.iterator();
- while (pkgItem.hasNext()) {
- PackageIdentification pkgId = pkgItem.next();
-
- //
- // Add package and it's contents to <FarPackageList>.
- //
- addPkgToPkgList(pkgId, fileFilter);
- }
-
- //
- // Add FarPlatform to this.farPlatformList.
- //
- Iterator<PlatformIdentification> plfItem = plfList.iterator();
- while (plfItem.hasNext()) {
- PlatformIdentification plfId = plfItem.next();
-
- //
- // Add platform to Mainifest.
- //
- addPlatformIdToFarPlatformItemList(plfId);
- }
- }
-
- public void setManifestFile(File manifestFile) throws Exception {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- InputStream is = new FileInputStream(manifestFile);
- this.manifestDoc = dombuilder.parse(is);
- }
-
- public void addPkgToPkgList(PackageIdentification packageId, Set<String> fileFilter) throws Exception {
- files.add(packageId.getSpdFile());
-
- FarPackage farPackage = new FarPackage();
- //
- // Add SPD file to FarPackage
- //
- File spdFile = new File(packageId.getPath());
-
- FarFileItem ffItem = new FarFileItem(spdFile.getName(), FarMd5.md5(spdFile));
- farPackage.setFarFile(ffItem);
-
- //
- // Add package guid value.
- //
- farPackage.setGuidValue(packageId.getGuid());
-
- //
- // Add package version
- //
- farPackage.setVersion(packageId.getVersion());
-
- //
- // Add DefaultPat: Package absoulte path - Workspace absolut
- // path.
- //
- String pkgDir = Tools.getFilePathOnly(packageId.getPath());
- File rootDir = new File(pkgDir);
- farPackage.setDefaultPath(Tools.getRelativePath(rootDir.getPath(), Workspace.getCurrentWorkspace()));
-
- //
- // Get package root dir contains.
- //
- Set<File> fileSet = new LinkedHashSet<File>();
- Set<File> fpdFileSet = new LinkedHashSet<File>();
-
- //
- // Get all files and fpd files
- //
- recursiveDirectory(fileSet, fpdFileSet, rootDir, fileFilter);
-
- //
- // Remove current package's SPD file
- //
- fileSet.remove(packageId.getSpdFile());
-
- files.addAll(fileSet);
-
- Iterator<File> iter = fileSet.iterator();
- List<FarFileItem> contents = new ArrayList<FarFileItem>();
- while (iter.hasNext()) {
- File normalFile = iter.next();
- String fileRelativePath = Tools.getRelativePath(normalFile.getPath(), pkgDir);
- ffItem = new FarFileItem(fileRelativePath, FarMd5.md5(normalFile));
- contents.add(ffItem);
- }
-
- farPackage.setContentList(contents);
-
- // List<FarPlatformItem> fpfList = new ArrayList<FarPlatformItem>();
- //
- // iter = fpdFileSet.iterator();
- //
- // while (iter.hasNext()) {
- // File fpdFile = iter.next();
- // PlatformIdentification platformId = new PlatformIdentification(wsTool
- // .getId(fpdFile.getPath(), OpenFile.openFpdFile(fpdFile
- // .getPath())));
- // addPlatformIdToFarPlatformItemList(fpfList, platformId);
- // }
- // farPackage.setFarPlatformList(fpfList);
- fPkgList.add(farPackage);
- }
-
- private void recursiveDirectory(Set<File> files, Set<File> fpds, File dir, Set<String> fileFilter) {
- if (isFilter(dir, fileFilter)) {
- return;
- }
- File[] allFilesInDir = dir.listFiles();
- for (int i = 0; i < allFilesInDir.length; i++) {
- if (allFilesInDir[i].isFile()) {
- if (isFilter(allFilesInDir[i], fileFilter)) {
- continue;
- }
- // if (allFilesInDir[i].getPath().toLowerCase().endsWith(".fpd")) {
- // fpds.add(allFilesInDir[i]);
- // } else {
- files.add(allFilesInDir[i]);
- // }
- } else {
- recursiveDirectory(files, fpds, allFilesInDir[i], fileFilter);
- }
- }
- }
-
- public void addPlatformIdToFarPlatformItemList(PlatformIdentification platformId) throws Exception {
- files.add(platformId.getFpdFile());
-
- FarPlatformItem fpfItem = new FarPlatformItem();
- FarFileItem ffItem;
- String fpfPath = platformId.getPath();
- File fpfFile = new File(fpfPath);
- //
- // Add farFileName
- //
- ffItem = new FarFileItem(Tools.getRelativePath(fpfFile.getPath(), Workspace.getCurrentWorkspace()),
- FarMd5.md5(fpfFile));
- fpfItem.setFarFile(ffItem);
-
- //
- // Add guid value
- //
- fpfItem.setGuidValue(platformId.getGuid());
-
- //
- // Add version
- //
- fpfItem.setVersion(platformId.getVersion());
-
- fPlfList.add(fpfItem);
- }
-
- /**
- *
- * @param
- * @return Set<PackageIdentification> list of PackageIdentification.
- */
- public List<PackageIdentification> getPackageList() throws Exception {
- //
- // PackageIdentification set.
- //
- List<PackageIdentification> pkgList = new ArrayList<PackageIdentification>();
- //
- //
- //
- Iterator pkgItem = this.fPkgList.iterator();
- while (pkgItem.hasNext()) {
- FarPackage fPkg = (FarPackage) pkgItem.next();
- //
- // Get package information from SPD file and create a package
- // identification.
- //
-
- PackageIdentification pkgId = new PackageIdentification(fPkg.getFarFile().getRelativeFilename(),
- fPkg.getGuidValue(), fPkg.getVersion());
- pkgId.setPath(Workspace.getCurrentWorkspace() + File.separatorChar + fPkg.getDefaultPath()
- + File.separatorChar + fPkg.getFarFile().getRelativeFilename());
- // wsTool.getId(
- // Workspace.getCurrentWorkspace() + File.separatorChar
- // + fPkg.getDefaultPath(), OpenFile
- // .openFpdFile(Workspace.getCurrentWorkspace()
- // + File.separatorChar
- // + fPkg.getDefaultPath()
- // + File.separatorChar
- // + fPkg.getFarFile().getRelativeFilename()));
- pkgList.add(pkgId);
- }
- return pkgList;
- }
-
- /**
- *
- */
- public List<PlatformIdentification> getPlatformList() throws Exception, IOException, XmlException {
- //
- // PlatformIdentification set.
- //
- List<PlatformIdentification> plfList = new ArrayList<PlatformIdentification>();
- Iterator plfItem = this.fPlfList.iterator();
- while (plfItem.hasNext()) {
- FarPlatformItem fpfItem = (FarPlatformItem) plfItem.next();
- File file = new File(Workspace.getCurrentWorkspace() + File.separatorChar
- + fpfItem.getFarFile().getRelativeFilename());
- //
- // Set platformIdentificaiton's path as absolutly path (include
- // workspace and FPD relatively path)
- //
- PlatformIdentification plfId = new PlatformIdentification(fpfItem.getFarFile().getRelativeFilename(),
- fpfItem.getGuidValue(), fpfItem.getVersion(),
- file.getPath());
-
- // (PlatformIdentification) wsTool
- // .getId(file.getParent(), OpenFile.openFpdFile(Workspace
- // .getCurrentWorkspace()
- // + File.separatorChar
- // + fpfItem.getFarFile().getRelativeFilename()));
- plfList.add(plfId);
- }
- return plfList;
- }
-
- public List<FarFileItem> getPlatformContents(PlatformIdentification platformId) {
- List<FarFileItem> result = new ArrayList<FarFileItem>();
- Iterator<FarPlatformItem> iter = this.fPlfList.iterator();
-
- while (iter.hasNext()) {
- FarPlatformItem item = iter.next();
- if (item.isIdentityPlf(platformId)) {
- FarFileItem farFileItem = item.getFarFile();
- farFileItem.setDefaultPath(farFileItem.getRelativeFilename());
- farFileItem.setRelativeFilename(Tools.getFileNameOnly(farFileItem.getRelativeFilename()));
- result.add(farFileItem);
- break;
- }
- }
- return result;
- }
-
- public List<FarFileItem> getPackageContents(PackageIdentification packageId) {
- List<FarFileItem> farFileList = new ArrayList<FarFileItem>();
- Iterator pkgItem = this.fPkgList.iterator();
- while (pkgItem.hasNext()) {
- FarPackage pkg = (FarPackage) pkgItem.next();
- if (pkg.isIdentityPkg(packageId)) {
- //
- // Add spd far file to list.
- //
- farFileList.add(pkg.getFarFile());
- //
- // Add all files in contents to list.
- //
- farFileList.addAll(pkg.getContentList());
- //
- // Add all farfiles in <FarPlatformList> to list.
- //
- // List<FarPlatformItem> plfList = pkg.getFarPlatformList();
- // Iterator plfItem = plfList.iterator();
- // while (plfItem.hasNext()) {
- // farFileList.add(((FarPlatformItem) plfItem.next())
- // .getFarFile());
- // }
-
- Iterator<FarFileItem> ffIter = farFileList.iterator();
- while (ffIter.hasNext()) {
- FarFileItem ffItem = ffIter.next();
- ffItem.setDefaultPath(pkg.getDefaultPath() + File.separatorChar + ffItem.getRelativeFilename());
- }
- break;
- }
- }
-
- return farFileList;
- }
-
- /**
- *
- * @param pkgId
- * @return String: return string represent jar file entry;
- */
- public String[] getPackgeSpd(PackageIdentification pkgId) {
- Iterator pkgItem = this.fPkgList.iterator();
- String[] entryStr = new String[2];
- while (pkgItem.hasNext()) {
- FarPackage pkg = (FarPackage) pkgItem.next();
- if (pkg.isIdentityPkg(pkgId)) {
- entryStr[0] = pkg.getFarFile().getRelativeFilename();
- entryStr[1] = pkg.getDefaultPath();
- return entryStr;
- }
- }
- return null;
- }
-
- public List<FarFileItem> getPackageContents() {
- //
- // In this farFilelist,all FarFileItem's relativeFileName should be
- // set as absolutely path.
- //
- List<FarFileItem> farFileList = new ArrayList<FarFileItem>();
- Iterator pkgItem = this.fPkgList.iterator();
- FarFileItem ffItem = null;
-
- while (pkgItem.hasNext()) {
- FarPackage pkg = (FarPackage) pkgItem.next();
-
- //
- // Add spd far file to list.
- //
- ffItem = pkg.getFarFile();
- //
- // Set farFileItem relativeFileName = absolutePath + file Name.
- //
- farFileList.add(new FarFileItem(pkg.getDefaultPath() + File.separatorChar + ffItem.getRelativeFilename(),
- ffItem.getMd5Value()));
- //
- // Add all files in contents to list.
- //
- Iterator contentsItem = pkg.getContentList().iterator();
- while (contentsItem.hasNext()) {
- ffItem = (FarFileItem) contentsItem.next();
- farFileList.add(new FarFileItem(pkg.getDefaultPath() + File.separator + ffItem.getRelativeFilename(),
- ffItem.getMd5Value()));
- }
- //
- // Add all farfiles in <FarPlatformList> to list.
- //
- List<FarPlatformItem> plfList = pkg.getFarPlatformList();
- Iterator plfItem = plfList.iterator();
- while (plfItem.hasNext()) {
- ffItem = ((FarPlatformItem) plfItem.next()).getFarFile();
- farFileList.add(new FarFileItem(pkg.getDefaultPath() + File.separator + ffItem.getRelativeFilename(),
- ffItem.getMd5Value()));
- }
- }
- return farFileList;
- }
-
- public String getPackageDefaultPath(PackageIdentification packageId) {
- Iterator pkgItr = this.fPkgList.iterator();
- while (pkgItr.hasNext()) {
- FarPackage farPackage = (FarPackage) pkgItr.next();
- if (farPackage.isIdentityPkg(packageId)) {
- return farPackage.getDefaultPath();
- }
- }
- return null;
- }
-
- // public void setPackageInstallPath(PackageIdentification packageId, String path) {
- // Iterator<FarPackage> pkgItr = this.fPkgList.iterator();
- // while (pkgItr.hasNext()) {
- // FarPackage farPackage = pkgItr.next();
- // if (farPackage.isIdentityPkg(packageId)) {
- // farPackage.setDefaultPath(path);
- // return ;
- // }
- // }
- // }
- //
- // public void setPlatformInstallPath(PlatformIdentification platformId, String path) {
- // Iterator<FarPlatformItem> plfItr = this.fPlfList.iterator();
- // while (plfItr.hasNext()) {
- // FarPlatformItem farPlatform = plfItr.next();
- // if (farPlatform.i.isIdentity(platformId)) {
- // farPackage.setDefaultPath(path);
- // return ;
- // }
- // }
- // }
-
- public List<FarFileItem> getAllFileItem() {
- //
- // The farFileName in this list are all abosulte path.
- //
- List<FarFileItem> ffiList = new ArrayList<FarFileItem>();
- //
- // Add far files in <FarPackageList> to list.
- //
- ffiList = this.getPackageContents();
-
- //
- // Add far files in <FarPlatformList> to list
- //
- NodeList elementList = this.manifestDoc.getElementsByTagName(farPlatformList);
- for (int i = 0; i < elementList.getLength(); i++) {
- //
- // Get <farPlatform> node list.
- //
- Node item = elementList.item(i);
- NodeList plfElements = item.getChildNodes();
- for (int j = 0; j < plfElements.getLength(); j++) {
- //
- // Get each <FarPlatform> content.
- //
- NodeList plfChildNode = plfElements.item(i).getChildNodes();
- Node tempNode = null;
- for (int t = 0; t < plfChildNode.getLength(); t++) {
- tempNode = plfChildNode.item(t);
- //
- // Get child node value and set to platformIdentification.
- //
- if (tempNode.getNodeName().equalsIgnoreCase(farPackage_FarfileName)) {
- NamedNodeMap farAttr = tempNode.getAttributes();
- //
- // Change relative path to absolute one
- //
- FarFileItem farFile = new FarFileItem(tempNode.getTextContent(),
- farAttr.getNamedItem(farFileName_Md5sum).getTextContent());
- ffiList.add(farFile);
- }
- }
- }
- }
- return ffiList;
- }
-
- public void hibernateToFile() throws Exception {
- //
- // create manifest root node
- //
- Element rootNode = this.manifestDoc.createElement("FrameworkArchiveManifest");
- this.manifestDoc.appendChild(rootNode);
-
- //
- // create manifest header node
- //
- Element headerNode = this.manifestDoc.createElement(farHeader);
- rootNode.appendChild(headerNode);
- //
- // Add FarHeader to headerNode.
- //
- Element farName = this.manifestDoc.createElement(farHeader_FarName);
- farName.setTextContent(this.fhInfo.getFarName());
- headerNode.appendChild(farName);
-
- Element gv = this.manifestDoc.createElement(guidValue);
- gv.setTextContent(this.fhInfo.getGuidValue());
- headerNode.appendChild(gv);
-
- Element ver = this.manifestDoc.createElement(version);
- ver.setTextContent(this.fhInfo.getVersion());
- headerNode.appendChild(ver);
-
- Element abstra = this.manifestDoc.createElement(farHeader_Abstract);
- abstra.setTextContent(this.fhInfo.getAbstractStr());
- headerNode.appendChild(abstra);
-
- Element descr = this.manifestDoc.createElement(farHeader_Description);
- descr.setTextContent(this.fhInfo.getDescription());
- headerNode.appendChild(descr);
-
- Element copyright = this.manifestDoc.createElement(farHeader_CopyRight);
- copyright.setTextContent(this.fhInfo.getCopyright());
- headerNode.appendChild(copyright);
-
- Element license = this.manifestDoc.createElement(farHeader_License);
- license.setTextContent(this.fhInfo.getLicense());
- headerNode.appendChild(license);
-
- Element spec = this.manifestDoc.createElement(farHeader_Specification);
- spec.setTextContent(this.fhInfo.getSpecification());
- System.out.println(this.fhInfo.getSpecification());
- headerNode.appendChild(spec);
-
- //
- // create manifest FarPackageList node
- //
- Element pkgListNode = this.manifestDoc.createElement(farPackageList);
- rootNode.appendChild(pkgListNode);
-
- //
- // Save each item in farPackage list to <FarPackage>.
- //
- Iterator pkgItem = this.fPkgList.iterator();
- while (pkgItem.hasNext()) {
- pkgToFarPkgNode(pkgListNode, (FarPackage) pkgItem.next());
-
- }
-
- //
- // create manifest FarPlatformList node
- //
- Element plfListNode = this.manifestDoc.createElement(farPlatformList);
- rootNode.appendChild(plfListNode);
-
- //
- // Save farPakcage list info to <FarPackageList> node
- //
- Iterator plfItem = this.fPlfList.iterator();
- while (plfItem.hasNext()) {
- FarPlatformItem plfIterator = (FarPlatformItem) plfItem.next();
- PlfToPlatformNode(plfListNode, plfIterator);
- }
-
- //
- // Write the DOM document to the file
- //
- Transformer xformer = TransformerFactory.newInstance().newTransformer();
- xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
- xformer.setOutputProperty(OutputKeys.INDENT, "yes");
-
- //
- // Prepare the DOM document for writing
- //
- Source source = new DOMSource(this.manifestDoc);
- //
- // Prepare the output file, get the Mainifest file name from <FarHeader>
- // <FarName>.
- //
- this.mfFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar + mfFileName);
- //
- // generate all directory path
- //
- Result result = new StreamResult(this.mfFile);
- xformer.transform(source, result);
- //
- // Close result. Flush file by manual for Jdk1.5.0_04.
- //
- ((StreamResult) result).getOutputStream().close();
- }
-
- public void pkgToFarPkgNode(Element parentNode, FarPackage pkgItem) {
- Element pkgNode = this.manifestDoc.createElement(farPackageList_FarPackage);
- //
- // Add <FarFileName>
- //
- ffiToFfNode(pkgNode, pkgItem.getFarFile());
- //
- // Add <GuidValue>
- //
- setStrItemToNode(pkgNode, pkgItem.getGuidValue(), guidValue);
- //
- // Add <Version>
- //
- setStrItemToNode(pkgNode, pkgItem.getVersion(), version);
- //
- // Add <DefaultPath>
- //
- setStrItemToNode(pkgNode, pkgItem.getDefaultPath(), farPackage_DefaultPath);
-
- //
- // Add <Contents>
- //
- Element contentNode = this.manifestDoc.createElement(contents);
- Iterator iterator = pkgItem.getContentList().iterator();
- while (iterator.hasNext()) {
- ffiToFfNode(contentNode, (FarFileItem) iterator.next());
- }
- pkgNode.appendChild(contentNode);
- parentNode.appendChild(pkgNode);
- }
-
- public void PlfToPlatformNode(Element parentNode, FarPlatformItem fplItem) {
- Element fplNode = this.manifestDoc.createElement(farPlatformList_FarPlatform);
- //
- // Add <FarFileName>
- //
- ffiToFfNode(fplNode, fplItem.getFarFile());
- //
- // Add <GuidValue>
- //
- setStrItemToNode(fplNode, fplItem.getGuidValue(), guidValue);
- //
- // Add <Version>
- //
- setStrItemToNode(fplNode, fplItem.getVersion(), version);
- //
- // Add to <PlatformList>
- //
- parentNode.appendChild(fplNode);
-
- }
-
- public void ffiToFfNode(Element parentNode, FarFileItem ffi) {
- Element farFileName = this.manifestDoc.createElement(farPackage_FarfileName);
- farFileName.setTextContent(ffi.getRelativeFilename());
- System.out.println(farFileName.getTextContent());
- System.out.println(ffi.getRelativeFilename());
- farFileName.setAttribute(farFileName_Md5sum, ffi.getMd5Value());
- parentNode.appendChild(farFileName);
- }
-
- public void setStrItemToNode(Element parentNode, String strValue, String strName) {
- Element node = this.manifestDoc.createElement(strName);
- node.setTextContent(strValue);
- parentNode.appendChild(node);
- }
-
- private void parseManifest() {
-
- //
- // Parse header
- //
- parseMfHeader();
- //
- // parse <farPackageList>
- //
- parseHeaderFarPackageList();
-
- //
- // parse <farPlatformList>
- //
- NodeList ele = this.manifestDoc.getElementsByTagName(farPlatformList);
- Node plfNode;
- if (ele.getLength() > 0) {
- //
- // Only have one <FarPlatformList> node under manifest root node.
- //
- plfNode = ele.item(0);
- parseFarPlatformList(plfNode, this.fPlfList);
- }
- }
-
- private void parseMfHeader() {
- Node headerNode;
- NodeList ele = this.manifestDoc.getElementsByTagName(farHeader);
- if (ele.getLength() > 0) {
- //
- // For manifest file only have one <FarHeader>
- //
- headerNode = ele.item(0);
- } else {
- return;
- }
- NodeList childList = headerNode.getChildNodes();
- Node node = null;
- String nodeName = null;
- for (int i = 0; i < childList.getLength(); i++) {
- node = childList.item(i);
- nodeName = node.getNodeName();
- if (nodeName.equalsIgnoreCase(farHeader_FarName)) {
- String nodeValue = node.getTextContent();
- this.fhInfo.setFarName(nodeValue);
- } else if (nodeName.equalsIgnoreCase(guidValue)) {
- this.fhInfo.setGuidValue(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(version)) {
- this.fhInfo.setVersion(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_Abstract)) {
- this.fhInfo.setAbstractStr(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_Description)) {
- this.fhInfo.setDescription(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_CopyRight)) {
- this.fhInfo.setCopyright(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_License)) {
- this.fhInfo.setLicense(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_Specification)) {
- this.fhInfo.setSpecification(node.getTextContent());
- }
- }
- }
-
- public void parseHeaderFarPackageList() {
- Node farPkgNode;
- NodeList ele = this.manifestDoc.getElementsByTagName(farPackageList);
- if (ele.getLength() > 0) {
- //
- // For manifest file only have one <FarHeader>
- //
- farPkgNode = ele.item(0);
- } else {
- return;
- }
- NodeList fpnList = farPkgNode.getChildNodes();
- for (int i = 0; i < fpnList.getLength(); i++) {
- if (fpnList.item(i).getNodeType() == Node.TEXT_NODE) {
- continue;
- }
- FarPackage fpItem = new FarPackage();
- parseFarPackage(fpnList.item(i), fpItem);
- this.fPkgList.add(fpItem);
- }
- }
-
- public void parseFarPackage(Node farPkgNode, FarPackage fpItem) {
- NodeList childList = farPkgNode.getChildNodes();
- Node childNode;
- String childName;
- for (int i = 0; i < childList.getLength(); i++) {
- childNode = childList.item(i);
- childName = childNode.getNodeName();
- if (childName.equalsIgnoreCase(farPackage_FarfileName)) {
- fpItem.setFarFile(parseFarFile(childNode));
- } else if (childName.equalsIgnoreCase(guidValue)) {
- fpItem.setGuidValue(childNode.getTextContent());
- } else if (childName.equalsIgnoreCase(version)) {
- fpItem.setVersion(childNode.getTextContent());
- } else if (childName.equalsIgnoreCase(farPackage_DefaultPath)) {
- fpItem.setDefaultPath(childNode.getTextContent());
- } else if (childName.equalsIgnoreCase(farPlatformList)) {
- List<FarPlatformItem> plfList = new ArrayList<FarPlatformItem>();
- parseFarPlatformList(childNode, plfList);
- fpItem.setFarPlatformList(plfList);
- } else if (childName.equalsIgnoreCase(contents)) {
- List<FarFileItem> ffList = new ArrayList<FarFileItem>();
- parseContents(childNode, ffList);
- fpItem.setContentList(ffList);
- }
- }
- }
-
- /**
- *
- * @param fpfListNode
- * @param plfList
- */
- public void parseFarPlatformList(Node fpfListNode, List<FarPlatformItem> plfList) {
- //
- // Get <FarPlatform> list.
- //
- NodeList child = fpfListNode.getChildNodes();
- Node farPlfNode;
- for (int i = 0; i < child.getLength(); i++) {
- if (child.item(i).getNodeType() == Node.TEXT_NODE) {
- continue;
- }
- farPlfNode = child.item(i);
- plfList.add(parseFarPlatform(farPlfNode));
- }
- }
-
- /**
- *
- * @param fpfNode
- * @return
- */
- public FarPlatformItem parseFarPlatform(Node fpfNode) {
- //
- // New FarPlatformItem.
- //
- FarPlatformItem fplItem = new FarPlatformItem();
- //
- // Get <FarPlatform> elements;
- //
- NodeList childList = fpfNode.getChildNodes();
- Node child;
- String nodeName;
- for (int i = 0; i < childList.getLength(); i++) {
- child = childList.item(i);
- nodeName = child.getNodeName();
- if (nodeName.equalsIgnoreCase(farPackage_FarfileName)) {
- fplItem.setFarFile(parseFarFile(child));
- } else if (nodeName.equalsIgnoreCase(guidValue)) {
- fplItem.setGuidValue(child.getTextContent());
- } else if (nodeName.equalsIgnoreCase(version)) {
- fplItem.setVersion(child.getTextContent());
- }
- }
-
- return fplItem;
- }
-
- public void parseContents(Node contentsNode, List<FarFileItem> ffList) {
- NodeList contentList = contentsNode.getChildNodes();
- Node contentNode;
- for (int i = 0; i < contentList.getLength(); i++) {
- if (contentList.item(i).getNodeType() == Node.TEXT_NODE) {
- continue;
- }
- contentNode = contentList.item(i);
- //
- // Parse each <FarFileName>.
- //
- ffList.add(parseFarFile(contentNode));
- }
- }
-
- public FarFileItem parseFarFile(Node farFileNode) {
- String ffName = farFileNode.getTextContent();
- NamedNodeMap attr = farFileNode.getAttributes();
- FarFileItem ffItem = new FarFileItem(ffName, attr.getNamedItem(farFileName_Md5sum).getTextContent());
- return ffItem;
- }
-
- public boolean isFilter(File file, Set<String> fileter) {
- Iterator<String> iter = fileter.iterator();
- while (iter.hasNext()) {
- Pattern pattern = Pattern.compile(iter.next());
- Matcher matcher = pattern.matcher(file.getName());
-
- if (matcher.find()) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java
deleted file mode 100644
index 28af114a5b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public interface ManifestInterface {
-
- public void createManifest(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,
- Set<String> fileFilter) throws Exception;
-
- public void setManifestFile(File manifestFile) throws Exception;
-
- public List<PackageIdentification> getPackageList() throws Exception;
-
- public List<PlatformIdentification> getPlatformList() throws Exception, IOException, XmlException;
-
- public List<FarFileItem> getPackageContents(PackageIdentification packageId);
-
- public String getPackageDefaultPath(PackageIdentification packageId);
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java
deleted file mode 100644
index f76af054ba..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageDependenciesDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class PackageQuery implements PackageQueryInterface {
-
- public PackageIdentification getPackageIdentification(File spdFile) {
- PackageIdentification packageId = null;
- try {
- String path = spdFile.getPath();
- packageId = Tools.getId(path, OpenFile.openSpdFile(path));
- } catch (Exception e) {
- e.printStackTrace();
- }
- return packageId;
- }
-
- public List<String> getPackageMsaList(InputStream spdInput) {
- List<String> result = new ArrayList<String>();
- try {
- PackageSurfaceAreaDocument spd = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(spdInput);
- result = spd.getPackageSurfaceArea().getMsaFiles().getFilenameList();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
- public List<PackageIdentification> getModuleDependencies(InputStream msaInput) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- try {
- ModuleSurfaceAreaDocument msa = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaInput);
- ModuleSurfaceAreaDocument.ModuleSurfaceArea sa = msa.getModuleSurfaceArea();
- if (sa == null) {
- return result;
- }
- PackageDependenciesDocument.PackageDependencies pkgDep = sa.getPackageDependencies();
- if (pkgDep == null) {
- return result;
- }
- List<PackageDependenciesDocument.PackageDependencies.Package> list = pkgDep.getPackageList();
- Iterator<PackageDependenciesDocument.PackageDependencies.Package> iter = list.iterator();
- while (iter.hasNext()) {
- PackageDependenciesDocument.PackageDependencies.Package item = iter.next();
- PackageIdentification packageId = new PackageIdentification(null, item.getPackageGuid(),
- item.getPackageVersion());
- result.add(packageId);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
- public List<File> getPackageMsaList(File spdFile) {
- List<File> result = new Vector<File>();
- WorkspaceTools wt = new WorkspaceTools();
- List<String> v = wt.getAllModulesOfPackage(spdFile.getPath());
- Iterator<String> iter = v.iterator();
- while (iter.hasNext()) {
- result.add(new File(iter.next()));
- }
- return result;
- }
-
- public List<PackageIdentification> getPackageDependencies(File spdFile) {
- List<File> msaFiles = getPackageMsaList(spdFile);
- return getPackageDependencies(msaFiles);
- }
-
- public List<PackageIdentification> getPackageDependencies(List<File> msaFiles) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<File> iter = msaFiles.iterator();
- while (iter.hasNext()) {
- result = AggregationOperation.union(result, getModuleDependencies(iter.next()));
- }
- return result;
- }
-
- public List<PackageIdentification> getModuleDependencies(File msaFile) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- try {
- ModuleSurfaceArea msa = OpenFile.openMsaFile(msaFile.getPath());
- List<PackageDependenciesDocument.PackageDependencies.Package> p = msa.getPackageDependencies()
- .getPackageList();
- Iterator<PackageDependenciesDocument.PackageDependencies.Package> iter = p.iterator();
- while (iter.hasNext()) {
- PackageDependenciesDocument.PackageDependencies.Package item = iter.next();
- PackageIdentification packageId = new PackageIdentification(null, item.getPackageGuid(),
- item.getPackageVersion());
- if (!AggregationOperation.belongs(packageId, result)) {
- result.add(packageId);
- }
- }
- } catch (Exception e) {
- }
- return result;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java
deleted file mode 100644
index e8644ebbf7..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.List;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public interface PackageQueryInterface {
-
- public PackageIdentification getPackageIdentification(File spdFile);
-
- public List<File> getPackageMsaList(File spdFile);
-
- public List<String> getPackageMsaList(InputStream spdInput);
-
- public List<PackageIdentification> getPackageDependencies(File spdFile);
-
- public List<PackageIdentification> getPackageDependencies(List<File> msaFiles);
-
- public List<PackageIdentification> getModuleDependencies(InputStream msaInput);
-
- public List<PackageIdentification> getModuleDependencies(File msaFile);
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java
deleted file mode 100644
index ab2ffd07ee..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.AggregationOperation;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.far.PackageQuery;
-import org.tianocore.frameworkwizard.far.PackageQueryInterface;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class CreateStepFour extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -7397213364965470902L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextAreaInstruction = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel2 = null;
-
- private JTextField jTextFieldSaveToFile = null;
-
- private JButton jButtonBrowser = null;
-
- // private JScrollPane jScrollPane = null;
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private IDefaultTableModel model = null;
-
- private CreateStepThree stepThree = null;
-
- // private JTable jTable = null;
- public CreateStepFour(IDialog iDialog, boolean modal, CreateStepThree stepThree) {
- this(iDialog, modal);
- this.stepThree = stepThree;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextAreaInstruction == null) {
- jTextAreaInstruction = new JTextArea();
- jTextAreaInstruction.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextAreaInstruction.setText("Step 4: Choose a file \n");
- jTextAreaInstruction.setEditable(false);
- }
- return jTextAreaInstruction;
- }
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextField1() {
- if (jTextFieldSaveToFile == null) {
- jTextFieldSaveToFile = new JTextField();
- jTextFieldSaveToFile.setBounds(new java.awt.Rectangle(147,70,412,20));
- }
- return jTextFieldSaveToFile;
- }
-
- /**
- * This method initializes jButtonBrowser
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrower() {
- if (jButtonBrowser == null) {
- jButtonBrowser = new JButton();
- jButtonBrowser.setBounds(new java.awt.Rectangle(570, 70, 100, 20));
- jButtonBrowser.setText("Browser...");
- jButtonBrowser.addMouseListener(this);
- }
- return jButtonBrowser;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- // private JScrollPane getJScrollPane() {
- // if (jScrollPane == null) {
- // jScrollPane = new JScrollPane();
- // jScrollPane.setBounds(new java.awt.Rectangle(139,85,500,100));
- // jScrollPane.setViewportView(getJTable());
- // }
- // return jScrollPane;
- // }
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- jButtonPrevious.setVisible(true);
- }
- return jButtonPrevious;
- }
-
- /**
- * This is the default constructor
- */
- public CreateStepFour(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_FOUR_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(30,70,111,18));
- jLabel2.setText("File to Save: ");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(29,108,320,20));
- jLabel.setText("This FAR will depend on the following packages: ");
- jLabel.setVisible(false);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- // jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(getJTextField1(), null);
- jContentPane.add(getJButtonBrower(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonFinish) {
- //
- // Add some logic process here
- // Guid Check, File Check etc.
- //
- if (this.jTextFieldSaveToFile.getText() == null) {
- Log.wrn("Create far", "Please input the Far name!");
- }
- try {
- //
- // Create an output stream for JAR
- //
-
- Far far = new Far(new File(this.jTextFieldSaveToFile.getText()));
-
- far.creatFar(this.getPreviousStep().getPreviousStep().getSelectedPackages(),
- this.getPreviousStep().getPreviousStep().getSelectedPlatforms(), this.getPreviousStep()
- .getFileFilter(),
- this.getPreviousStep().getPreviousStep().getPreviousStep().getFarHeader());
- } catch (Exception exp) {
- Log.wrn("Create far", exp.getMessage());
- Log.err("Create far", exp.getMessage());
- return;
- }
- getPreviousStep().getPreviousStep().getPreviousStep().returnType = DataType.RETURN_TYPE_OK;
- getPreviousStep().getPreviousStep().dispose();
- getPreviousStep().dispose();
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonBrowser) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(DataType.FAR_SURFACE_AREA_EXT));
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
-
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldSaveToFile.setText(Tools.addPathExt(fc.getSelectedFile().getPath(),
- DataType.RETURN_TYPE_FAR_SURFACE_AREA));
- }
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepThree.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public CreateStepThree getPreviousStep() {
- return stepThree;
- }
-
- public void prepareTable() {
- model.setRowCount(0);
-
- List<PackageIdentification> packageList = new ArrayList<PackageIdentification>();
- //
- // Change here to get packages and platforms from FAR
- //
- List<PackageIdentification> selectedPackages = getPreviousStep().getPreviousStep().getSelectedPackages();
- PackageQueryInterface pq = new PackageQuery();
-
- Iterator<PackageIdentification> iter = selectedPackages.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- List<PackageIdentification> list = pq.getPackageDependencies(item.getSpdFile());
- packageList = AggregationOperation.union(list, packageList);
- }
-
- packageList = AggregationOperation.minus(packageList, selectedPackages);
-
- iter = packageList.iterator();
- while (iter.hasNext()) {
- String[] str = new String[3];
- PackageIdentification item = iter.next();
- str[2] = item.getName();
- str[1] = item.getVersion();
- str[0] = item.getGuid();
- model.addRow(str);
- }
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java
deleted file mode 100644
index 0126b96f38..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java
+++ /dev/null
@@ -1,641 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.far.FarHeader;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-
-public class CreateStepOne extends IDialog implements MouseListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -8152099582923006900L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelBaseName = null;
-
- private JTextField jTextFieldBaseName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelLicense = null;
-
- private JTextArea jTextAreaLicense = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jLabelDescription = null;
-
- private JTextArea jTextAreaDescription = null;
-
- private JLabel jLabelSpecification = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JButton jButtonOk = null;
-
- private JScrollPane jScrollPaneLicense = null;
-
- private JScrollPane jScrollPaneDescription = null;
-
- private JLabel jLabelAbstract = null;
-
- private JTextField jTextFieldAbstract = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel6 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private StarLabel jStarLabel10 = null;
-
- private StarLabel jStarLabel12 = null;
-
- private JLabel jLabelURL = null;
-
- private JTextField jTextFieldURL = null;
-
- private JScrollPane jScrollPane = null;
-
- private CreateStepTwo stepTwo = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private FarHeader farHeader = new FarHeader();
-
- private JScrollPane jScrollPaneCopyright = null;
-
- private JTextArea jTextAreaCopyright = null;
-
- /**
- * This method initializes jTextFieldBaseName
- *
- * @return javax.swing.JTextField jTextFieldBaseName
- *
- */
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 520, 20));
- jTextFieldBaseName.setToolTipText("A brief Identifier, such as USB I/O Drivers, of the Framework Archive.");
- }
- return jTextFieldBaseName;
- }
-
- /**
- * This method initializes jTextFieldGuid
- *
- * @return javax.swing.JTextField jTextFieldGuid
- *
- */
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 410, 20));
- jTextFieldGuid.setToolTipText("Guaranteed Unique Identification Number (8-4-4-4-12)");
- }
- return jTextFieldGuid;
- }
-
- /**
- * This method initializes jTextFieldVersion
- *
- * @return javax.swing.JTextField jTextFieldVersion
- *
- */
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 520, 20));
- jTextFieldVersion.setToolTipText("A Version Number, 1.0, 1, 1.01");
- }
- return jTextFieldVersion;
- }
-
- /**
- * This method initializes jButtonGenerateGuid
- *
- * @return javax.swing.JButton jButtonGenerateGuid
- *
- */
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(590, 35, 90, 20));
- jButtonGenerateGuid.setText("Generate");
- jButtonGenerateGuid.addMouseListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- * This method initializes jTextAreaLicense
- *
- * @return javax.swing.JTextArea jTextAreaLicense
- *
- */
- private JTextArea getJTextAreaLicense() {
- if (jTextAreaLicense == null) {
- jTextAreaLicense = new JTextArea();
- jTextAreaLicense.setText("");
- jTextAreaLicense.setLineWrap(true);
- jTextAreaLicense.setWrapStyleWord(true);
- jTextAreaLicense.setToolTipText("The License for this FAR file.");
- }
- return jTextAreaLicense;
- }
-
- /**
- * This method initializes jTextAreaDescription
- *
- * @return javax.swing.JTextArea jTextAreaDescription
- *
- */
- private JTextArea getJTextAreaDescription() {
- if (jTextAreaDescription == null) {
- jTextAreaDescription = new JTextArea();
- jTextAreaDescription.setLineWrap(true);
- jTextAreaDescription.setWrapStyleWord(true);
- jTextAreaDescription.setToolTipText("A verbose description of the FAR contents.");
- }
- return jTextAreaDescription;
- }
-
- /**
- * This method initializes jTextFieldSpecification
- *
- * @return javax.swing.JTextField jTextFieldSpecification
- *
- */
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- jTextFieldSpecification = new JTextField();
- jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(160, 310, 520, 20));
- jTextFieldSpecification.setEditable(false);
- }
- return jTextFieldSpecification;
- }
-
- /**
- * This method initializes jScrollPaneLicense
- *
- * @return javax.swing.JScrollPane jScrollPaneLicense
- *
- */
- private JScrollPane getJScrollPaneLicense() {
- if (jScrollPaneLicense == null) {
- jScrollPaneLicense = new JScrollPane();
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 220, 520, 60));
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());
- }
- return jScrollPaneLicense;
- }
-
- /**
- * This method initializes jScrollPaneDescription
- *
- * @return javax.swing.JScrollPane jScrollPaneDescription
- *
- */
- private JScrollPane getJScrollPaneDescription() {
- if (jScrollPaneDescription == null) {
- jScrollPaneDescription = new JScrollPane();
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 110, 520, 60));
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());
- }
- return jScrollPaneDescription;
- }
-
- /**
- * This method initializes jTextFieldAbstract
- *
- * @return javax.swing.JTextField jTextFieldAbstract
- *
- */
- private JTextField getJTextFieldAbstract() {
- if (jTextFieldAbstract == null) {
- jTextFieldAbstract = new JTextField();
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(160, 85, 520, 20));
- jTextFieldAbstract.setToolTipText("A one sentence description of this FAR package.");
- }
- return jTextFieldAbstract;
- }
-
- /**
- * This method initializes jTextFieldURL
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldURL() {
- if (jTextFieldURL == null) {
- jTextFieldURL = new JTextField();
- jTextFieldURL.setBounds(new java.awt.Rectangle(160, 285, 520, 20));
- jTextFieldURL.setToolTipText("A URL for the latest version of the license");
- }
- return jTextFieldURL;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jButtonCancel1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(590, 350, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(480, 350, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jScrollPaneCopyright
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneCopyright() {
- if (jScrollPaneCopyright == null) {
- jScrollPaneCopyright = new JScrollPane();
- jScrollPaneCopyright.setBounds(new java.awt.Rectangle(160, 175, 520, 40));
- jScrollPaneCopyright.setViewportView(getJTextAreaCopyright());
- }
- return jScrollPaneCopyright;
- }
-
- /**
- * This method initializes jTextAreaCopyright
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaCopyright() {
- if (jTextAreaCopyright == null) {
- jTextAreaCopyright = new JTextArea();
- }
- return jTextAreaCopyright;
- }
-
- public static void main(String[] args) {
- CreateStepOne c = new CreateStepOne(new IFrame(), true);
- c.setVisible(true);
- }
-
- /**
- * This is the default constructor
- *
- */
- public CreateStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jTextFieldBaseName.setEnabled(!isView);
- this.jTextFieldGuid.setEnabled(!isView);
- this.jTextFieldVersion.setEnabled(!isView);
- this.jTextAreaLicense.setEnabled(!isView);
- this.jScrollPaneCopyright.setEnabled(!isView);
- this.jTextAreaCopyright.setEnabled(!isView);
- this.jTextAreaDescription.setEnabled(!isView);
- this.jTextFieldSpecification.setEnabled(!isView);
- this.jTextFieldAbstract.setEnabled(!isView);
- this.jButtonGenerateGuid.setEnabled(!isView);
- this.jButtonOk.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes this
- *
- */
- private void initialize() {
- this.setSize(700, 425);
- this.setContentPane(getJScrollPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_ONE_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
-
- jLabelURL = new JLabel();
- jLabelURL.setText("License URL");
- jLabelURL.setBounds(new java.awt.Rectangle(35, 285, 120, 20));
- jLabelBaseName = new JLabel();
- jLabelBaseName.setText("FAR Name");
- jLabelBaseName.setBounds(new java.awt.Rectangle(35, 10, 120, 20));
- jLabelGuid = new JLabel();
- jLabelGuid.setText("Guid Value");
- jLabelGuid.setBounds(new java.awt.Rectangle(35, 35, 120, 20));
- jLabelVersion = new JLabel();
- jLabelVersion.setText("Version");
- jLabelVersion.setBounds(new java.awt.Rectangle(35, 60, 120, 20));
- jLabelAbstract = new JLabel();
- jLabelAbstract.setText("Abstract");
- jLabelAbstract.setBounds(new java.awt.Rectangle(35, 85, 120, 20));
- jLabelDescription = new JLabel();
- jLabelDescription.setText("Description");
- jLabelDescription.setBounds(new java.awt.Rectangle(35, 110, 120, 20));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setBounds(new java.awt.Rectangle(35, 175, 120, 20));
- jLabelLicense = new JLabel();
- jLabelLicense.setText("License");
- jLabelLicense.setBounds(new java.awt.Rectangle(35, 220, 120, 20));
- jLabelSpecification = new JLabel();
- jLabelSpecification.setText("Specification");
- jLabelSpecification.setBounds(new java.awt.Rectangle(35, 310, 120, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
-
- jContentPane.add(jLabelBaseName, null);
- jContentPane.add(getJTextFieldBaseName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelLicense, null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(jLabelDescription, null);
- jContentPane.add(jLabelSpecification, null);
- jContentPane.add(getJTextFieldSpecification(), null);
- jContentPane.add(getJScrollPaneLicense(), null);
- jContentPane.add(getJScrollPaneDescription(), null);
- jContentPane.add(jLabelAbstract, null);
- jContentPane.add(getJTextFieldAbstract(), null);
- jContentPane.add(jLabelURL, null);
- jContentPane.add(getJTextFieldURL(), null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(20, 10));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(20, 35));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(20, 60));
- jStarLabel6 = new StarLabel();
- jStarLabel6.setLocation(new java.awt.Point(20, 110));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(20, 175));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(20, 220));
- jStarLabel10 = new StarLabel();
- jStarLabel10.setLocation(new java.awt.Point(20, 85));
- jStarLabel12 = new StarLabel();
- jStarLabel12.setLocation(new java.awt.Point(20, 310));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel6, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(jStarLabel10, null);
- jContentPane.add(jStarLabel12, null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJScrollPaneCopyright(), null);
- }
- return jContentPane;
- }
-
- public boolean valid() {
- //
- // Check BaseName
- //
- if (isEmpty(this.jTextFieldBaseName.getText())) {
- Log.wrn("Create far", "FAR Name must be entered.");
- return false;
- }
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
- Log.wrn("Create far", "Incorrect data type for FAR Name");
- return false;
- }
- farHeader.setFarName(this.jTextFieldBaseName.getText());
-
- //
- // Check Guid
- //
- if (isEmpty(this.jTextFieldGuid.getText())) {
- Log.wrn("Create far", "A GUID must be entered.");
- return false;
- }
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
- Log.wrn("Create far", "Incorrect data type for Guid");
- return false;
- }
- farHeader.setGuidValue(this.jTextFieldGuid.getText());
-
- //
- // Check Version
- //
- if (isEmpty(this.jTextFieldVersion.getText())) {
- Log.wrn("Create far", "A Version must be entered.");
- return false;
- }
- if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
- Log.wrn("Create far", "Incorrect data type for Version");
- return false;
- }
- farHeader.setVersion(this.jTextFieldVersion.getText());
-
- //
- // Check Abstact
- //
- if (isEmpty(this.jTextFieldAbstract.getText())) {
- Log.wrn("Create far", "An Abstract must be entered.");
- return false;
- }
- if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
- Log.wrn("Create far", "Incorrect data type for Abstract");
- return false;
- }
- farHeader.setAbstractStr(this.jTextFieldAbstract.getText());
-
- //
- // Check Description
- //
- if (isEmpty(this.jTextAreaDescription.getText())) {
- Log.wrn("Create far", "A Description must be entered.");
- return false;
- }
- farHeader.setDescription(this.jTextAreaDescription.getText());
-
- //
- // Check Copyright
- //
- if (isEmpty(this.jTextAreaCopyright.getText())) {
- Log.wrn("Create far", "The Copyright must be entered.");
- return false;
- }
- farHeader.setCopyright(this.jTextAreaCopyright.getText());
-
- //
- // Check License
- //
- if (isEmpty(this.jTextAreaLicense.getText())) {
- Log.wrn("Create far", "The License must be entered.");
- return false;
- }
- farHeader.setLicense(this.jTextAreaLicense.getText());
-
- farHeader.setSpecification(this.jTextFieldSpecification.getText());
- return true;
- }
-
- /**
- * Check the input data is empty or not
- *
- * @param strValue
- * The input data which need be checked
- *
- * @retval true - The input data is empty
- * @retval fals - The input data is not empty
- *
- */
- public boolean isEmpty(String strValue) {
- if (strValue.length() > 0) {
- return false;
- }
- return true;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
- if (!valid()) {
- return ;
- }
- if (stepTwo == null) {
- stepTwo = new CreateStepTwo(this, true, this);
- }
- this.setVisible(false);
- stepTwo.setVisible(true);
- } else if (e.getSource() == jButtonGenerateGuid) {
- this.jTextFieldGuid.setText(Tools.generateUuidString());
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public FarHeader getFarHeader() {
- return farHeader;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java
deleted file mode 100644
index 666082d3d4..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-public class CreateStepThree extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 7559888600474043337L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private JButton jButtonNext = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonPrevious = null;
-
- private JLabel jLabel = null;
-
- private ICheckBoxList jComboBoxFileFilter = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabel1 = null;
-
- private JTextField jTextField = null;
-
- Vector<String> v = new Vector<String>();
-
- private CreateStepTwo stepTwo = null;
-
- private CreateStepFour stepFour = null;
-
- public CreateStepThree(IDialog iDialog, boolean modal, CreateStepTwo stepTwo) {
- this(iDialog, modal);
- this.stepTwo = stepTwo;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Add additional file filter regular expressions in the text field, separated by space characters.\n");
- jTextArea.append("Note, for additional information about regular expressions, please reference PERL language regular expressions.");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private ICheckBoxList getJComboBoxFileFilter() {
- if (jComboBoxFileFilter == null) {
- jComboBoxFileFilter = new ICheckBoxList();
- v.addElement(".svn");
- v.addElement("CVS");
- jComboBoxFileFilter.setAllItems(v);
- jComboBoxFileFilter.initCheckedItem(true, v);
- }
- return jComboBoxFileFilter;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 85, 640, 130));
- jScrollPane.setViewportView(getJComboBoxFileFilter());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(30, 250, 640, 20));
- }
- return jTextField;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- }
-
- /**
- * This is the default constructor
- */
- public CreateStepThree(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_THREE_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 220, 260, 20));
- jLabel1.setText("Input File Filter Pattern (regular expressions)");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 64, 160, 20));
- jLabel.setText("File Filter Pattern: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJTextField(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
-
- if (stepFour == null) {
- stepFour = new CreateStepFour(this, true, this);
- }
-
- this.setVisible(false);
- stepFour.setVisible(true);
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepTwo.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public Set<String> getFileFilter() {
- Set<String> result = new LinkedHashSet<String>();
- Vector<Integer> selected = jComboBoxFileFilter.getAllCheckedItemsIndex();
-
- Iterator<Integer> iter = selected.iterator();
-
- while (iter.hasNext()) {
- result.add(v.get(iter.next().intValue()));
- }
-
- String[] userdefined = jTextField.getText().split(" ");
-
- for (int i = 0; i < userdefined.length; i++) {
- if (!userdefined[i].trim().equalsIgnoreCase("")) {
- result.add(userdefined[i]);
- }
- }
-
- return result;
- }
-
- public CreateStepTwo getPreviousStep() {
- return stepTwo;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java
deleted file mode 100644
index a2e3500c3a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class CreateStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 3003841865197005528L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel1 = null;
-
- private ICheckBoxList jComboBoxPackage = null;
-
- private ICheckBoxList jComboBoxPlatform = null;
-
- private JButton jButtonNext = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPanePackage = null;
-
- private JScrollPane jScrollPanePlatform = null;
-
- private CreateStepThree stepThree = null;
-
- private Vector<PlatformIdentification> platformVector = null;
-
- private Vector<PackageIdentification> packageVector = null;
-
- private CreateStepOne stepOne = null;
-
- private JButton jButtonPrevious = null;
-
- public CreateStepTwo(IDialog iDialog, boolean modal, CreateStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Choose at least one package or platform. ");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private ICheckBoxList getJComboBoxPackage() {
- if (jComboBoxPackage == null) {
- jComboBoxPackage = new ICheckBoxList();
- WorkspaceTools wt = new WorkspaceTools();
- Vector<String> v = new Vector<String>();
- packageVector = wt.getAllPackages();
- Iterator<PackageIdentification> iter = packageVector.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- String str = item.getName() + " " + item.getVersion() + " [" + item.getPath() + "]";
- v.addElement(str);
- }
- jComboBoxPackage.setAllItems(v);
- }
- return jComboBoxPackage;
- }
-
- /**
- * This method initializes jComboBox1
- *
- * @return javax.swing.JComboBox
- */
- private ICheckBoxList getJComboBoxPlatform() {
- if (jComboBoxPlatform == null) {
- jComboBoxPlatform = new ICheckBoxList();
- WorkspaceTools wt = new WorkspaceTools();
- Vector<String> v = new Vector<String>();
- platformVector = wt.getAllPlatforms();
- Iterator<PlatformIdentification> iter = platformVector.iterator();
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- String str = item.getName() + " " + item.getVersion() + " [" + item.getPath() + "]";
- v.addElement(str);
- }
- jComboBoxPlatform.setAllItems(v);
- }
- return jComboBoxPlatform;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePackage() {
- if (jScrollPanePackage == null) {
- jScrollPanePackage = new JScrollPane();
- jScrollPanePackage.setBounds(new java.awt.Rectangle(140,65,535,130));
- jScrollPanePackage.setViewportView(getJComboBoxPackage());
- }
- return jScrollPanePackage;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePlatform() {
- if (jScrollPanePlatform == null) {
- jScrollPanePlatform = new JScrollPane();
- jScrollPanePlatform.setBounds(new java.awt.Rectangle(140,200,535,110));
- jScrollPanePlatform.setViewportView(getJComboBoxPlatform());
- }
- return jScrollPanePlatform;
- }
-
- /**
- * This is the default constructor
- */
- public CreateStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_TWO_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 200, 100, 20));
- jLabel1.setText("Platforms: ");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 64, 100, 20));
- jLabel.setText("Packages:");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJScrollPanePackage(), null);
- jContentPane.add(getJScrollPanePlatform(), null);
- jContentPane.add(getJButtonPrevious(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
- if (jComboBoxPlatform.getAllCheckedItemsIndex().size() == 0
- && jComboBoxPackage.getAllCheckedItemsIndex().size() == 0) {
- Log.wrn("Create far", "Choose at least one package and/or platform.");
- return;
- }
-
- //
- // If some packages a Repackage=false, give a warning message
- //
- List<PackageIdentification> selectedPackages = getSelectedPackages();
- WorkspaceTools wt = new WorkspaceTools();
- List<PackageIdentification> allRepackablePackages = wt.getAllRepackagablePackages();
-
- List<PackageIdentification> unRepackablePackages = new Vector<PackageIdentification>();
- String msg = "Following selected packages: \n";
- Iterator<PackageIdentification> iter = selectedPackages.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (!allRepackablePackages.contains(item)) {
- unRepackablePackages.add(item);
- msg += item.getName() + "\n";
- }
- }
- msg += "is un-Repackagable. Do you want to continue? ";
-
- if (unRepackablePackages.size() > 0) {
- if(JOptionPane.showConfirmDialog(this, msg, "Warning", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
- return ;
- }
- }
-
- if (stepThree == null) {
- stepThree = new CreateStepThree(this, true, this);
- }
- this.setVisible(false);
- stepThree.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- public List<PackageIdentification> getSelectedPackages() {
- Vector<Integer> v = jComboBoxPackage.getAllCheckedItemsIndex();
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- for (int i = 0; i < v.size(); i++) {
- result.add(packageVector.get(v.get(i).intValue()));
- }
- return result;
- }
-
- public List<PlatformIdentification> getSelectedPlatforms() {
- Vector<Integer> v = jComboBoxPlatform.getAllCheckedItemsIndex();
- List<PlatformIdentification> result = new ArrayList<PlatformIdentification>();
- for (int i = 0; i < v.size(); i++) {
- result.add(platformVector.get(v.get(i).intValue()));
- }
- return result;
- }
-
- public CreateStepOne getPreviousStep() {
- return stepOne;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java
deleted file mode 100644
index f5b68f4eae..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far.deleteui;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.far.AggregationOperation;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.far.PackageQuery;
-import org.tianocore.frameworkwizard.far.PackageQueryInterface;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class DeleteStepOne extends IDialog implements ListSelectionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 636773964435618476L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private JTextArea jTextAreaInstruction = null;
-
- private JLabel jLabel = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabel2 = null;
-
- private JLabel jLabel3 = null;
-
- private JScrollPane jScrollPane1 = null;
-
- private JScrollPane jScrollPane2 = null;
-
- private JList jListPlatform = null;
-
- private JList jListPackage = null;
-
- private JLabel jLabel4 = null;
-
- private JButton jButtonDetail = null;
-
- private JList jListFar = null;
-
- private JLabel jLabelImage = null;
-
- private Vector<FarIdentification> farVector = null;
-
- Vector<PackageIdentification> removePackages = null;
-
- Vector<PlatformIdentification> removePlatforms = null;
-
- private DeleteStepTwo stepTwo = null;
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.setEnabled(false);
- jButtonNext.addActionListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jTextArea1
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea1() {
- if (jTextAreaInstruction == null) {
- jTextAreaInstruction = new JTextArea();
- jTextAreaInstruction.setBounds(new java.awt.Rectangle(30, 7, 662, 50));
- jTextAreaInstruction.setText("Step 1: Select FAR to remove.\n");
- jTextAreaInstruction.setCaretColor(Color.RED);
- jTextAreaInstruction
- .append("After choosing the FAR, the packages and/or platforms that belong to the FAR will displayed.\n");
- jTextAreaInstruction.append("Icon \"OK\" or \"NO\" indicates whether the FAR can be safely removed.");
- jTextAreaInstruction.setEditable(false);
- }
- return jTextAreaInstruction;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(140, 65, 530, 100));
- jScrollPane.setViewportView(getJListFar());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane1() {
- if (jScrollPane1 == null) {
- jScrollPane1 = new JScrollPane();
- jScrollPane1.setBounds(new java.awt.Rectangle(30, 195, 300, 115));
- jScrollPane1.setViewportView(getJListPackage());
- }
- return jScrollPane1;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane2() {
- if (jScrollPane2 == null) {
- jScrollPane2 = new JScrollPane();
- jScrollPane2.setBounds(new java.awt.Rectangle(360, 195, 310, 115));
- jScrollPane2.setViewportView(getJListPlatform());
- }
- return jScrollPane2;
- }
-
- /**
- * This method initializes jList
- *
- * @return javax.swing.JList
- */
- private JList getJListPlatform() {
- if (jListPlatform == null) {
- jListPlatform = new JList();
- jListPlatform.setEnabled(false);
- }
- return jListPlatform;
- }
-
- /**
- * This method initializes jList1
- *
- * @return javax.swing.JList
- */
- private JList getJListPackage() {
- if (jListPackage == null) {
- jListPackage = new JList();
- jListPackage.setEnabled(false);
- }
- return jListPackage;
- }
-
- /**
- * This method initializes jButtonDetail
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDetail() {
- if (jButtonDetail == null) {
- jButtonDetail = new JButton();
- jButtonDetail.setBounds(new java.awt.Rectangle(367, 325, 69, 20));
- jButtonDetail.setText("Detail");
- jButtonDetail.setVisible(false);
- }
- return jButtonDetail;
- }
-
- /**
- * This method initializes jListFar
- *
- * @return javax.swing.JList
- */
- private JList getJListFar() {
- if (jListFar == null) {
- jListFar = new JList();
- WorkspaceTools wt = new WorkspaceTools();
- farVector = wt.getAllFars();
- jListFar.setListData(farVector);
- jListFar.addListSelectionListener(this);
- }
- return jListFar;
- }
-
- /**
- * This is the default constructor
- */
- public DeleteStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.DELETE_STEP_ONE_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelImage = new JLabel();
- jLabelImage.setBounds(new java.awt.Rectangle(30, 319, 36, 36));
- jLabel4 = new JLabel();
- jLabel4.setBounds(new java.awt.Rectangle(71, 325, 320, 20));
- jLabel3 = new JLabel();
- jLabel3.setBounds(new java.awt.Rectangle(360, 170, 113, 20));
- jLabel3.setText("FAR's Platforms");
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(30, 170, 113, 20));
- jLabel2.setText("FAR's Packages");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 65, 100, 20));
- jLabel.setText("Select one FAR: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJTextArea1(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(jLabel3, null);
- jContentPane.add(getJScrollPane1(), null);
- jContentPane.add(getJScrollPane2(), null);
- jContentPane.add(jLabel4, null);
- jContentPane.add(getJButtonDetail(), null);
- jContentPane.add(jLabelImage, null);
- }
- return jContentPane;
- }
-
- public void valueChanged(ListSelectionEvent e) {
- //
- // Add logic for FAR list value changed
- //
- if (e.getSource() == jListFar) {
- boolean flag = true;
- FarIdentification far = (FarIdentification) jListFar.getSelectedValue();
- WorkspaceTools wt = new WorkspaceTools();
-
- removePackages = wt.getPackagesByFar(far);
- jListPackage.setListData(removePackages);
- removePlatforms = wt.getPlatformsByFar(far);
- jListPlatform.setListData(removePlatforms);
-
- //
- // Get Dependencies Info for current FAR
- //
- List<PackageIdentification> allPackages = wt.getAllPackages();
-
- //
- // Remain packages
- //
- allPackages.removeAll(removePackages);
-
- Iterator<PackageIdentification> iter = allPackages.iterator();
-
- PackageQueryInterface pq = new PackageQuery();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- List<PackageIdentification> list = pq.getPackageDependencies(item.getSpdFile());
- List<PackageIdentification> result = AggregationOperation.minus(list, allPackages);
- if (result.size() > 0) {
- if (AggregationOperation.intersection(result, removePackages).size() > 0) {
- flag = false;
- break;
- }
- }
- }
-
- if (flag) {
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/Yes.JPG")));
- jLabel4.setText("None of the remaining packages depend on this FAR. ");
- jButtonDetail.setVisible(false);
- jButtonNext.setEnabled(true);
- } else {
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/No.JPG")));
- jLabel4.setText("Some of the remaining packages still depend on this FAR. ");
- // jButtonDetail.setVisible(true);
- jButtonNext.setEnabled(false);
- }
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
-
- if (stepTwo == null) {
- stepTwo = new DeleteStepTwo(this, true, this);
- }
- this.setVisible(false);
- stepTwo.setVisible(true);
- }
-
- }
-
- public FarIdentification getSelecedFar() {
- return (FarIdentification) jListFar.getSelectedValue();
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java
deleted file mode 100644
index 8d7e4e6fed..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far.deleteui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JPanel;
-import javax.swing.JButton;
-import javax.swing.JTextArea;
-import javax.swing.JLabel;
-import javax.swing.JRadioButton;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class DeleteStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -1333748185798962746L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private JTextArea jTextArea = null;
-
- private JLabel jLabel = null;
-
- private JRadioButton jRadioButton = null;
-
- private JRadioButton jRadioButton1 = null;
-
- private DeleteStepOne stepOne = null;
-
- public DeleteStepTwo(IDialog iDialog, boolean modal, DeleteStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 2: Choose Delete Mode. \n");
- jTextArea.append("Mode 1 Only remove registation information from the WORKSPACE. \n");
- jTextArea.append("Mode 2 Also delete all files and directories from file system. ");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jRadioButton
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButton() {
- if (jRadioButton == null) {
- jRadioButton = new JRadioButton();
- jRadioButton.setBounds(new java.awt.Rectangle(40,100,440,20));
- jRadioButton.setSelected(true);
- jRadioButton.setText("Mode 1: Only remove registration information from the WORKSPACE.");
- }
- return jRadioButton;
- }
-
- /**
- * This method initializes jRadioButton1
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButton1() {
- if (jRadioButton1 == null) {
- jRadioButton1 = new JRadioButton();
- jRadioButton1.setBounds(new java.awt.Rectangle(40,140,440,20));
- jRadioButton1.setText("Mode 2: Delete ALL related files and directories from the WORKSPACE.");
- }
- return jRadioButton1;
- }
-
- /**
- * This is the default constructor
- */
- public DeleteStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.DELETE_STEP_TWO_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 70, 200, 20));
- jLabel.setText("Select delete mode: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- ButtonGroup group = new ButtonGroup();
- group.add(getJRadioButton());
- group.add(getJRadioButton1());
- jContentPane.add(getJRadioButton(), null);
- jContentPane.add(getJRadioButton1(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonFinish) {
- FarIdentification far = stepOne.getSelecedFar();
- WorkspaceTools wt = new WorkspaceTools();
- //
- // If remove all source files
- //
- if (jRadioButton1.isSelected()) {
-
- Vector<PackageIdentification> removePackages = wt.getPackagesByFar(far);
- Vector<PlatformIdentification> removePlatforms = wt.getPlatformsByFar(far);
-
- Vector<PlatformIdentification> allPlatforms = wt.getAllPlatforms();
- Set<File> allPlatformFiles = new LinkedHashSet<File>();
-
- Iterator<PlatformIdentification> iter = allPlatforms.iterator();
- while (iter.hasNext()) {
- allPlatformFiles.add(iter.next().getFpdFile());
- }
-
- //
- // For all platforms, only remove its FPD file
- //
- Iterator<PlatformIdentification> platfomrIter = removePlatforms.iterator();
- while (platfomrIter.hasNext()) {
- PlatformIdentification item = platfomrIter.next();
- allPlatformFiles.remove(item.getFpdFile());
- File parentDir = item.getFpdFile().getParentFile();
- item.getFpdFile().delete();
- //
- // Remove all empty parent dir
- //
- while (parentDir.listFiles().length == 0) {
- File tempFile = parentDir;
- parentDir = parentDir.getParentFile();
- tempFile.delete();
- }
- }
-
- //
- // For all packages, remove all files.
- // Exception FPD file still in DB
- //
-
- Iterator<PackageIdentification> packageIter = removePackages.iterator();
- while (packageIter.hasNext()) {
- PackageIdentification item = packageIter.next();
- Set<File> deleteFiles = new LinkedHashSet<File>();
- recursiveDir(deleteFiles, item.getSpdFile().getParentFile(), allPlatformFiles);
- Iterator<File> iterDeleteFile = deleteFiles.iterator();
- while (iterDeleteFile.hasNext()) {
- deleteFiles(iterDeleteFile.next());
- }
- //
- // Remove all empty parent dir
- //
- File parentDir = item.getSpdFile().getParentFile();
- while (parentDir.listFiles().length == 0) {
- File tempFile = parentDir;
- parentDir = parentDir.getParentFile();
- tempFile.delete();
- }
- }
- }
-
- //
- // Update DB file
- //
- wt.removeFarFromDb(far);
-
- this.setVisible(false);
- this.stepOne.returnType = DataType.RETURN_TYPE_OK;
- this.dispose();
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- private void recursiveDir(Set<File> files, File dir, Set<File> platformFiles) {
- File[] fileList = dir.listFiles();
- for (int i = 0; i < fileList.length; i++) {
- if (fileList[i].isFile()) {
- if (!platformFiles.contains(fileList[i])) {
- files.add(fileList[i]);
- }
- } else {
- if (isContain(fileList[i], platformFiles)) {
- recursiveDir(files, fileList[i], platformFiles);
- } else {
- files.add(fileList[i]);
- }
- }
- }
- }
-
- private void deleteFiles(File file) {
- if (file.isDirectory()) {
- File[] files = file.listFiles();
- for (int i = 0; i < files.length; i++) {
- deleteFiles(files[i]);
- }
- }
- file.delete();
- }
-
- private boolean isContain(File dir, Set<File> platformFiles) {
- Iterator<File> iter = platformFiles.iterator();
- while (iter.hasNext()) {
- File file = iter.next();
- if (file.getPath().startsWith(dir.getPath())) {
- //
- // continue this FPD file
- //
- return true;
- }
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java
deleted file mode 100644
index 24cd1369ea..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far.installui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.List;
-import java.util.jar.JarFile;
-import java.util.Iterator;
-
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JButton;
-import javax.swing.JTextArea;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.far.DistributeRule;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableModel;
-
-public class InstallStepOne extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -8821906198791949544L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private JTextArea jTextArea = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextFieldFarFile = null;
-
- private JButton jButtonBrowser = null;
-
- private InstallStepTwo stepTwo = null;
-
- Far far = null;
-
- private JLabel jLabelWarning = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTable jTable = null;
-
- private PartialTableModel model = null;
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 1: Choose a framework archive(FAR) file. \n");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFarFile() {
- if (jTextFieldFarFile == null) {
- jTextFieldFarFile = new JTextField();
- jTextFieldFarFile.setBounds(new java.awt.Rectangle(140, 80, 423, 20));
- }
- return jTextFieldFarFile;
- }
-
- /**
- * This method initializes jButtonBrowser
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowser() {
- if (jButtonBrowser == null) {
- jButtonBrowser = new JButton();
- jButtonBrowser.setBounds(new java.awt.Rectangle(570, 80, 100, 20));
- jButtonBrowser.setText("Browser...");
- jButtonBrowser.addMouseListener(this);
- }
- return jButtonBrowser;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 165, 642, 140));
- jScrollPane.setViewportView(getJTable());
- }
- jScrollPane.setVisible(false);
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new PartialTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- model.addColumn("Name");
- model.addColumn("Version");
- model.addColumn("GUID");
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- }
- jTable.setVisible(false);
- return jTable;
- }
-
- public void prepareTable(List<PackageIdentification> packageList) {
- model.setRowCount(0);
- //
- // Change here to get packages and platforms from FAR
- //
- Iterator<PackageIdentification> iter = packageList.iterator();
- while (iter.hasNext()) {
- String[] str = new String[3];
- PackageIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = item.getGuid();
- model.addRow(str);
- }
- }
-
- /**
- * This is the default constructor
- */
- public InstallStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.INSTALL_STEP_ONE_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelWarning = new JLabel();
- jLabelWarning.setBounds(new java.awt.Rectangle(30, 125, 510, 20));
- jLabelWarning.setText("Cannot install this FAR, the WORKSPACE is missing the following required packages.");
- jLabelWarning.setVisible(false);
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 80, 97, 20));
- jLabel.setText("Choose FAR file: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJTextFieldFarFile(), null);
- jContentPane.add(getJButtonBrowser(), null);
- jContentPane.add(jLabelWarning, null);
- jContentPane.add(getJScrollPane(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
- File farFile = new File(jTextFieldFarFile.getText());
- if (!farFile.exists() || !farFile.isFile()) {
- Log.wrn("Install far", "Please choose an existing FAR file.");
- return;
- }
-
- //
- // Verify Far
- //
- JarFile jarFar;
- try {
- jarFar = new JarFile(farFile);
- far = new Far(jarFar);
-
- //
- // Far dependency check
- //
- List<PackageIdentification> pkgIdList = DistributeRule.installFarCheck(far);
-
- if (pkgIdList.size() > 0) {
- prepareTable(pkgIdList);
- jLabelWarning.setVisible(true);
- jTable.setVisible(true);
- jScrollPane.setVisible(true);
- return;
- }
-
- } catch (Exception exp) {
- Log.wrn("Install far" + exp.getMessage());
- Log.err("Install far" + exp.getMessage());
- }
-
- if (stepTwo == null) {
- stepTwo = new InstallStepTwo(this, true, this);
- }
- this.setVisible(false);
-
- //
- // Refresh table
- //
- stepTwo.preparePackageTable();
- stepTwo.preparePlatformTable();
- stepTwo.setVisible(true);
- } else if (e.getSource() == jButtonBrowser) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(DataType.FAR_SURFACE_AREA_EXT));
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
-
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- jLabelWarning.setVisible(false);
- jTable.setVisible(false);
- jScrollPane.setVisible(false);
- this.jTextFieldFarFile.setText(Tools.addPathExt(fc.getSelectedFile().getPath(),
- DataType.RETURN_TYPE_FAR_SURFACE_AREA));
- }
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public Far getFar() {
- return far;
- }
-
-}
-
-class PartialTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- switch (col) {
- default:
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java
deleted file mode 100644
index 68d286cdf5..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java
+++ /dev/null
@@ -1,483 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far.installui;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.ListSelectionModel;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.JTable;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class InstallStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 4583090421587036969L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private PartialEditableTableModel packageModel = null;
-
- private PartialEditableTableModel platformModel = null;
-
- private InstallStepOne stepOne = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private JLabel jLabel = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTable jTablePackage = null;
-
- private JLabel jLabel1 = null;
-
- private JScrollPane jScrollPane1 = null;
-
- private JTable jTablePlatform = null;
-
- List<PlatformIdentification> platformVector = null;
-
- List<PackageIdentification> packageVector = null;
-
- public InstallStepTwo(IDialog iDialog, boolean modal, InstallStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 2: Set Install Path for Packages and/or Platforms.\n");
- jTextArea.setCaretColor(Color.RED);
- jTextArea.append("Note that the Install Path is Relative to WORKSPACE. ");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 80, 642, 110));
- jScrollPane.setViewportView(getJTablePackage());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePackage() {
- if (jTablePackage == null) {
- jTablePackage = new JTable();
- packageModel = new PartialEditableTableModel();
- jTablePackage = new JTable(packageModel);
- jTablePackage.setRowHeight(20);
- jTablePackage.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- packageModel.addColumn("Name");
- packageModel.addColumn("Version");
- packageModel.addColumn("Default Path");
- packageModel.addColumn("Install To");
-
- jTablePackage.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- }
- return jTablePackage;
- }
-
- public void preparePackageTable() {
- packageModel.setRowCount(0);
- //
- // Change here to get packages and platforms from FAR
- //
- try {
- Far far = stepOne.getFar();
-
- packageVector = far.manifest.getPackageList();
- Iterator<PackageIdentification> iter = packageVector.iterator();
- while (iter.hasNext()) {
- String[] str = new String[4];
- PackageIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- str[3] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- packageModel.addRow(str);
- }
- } catch (Exception e) {
- }
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane1() {
- if (jScrollPane1 == null) {
- jScrollPane1 = new JScrollPane();
- jScrollPane1.setBounds(new java.awt.Rectangle(30, 215, 642, 110));
- jScrollPane1.setViewportView(getJTablePlatform());
- }
- return jScrollPane1;
- }
-
- /**
- * This method initializes jTablePlatform
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePlatform() {
- if (jTablePlatform == null) {
- jTablePlatform = new JTable();
- platformModel = new PartialEditableTableModel();
- jTablePlatform = new JTable(platformModel);
- jTablePlatform.setRowHeight(20);
- jTablePlatform.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- platformModel.addColumn("Name");
- platformModel.addColumn("Version");
- platformModel.addColumn("Default Path");
- platformModel.addColumn("Install To");
-
- jTablePlatform.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- preparePlatformTable();
- }
- return jTablePlatform;
- }
-
- public void preparePlatformTable() {
- platformModel.setRowCount(0);
- //
- // Change here to get packages and platforms from FAR
- //
- try {
- Far far = stepOne.getFar();
-
- platformVector = far.manifest.getPlatformList();
- Iterator<PlatformIdentification> iter = platformVector.iterator();
- while (iter.hasNext()) {
- String[] str = new String[4];
- PlatformIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- str[3] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- platformModel.addRow(str);
- }
- } catch (Exception e) {
- }
- }
-
- /**
- * This is the default constructor
- */
- public InstallStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.INSTALL_STEP_TWO_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 195, 348, 18));
- jLabel1.setText("Edit \"Install To\" paths for platforms: ");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(29, 60, 366, 20));
- jLabel.setText("Edit \"Install To\" paths for packages");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJScrollPane1(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonFinish) {
-
- if (jTablePackage.isEditing()) {
- jTablePackage.getCellEditor().stopCellEditing();
- }
-
- if (jTablePlatform.isEditing()) {
- jTablePlatform.getCellEditor().stopCellEditing();
- }
-
- List<String> packageList = new ArrayList<String>();
- List<String> platformList = new ArrayList<String>();
- //
- // Add some logic process here
- // Guid Check, File Check etc.
- //
- Set<File> allNewPath = new LinkedHashSet<File>();
- Map<PackageIdentification, File> packageMap = new LinkedHashMap<PackageIdentification, File>();
- for (int i = 0; i < packageModel.getRowCount(); i++) {
- File toFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar
- + packageModel.getValueAt(i, 3));
- if (!isPackagePathValid(toFile)) {
- Log.wrn("Install far", packageVector.get(i) + " path already contains a package.");
- return;
- }
- if (allNewPath.contains(toFile)) {
- Log.wrn("Install far", "Path " + packageModel.getValueAt(i, 3) + " is specified twice.");
- return;
- }
- allNewPath.add(toFile);
- File spdFile = new File((String) packageModel.getValueAt(i, 3) + File.separatorChar
- + packageVector.get(i).getSpdFile().getName());
- packageList.add(spdFile.getPath());
- packageMap.put(packageVector.get(i), toFile);
- }
-
- Map<PlatformIdentification, File> platformMap = new LinkedHashMap<PlatformIdentification, File>();
- for (int i = 0; i < platformModel.getRowCount(); i++) {
- File toFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar
- + platformModel.getValueAt(i, 3));
- if (!isPlatformPathValid(toFile)) {
- Log.wrn("Install far", platformVector.get(i) + " path already contains a platform.");
- return;
- }
- File fpdFile = new File((String) platformModel.getValueAt(i, 3) + File.separatorChar
- + platformVector.get(i).getFpdFile().getName());
- platformList.add(fpdFile.getPath());
- platformMap.put(platformVector.get(i), toFile);
- }
-
- //
- //
- //
- Far far = stepOne.getFar();
- try {
- far.InstallFar(platformMap, packageMap);
- //
- // Add to database
- //
- WorkspaceTools wt = new WorkspaceTools();
- wt.addFarToDb(packageList, platformList, far.manifest.getHeader());
- } catch (Exception ex) {
- Log.wrn("Install far", ex.getMessage());
- Log.err("Install far", ex.getMessage());
- return;
- }
-
- this.setVisible(false);
- this.stepOne.returnType = DataType.RETURN_TYPE_OK;
- this.dispose();
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- }
- }
-
- private boolean isPackagePathValid(File spdFile) {
- WorkspaceTools wt = new WorkspaceTools();
- List<PackageIdentification> allPackages = wt.getAllPackages();
- Iterator<PackageIdentification> iter = allPackages.iterator();
-
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (isPathContainMutual(spdFile, item.getSpdFile())) {
- return false;
- }
- }
- return true;
- }
-
- private boolean isPlatformPathValid(File fpdFile) {
- WorkspaceTools wt = new WorkspaceTools();
- List<PlatformIdentification> allPlatforms = wt.getAllPlatforms();
- Iterator<PlatformIdentification> iter = allPlatforms.iterator();
-
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- if (isPathContainMutual(fpdFile, item.getFpdFile())) {
- return false;
- }
- }
- return true;
- }
-
- private boolean isPathContainMutual(File path1, File path2) {
- String s1 = Tools.addFileSeparator(path1.getPath());
- String s2 = Tools.addFileSeparator(path2.getParent());
-
- if (s1.length() > s2.length()) {
- if (s1.substring(0, s2.length()).equalsIgnoreCase(s2)) {
- return true;
- }
- } else {
- if (s2.substring(0, s1.length()).equalsIgnoreCase(s1)) {
- return true;
- }
- }
- return false;
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
-}
-
-class PartialEditableTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- switch (col) {
- case 3:
- return true;
- default:
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java
deleted file mode 100644
index 5ae496672a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far.updateui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.Vector;
-import java.util.jar.JarFile;
-
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-import javax.swing.JScrollPane;
-import javax.swing.JList;
-
-public class UpdateStepOne extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 735554907464539931L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextFieldFarFile = null;
-
- private JButton jButtonBrowser = null;
-
- private UpdateStepTwo stepTwo = null;
-
- private Far far = null;
-
- private Vector<FarIdentification> farVector = null;
-
- private JLabel jLabel1 = null;
-
- private JScrollPane jScrollPane = null;
-
- private JList jListFarFromDb = null;
-
- private File farFile = null;
-
- public File getFarFile() {
- return farFile;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 1: Choose framework archive (FAR) file. \n");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFarFile() {
- if (jTextFieldFarFile == null) {
- jTextFieldFarFile = new JTextField();
- jTextFieldFarFile.setBounds(new java.awt.Rectangle(130, 80, 436, 20));
- }
- return jTextFieldFarFile;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowser() {
- if (jButtonBrowser == null) {
- jButtonBrowser = new JButton();
- jButtonBrowser.setBounds(new java.awt.Rectangle(570, 80, 100, 20));
- jButtonBrowser.setText("Browser...");
- jButtonBrowser.addMouseListener(this);
- }
- return jButtonBrowser;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 135, 642, 160));
- jScrollPane.setViewportView(getJListFarFromDb());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jListFarFromDb
- *
- * @return javax.swing.JList
- */
- private JList getJListFarFromDb() {
- if (jListFarFromDb == null) {
- jListFarFromDb = new JList();
- WorkspaceTools wt = new WorkspaceTools();
- farVector = wt.getAllFars();
- jListFarFromDb.setListData(farVector);
- jListFarFromDb.setSelectionMode(0);
- }
- return jListFarFromDb;
- }
-
- /**
- * This is the default constructor
- */
- public UpdateStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.UPDATE_STEP_ONE_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 110, 355, 18));
- jLabel1.setText("Choose FAR from current WORKSPACE.");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 80, 97, 20));
- jLabel.setText("Choose FAR file: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJTextFieldFarFile(), null);
- jContentPane.add(getJButtonBrowser(), null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJScrollPane(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Judge if FAR file is existed
- //
- farFile = new File(jTextFieldFarFile.getText());
- if (!farFile.exists() || !farFile.isFile()) {
- Log.wrn("Update far", "Please choose a FAR file that already exists.");
- return;
- }
-
- //
- // Judge FAR is valid
- //
- try {
- JarFile file = new JarFile(farFile);
- this.far = new Far(file);
- } catch (Exception ex) {
- Log.wrn("Update far", ex.getMessage());
- Log.err("Update far", ex.getMessage());
- }
-
- //
- // Add more logic process here
- //
- if (jListFarFromDb.getSelectedValue() == null) {
- Log.wrn("Update far", "Please choose a FAR from current WORKSPACE.");
- return;
- }
-
- if (stepTwo == null) {
- stepTwo = new UpdateStepTwo(this, true, this);
- }
- this.setVisible(false);
- stepTwo.prepareTable();
- stepTwo.setVisible(true);
- } else if (e.getSource() == jButtonBrowser) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(DataType.FAR_SURFACE_AREA_EXT));
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
-
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldFarFile.setText(Tools.addPathExt(fc.getSelectedFile().getPath(),
- DataType.RETURN_TYPE_FAR_SURFACE_AREA));
- }
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public FarIdentification getSelecedDbFar() {
- return (FarIdentification) jListFarFromDb.getSelectedValue();
- }
-
- public Far getFar() {
- return far;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java
deleted file mode 100644
index 6785803453..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.far.updateui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JScrollPane;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.table.DefaultTableModel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.AggregationOperation;
-import org.tianocore.frameworkwizard.far.DistributeRule;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class UpdateStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -4400145363721213110L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private UpdateStepOne stepOne = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabel = null;
-
- private JTable jTablePackage = null;
-
- private PartialTableModel model = null;
-
- List<PackageIdentification> updatPkgList = new ArrayList<PackageIdentification>();
-
- public UpdateStepTwo(IDialog iDialog, boolean modal, UpdateStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 2: Summary. \n");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 100, 642, 170));
- jScrollPane.setViewportView(getJTablePackage());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTablePackage
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePackage() {
- if (jTablePackage == null) {
- jTablePackage = new JTable();
- model = new PartialTableModel();
- jTablePackage = new JTable(model);
- jTablePackage.setRowHeight(20);
- jTablePackage.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- model.addColumn("Name");
- model.addColumn("Version");
- model.addColumn("Guid");
- model.addColumn("Path");
-
- jTablePackage.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- }
- return jTablePackage;
- }
-
- public void prepareTable() {
- model.setRowCount(0);
- try {
- Far far = stepOne.getFar();
- List<PackageIdentification> packagesInFar = far.manifest.getPackageList();
-
- WorkspaceTools wt = new WorkspaceTools();
- List<PackageIdentification> packagesInDb = wt.getAllPackages();
-
- updatPkgList = AggregationOperation.intersection(packagesInDb, packagesInFar);
- //
- // Change here to get packages and platforms from FAR
- //
- Iterator<PackageIdentification> iter = updatPkgList.iterator();//packageList.iterator();
- while (iter.hasNext()) {
- String[] str = new String[4];
- PackageIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = item.getGuid();
- str[3] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- model.addRow(str);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- /**
- * This is the default constructor
- */
- public UpdateStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.UPDATE_STEP_TWO_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 70, 281, 20));
- jLabel.setText("Following packages will be updated: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel, null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonFinish) {
- //
- // Check depedency ?
- //
- WorkspaceTools wsTools = new WorkspaceTools();
-
- Iterator<PackageIdentification> iter = updatPkgList.iterator();
- List<PackageIdentification> depResultList = new ArrayList<PackageIdentification>();
- while (iter.hasNext()) {
- List<PackageIdentification> depPkgList = stepOne.getFar().getPackageDependencies(iter.next());
- depResultList = AggregationOperation.union(depResultList, depPkgList);
- }
-
- List<PackageIdentification> dbPkgList = DistributeRule.vectorToList(wsTools.getAllPackages());
- List<PackageIdentification> resultList = AggregationOperation
- .minus(
- depResultList,
- AggregationOperation
- .union(
- this.updatPkgList,
- dbPkgList));
- Iterator resultIter = resultList.iterator();
- while (resultIter.hasNext()) {
- Log.wrn("Update far", "Missing dependency package " + ((PackageIdentification) resultIter.next()).toString()
- + " in workspace!");
- return;
- }
-
- //
- // Remove all update packages
- //
- //
- // For all packages, remove all files.
- // Exception FPD file still in DB
- //
- Vector<PlatformIdentification> allPlatforms = wsTools.getAllPlatforms();
- Set<File> allPlatformFiles = new LinkedHashSet<File>();
-
- Iterator<PlatformIdentification> allPlfIter = allPlatforms.iterator();
- while (iter.hasNext()) {
- allPlatformFiles.add(allPlfIter.next().getFpdFile());
- }
-
- Iterator<PackageIdentification> packageIter = this.updatPkgList.iterator();
- while (packageIter.hasNext()) {
- PackageIdentification item = packageIter.next();
- Set<File> deleteFiles = new LinkedHashSet<File>();
- recursiveDir(deleteFiles, item.getSpdFile().getParentFile(), allPlatformFiles);
- Iterator<File> iterDeleteFile = deleteFiles.iterator();
- while (iterDeleteFile.hasNext()) {
- deleteFiles(iterDeleteFile.next());
- }
- //
- // Remove all empty parent dir
- //
- File parentDir = item.getSpdFile().getParentFile();
- while (parentDir.listFiles().length == 0) {
- File tempFile = parentDir;
- parentDir = parentDir.getParentFile();
- tempFile.delete();
- }
- }
-
- //
- // Install all update packages
- //
- Iterator<PackageIdentification> updataIter = this.updatPkgList.iterator();
- while (updataIter.hasNext()) {
- PackageIdentification pkgId = updataIter.next();
- try {
- stepOne.getFar().installPackage(pkgId, new File(pkgId.getSpdFile().getParent()));
- } catch (Exception ex) {
- Log.wrn("Install " + pkgId.toString(), ex.getMessage());
- Log.err("Install " + pkgId.toString(), ex.getMessage());
- }
-
- }
- this.stepOne.returnType = DataType.RETURN_TYPE_OK;
-
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- private void recursiveDir(Set<File> files, File dir, Set<File> platformFiles) {
- File[] fileList = dir.listFiles();
- for (int i = 0; i < fileList.length; i++) {
- if (fileList[i].isFile()) {
- if (!platformFiles.contains(fileList[i])) {
- files.add(fileList[i]);
- }
- } else {
- if (isContain(fileList[i], platformFiles)) {
- recursiveDir(files, fileList[i], platformFiles);
- } else {
- files.add(fileList[i]);
- }
- }
- }
- }
-
- private void deleteFiles(File file) {
- if (file.isDirectory()) {
- File[] files = file.listFiles();
- for (int i = 0; i < files.length; i++) {
- deleteFiles(files[i]);
- }
- }
- file.delete();
- }
-
- private boolean isContain(File dir, Set<File> platformFiles) {
- Iterator<File> iter = platformFiles.iterator();
- while (iter.hasNext()) {
- File file = iter.next();
- if (file.getPath().startsWith(dir.getPath())) {
- //
- // continue this FPD file
- //
- return true;
- }
- }
- return false;
- }
-}
-
-class PartialTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- switch (col) {
- case 3:
- return false;
- default:
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesIdentification.java
deleted file mode 100644
index 3a81248926..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesIdentification.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file
-
- The file is used to define Boot Modes Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.BootModes;
-
-import java.util.Vector;
-
-public class BootModesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public BootModesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(BootModesIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java
deleted file mode 100644
index 4c0840370f..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
-
- The file is used to define Boot Modes Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.BootModes;
-
-import java.util.Vector;
-
-public class BootModesVector {
-
- private Vector<BootModesIdentification> vBootModes = new Vector<BootModesIdentification>();
-
- public int findBootModes(BootModesIdentification sfi) {
- for (int index = 0; index < vBootModes.size(); index++) {
- if (vBootModes.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findBootModes(String name) {
- for (int index = 0; index < vBootModes.size(); index++) {
- if (vBootModes.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public BootModesIdentification getBootModes(int index) {
- if (index > -1) {
- return vBootModes.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addBootModes(BootModesIdentification arg0) {
- vBootModes.addElement(arg0);
- }
-
- public void setBootModes(BootModesIdentification arg0, int arg1) {
- vBootModes.setElementAt(arg0, arg1);
- }
-
- public void removeBootModes(BootModesIdentification arg0) {
- int index = findBootModes(arg0);
- if (index > -1) {
- vBootModes.removeElementAt(index);
- }
- }
-
- public void removeBootModes(int index) {
- if (index > -1 && index < this.size()) {
- vBootModes.removeElementAt(index);
- }
- }
-
- public Vector<BootModesIdentification> getvBootModes() {
- return vBootModes;
- }
-
- public void setvBootModes(Vector<BootModesIdentification> BootModes) {
- vBootModes = BootModes;
- }
-
- public Vector<String> getBootModesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vBootModes.size(); index++) {
- v.addElement(vBootModes.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vBootModes.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getBootModes(index).getName());
- v.addElement(getBootModes(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsIdentification.java
deleted file mode 100644
index 7074d3c7e0..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsIdentification.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/** @file
-
- The file is used to define Build Options Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.BuildOptions;
-
-import java.util.Vector;
-
-public class BuildOptionsIdentification {
-
- //
- // Define class members
- //
- private String option = null;
-
- private Vector<String> buildTargets = null;
-
- private String toolChainFamily = null;
-
- private String tagName = null;
-
- private String toolCode = null;
-
- private Vector<String> supArchList = null;
-
- public BuildOptionsIdentification(String arg0, Vector<String> arg1, String arg2, String arg3, String arg4, Vector<String> arg5) {
- this.option = (arg0 == null ? "" : arg0);
- this.buildTargets = arg1;
- this.toolChainFamily = (arg2 == null ? "" : arg2);
- this.tagName = (arg3 == null ? "" : arg3);
- this.toolCode = (arg4 == null ? "" : arg4);
- this.supArchList = arg5;
- }
-
- public String getOption() {
- return option;
- }
-
- public void setOption(String option) {
- this.option = option;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public String getTagName() {
- return tagName;
- }
-
- public void setTagName(String tagName) {
- this.tagName = tagName;
- }
-
- public String getToolChainFamily() {
- return toolChainFamily;
- }
-
- public void setToolChainFamily(String toolChainFamily) {
- this.toolChainFamily = toolChainFamily;
- }
-
- public String getToolCode() {
- return toolCode;
- }
-
- public void setToolCode(String toolCode) {
- this.toolCode = toolCode;
- }
-
- public Vector<String> getBuildTargets() {
- return buildTargets;
- }
-
- public void setBuildTargets(Vector<String> buildTargets) {
- this.buildTargets = buildTargets;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsVector.java
deleted file mode 100644
index dcd1bff392..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsVector.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/** @file
-
- The file is used to define Build Options Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.BuildOptions;
-
-import java.util.Vector;
-
-public class BuildOptionsVector {
-
- private Vector<BuildOptionsIdentification> vBuildOptions = new Vector<BuildOptionsIdentification>();
-
- public int findBuildOptions(BuildOptionsIdentification sfi) {
- for (int index = 0; index < vBuildOptions.size(); index++) {
- if (vBuildOptions.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findBuildOptions(String name) {
- for (int index = 0; index < vBuildOptions.size(); index++) {
- if (vBuildOptions.elementAt(index).getOption().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public BuildOptionsIdentification getBuildOptions(int index) {
- if (index > -1) {
- return vBuildOptions.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addBuildOptions(BuildOptionsIdentification arg0) {
- vBuildOptions.addElement(arg0);
- }
-
- public void setBuildOptions(BuildOptionsIdentification arg0, int arg1) {
- vBuildOptions.setElementAt(arg0, arg1);
- }
-
- public void removeBuildOptions(BuildOptionsIdentification arg0) {
- int index = findBuildOptions(arg0);
- if (index > -1) {
- vBuildOptions.removeElementAt(index);
- }
- }
-
- public void removeBuildOptions(int index) {
- if (index > -1 && index < this.size()) {
- vBuildOptions.removeElementAt(index);
- }
- }
-
- public Vector<BuildOptionsIdentification> getvBuildOptions() {
- return vBuildOptions;
- }
-
- public void setvBuildOptions(Vector<BuildOptionsIdentification> BuildOptions) {
- vBuildOptions = BuildOptions;
- }
-
- public Vector<String> getBuildOptionsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vBuildOptions.size(); index++) {
- v.addElement(vBuildOptions.get(index).getOption());
- }
- return v;
- }
-
- public int size() {
- return this.vBuildOptions.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getBuildOptions(index).getOption());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsIdentification.java
deleted file mode 100644
index 2b5b362acb..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsIdentification.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.DataHubs;
-
-import java.util.Vector;
-
-public class DataHubsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public DataHubsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(DataHubsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java
deleted file mode 100644
index 7405342c74..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.DataHubs;
-
-import java.util.Vector;
-
-public class DataHubsVector {
-
- private Vector<DataHubsIdentification> vDataHubs = new Vector<DataHubsIdentification>();
-
- public int findDataHubs(DataHubsIdentification sfi) {
- for (int index = 0; index < vDataHubs.size(); index++) {
- if (vDataHubs.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findDataHubs(String name) {
- for (int index = 0; index < vDataHubs.size(); index++) {
- if (vDataHubs.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public DataHubsIdentification getDataHubs(int index) {
- if (index > -1) {
- return vDataHubs.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addDataHubs(DataHubsIdentification arg0) {
- vDataHubs.addElement(arg0);
- }
-
- public void setDataHubs(DataHubsIdentification arg0, int arg1) {
- vDataHubs.setElementAt(arg0, arg1);
- }
-
- public void removeDataHubs(DataHubsIdentification arg0) {
- int index = findDataHubs(arg0);
- if (index > -1) {
- vDataHubs.removeElementAt(index);
- }
- }
-
- public void removeDataHubs(int index) {
- if (index > -1 && index < this.size()) {
- vDataHubs.removeElementAt(index);
- }
- }
-
- public Vector<DataHubsIdentification> getvDataHubs() {
- return vDataHubs;
- }
-
- public void setvDataHubs(Vector<DataHubsIdentification> DataHubs) {
- vDataHubs = DataHubs;
- }
-
- public Vector<String> getDataHubsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vDataHubs.size(); index++) {
- v.addElement(vDataHubs.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vDataHubs.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getDataHubs(index).getName());
- v.addElement(getDataHubs(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java
deleted file mode 100644
index bbb22e594a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Events;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.common.DataType;
-
-public class EventsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String type = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- private String group = null;
-
- public EventsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5, String arg6) {
- this.name = (arg0 == null ? "" : arg0);
- this.name = (this.name == DataType.EMPTY_SELECT_ITEM ? "" : this.name);
- this.type = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- this.group = (arg6 == null ? "" : arg6);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(EventsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public String getGroup() {
- return group;
- }
-
- public void setGroup(String group) {
- this.group = group;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java
deleted file mode 100644
index f64e184aa3..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Events;
-
-import java.util.Vector;
-
-public class EventsVector {
-
- private Vector<EventsIdentification> vEvents = new Vector<EventsIdentification>();
-
- public int findEvents(EventsIdentification sfi) {
- for (int index = 0; index < vEvents.size(); index++) {
- if (vEvents.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findEvents(String name) {
- for (int index = 0; index < vEvents.size(); index++) {
- if (vEvents.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public EventsIdentification getEvents(int index) {
- if (index > -1) {
- return vEvents.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addEvents(EventsIdentification arg0) {
- vEvents.addElement(arg0);
- }
-
- public void setEvents(EventsIdentification arg0, int arg1) {
- vEvents.setElementAt(arg0, arg1);
- }
-
- public void removeEvents(EventsIdentification arg0) {
- int index = findEvents(arg0);
- if (index > -1) {
- vEvents.removeElementAt(index);
- }
- }
-
- public void removeEvents(int index) {
- if (index > -1 && index < this.size()) {
- vEvents.removeElementAt(index);
- }
- }
-
- public Vector<EventsIdentification> getvEvents() {
- return vEvents;
- }
-
- public void setvEvents(Vector<EventsIdentification> Events) {
- vEvents = Events;
- }
-
- public Vector<String> getEventsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vEvents.size(); index++) {
- v.addElement(vEvents.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vEvents.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getEvents(index).getName());
- v.addElement(getEvents(index).getType());
- v.addElement(getEvents(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsIdentification.java
deleted file mode 100644
index 31979ceb88..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsIdentification.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Externs;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.common.EnumerationData;
-
-public class ExternsIdentification {
-
- //
- // Define class members
- //
- private String name0 = null;
-
- private String name1 = null;
-
- private String name2 = null;
-
- private String name3 = null;
-
- private String type = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- public ExternsIdentification(String arg0, String arg1) {
- this.name0 = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- }
-
- public ExternsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4) {
- this.name0 = (arg0 == null ? "" : arg0);
- this.name1 = (arg1 == null ? "" : arg1);
- this.type = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- }
-
- public ExternsIdentification(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
- Vector<String> arg6) {
- this.name0 = (arg0 == null ? "" : arg0);
- this.name1 = (arg1 == null ? "" : arg1);
- this.name2 = (arg2 == null ? "" : arg2);
- this.name3 = (arg3 == null ? "" : arg3);
- this.type = (arg4 == null ? "" : arg4);
- this.featureFlag = (arg5 == null ? "" : arg5);
- this.supArchList = arg6;
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(ExternsIdentification pi) {
- if (this.type.equals(pi.type)) {
- if (this.type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- if (this.name0.equals(pi.name0)) {
- return true;
- }
- }
- if (this.type.equals(EnumerationData.EXTERNS_IMAGE)) {
- if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
- return true;
- }
- }
- if (this.type.equals(EnumerationData.EXTERNS_LIBRARY)) {
- if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
- return true;
- }
- }
- if (this.type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
- if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
- return true;
- }
- }
- if (this.type.equals(EnumerationData.EXTERNS_DRIVER)) {
- if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1) && this.name2.equals(pi.name2) && this.name3.equals(pi.name3)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getName0() {
- return name0;
- }
-
- public void setName0(String name0) {
- this.name0 = name0;
- }
-
- public String getName1() {
- return name1;
- }
-
- public void setName1(String name1) {
- this.name1 = name1;
- }
-
- public String getName2() {
- return name2;
- }
-
- public void setName2(String name2) {
- this.name2 = name2;
- }
-
- public String getName3() {
- return name3;
- }
-
- public void setName3(String name3) {
- this.name3 = name3;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java
deleted file mode 100644
index dbc2035fa9..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Externs;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-
-public class ExternsVector {
-
- private Vector<ExternsIdentification> vExterns = new Vector<ExternsIdentification>();
-
- public int findExterns(ExternsIdentification sfi) {
- for (int index = 0; index < vExterns.size(); index++) {
- if (vExterns.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public ExternsIdentification getExterns(int index) {
- if (index > -1) {
- return vExterns.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addExterns(ExternsIdentification arg0) {
- vExterns.addElement(arg0);
- }
-
- public void setExterns(ExternsIdentification arg0, int arg1) {
- vExterns.setElementAt(arg0, arg1);
- }
-
- public void removeExterns(ExternsIdentification arg0) {
- int index = findExterns(arg0);
- if (index > -1) {
- vExterns.removeElementAt(index);
- }
- }
-
- public void removeExterns(int index) {
- if (index > -1 && index < this.size()) {
- vExterns.removeElementAt(index);
- }
- }
-
- public Vector<ExternsIdentification> getvExterns() {
- return vExterns;
- }
-
- public void setvExterns(Vector<ExternsIdentification> Externs) {
- vExterns = Externs;
- }
-
- public int size() {
- return this.vExterns.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
-
- //
- // For Specification
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- v.addElement(getExterns(index).getType());
- v.addElement(getExterns(index).getType() + " Name");
- v.addElement(getExterns(index).getName0());
- return v;
- }
-
- //
- // For Image
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
- v.addElement(getExterns(index).getType());
- String name = "";
- String value = "";
-
- name = EnumerationData.EXTERNS_MODULE_ENTRY_POINT;
- value = this.getExterns(index).getName0();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
- + DataType.HTML_LINE_SEPARATOR;
-
- v.addElement("<html>" + name + "<html>");
- v.addElement("<html>" + value + "<html>");
- return v;
- }
-
- //
- // For Library
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
- v.addElement(getExterns(index).getType());
- String name = "";
- String value = "";
-
- name = EnumerationData.EXTERNS_CONSTRUCTOR;
- value = this.getExterns(index).getName0();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DESTRUCTOR;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
- + DataType.HTML_LINE_SEPARATOR;
-
- v.addElement("<html>" + name + "<html>");
- v.addElement("<html>" + value + "<html>");
- return v;
- }
-
- //
- // For Driver
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
- v.addElement(getExterns(index).getType());
- String name = "";
- String value = "";
-
- name = EnumerationData.EXTERNS_DRIVER_BINDING;
- value = this.getExterns(index).getName0();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_COMPONENT_NAME;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DRIVER_CONFIG;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName2();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DRIVER_DIAG;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName3()
- + DataType.HTML_LINE_SEPARATOR;
-
- v.addElement("<html>" + name + "<html>");
- v.addElement("<html>" + value + "<html>");
- return v;
- }
-
- //
- // For Call Back
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- v.addElement(getExterns(index).getType());
- String name = "";
- String value = "";
-
- name = EnumerationData.EXTERNS_VIRTUAL_ADDRESS_MAP_CALL_BACK;
- value = this.getExterns(index).getName0();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
- + DataType.HTML_LINE_SEPARATOR;
-
- v.addElement("<html>" + name + "<html>");
- v.addElement("<html>" + value + "<html>");
- return v;
- }
-
- //
- // Return a empty v
- //
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsIdentification.java
deleted file mode 100644
index 4affae9797..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsIdentification.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Guids;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class GuidsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public GuidsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(GuidsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java
deleted file mode 100644
index 6d415c3162..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Guids;
-
-import java.util.Vector;
-
-public class GuidsVector {
-
- private Vector<GuidsIdentification> vGuids = new Vector<GuidsIdentification>();
-
- public int findGuids(GuidsIdentification sfi) {
- for (int index = 0; index < vGuids.size(); index++) {
- if (vGuids.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findGuids(String name) {
- for (int index = 0; index < vGuids.size(); index++) {
- if (vGuids.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public GuidsIdentification getGuids(int index) {
- if (index > -1) {
- return vGuids.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addGuids(GuidsIdentification arg0) {
- vGuids.addElement(arg0);
- }
-
- public void setGuids(GuidsIdentification arg0, int arg1) {
- vGuids.setElementAt(arg0, arg1);
- }
-
- public void removeGuids(GuidsIdentification arg0) {
- int index = findGuids(arg0);
- if (index > -1) {
- vGuids.removeElementAt(index);
- }
- }
-
- public void removeGuids(int index) {
- if (index > -1 && index < this.size()) {
- vGuids.removeElementAt(index);
- }
- }
-
- public Vector<GuidsIdentification> getvGuids() {
- return vGuids;
- }
-
- public void setvGuids(Vector<GuidsIdentification> Guids) {
- vGuids = Guids;
- }
-
- public Vector<String> getGuidsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vGuids.size(); index++) {
- v.addElement(vGuids.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vGuids.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getGuids(index).getName());
- v.addElement(getGuids(index).getUsage());
- return v;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesIdentification.java
deleted file mode 100644
index 4935d306b0..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesIdentification.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.HiiPackages;
-
-import java.util.Vector;
-
-public class HiiPackagesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public HiiPackagesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(HiiPackagesIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java
deleted file mode 100644
index f946c0c7e3..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.HiiPackages;
-
-import java.util.Vector;
-
-public class HiiPackagesVector {
-
- private Vector<HiiPackagesIdentification> vHiiPackages = new Vector<HiiPackagesIdentification>();
-
- public int findHiiPackages(HiiPackagesIdentification sfi) {
- for (int index = 0; index < vHiiPackages.size(); index++) {
- if (vHiiPackages.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findHiiPackages(String name) {
- for (int index = 0; index < vHiiPackages.size(); index++) {
- if (vHiiPackages.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public HiiPackagesIdentification getHiiPackages(int index) {
- if (index > -1) {
- return vHiiPackages.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addHiiPackages(HiiPackagesIdentification arg0) {
- vHiiPackages.addElement(arg0);
- }
-
- public void setHiiPackages(HiiPackagesIdentification arg0, int arg1) {
- vHiiPackages.setElementAt(arg0, arg1);
- }
-
- public void removeHiiPackages(HiiPackagesIdentification arg0) {
- int index = findHiiPackages(arg0);
- if (index > -1) {
- vHiiPackages.removeElementAt(index);
- }
- }
-
- public void removeHiiPackages(int index) {
- if (index > -1 && index < this.size()) {
- vHiiPackages.removeElementAt(index);
- }
- }
-
- public Vector<HiiPackagesIdentification> getvHiiPackages() {
- return vHiiPackages;
- }
-
- public void setvHiiPackages(Vector<HiiPackagesIdentification> HiiPackages) {
- vHiiPackages = HiiPackages;
- }
-
- public Vector<String> getHiiPackagesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vHiiPackages.size(); index++) {
- v.addElement(vHiiPackages.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vHiiPackages.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getHiiPackages(index).getName());
- v.addElement(getHiiPackages(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java
deleted file mode 100644
index 7b9dadd15e..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Hobs;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.common.DataType;
-
-public class HobsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String type = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public HobsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
- this.name = (arg0 == null ? "" : arg0);
- this.name = (this.name == DataType.EMPTY_SELECT_ITEM ? "" : this.name);
- this.type = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(HobsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java
deleted file mode 100644
index 550cb0aca1..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Hobs;
-
-import java.util.Vector;
-
-public class HobsVector {
-
- private Vector<HobsIdentification> vHobs = new Vector<HobsIdentification>();
-
- public int findHobs(HobsIdentification sfi) {
- for (int index = 0; index < vHobs.size(); index++) {
- if (vHobs.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findHobs(String name) {
- for (int index = 0; index < vHobs.size(); index++) {
- if (vHobs.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public HobsIdentification getHobs(int index) {
- if (index > -1) {
- return vHobs.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addHobs(HobsIdentification arg0) {
- vHobs.addElement(arg0);
- }
-
- public void setHobs(HobsIdentification arg0, int arg1) {
- vHobs.setElementAt(arg0, arg1);
- }
-
- public void removeHobs(HobsIdentification arg0) {
- int index = findHobs(arg0);
- if (index > -1) {
- vHobs.removeElementAt(index);
- }
- }
-
- public void removeHobs(int index) {
- if (index > -1 && index < this.size()) {
- vHobs.removeElementAt(index);
- }
- }
-
- public Vector<HobsIdentification> getvHobs() {
- return vHobs;
- }
-
- public void setvHobs(Vector<HobsIdentification> Hobs) {
- vHobs = Hobs;
- }
-
- public Vector<String> getHobsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vHobs.size(); index++) {
- v.addElement(vHobs.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vHobs.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getHobs(index).getName());
- v.addElement(getHobs(index).getType());
- v.addElement(getHobs(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassIdentification.java
deleted file mode 100644
index d47fa74208..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassIdentification.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/** @file
-
- The file is used to define Library Class Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.LibraryClass;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class LibraryClassIdentification {
- private String libraryClassName = null;
-
- private String usage = null;
-
- private String recommendedInstanceVersion = null;
-
- private String recommendedInstanceGuid = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private Vector<String> supModuleList = null;
-
- private String help = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public LibraryClassIdentification() {
-
- }
-
- public LibraryClassIdentification(String strName, String strUsage, String strRecommendedInstanceVersion,
- String strRecommendedInstanceGuid, Vector<String> vSupArchList,
- String strFeatureFlag, Vector<String> vSupModuleList, String strHelp) {
- this.libraryClassName = (strName == null ? "" : strName);
- this.usage = (strUsage == null ? "" : strUsage);
- this.recommendedInstanceVersion = (strRecommendedInstanceVersion == null ? "" : strRecommendedInstanceVersion);
- this.recommendedInstanceGuid = (strRecommendedInstanceGuid == null ? "" : strRecommendedInstanceGuid);
- this.supArchList = vSupArchList;
- this.featureFlag = (strFeatureFlag == null ? "" : strFeatureFlag);
- this.supModuleList = vSupModuleList;
- this.help = (strHelp == null ? "" : strHelp);
- }
-
- public String getLibraryClassName() {
- return libraryClassName;
- }
-
- public void setLibraryClassName(String libraryClassName) {
- this.libraryClassName = libraryClassName;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getRecommendedInstanceGuid() {
- return recommendedInstanceGuid;
- }
-
- public void setRecommendedInstanceGuid(String recommendedInstanceGuid) {
- this.recommendedInstanceGuid = recommendedInstanceGuid;
- }
-
- public String getRecommendedInstanceVersion() {
- return recommendedInstanceVersion;
- }
-
- public void setRecommendedInstanceVersion(String recommendedInstanceVersion) {
- this.recommendedInstanceVersion = recommendedInstanceVersion;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(LibraryClassIdentification lib) {
- if (this.libraryClassName.equals(lib.libraryClassName) && this.usage.equals(lib.getUsage())) {
- return true;
- }
- return false;
- }
-
- public Vector<String> getSupModuleList() {
- return supModuleList;
- }
-
- public void setSupModuleList(Vector<String> supModuleList) {
- this.supModuleList = supModuleList;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
deleted file mode 100644
index 3155cf6329..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/** @file
-
- The file is used to define Library Class Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.LibraryClass;
-
-import java.util.Vector;
-
-public class LibraryClassVector {
- private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();
-
- public int findLibraryClass(LibraryClassIdentification lib) {
- for (int index = 0; index < vLibraryClass.size(); index++) {
- if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())
- && vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {
- if (vLibraryClass.elementAt(index).getBelongModule() != null && lib.getBelongModule() != null) {
- if (vLibraryClass.elementAt(index).getBelongModule().equals(lib.getBelongModule())) {
- return index;
- }
- }
- if (vLibraryClass.elementAt(index).getBelongModule() == null && lib.getBelongModule() == null) {
- return index;
- }
- }
- }
- return -1;
- }
-
- public int findLibraryClass(String name) {
- for (int index = 0; index < vLibraryClass.size(); index++) {
- if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public LibraryClassIdentification getLibraryClass(int index) {
- if (index > -1) {
- return vLibraryClass.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addLibraryClass(LibraryClassIdentification lib) {
- if (findLibraryClass(lib) == -1) {
- vLibraryClass.addElement(lib);
- }
- }
-
- public void setLibraryClass(LibraryClassIdentification lib, int index) {
- vLibraryClass.setElementAt(lib, index);
- }
-
- public void removeLibraryClass(LibraryClassIdentification lib) {
- int index = findLibraryClass(lib);
- if (index > -1) {
- vLibraryClass.removeElementAt(index);
- }
- }
-
- public void removeLibraryClass(int index) {
- if (index > -1 && index < this.size()) {
- vLibraryClass.removeElementAt(index);
- }
- }
-
- public Vector<LibraryClassIdentification> getVLibraryClass() {
- return vLibraryClass;
- }
-
- public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {
- vLibraryClass = libraryClass;
- }
-
- public Vector<String> getLibraryClassName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vLibraryClass.size(); index++) {
- v.addElement(vLibraryClass.get(index).getLibraryClassName());
- }
- return v;
- }
-
- public int size() {
- return this.vLibraryClass.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getLibraryClass(index).getLibraryClassName());
- v.addElement(getLibraryClass(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java
deleted file mode 100644
index 1302f665f7..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/** @file
-
- The file is used to save basic information of module
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications;
-
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.LibraryUsage;
-import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class ModuleIdentification extends Identification {
-
- private PackageIdentification packageId;
-
- private String moduleType;
-
- private boolean isLibrary;
-
- public ModuleIdentification(String name, String guid, String version, String path) {
- super(name, guid, version, path);
- setModuleType();
- }
-
- public ModuleIdentification(String name, String guid, String version, String path, boolean library) {
- super(name, guid, version, path);
- this.isLibrary = library;
- }
-
- public ModuleIdentification(Identification id) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- }
-
- public ModuleIdentification(Identification id, boolean library) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- this.isLibrary = library;
- }
-
- public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId) {
- super(name, guid, version, path);
- this.packageId = packageId;
- setModuleType();
- }
-
- public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId,
- String type) {
- super(name, guid, version, path);
- this.packageId = packageId;
- this.moduleType = type;
- }
-
- public ModuleIdentification(Identification id, PackageIdentification packageId) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- this.packageId = packageId;
- setModuleType();
- }
-
- public ModuleIdentification(Identification id, PackageIdentification packageId, boolean library) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- this.packageId = packageId;
- this.isLibrary = library;
- }
-
- public ModuleIdentification(Identification id, PackageIdentification packageId, String type) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- this.packageId = packageId;
- this.moduleType = type;
- }
-
- public String toString() {
- return "Module " + this.getName() + "[" + this.getGuid() + "] in package " + packageId;
- }
-
- public PackageIdentification getPackageId() {
- return packageId;
- }
-
- public void setPackageId(PackageIdentification packageId) {
- this.packageId = packageId;
- }
-
- public String getModuleType() {
- return moduleType;
- }
-
- public void setModuleType(String moduleType) {
- this.moduleType = moduleType;
- }
-
- private void setModuleType() {
- ModuleSurfaceArea msa = null;
- try {
- msa = OpenFile.openMsaFile(this.getPath());
- } catch (IOException e) {
- // TODO Auto-generated catch block
-
- } catch (XmlException e) {
- // TODO Auto-generated catch block
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
-
- }
- setModuleType(DataType.MODULE_TYPE_MODULE);
- setLibrary(false);
- if (msa != null) {
- LibraryClassDefinitions lib = msa.getLibraryClassDefinitions();
- if (lib != null) {
- for (int index = 0; index < lib.getLibraryClassList().size(); index++) {
- if (lib.getLibraryClassList().get(index).getUsage().equals(LibraryUsage.ALWAYS_PRODUCED)) {
- setModuleType(DataType.MODULE_TYPE_LIBRARY);
- setLibrary(true);
- break;
- }
- }
- }
- }
- }
-
- public boolean equals(String moduleGuid, String moduleVersion, String packageGuid, String packageVersion) {
- boolean b = false;
- if (this.getGuid().equals(moduleGuid) && this.getPackageId().getGuid().equals(packageGuid)) {
- b = true;
- //
- // Check Version
- //
- if (moduleVersion != null) {
- if (!Tools.isEmpty(moduleVersion)) {
- if (!moduleVersion.equals(this.getVersion())) {
- b = false;
- }
- }
- }
- if (packageVersion != null) {
- if (!Tools.isEmpty(packageVersion)) {
- if (!packageVersion.equals(this.getPackageId().getVersion())) {
- b = false;
- }
- }
- }
- }
- return b;
- }
-
- public boolean isLibrary() {
- return isLibrary;
- }
-
- public void setLibrary(boolean isLibrary) {
- this.isLibrary = isLibrary;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesIdentification.java
deleted file mode 100644
index 170c417371..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesIdentification.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.PackageDependencies;
-
-import java.util.Vector;
-
-public class PackageDependenciesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String version = null;
-
- private String guid = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- public PackageDependenciesIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.version = (arg1 == null ? "" : arg1);
- this.guid = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public boolean equals(PackageDependenciesIdentification pdi) {
- if (this.guid.equals(pdi.guid)) {
- return true;
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java
deleted file mode 100644
index 7661453c4f..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.PackageDependencies;
-
-import java.util.Vector;
-
-public class PackageDependenciesVector {
-
- private Vector<PackageDependenciesIdentification> vPackageDependencies = new Vector<PackageDependenciesIdentification>();
-
- public int findPackageDependencies(PackageDependenciesIdentification sfi) {
- for (int index = 0; index < vPackageDependencies.size(); index++) {
- if (vPackageDependencies.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findPackageDependencies(String name) {
- for (int index = 0; index < vPackageDependencies.size(); index++) {
- if (vPackageDependencies.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public PackageDependenciesIdentification getPackageDependencies(int index) {
- if (index > -1) {
- return vPackageDependencies.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addPackageDependencies(PackageDependenciesIdentification arg0) {
- vPackageDependencies.addElement(arg0);
- }
-
- public void setPackageDependencies(PackageDependenciesIdentification arg0, int arg1) {
- vPackageDependencies.setElementAt(arg0, arg1);
- }
-
- public void removePackageDependencies(PackageDependenciesIdentification arg0) {
- int index = findPackageDependencies(arg0);
- if (index > -1) {
- vPackageDependencies.removeElementAt(index);
- }
- }
-
- public void removePackageDependencies(int index) {
- if (index > -1 && index < this.size()) {
- vPackageDependencies.removeElementAt(index);
- }
- }
-
- public Vector<PackageDependenciesIdentification> getvPackageDependencies() {
- return vPackageDependencies;
- }
-
- public void setvPackageDependencies(Vector<PackageDependenciesIdentification> PackageDependencies) {
- vPackageDependencies = PackageDependencies;
- }
-
- public Vector<String> getPackageDependenciesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vPackageDependencies.size(); index++) {
- v.addElement(vPackageDependencies.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vPackageDependencies.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getPackageDependencies(index).getName());
- v.addElement(getPackageDependencies(index).getVersion());
- return v;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java
deleted file mode 100644
index 13ed398fa3..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.PcdCoded;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class PcdCodedIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String guid = null;
-
- private String featureFlag = null;
-
- private Vector<String> supArchList = null;
-
- private String value = null;
-
- private String help = null;
-
- private String type = null;
-
- private String usage = null;
-
- private String tokenSpaceGuidCName = null;
-
- private String token = null;
-
- private String datumType = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public PcdCodedIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4, String arg5, String arg6, String arg7) {
- this.name = (arg0 == null ? "" : arg0);
- this.guid = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.value = (arg4 == null ? "" : arg4);
- this.help = (arg5 == null ? "" : arg5);
- this.type = (arg6 == null ? "" : arg6);
- this.usage = (arg7 == null ? "" : arg7);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(PcdCodedIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public String getTokenSpaceGuidCName() {
- return tokenSpaceGuidCName;
- }
-
- public void setTokenSpaceGuidCName(String tokenSpaceGuidCName) {
- this.tokenSpaceGuidCName = tokenSpaceGuidCName;
- }
-
- public String getDatumType() {
- return datumType;
- }
-
- public void setDatumType(String datumType) {
- this.datumType = datumType;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java
deleted file mode 100644
index 7b35f1a426..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/** @file
-
- The file is used to define PcdCoded Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.PcdCoded;
-
-import java.util.Vector;
-
-public class PcdCodedVector {
-
- private Vector<PcdCodedIdentification> vPcdCoded = new Vector<PcdCodedIdentification>();
-
- public int findPcdCoded(PcdCodedIdentification sfi) {
- for (int index = 0; index < vPcdCoded.size(); index++) {
- if (vPcdCoded.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findPcdCoded(String name) {
- for (int index = 0; index < vPcdCoded.size(); index++) {
- if (vPcdCoded.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public PcdCodedIdentification getPcdCoded(int index) {
- if (index > -1) {
- return vPcdCoded.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addPcdCoded(PcdCodedIdentification arg0) {
- vPcdCoded.addElement(arg0);
- }
-
- public void setPcdCoded(PcdCodedIdentification arg0, int arg1) {
- vPcdCoded.setElementAt(arg0, arg1);
- }
-
- public void removePcdCoded(PcdCodedIdentification arg0) {
- int index = findPcdCoded(arg0);
- if (index > -1) {
- vPcdCoded.removeElementAt(index);
- }
- }
-
- public void removePcdCoded(int index) {
- if (index > -1 && index < this.size()) {
- vPcdCoded.removeElementAt(index);
- }
- }
-
- public Vector<PcdCodedIdentification> getvPcdCoded() {
- return vPcdCoded;
- }
-
- public void setvPcdCoded(Vector<PcdCodedIdentification> PcdCoded) {
- vPcdCoded = PcdCoded;
- }
-
- public Vector<String> getPcdCodedName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vPcdCoded.size(); index++) {
- v.addElement(vPcdCoded.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vPcdCoded.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getPcdCoded(index).getName());
- v.addElement(getPcdCoded(index).getType());
- v.addElement(getPcdCoded(index).getValue());
- v.addElement(getPcdCoded(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdIdentification.java
deleted file mode 100644
index 85a770662a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdIdentification.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/** @file
-
- The file is used to define Pcd Item Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.PcdCoded;
-
-import java.util.Vector;
-
-public class PcdIdentification {
- //
- // Define class members
- //
- private String name = null;
-
- private String guidCName = null;
-
- private String help = null;
-
- private Vector<String> type = null;
-
- public PcdIdentification(String arg0, String arg1, String arg2, Vector<String> arg3) {
- this.name = (arg0 == null ? "" : arg0);
- this.guidCName = (arg1 == null ? "" : arg1);
- this.help = (arg2 == null ? "" : arg2);
- this.type = arg3;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public String getGuidCName() {
- return guidCName;
- }
-
- public void setGuidCName(String guidCName) {
- this.guidCName = guidCName;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getType() {
- return type;
- }
-
- public void setType(Vector<String> type) {
- this.type = type;
- }
-
- public String toString() {
- return name;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdVector.java
deleted file mode 100644
index dd2832e778..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdVector.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
-
- The file is used to define Pcd Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.PcdCoded;
-
-import java.util.Vector;
-
-public class PcdVector {
-
- private Vector<PcdIdentification> vPcd = new Vector<PcdIdentification>();
-
- public int findPcd(PcdIdentification sfi) {
- for (int index = 0; index < vPcd.size(); index++) {
- if (vPcd.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findPcd(String name) {
- for (int index = 0; index < vPcd.size(); index++) {
- if (vPcd.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public PcdIdentification getPcd(int index) {
- if (index > -1) {
- return vPcd.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addPcd(PcdIdentification arg0) {
- vPcd.addElement(arg0);
- }
-
- public void setPcd(PcdIdentification arg0, int arg1) {
- vPcd.setElementAt(arg0, arg1);
- }
-
- public void removePcd(PcdIdentification arg0) {
- int index = findPcd(arg0);
- if (index > -1) {
- vPcd.removeElementAt(index);
- }
- }
-
- public void removePcd(int index) {
- if (index > -1 && index < this.size()) {
- vPcd.removeElementAt(index);
- }
- }
-
- public Vector<PcdIdentification> getvPcd() {
- return vPcd;
- }
-
- public void setvPcd(Vector<PcdIdentification> Pcd) {
- vPcd = Pcd;
- }
-
- public Vector<String> getPcdName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vPcd.size(); index++) {
- v.addElement(vPcd.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vPcd.size();
- }
-
- public void addAll(PcdVector v) {
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- vPcd.add(v.getPcd(index));
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisIdentification.java
deleted file mode 100644
index a871f628db..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisIdentification.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Ppis;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class PpisIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String type = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public PpisIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(PpisIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java
deleted file mode 100644
index 9c6f343ee7..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Ppis;
-
-import java.util.Vector;
-
-public class PpisVector {
-
- private Vector<PpisIdentification> vPpis = new Vector<PpisIdentification>();
-
- public int findPpis(PpisIdentification sfi) {
- for (int index = 0; index < vPpis.size(); index++) {
- if (vPpis.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findPpis(String name) {
- for (int index = 0; index < vPpis.size(); index++) {
- if (vPpis.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public PpisIdentification getPpis(int index) {
- if (index > -1) {
- return vPpis.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addPpis(PpisIdentification arg0) {
- vPpis.addElement(arg0);
- }
-
- public void setPpis(PpisIdentification arg0, int arg1) {
- vPpis.setElementAt(arg0, arg1);
- }
-
- public void removePpis(PpisIdentification arg0) {
- int index = findPpis(arg0);
- if (index > -1) {
- vPpis.removeElementAt(index);
- }
- }
-
- public void removePpis(int index) {
- if (index > -1 && index < this.size()) {
- vPpis.removeElementAt(index);
- }
- }
-
- public Vector<PpisIdentification> getvPpis() {
- return vPpis;
- }
-
- public void setvPpis(Vector<PpisIdentification> Ppis) {
- vPpis = Ppis;
- }
-
- public Vector<String> getPpisName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vPpis.size(); index++) {
- v.addElement(vPpis.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vPpis.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getPpis(index).getName());
- v.addElement(getPpis(index).getType());
- v.addElement(getPpis(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsIdentification.java
deleted file mode 100644
index 685c6d1b6e..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsIdentification.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Protocols;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class ProtocolsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String type = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public ProtocolsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(ProtocolsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java
deleted file mode 100644
index 7f09670d5a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Protocols;
-
-import java.util.Vector;
-
-public class ProtocolsVector {
-
- private Vector<ProtocolsIdentification> vProtocols = new Vector<ProtocolsIdentification>();
-
- public int findProtocols(ProtocolsIdentification sfi) {
- for (int index = 0; index < vProtocols.size(); index++) {
- if (vProtocols.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findProtocols(String name) {
- for (int index = 0; index < vProtocols.size(); index++) {
- if (vProtocols.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public ProtocolsIdentification getProtocols(int index) {
- if (index > -1) {
- return vProtocols.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addProtocols(ProtocolsIdentification arg0) {
- vProtocols.addElement(arg0);
- }
-
- public void setProtocols(ProtocolsIdentification arg0, int arg1) {
- vProtocols.setElementAt(arg0, arg1);
- }
-
- public void removeProtocols(ProtocolsIdentification arg0) {
- int index = findProtocols(arg0);
- if (index > -1) {
- vProtocols.removeElementAt(index);
- }
- }
-
- public void removeProtocols(int index) {
- if (index > -1 && index < this.size()) {
- vProtocols.removeElementAt(index);
- }
- }
-
- public Vector<ProtocolsIdentification> getvProtocols() {
- return vProtocols;
- }
-
- public void setvProtocols(Vector<ProtocolsIdentification> Protocols) {
- vProtocols = Protocols;
- }
-
- public Vector<String> getProtocolsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vProtocols.size(); index++) {
- v.addElement(vProtocols.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vProtocols.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getProtocols(index).getName());
- v.addElement(getProtocols(index).getType());
- v.addElement(getProtocols(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesIdentification.java
deleted file mode 100644
index 02a9d7faf4..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesIdentification.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/** @file
-
- The file is used to define Source Files Identification
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.SourceFiles;
-
-import java.util.Vector;
-
-public class SourceFilesIdentification {
-
- private String filename = null;
-
- private String tagName = null;
-
- private String toolCode = null;
-
- private String toolChainFamily = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- public SourceFilesIdentification(String strFilename, String strTagName, String strToolCode,
- String strToolChainFamily, String strFeatureFlag, Vector<String> arch) {
- this.filename = (strFilename == null ? "" : strFilename);
- this.tagName = (strTagName == null ? "" : strTagName);
- this.toolCode = (strToolCode == null ? "" : strToolCode);
- this.toolChainFamily = (strToolChainFamily == null ? "" : strToolChainFamily);
- this.featureFlag = (strFeatureFlag == null ? "" : strFeatureFlag);
- this.supArchList = arch;
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public String getTagName() {
- return tagName;
- }
-
- public void setTagName(String tagName) {
- this.tagName = tagName;
- }
-
- public String getToolChainFamily() {
- return toolChainFamily;
- }
-
- public void setToolChainFamily(String toolChainFamily) {
- this.toolChainFamily = toolChainFamily;
- }
-
- public String getToolCode() {
- return toolCode;
- }
-
- public void setToolCode(String toolCode) {
- this.toolCode = toolCode;
- }
-
- public boolean equals(SourceFilesIdentification sfid) {
- if (this.filename.equals(sfid.filename) && this.tagName.equals(sfid.tagName)
- && this.toolCode.equals(sfid.toolCode) && this.toolChainFamily.equals(sfid.toolChainFamily)
- && this.featureFlag.equals(sfid.featureFlag)
- && this.supArchList.toString().equals(sfid.supArchList.toString())) {
- return true;
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java
deleted file mode 100644
index 0e5cdc97a5..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/** @file
-
- The file is used to define Source Files Vector
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.SourceFiles;
-
-import java.util.Vector;
-
-public class SourceFilesVector {
- private Vector<SourceFilesIdentification> vSourceFiles = new Vector<SourceFilesIdentification>();
-
- public int findSourceFiles(SourceFilesIdentification sfi) {
- for (int index = 0; index < vSourceFiles.size(); index++) {
- if (vSourceFiles.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findSourceFiles(String name) {
- for (int index = 0; index < vSourceFiles.size(); index++) {
- if (vSourceFiles.elementAt(index).getFilename().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public SourceFilesIdentification getSourceFiles(int index) {
- if (index > -1) {
- return vSourceFiles.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addSourceFiles(SourceFilesIdentification sfi) {
- if (findSourceFiles(sfi) == -1) {
- vSourceFiles.addElement(sfi);
- }
- }
-
- public void setSourceFiles(SourceFilesIdentification sfi, int index) {
- vSourceFiles.setElementAt(sfi, index);
- }
-
- public void removeSourceFiles(SourceFilesIdentification sfi) {
- int index = findSourceFiles(sfi);
- if (index > -1) {
- vSourceFiles.removeElementAt(index);
- }
- }
-
- public void removeSourceFiles(int index) {
- if (index > -1 && index < this.size()) {
- vSourceFiles.removeElementAt(index);
- }
- }
-
- public Vector<SourceFilesIdentification> getvSourceFiles() {
- return vSourceFiles;
- }
-
- public void setvSourceFiles(Vector<SourceFilesIdentification> SourceFiles) {
- vSourceFiles = SourceFiles;
- }
-
- public Vector<String> getSourceFilesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vSourceFiles.size(); index++) {
- v.addElement(vSourceFiles.get(index).getFilename());
- }
- return v;
- }
-
- public int size() {
- return this.vSourceFiles.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getSourceFiles(index).getFilename());
- v.addElement(getSourceFiles(index).getTagName());
- v.addElement(getSourceFiles(index).getToolCode());
- v.addElement(getSourceFiles(index).getToolChainFamily());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesIdentification.java
deleted file mode 100644
index d2952c0e7e..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesIdentification.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.SystemTables;
-
-import java.util.Vector;
-
-public class SystemTablesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public SystemTablesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(SystemTablesIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java
deleted file mode 100644
index fb875acfd5..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.SystemTables;
-
-import java.util.Vector;
-
-public class SystemTablesVector {
-
- private Vector<SystemTablesIdentification> vSystemTables = new Vector<SystemTablesIdentification>();
-
- public int findSystemTables(SystemTablesIdentification sfi) {
- for (int index = 0; index < vSystemTables.size(); index++) {
- if (vSystemTables.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findSystemTables(String name) {
- for (int index = 0; index < vSystemTables.size(); index++) {
- if (vSystemTables.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public SystemTablesIdentification getSystemTables(int index) {
- if (index > -1) {
- return vSystemTables.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addSystemTables(SystemTablesIdentification arg0) {
- vSystemTables.addElement(arg0);
- }
-
- public void setSystemTables(SystemTablesIdentification arg0, int arg1) {
- vSystemTables.setElementAt(arg0, arg1);
- }
-
- public void removeSystemTables(SystemTablesIdentification arg0) {
- int index = findSystemTables(arg0);
- if (index > -1) {
- vSystemTables.removeElementAt(index);
- }
- }
-
- public void removeSystemTables(int index) {
- if (index > -1 && index < this.size()) {
- vSystemTables.removeElementAt(index);
- }
- }
-
- public Vector<SystemTablesIdentification> getvSystemTables() {
- return vSystemTables;
- }
-
- public void setvSystemTables(Vector<SystemTablesIdentification> SystemTables) {
- vSystemTables = SystemTables;
- }
-
- public Vector<String> getSystemTablesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vSystemTables.size(); index++) {
- v.addElement(vSystemTables.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vSystemTables.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getSystemTables(index).getName());
- v.addElement(getSystemTables(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesIdentification.java
deleted file mode 100644
index 24d81860a4..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesIdentification.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Variables;
-
-import java.util.Vector;
-
-public class VariablesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String guid = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public VariablesIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
- this.name = (arg0 == null ? "" : arg0);
- this.guid = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(VariablesIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java
deleted file mode 100644
index 6949eff7c3..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Variables;
-
-import java.util.Vector;
-
-public class VariablesVector {
-
- private Vector<VariablesIdentification> vVariables = new Vector<VariablesIdentification>();
-
- public int findVariables(VariablesIdentification sfi) {
- for (int index = 0; index < vVariables.size(); index++) {
- if (vVariables.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findVariables(String name) {
- for (int index = 0; index < vVariables.size(); index++) {
- if (vVariables.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public VariablesIdentification getVariables(int index) {
- if (index > -1) {
- return vVariables.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addVariables(VariablesIdentification arg0) {
- vVariables.addElement(arg0);
- }
-
- public void setVariables(VariablesIdentification arg0, int arg1) {
- vVariables.setElementAt(arg0, arg1);
- }
-
- public void removeVariables(VariablesIdentification arg0) {
- int index = findVariables(arg0);
- if (index > -1) {
- vVariables.removeElementAt(index);
- }
- }
-
- public void removeVariables(int index) {
- if (index > -1 && index < this.size()) {
- vVariables.removeElementAt(index);
- }
- }
-
- public Vector<VariablesIdentification> getvVariables() {
- return vVariables;
- }
-
- public void setvVariables(Vector<VariablesIdentification> Variables) {
- vVariables = Variables;
- }
-
- public Vector<String> getVariablesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vVariables.size(); index++) {
- v.addElement(vVariables.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vVariables.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getVariables(index).getName());
- v.addElement(getVariables(index).getGuid());
- v.addElement(getVariables(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java
deleted file mode 100644
index aee620db50..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/** @file
-
- The file is used to create, update BootModes of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.BootModeNames;
-import org.tianocore.BootModeUsage;
-import org.tianocore.BootModesDocument;
-import org.tianocore.BootModesDocument.BootModes;
-import org.tianocore.BootModesDocument.BootModes.BootMode;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.BootModesDlg;
-
-/**
- The class is used to create, update BootModes of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleBootModes extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -3888558623432442561L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- private IFrame parentFrame = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private BootModesDocument.BootModes bootModes = null;
-
- private BootModesIdentification id = null;
-
- private BootModesVector vid = new BootModesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(210, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(390, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Boot Modes");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inBootModes
-
- **/
- private void init(BootModes inBootModes) {
- init();
- this.bootModes = inBootModes;
-
- if (this.bootModes != null) {
- if (this.bootModes.getBootModeList().size() > 0) {
- for (int index = 0; index < this.bootModes.getBootModeList().size(); index++) {
- String arg0 = null;
- if (bootModes.getBootModeList().get(index).getBootModeName() != null) {
- arg0 = bootModes.getBootModeList().get(index).getBootModeName().toString();
- }
- String arg1 = null;
- if (bootModes.getBootModeList().get(index).getUsage() != null) {
- arg1 = bootModes.getBootModeList().get(index).getUsage().toString();
- }
-
- String arg2 = bootModes.getBootModeList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(bootModes.getBootModeList().get(index)
- .getSupArchList());
- String arg4 = bootModes.getBootModeList().get(index).getHelpText();
-
- id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addBootModes(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleBootModes() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inBootModes The input BootModesDocument.BootModes
-
- **/
- public ModuleBootModes(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getBootModes());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- BootModesDlg dlg = new BootModesDlg(vid.getBootModes(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addBootModes(dlg.getId());
- } else {
- this.vid.setBootModes(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Boot Modes", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeBootModes(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Mbd Header
- if exists bootModes, set the value directly
- if not exists bootModes, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.bootModes = BootModes.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- BootMode p = BootMode.Factory.newInstance();
- if (!isEmpty(vid.getBootModes(index).getName())) {
- p.setBootModeName(BootModeNames.Enum.forString(vid.getBootModes(index).getName()));
- }
- if (!isEmpty(vid.getBootModes(index).getUsage())) {
- p.setUsage(BootModeUsage.Enum.forString(vid.getBootModes(index).getUsage()));
- }
- if (!isEmpty(vid.getBootModes(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getBootModes(index).getFeatureFlag());
- }
- if (vid.getBootModes(index).getSupArchList() != null
- && vid.getBootModes(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getBootModes(index).getSupArchList());
- }
- if (!isEmpty(vid.getBootModes(index).getHelp())) {
- p.setHelpText(vid.getBootModes(index).getHelp());
- }
- this.bootModes.addNewBootMode();
- this.bootModes.setBootModeArray(bootModes.getBootModeList().size() - 1, p);
- }
- }
-
- this.msa.setBootModes(bootModes);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Boot Modes", e.getMessage());
- Log.err("Update Boot Modes", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBuildOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBuildOptions.java
deleted file mode 100644
index 993d1b9dcb..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBuildOptions.java
+++ /dev/null
@@ -1,493 +0,0 @@
-/** @file
-
- The file is used to create, update BuildOptions of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.ModuleBuildOptionsDocument;
-import org.tianocore.UserExtensionsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.OptionDocument.Option;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.BuildOptions.BuildOptionsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.BuildOptions.BuildOptionsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.BuildOptionsDlg;
-
-/**
- The class is used to create, update BuildOptions of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleBuildOptions extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -3888558623432442561L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private ModuleBuildOptionsDocument.ModuleBuildOptions mbo = null;
-
- private List<UserExtensionsDocument.UserExtensions> ue = null;
-
- private BuildOptionsIdentification id = null;
-
- private BuildOptionsVector vid = new BuildOptionsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(210, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(390, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Option String Value");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Boot Modes");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inBuildOptions
-
- **/
- private void init(ModuleBuildOptionsDocument.ModuleBuildOptions inModuleBuildOptions) {
- init();
- this.mbo = inModuleBuildOptions;
-
- if (this.mbo != null) {
- //
- // Save User Extensitions
- //
- if (this.mbo.getUserExtensionsList() != null) {
- this.ue = this.mbo.getUserExtensionsList();
- }
-
- if (this.mbo.getOptions() != null) {
- if (this.mbo.getOptions().getOptionList() != null) {
- for (int index = 0; index < this.mbo.getOptions().getOptionList().size(); index++) {
- Option o = this.mbo.getOptions().getOptionList().get(index);
- if (o != null) {
- String arg0 = o.getStringValue();
- Vector<String> arg1 = Tools.convertListToVector(o.getBuildTargets());
- String arg2 = o.getToolChainFamily();
- String arg3 = o.getTagName();
- String arg4 = o.getToolCode();
- Vector<String> arg5 = Tools.convertListToVector(o.getSupArchList());
-
- id = new BuildOptionsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addBuildOptions(id);
- }
- }
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleBuildOptions() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inBuildOptions The input BuildOptionsDocument.BuildOptions
-
- **/
- public ModuleBuildOptions(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getModuleBuildOptions());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- BuildOptionsDlg dlg = new BuildOptionsDlg(vid.getBuildOptions(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addBuildOptions(dlg.getId());
- } else {
- this.vid.setBuildOptions(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Boot Modes", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeBuildOptions(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Mbd Header
- if exists BuildOptions, set the value directly
- if not exists BuildOptions, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.mbo = ModuleBuildOptionsDocument.ModuleBuildOptions.Factory.newInstance();
- this.mbo.addNewOptions();
- //
- // Restore User Extensions Data
- //
- if (this.ue != null) {
- for (int index = 0; index < this.ue.size(); index++) {
- this.mbo.addNewUserExtensions();
- this.mbo.setUserExtensionsArray(index, ue.get(index));
- }
- }
-
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- Option o = Option.Factory.newInstance();
- if (!isEmpty(vid.getBuildOptions(index).getOption())) {
- o.setStringValue(vid.getBuildOptions(index).getOption());
- }
- if (vid.getBuildOptions(index).getBuildTargets() != null
- && vid.getBuildOptions(index).getBuildTargets().size() > 0) {
- o.setBuildTargets(vid.getBuildOptions(index).getBuildTargets());
- }
- if (!isEmpty(vid.getBuildOptions(index).getToolChainFamily())) {
- o.setToolChainFamily(vid.getBuildOptions(index).getToolChainFamily());
- }
- if (!isEmpty(vid.getBuildOptions(index).getTagName())) {
- o.setTagName(vid.getBuildOptions(index).getTagName());
- }
- if (!isEmpty(vid.getBuildOptions(index).getToolCode())) {
- o.setToolCode(vid.getBuildOptions(index).getToolCode());
- }
- if (vid.getBuildOptions(index).getSupArchList() != null
- && vid.getBuildOptions(index).getSupArchList().size() > 0) {
- o.setSupArchList(vid.getBuildOptions(index).getSupArchList());
- }
-
- this.mbo.getOptions().addNewOption();
- this.mbo.getOptions().setOptionArray(this.mbo.getOptions().getOptionList().size() - 1, o);
- }
- }
-
- this.msa.setModuleBuildOptions(this.mbo);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Module Build Options", e.getMessage());
- Log.err("Update Module Build Options", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java
deleted file mode 100644
index b2217f15cd..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/** @file
-
- The file is used to create, update DataHub of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.DataHubUsage;
-import org.tianocore.DataHubsDocument;
-import org.tianocore.DataHubsDocument.DataHubs;
-import org.tianocore.DataHubsDocument.DataHubs.DataHubRecord;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.DataHubsDlg;
-
-/**
- The class is used to create, update DataHub of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleDataHubs extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -3667906991966638892L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private DataHubsDocument.DataHubs dataHubs = null;
-
- private DataHubsIdentification id = null;
-
- private DataHubsVector vid = new DataHubsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Data Hub C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Data Hubs");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(DataHubs inDataHubs) {
- init();
- this.dataHubs = inDataHubs;
-
- if (this.dataHubs != null) {
- if (this.dataHubs.getDataHubRecordList().size() > 0) {
- for (int index = 0; index < this.dataHubs.getDataHubRecordList().size(); index++) {
- String arg0 = dataHubs.getDataHubRecordList().get(index).getDataHubCName();
- String arg1 = null;
- if (dataHubs.getDataHubRecordList().get(index).getUsage() != null) {
- arg1 = dataHubs.getDataHubRecordList().get(index).getUsage().toString();
- }
-
- String arg2 = dataHubs.getDataHubRecordList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(dataHubs.getDataHubRecordList().get(index)
- .getSupArchList());
- String arg4 = dataHubs.getDataHubRecordList().get(index).getHelpText();
-
- id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addDataHubs(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleDataHubs() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inDataHubs The input DataHubsDocument.DataHubs
-
- **/
- public ModuleDataHubs(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getDataHubs());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- DataHubsDlg dlg = new DataHubsDlg(vid.getDataHubs(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addDataHubs(dlg.getId());
- } else {
- this.vid.setDataHubs(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Data Hubs", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeDataHubs(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of DataHubs
- if exists dataHubs, set the value directly
- if not exists dataHubs, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.dataHubs = DataHubs.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- DataHubRecord p = DataHubRecord.Factory.newInstance();
- if (!isEmpty(vid.getDataHubs(index).getName())) {
- p.setDataHubCName(vid.getDataHubs(index).getName());
- }
- if (!isEmpty(vid.getDataHubs(index).getUsage())) {
- p.setUsage(DataHubUsage.Enum.forString(vid.getDataHubs(index).getUsage()));
- }
- if (!isEmpty(vid.getDataHubs(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getDataHubs(index).getFeatureFlag());
- }
- if (vid.getDataHubs(index).getSupArchList() != null
- && vid.getDataHubs(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getDataHubs(index).getSupArchList());
- }
- if (!isEmpty(vid.getDataHubs(index).getHelp())) {
- p.setHelpText(vid.getDataHubs(index).getHelp());
- }
- this.dataHubs.addNewDataHubRecord();
- this.dataHubs.setDataHubRecordArray(dataHubs.getDataHubRecordList().size() - 1, p);
- }
- }
-
- this.msa.setDataHubs(dataHubs);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Data Hubs", e.getMessage());
- Log.err("Update Data Hubs", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java
deleted file mode 100644
index 354be3ddae..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java
+++ /dev/null
@@ -1,537 +0,0 @@
-/** @file
-
- The file is used to create, update Event of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.EventTypes;
-import org.tianocore.EventsDocument;
-import org.tianocore.ProtocolNotifyUsage;
-import org.tianocore.ProtocolUsage;
-import org.tianocore.EventsDocument.Events;
-import org.tianocore.EventsDocument.Events.CreateEvents;
-import org.tianocore.EventsDocument.Events.SignalEvents;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Events.EventsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Events.EventsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.EventsDlg;
-
-/**
- The class is used to create, update Event of MSA/MBD file
- It extends IInternalFrame
-
- @since ModuleEditor 1.0
-
- **/
-public class ModuleEvents extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -4396143706422842331L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private EventsDocument.Events events = null;
-
- private EventsIdentification id = null;
-
- private EventsVector vid = new EventsVector();
-
- private EnumerationData ed = new EnumerationData();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Type");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Events");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Events inEvents) {
- init();
- this.events = inEvents;
-
- if (this.events != null) {
- if (this.events.getCreateEvents() != null) {
- if (this.events.getCreateEvents().getEventTypesList().size() > 0) {
- for (int index = 0; index < this.events.getCreateEvents().getEventTypesList().size(); index++) {
- String arg0 = events.getCreateEvents().getEventTypesList().get(index).getEventGuidCName();
- String arg1 = ed.getVEventType().get(0);
- String arg2 = null;
- if (events.getCreateEvents().getEventTypesList().get(index).getUsage() != null) {
- arg2 = events.getCreateEvents().getEventTypesList().get(index).getUsage().toString();
- }
-
- String arg3 = events.getCreateEvents().getEventTypesList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(events.getCreateEvents().getEventTypesList()
- .get(index).getSupArchList());
- String arg5 = events.getCreateEvents().getEventTypesList().get(index).getHelpText();
- String arg6 = events.getCreateEvents().getEventTypesList().get(index).getEventType().toString();
- id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- vid.addEvents(id);
- }
- }
- }
- if (this.events.getSignalEvents() != null) {
- if (this.events.getSignalEvents().getEventTypesList().size() > 0) {
- for (int index = 0; index < this.events.getSignalEvents().getEventTypesList().size(); index++) {
- String arg0 = events.getSignalEvents().getEventTypesList().get(index).getEventGuidCName();
- String arg1 = ed.getVEventType().get(1);
- String arg2 = null;
- if (events.getSignalEvents().getEventTypesList().get(index).getUsage() != null) {
- arg2 = events.getSignalEvents().getEventTypesList().get(index).getUsage().toString();
- }
-
- String arg3 = events.getSignalEvents().getEventTypesList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(events.getSignalEvents().getEventTypesList()
- .get(index).getSupArchList());
- String arg5 = events.getSignalEvents().getEventTypesList().get(index).getHelpText();
- String arg6 = events.getSignalEvents().getEventTypesList().get(index).getEventType().toString();
- id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- vid.addEvents(id);
- }
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleEvents() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inEvents The input EventsDocument.Events
-
- **/
- public ModuleEvents(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getEvents());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- EventsDlg dlg = new EventsDlg(vid.getEvents(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addEvents(dlg.getId());
- } else {
- this.vid.setEvents(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Events", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeEvents(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Events
- if exists events, set the value directly
- if not exists events, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.events = Events.Factory.newInstance();
- CreateEvents ce = CreateEvents.Factory.newInstance();
- SignalEvents se = SignalEvents.Factory.newInstance();
-
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- if (vid.getEvents(index).getType().equals(ed.getVEventType().get(0))) {
- CreateEvents.EventTypes e = CreateEvents.EventTypes.Factory.newInstance();
- if (!isEmpty(vid.getEvents(index).getName())) {
- e.setEventGuidCName(vid.getEvents(index).getName());
- }
- if (!isEmpty(vid.getEvents(index).getUsage())) {
- e.setUsage(ProtocolUsage.Enum.forString(vid.getEvents(index).getUsage()));
- }
- if (!isEmpty(vid.getEvents(index).getFeatureFlag())) {
- e.setFeatureFlag(vid.getEvents(index).getFeatureFlag());
- }
- if (vid.getEvents(index).getSupArchList() != null
- && vid.getEvents(index).getSupArchList().size() > 0) {
- e.setSupArchList(vid.getEvents(index).getSupArchList());
- }
- if (!isEmpty(vid.getEvents(index).getHelp())) {
- e.setHelpText(vid.getEvents(index).getHelp());
- }
- if (!isEmpty(vid.getEvents(index).getGroup())) {
- e.setEventType(EventTypes.Enum.forString(vid.getEvents(index).getGroup()));
- }
- ce.addNewEventTypes();
- ce.setEventTypesArray(ce.getEventTypesList().size() - 1, e);
- }
- if (vid.getEvents(index).getType().equals(ed.getVEventType().get(1))) {
- SignalEvents.EventTypes e = SignalEvents.EventTypes.Factory.newInstance();
- if (!isEmpty(vid.getEvents(index).getName())) {
- e.setEventGuidCName(vid.getEvents(index).getName());
- }
- if (!isEmpty(vid.getEvents(index).getUsage())) {
- e.setUsage(ProtocolNotifyUsage.Enum.forString(vid.getEvents(index).getUsage()));
- }
- if (!isEmpty(vid.getEvents(index).getFeatureFlag())) {
- e.setFeatureFlag(vid.getEvents(index).getFeatureFlag());
- }
- if (vid.getEvents(index).getSupArchList() != null
- && vid.getEvents(index).getSupArchList().size() > 0) {
- e.setSupArchList(vid.getEvents(index).getSupArchList());
- }
- if (!isEmpty(vid.getEvents(index).getHelp())) {
- e.setHelpText(vid.getEvents(index).getHelp());
- }
- if (!isEmpty(vid.getEvents(index).getGroup())) {
- e.setEventType(EventTypes.Enum.forString(vid.getEvents(index).getGroup()));
- }
- se.addNewEventTypes();
- se.setEventTypesArray(se.getEventTypesList().size() - 1, e);
- }
- }
- }
- if (ce.getEventTypesList().size() > 0) {
- events.addNewCreateEvents();
- events.setCreateEvents(ce);
- }
- if (se.getEventTypesList().size() > 0) {
- events.addNewSignalEvents();
- events.setSignalEvents(se);
- }
- this.msa.setEvents(events);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Events", e.getMessage());
- Log.err("Update Events", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java
deleted file mode 100644
index b1917dd033..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java
+++ /dev/null
@@ -1,655 +0,0 @@
-/** @file
-
- The file is used to create, update DataHub of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.ExternsDocument;
-import org.tianocore.ExternsDocument.Externs;
-import org.tianocore.ExternsDocument.Externs.Extern;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.ExternsDlg;
-
-/**
- The class is used to create, update DataHub of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleExterns extends IInternalFrame implements ItemListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7382008402932047191L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private ExternsDocument.Externs externs = null;
-
- private ExternsIdentification id = null;
-
- private ExternsVector vid = new ExternsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Type");
- model.addColumn("Name");
- model.addColumn("Value");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Externs");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Externs inExterns) {
- init();
- this.externs = inExterns;
-
- if (this.externs != null) {
- //
- // Get specification
- //
- if (this.externs.getSpecificationList().size() > 0) {
- for (int index = 0; index < this.externs.getSpecificationList().size(); index++) {
- String arg0 = externs.getSpecificationList().get(index);
- String arg1 = EnumerationData.EXTERNS_SPECIFICATION;
-
- id = new ExternsIdentification(arg0, arg1);
- vid.addExterns(id);
- }
- }
-
- //
- // Get Externs list
- //
- if (this.externs.getExternList().size() > 0) {
- for (int index = 0; index < this.externs.getExternList().size(); index++) {
- //
- // Get common data
- //
- String featureFlag = externs.getExternList().get(index).getFeatureFlag();
- Vector<String> arch = Tools
- .convertListToVector(externs.getExternList().get(index).getSupArchList());
-
- //
- // Get Image data
- //
- if (this.externs.getExternList().get(index).getModuleEntryPoint() != null
- || this.externs.getExternList().get(index).getModuleUnloadImage() != null) {
- String moduleEntryPoint = this.externs.getExternList().get(index).getModuleEntryPoint();
- String moduleUnloadImage = this.externs.getExternList().get(index).getModuleUnloadImage();
- String type = EnumerationData.EXTERNS_IMAGE;
- id = new ExternsIdentification(moduleEntryPoint, moduleUnloadImage, type, featureFlag, arch);
- }
-
- //
- // Get Library Data
- //
- if (this.externs.getExternList().get(index).getConstructor() != null
- || this.externs.getExternList().get(index).getDestructor() != null) {
- String constructor = this.externs.getExternList().get(index).getConstructor();
- String destructor = this.externs.getExternList().get(index).getDestructor();
- String type = EnumerationData.EXTERNS_LIBRARY;
- id = new ExternsIdentification(constructor, destructor, type, featureFlag, arch);
- }
-
- //
- // Get Driver Data
- //
- if (this.externs.getExternList().get(index).getDriverBinding() != null) {
- String driverBinding = this.externs.getExternList().get(index).getDriverBinding();
- String componentName = this.externs.getExternList().get(index).getComponentName();
- String driverConfig = this.externs.getExternList().get(index).getDriverConfig();
- String driverDiag = this.externs.getExternList().get(index).getDriverDiag();
- String type = EnumerationData.EXTERNS_DRIVER;
- id = new ExternsIdentification(driverBinding, componentName, driverConfig, driverDiag, type,
- featureFlag, arch);
- }
-
- //
- // Get Call Back Data
- //
- if (this.externs.getExternList().get(index).getSetVirtualAddressMapCallBack() != null
- || this.externs.getExternList().get(index).getExitBootServicesCallBack() != null) {
- String virtualAddressMap = this.externs.getExternList().get(index)
- .getSetVirtualAddressMapCallBack();
- String exitBootServices = this.externs.getExternList().get(index).getExitBootServicesCallBack();
- String type = EnumerationData.EXTERNS_CALL_BACK;
- id = new ExternsIdentification(virtualAddressMap, exitBootServices, type, featureFlag, arch);
- }
-
- //
- // Add id to vector
- //
- vid.addExterns(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleExterns() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inExterns The input data of ExternsDocument.Externs
-
- **/
- public ModuleExterns(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getExterns());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- ExternsDlg dlg = new ExternsDlg(vid.getExterns(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addExterns(dlg.getId());
- } else {
- this.vid.setExterns(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- int line = 1;
-
- //
- // For Specification
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- line = 1;
- }
-
- //
- // For Image
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
- line = 2;
- }
-
- //
- // For Library
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
- line = 2;
- }
-
- //
- // For Driver
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
- line = 4;
- }
-
- //
- // For Call Back
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- line = 2;
- }
-
- model.addRow(vid.toStringVector(index));
- jTable.setRowHeight(index, line * 18);
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Externs", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeExterns(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Externs
- if exists externs, set the value directly
- if not exists externs, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- //
- // Save pcd and flash map information first
- //
- Externs ex = Externs.Factory.newInstance();
- if (this.externs != null) {
- if (this.externs.getPcdIsDriver() != null) {
- ex.setPcdIsDriver(this.externs.getPcdIsDriver());
- }
- if (this.externs.getTianoR8FlashMapH()) {
- ex.setTianoR8FlashMapH(this.externs.getTianoR8FlashMapH());
- }
- }
- this.externs = ex;
-
- //
- // Save externs
- //
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- //
- // Save specfication
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- if (!isEmpty(vid.getExterns(index).getName0())) {
- this.externs.addNewSpecification();
- this.externs.setSpecificationArray(externs.getSpecificationList().size() - 1,
- vid.getExterns(index).getName0());
- continue;
- }
- }
-
- Extern e = Extern.Factory.newInstance();
- //
- // Save image
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
- if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())) {
- e = Extern.Factory.newInstance();
- if (!isEmpty(vid.getExterns(index).getName0())) {
- e.setModuleEntryPoint(vid.getExterns(index).getName0());
- }
- if (!isEmpty(vid.getExterns(index).getName1())) {
- e.setModuleUnloadImage(vid.getExterns(index).getName1());
- }
- }
- }
-
- //
- // Save library
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
- if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())) {
- e = Extern.Factory.newInstance();
- if (!isEmpty(vid.getExterns(index).getName0())) {
- e.setConstructor(vid.getExterns(index).getName0());
- }
- if (!isEmpty(vid.getExterns(index).getName1())) {
- e.setDestructor(vid.getExterns(index).getName1());
- }
- }
- }
-
- //
- // Save call back
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())) {
- e = Extern.Factory.newInstance();
- if (!isEmpty(vid.getExterns(index).getName0())) {
- e.setSetVirtualAddressMapCallBack(vid.getExterns(index).getName0());
- }
- if (!isEmpty(vid.getExterns(index).getName1())) {
- e.setExitBootServicesCallBack(vid.getExterns(index).getName1());
- }
- }
- }
-
- //
- // Save driver
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
- if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())
- || !isEmpty(vid.getExterns(index).getName2()) || !isEmpty(vid.getExterns(index).getName3())) {
- e = Extern.Factory.newInstance();
- if (!isEmpty(vid.getExterns(index).getName0())) {
- e.setDriverBinding(vid.getExterns(index).getName0());
- }
- if (!isEmpty(vid.getExterns(index).getName1())) {
- e.setComponentName(vid.getExterns(index).getName1());
- }
- if (!isEmpty(vid.getExterns(index).getName2())) {
- e.setDriverConfig(vid.getExterns(index).getName2());
- }
- if (!isEmpty(vid.getExterns(index).getName3())) {
- e.setDriverDiag(vid.getExterns(index).getName3());
- }
- }
- }
-
- //
- // Save common data
- //
- if (!isEmpty(vid.getExterns(index).getFeatureFlag())) {
- e.setFeatureFlag(vid.getExterns(index).getFeatureFlag());
- }
- if (vid.getExterns(index).getSupArchList() != null
- && vid.getExterns(index).getSupArchList().size() > 0) {
- e.setSupArchList(vid.getExterns(index).getSupArchList());
- }
-
- this.externs.addNewExtern();
- this.externs.setExternArray(this.externs.getExternList().size() - 1, e);
- }
- }
-
- this.msa.setExterns(externs);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Externs", e.getMessage());
- Log.err("Update Externs", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java
deleted file mode 100644
index 5c9d329a55..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java
+++ /dev/null
@@ -1,465 +0,0 @@
-/** @file
-
- The file is used to create, update Guids of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.GuidUsage;
-import org.tianocore.GuidsDocument;
-import org.tianocore.GuidsDocument.Guids;
-import org.tianocore.GuidsDocument.Guids.GuidCNames;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.GuidsDlg;
-
-/**
- The class is used to create, update Guids of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleGuids extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 6710858997766979803L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private GuidsDocument.Guids guids = null;
-
- private GuidsIdentification id = null;
-
- private GuidsVector vid = new GuidsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Guids");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Guids inGuids) {
- init();
- this.guids = inGuids;
-
- if (this.guids != null) {
- if (this.guids.getGuidCNamesList().size() > 0) {
- for (int index = 0; index < this.guids.getGuidCNamesList().size(); index++) {
- String arg0 = guids.getGuidCNamesList().get(index).getGuidCName();
- String arg1 = null;
- if (guids.getGuidCNamesList().get(index).getUsage() != null) {
- arg1 = guids.getGuidCNamesList().get(index).getUsage().toString();
- }
-
- String arg2 = guids.getGuidCNamesList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(guids.getGuidCNamesList().get(index)
- .getSupArchList());
- String arg4 = guids.getGuidCNamesList().get(index).getHelpText();
-
- id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addGuids(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleGuids() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inGuids The input data of GuidsDocument.Guids
-
- **/
- public ModuleGuids(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getGuids());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- GuidsDlg dlg = new GuidsDlg(vid.getGuids(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addGuids(dlg.getId());
- } else {
- this.vid.setGuids(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Guids", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeGuids(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Guids
- if exists guids, set the value directly
- if not exists guids, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.guids = Guids.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- GuidCNames p = GuidCNames.Factory.newInstance();
- if (!isEmpty(vid.getGuids(index).getName())) {
- p.setGuidCName(vid.getGuids(index).getName());
- }
- if (!isEmpty(vid.getGuids(index).getUsage())) {
- p.setUsage(GuidUsage.Enum.forString(vid.getGuids(index).getUsage()));
- }
- if (!isEmpty(vid.getGuids(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getGuids(index).getFeatureFlag());
- }
- if (vid.getGuids(index).getSupArchList() != null && vid.getGuids(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getGuids(index).getSupArchList());
- }
- if (!isEmpty(vid.getGuids(index).getHelp())) {
- p.setHelpText(vid.getGuids(index).getHelp());
- }
- this.guids.addNewGuidCNames();
- this.guids.setGuidCNamesArray(guids.getGuidCNamesList().size() - 1, p);
- }
- }
-
- this.msa.setGuids(guids);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Guids", e.getMessage());
- Log.err("Update Guids", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java
deleted file mode 100644
index 5914b6a69a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/** @file
-
- The file is used to create, update Formset of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.HiiPackageUsage;
-import org.tianocore.HiiPackagesDocument;
-import org.tianocore.HiiPackagesDocument.HiiPackages;
-import org.tianocore.HiiPackagesDocument.HiiPackages.HiiPackage;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPackagesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPackagesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.HiiPackagesDlg;
-
-/**
- The class is used to create, update Formset of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleHiiPackages extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6851574146786158116L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private HiiPackagesDocument.HiiPackages hiiPackages = null;
-
- private HiiPackagesIdentification id = null;
-
- private HiiPackagesVector vid = new HiiPackagesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Hii Package C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Hii Packages");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(HiiPackages inHiiPackages) {
- init();
- this.hiiPackages = inHiiPackages;
-
- if (this.hiiPackages != null) {
- if (this.hiiPackages.getHiiPackageList().size() > 0) {
- for (int index = 0; index < this.hiiPackages.getHiiPackageList().size(); index++) {
- String arg0 = hiiPackages.getHiiPackageList().get(index).getHiiCName();
- String arg1 = null;
- if (hiiPackages.getHiiPackageList().get(index).getUsage() != null) {
- arg1 = hiiPackages.getHiiPackageList().get(index).getUsage().toString();
- }
-
- String arg2 = hiiPackages.getHiiPackageList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(hiiPackages.getHiiPackageList().get(index)
- .getSupArchList());
- String arg4 = hiiPackages.getHiiPackageList().get(index).getHelpText();
-
- id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addHiiPackages(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleHiiPackages() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- *
- */
- /**
- This is the override edit constructor
-
- @param inFormsets The input data of HiiPackagesDocument.HiiPackages
-
- **/
- public ModuleHiiPackages(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getHiiPackages());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- HiiPackagesDlg dlg = new HiiPackagesDlg(vid.getHiiPackages(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addHiiPackages(dlg.getId());
- } else {
- this.vid.setHiiPackages(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Hii Packages", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeHiiPackages(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of hiiPackages
- if exists formset, set the value directly
- if not exists formset, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.hiiPackages = HiiPackages.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- HiiPackage p = HiiPackage.Factory.newInstance();
- if (!isEmpty(vid.getHiiPackages(index).getName())) {
- p.setHiiCName(vid.getHiiPackages(index).getName());
- }
- if (!isEmpty(vid.getHiiPackages(index).getUsage())) {
- p.setUsage(HiiPackageUsage.Enum.forString(vid.getHiiPackages(index).getUsage()));
- }
- if (!isEmpty(vid.getHiiPackages(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getHiiPackages(index).getFeatureFlag());
- }
- if (vid.getHiiPackages(index).getSupArchList() != null
- && vid.getHiiPackages(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getHiiPackages(index).getSupArchList());
- }
- if (!isEmpty(vid.getHiiPackages(index).getHelp())) {
- p.setHelpText(vid.getHiiPackages(index).getHelp());
- }
- this.hiiPackages.addNewHiiPackage();
- this.hiiPackages.setHiiPackageArray(hiiPackages.getHiiPackageList().size() - 1, p);
- }
- }
-
- this.msa.setHiiPackages(hiiPackages);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update hiiPackages", e.getMessage());
- Log.err("Update hiiPackages", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java
deleted file mode 100644
index 465ebee104..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/** @file
-
- The file is used to create, update Hob of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.HobTypes;
-import org.tianocore.HobUsage;
-import org.tianocore.HobsDocument;
-import org.tianocore.HobsDocument.Hobs;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Hobs.HobsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Hobs.HobsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.HobsDlg;
-
-/**
- The class is used to create, update Hob of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleHobs extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -553473437579358325L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private HobsDocument.Hobs hobs = null;
-
- private HobsIdentification id = null;
-
- private HobsVector vid = new HobsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Type");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Hobs");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Hobs inHobs) {
- init();
- this.hobs = inHobs;
-
- if (this.hobs != null) {
- if (this.hobs.getHobTypesList().size() > 0) {
- for (int index = 0; index < this.hobs.getHobTypesList().size(); index++) {
- String arg0 = hobs.getHobTypesList().get(index).getHobGuidCName();
- String arg1 = null;
- if (hobs.getHobTypesList().get(index).getHobType() != null) {
- arg1 = hobs.getHobTypesList().get(index).getHobType().toString();
- }
- String arg2 = null;
- if (hobs.getHobTypesList().get(index).getUsage() != null) {
- arg2 = hobs.getHobTypesList().get(index).getUsage().toString();
- }
-
- String arg3 = hobs.getHobTypesList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(hobs.getHobTypesList().get(index).getSupArchList());
- String arg5 = hobs.getHobTypesList().get(index).getHelpText();
- id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addHobs(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleHobs() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inHobs The input data of HobsDocument.Hobs
-
- **/
- public ModuleHobs(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getHobs());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- public JPanel getJContentPane() {
- if (jContentPane == null) {
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- HobsDlg dlg = new HobsDlg(vid.getHobs(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addHobs(dlg.getId());
- } else {
- this.vid.setHobs(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Hobs", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeHobs(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Hobs
- if exists hobs, set the value directly
- if not exists hobs, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.hobs = Hobs.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- HobsDocument.Hobs.HobTypes p = HobsDocument.Hobs.HobTypes.Factory.newInstance();
- if (!isEmpty(vid.getHobs(index).getName())) {
- p.setHobGuidCName(vid.getHobs(index).getName());
- }
- if (!isEmpty(vid.getHobs(index).getUsage())) {
- p.setUsage(HobUsage.Enum.forString(vid.getHobs(index).getUsage()));
- }
- if (!isEmpty(vid.getHobs(index).getType())) {
- p.setHobType(HobTypes.Enum.forString(vid.getHobs(index).getType()));
- }
- if (!isEmpty(vid.getHobs(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getHobs(index).getFeatureFlag());
- }
- if (vid.getHobs(index).getSupArchList() != null && vid.getHobs(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getHobs(index).getSupArchList());
- }
- this.hobs.addNewHobTypes();
- this.hobs.setHobTypesArray(hobs.getHobTypesList().size() - 1, p);
- }
- }
-
- this.msa.setHobs(hobs);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Hobs", e.getMessage());
- Log.err("Update Hobs", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java
deleted file mode 100644
index 09685719fe..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/** @file
-
- The file is used to create, update Library Class Definition of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.LibraryClassDefinitionsDocument;
-import org.tianocore.LibraryUsage;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
-import org.tianocore.LibraryClassDocument.LibraryClass;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.LibraryClassDefsDlg;
-
-/**
- The class is used to create, update Library Class Definition of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleLibraryClassDefinitions extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1743248695411382857L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not for UI
- //
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
-
- private LibraryClassDefinitions lcd = null;
-
- private LibraryClassVector vLibraryClass = new LibraryClassVector();
-
- private OpeningModuleType omt = null;
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 330, 90, 20));
- jButtonAdd.setPreferredSize(new Dimension(90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 330, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.setPreferredSize(new Dimension(90, 20));
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 330, 90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.setPreferredSize(new Dimension(90, 20));
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Library Class Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleLibraryClassDefinitions() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param
-
- **/
- public ModuleLibraryClassDefinitions(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getLibraryClassDefinitions());
- this.setVisible(true);
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inLibraryClassDefinitions The input data of LibraryClassDefinitionsDocument.LibraryClassDefinitions
-
- **/
- private void init(LibraryClassDefinitionsDocument.LibraryClassDefinitions inLibraryClassDefinitions) {
- init();
- this.lcd = inLibraryClassDefinitions;
- if (this.lcd != null) {
- if (this.lcd.getLibraryClassList().size() > 0) {
- for (int index = 0; index < this.lcd.getLibraryClassList().size(); index++) {
- String name = lcd.getLibraryClassList().get(index).getKeyword();
- String usage = null;
- if (lcd.getLibraryClassList().get(index).getUsage() != null) {
- usage = lcd.getLibraryClassList().get(index).getUsage().toString();
- }
- String version = lcd.getLibraryClassList().get(index).getRecommendedInstanceVersion();
- String guid = lcd.getLibraryClassList().get(index).getRecommendedInstanceGuid();
- String featureFlag = lcd.getLibraryClassList().get(index).getFeatureFlag();
- Vector<String> arch = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
- .getSupArchList());
- Vector<String> module = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
- .getSupModuleList());
- String help = lcd.getLibraryClassList().get(index).getHelpText();
- LibraryClassIdentification lcid = new LibraryClassIdentification(name, usage, version, guid, arch,
- featureFlag, module, help);
- vLibraryClass.addLibraryClass(lcid);
- }
- }
- }
- //
- // Update the list
- //
- showTable();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setContentPane(getJScrollPane());
- this.setTitle("Library Class Definitions");
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 515));
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- /**
- Save all components of Mbd Header
- if exists mbdHeader, set the value directly
- if not exists mbdHeader, new an instance first
-
- **/
- public void save() {
- try {
- int intLibraryCount = this.vLibraryClass.size();
-
- lcd = LibraryClassDefinitions.Factory.newInstance();
- if (intLibraryCount > 0) {
- for (int index = 0; index < intLibraryCount; index++) {
- LibraryClass mLibraryClass = LibraryClass.Factory.newInstance();
-
- mLibraryClass.setKeyword(vLibraryClass.getLibraryClass(index).getLibraryClassName());
- mLibraryClass
- .setUsage(LibraryUsage.Enum.forString(vLibraryClass.getLibraryClass(index).getUsage()));
- if (!isEmpty(vLibraryClass.getLibraryClass(index).getRecommendedInstanceVersion())) {
- mLibraryClass.setRecommendedInstanceVersion(vLibraryClass.getLibraryClass(index)
- .getRecommendedInstanceVersion());
- }
- if (!isEmpty(vLibraryClass.getLibraryClass(index).getRecommendedInstanceGuid())) {
- mLibraryClass.setRecommendedInstanceGuid(vLibraryClass.getLibraryClass(index)
- .getRecommendedInstanceGuid());
- }
- if (!isEmpty(vLibraryClass.getLibraryClass(index).getFeatureFlag())) {
- mLibraryClass.setFeatureFlag(vLibraryClass.getLibraryClass(index).getFeatureFlag());
- }
- if (vLibraryClass.getLibraryClass(index).getSupArchList() != null
- && vLibraryClass.getLibraryClass(index).getSupArchList().size() > 0) {
- mLibraryClass.setSupArchList(vLibraryClass.getLibraryClass(index).getSupArchList());
- }
- if (vLibraryClass.getLibraryClass(index).getSupModuleList() != null
- && vLibraryClass.getLibraryClass(index).getSupModuleList().size() > 0) {
- mLibraryClass.setSupModuleList(vLibraryClass.getLibraryClass(index).getSupModuleList());
- }
- if (!isEmpty(vLibraryClass.getLibraryClass(index).getHelp())) {
- mLibraryClass.setHelpText(vLibraryClass.getLibraryClass(index).getHelp());
- }
-
- this.lcd.addNewLibraryClass();
- this.lcd.setLibraryClassArray(index, mLibraryClass);
- }
- }
-
- if (msa.getLibraryClassDefinitions() == null) {
- this.msa.addNewLibraryClassDefinitions();
- }
- this.msa.setLibraryClassDefinitions(this.lcd);
-
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Library Class Definitions", e.getMessage());
- Log.err("Update Library Class Definitions", e.getMessage());
- }
- }
-
- private void showEdit(int index) {
- LibraryClassDefsDlg mcdd = new LibraryClassDefsDlg(vLibraryClass.getLibraryClass(index), this.parentFrame, omt.getId());
- int result = mcdd.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vLibraryClass.addLibraryClass(mcdd.getLcid());
- } else {
- this.vLibraryClass.setLibraryClass(mcdd.getLcid(), index);
- }
- this.showTable();
- this.save();
- mcdd.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- mcdd.dispose();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Library Class Definitions", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vLibraryClass.removeLibraryClass(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vLibraryClass.size() > 0) {
- for (int index = 0; index < vLibraryClass.size(); index++) {
- model.addRow(vLibraryClass.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- //this.jScrollPane.setViewportView(this.jTable);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java
deleted file mode 100644
index a50475527b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/** @file
-
- The file is used to create, update PCD of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.PcdCodedDocument;
-import org.tianocore.PcdItemTypes;
-import org.tianocore.PcdUsage;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PcdCodedDocument.PcdCoded;
-import org.tianocore.PcdCodedDocument.PcdCoded.PcdEntry;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.PCDsDlg;
-
-/**
- The class is used to create, update PCD of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModulePCDs extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 2227717658188438696L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private PcdCodedDocument.PcdCoded pcds = null;
-
- private PcdCodedIdentification id = null;
-
- private PcdCodedVector vid = new PcdCodedVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 245, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 245, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 245, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Name");
- model.addColumn("Type");
- model.addColumn("Value");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Pcd Coded");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(PcdCoded inPcdCodeds) {
- init();
- this.pcds = inPcdCodeds;
-
- if (this.pcds != null) {
- if (this.pcds.getPcdEntryList().size() > 0) {
- for (int index = 0; index < this.pcds.getPcdEntryList().size(); index++) {
- String arg0 = pcds.getPcdEntryList().get(index).getCName();
- String arg1 = pcds.getPcdEntryList().get(index).getTokenSpaceGuidCName();
-
- String arg2 = pcds.getPcdEntryList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(pcds.getPcdEntryList().get(index).getSupArchList());
-
- String arg4 = pcds.getPcdEntryList().get(index).getDefaultValue();
- String arg5 = pcds.getPcdEntryList().get(index).getHelpText();
- String arg6 = null;
- if (pcds.getPcdEntryList().get(index).getPcdItemType() != null) {
- arg6 = pcds.getPcdEntryList().get(index).getPcdItemType().toString();
- }
- String arg7 = null;
- if (pcds.getPcdEntryList().get(index).getUsage() != null) {
- arg7 = pcds.getPcdEntryList().get(index).getUsage().toString();
- }
- id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- vid.addPcdCoded(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModulePCDs() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inPcds The input data of PCDsDocument.PCDs
-
- **/
- public ModulePCDs(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getPcdCoded());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- PCDsDlg dlg = new PCDsDlg(vid.getPcdCoded(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addPcdCoded(dlg.getId());
- } else {
- this.vid.setPcdCoded(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update PcdCoded", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removePcdCoded(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of PCDs
- if exists pcds, set the value directly
- if not exists pcds, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.pcds = PcdCoded.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- PcdEntry p = PcdEntry.Factory.newInstance();
- if (!isEmpty(vid.getPcdCoded(index).getName())) {
- p.setCName(vid.getPcdCoded(index).getName());
- }
- if (!isEmpty(vid.getPcdCoded(index).getGuid())) {
- p.setTokenSpaceGuidCName(vid.getPcdCoded(index).getGuid());
- }
- if (!isEmpty(vid.getPcdCoded(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getPcdCoded(index).getFeatureFlag());
- }
- if (vid.getPcdCoded(index).getSupArchList() != null
- && vid.getPcdCoded(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getPcdCoded(index).getSupArchList());
- }
- if (!isEmpty(vid.getPcdCoded(index).getValue())) {
- p.setDefaultValue(vid.getPcdCoded(index).getValue());
- }
- if (!isEmpty(vid.getPcdCoded(index).getHelp())) {
- p.setHelpText(vid.getPcdCoded(index).getHelp());
- }
- if (!isEmpty(vid.getPcdCoded(index).getType())) {
- p.setPcdItemType(PcdItemTypes.Enum.forString(vid.getPcdCoded(index).getType()));
- }
- if (!isEmpty(vid.getPcdCoded(index).getUsage())) {
- p.setUsage(PcdUsage.Enum.forString(vid.getPcdCoded(index).getUsage()));
- }
- this.pcds.addNewPcdEntry();
- this.pcds.setPcdEntryArray(pcds.getPcdEntryList().size() - 1, p);
- }
- }
-
- this.msa.setPcdCoded(pcds);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update PcdCoded", e.getMessage());
- Log.err("Update PcdCoded", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java
deleted file mode 100644
index 3077f3d251..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/** @file
-
- The file is used to create, update Include of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageDependenciesDocument.PackageDependencies;
-import org.tianocore.PackageDependenciesDocument.PackageDependencies.Package;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.PackageDependencies.PackageDependenciesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PackageDependencies.PackageDependenciesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.PackageDepDlg;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- The class is used to create, update Include of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModulePackageDependencies extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 3465193035145152131L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private PackageDependencies pd = null;
-
- private PackageDependenciesIdentification pdid = null;
-
- private PackageDependenciesVector vid = new PackageDependenciesVector();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private Vector<PackageIdentification> vPackage = wt.getAllPackages();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 445, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 445, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 445, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Package Name");
- model.addColumn("Package Version");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public ModulePackageDependencies() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param
-
- **/
- public ModulePackageDependencies(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getPackageDependencies());
- this.setVisible(true);
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Package Dependencies");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(PackageDependencies inPackageDependencies) {
- init();
- this.pd = inPackageDependencies;
-
- if (this.pd != null) {
- if (this.pd.getPackageList().size() > 0) {
- for (int index = 0; index < this.pd.getPackageList().size(); index++) {
- String arg0 = "";
- String arg1 = pd.getPackageList().get(index).getPackageVersion();
- String arg2 = pd.getPackageList().get(index).getPackageGuid();
- //
- // If no guid, skip current item
- //
- if (arg2 == null) {
- continue;
- }
- for (int indexJ = 0; indexJ < this.vPackage.size(); indexJ++) {
- if (vPackage.get(indexJ).getGuid().equals(arg2)) {
- arg0 = vPackage.get(indexJ).getName();
- }
- }
- String arg3 = pd.getPackageList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(pd.getPackageList().get(index).getSupArchList());
- pdid = new PackageDependenciesIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addPackageDependencies(pdid);
- }
- }
- }
- showTable();
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- PackageDepDlg pdd = new PackageDepDlg(vid.getPackageDependencies(index), this.parentFrame, omt.getId());
- int result = pdd.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addPackageDependencies(pdd.getPdid());
- } else {
- this.vid.setPackageDependencies(pdd.getPdid(), index);
- }
- this.showTable();
- this.save();
- pdd.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- pdd.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- //this.jScrollPane.setViewportView(this.jTable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Package Dependencies", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removePackageDependencies(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Includes
- if exists includes, set the value directly
- if not exists includes, new an instance first
-
- **/
- public void save() {
- try {
- //
- //Save as file name
- //
- int count = this.vid.size();
-
- this.pd = PackageDependencies.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- Package p = Package.Factory.newInstance();
-
- if (!isEmpty(vid.getPackageDependencies(index).getVersion())) {
- p.setPackageVersion(vid.getPackageDependencies(index).getVersion());
- }
- if (!isEmpty(vid.getPackageDependencies(index).getGuid())) {
- p.setPackageGuid(vid.getPackageDependencies(index).getGuid());
- }
- if (!isEmpty(vid.getPackageDependencies(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getPackageDependencies(index).getFeatureFlag());
- }
- if (vid.getPackageDependencies(index).getSupArchList() != null
- && vid.getPackageDependencies(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getPackageDependencies(index).getSupArchList());
- }
-
- this.pd.addNewPackage();
- this.pd.setPackageArray(index, p);
- }
- }
- this.msa.setPackageDependencies(pd);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Package Dependencies", e.getMessage());
- Log.err("Update Package Dependencies", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java
deleted file mode 100644
index c7a3e424e9..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java
+++ /dev/null
@@ -1,514 +0,0 @@
-/** @file
-
- The file is used to create, update Ppi of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.PPIsDocument;
-import org.tianocore.PpiNotifyUsage;
-import org.tianocore.PpiUsage;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PPIsDocument.PPIs;
-import org.tianocore.PPIsDocument.PPIs.Ppi;
-import org.tianocore.PPIsDocument.PPIs.PpiNotify;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.PpisDlg;
-
-/**
- The class is used to create, update Ppi of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModulePpis extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -4284901202357037724L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
-
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private PPIsDocument.PPIs ppis = null;
-
- private PpisIdentification id = null;
-
- private PpisVector vid = new PpisVector();
-
- private EnumerationData ed = new EnumerationData();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Type");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Ppis");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(PPIs inPpis) {
- init();
- this.ppis = inPpis;
-
- if (this.ppis != null) {
- if (this.ppis.getPpiList().size() > 0) {
- for (int index = 0; index < this.ppis.getPpiList().size(); index++) {
- String arg0 = ppis.getPpiList().get(index).getPpiCName();
- String arg1 = ed.getVPpiType().get(0);
- String arg2 = null;
- if (ppis.getPpiList().get(index).getUsage() != null) {
- arg2 = ppis.getPpiList().get(index).getUsage().toString();
- }
-
- String arg3 = ppis.getPpiList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(ppis.getPpiList().get(index).getSupArchList());
- String arg5 = ppis.getPpiList().get(index).getHelpText();
-
- id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addPpis(id);
- }
- }
- if (this.ppis.getPpiNotifyList().size() > 0) {
- for (int index = 0; index < this.ppis.getPpiNotifyList().size(); index++) {
- String arg0 = ppis.getPpiNotifyList().get(index).getPpiNotifyCName();
- String arg1 = ed.getVPpiType().get(1);
- String arg2 = null;
- if (ppis.getPpiNotifyList().get(index).getUsage() != null) {
- arg2 = ppis.getPpiNotifyList().get(index).getUsage().toString();
- }
-
- String arg3 = ppis.getPpiNotifyList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools
- .convertListToVector(ppis.getPpiNotifyList().get(index).getSupArchList());
- String arg5 = ppis.getPpiNotifyList().get(index).getHelpText();
-
- id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addPpis(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModulePpis() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inPpis The input data of PPIsDocument.PPIs
-
- **/
- public ModulePpis(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getPPIs());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- PpisDlg dlg = new PpisDlg(vid.getPpis(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addPpis(dlg.getId());
- } else {
- this.vid.setPpis(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Ppis", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removePpis(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of PPIs
- if exists ppis, set the value directly
- if not exists ppis, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.ppis = PPIs.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- if (vid.getPpis(index).getType().equals(ed.getVPpiType().get(0))) {
- Ppi p = Ppi.Factory.newInstance();
- if (!isEmpty(vid.getPpis(index).getName())) {
- p.setPpiCName(vid.getPpis(index).getName());
- }
- if (!isEmpty(vid.getPpis(index).getUsage())) {
- p.setUsage(PpiUsage.Enum.forString(vid.getPpis(index).getUsage()));
- }
- if (!isEmpty(vid.getPpis(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getPpis(index).getFeatureFlag());
- }
- if (vid.getPpis(index).getSupArchList() != null
- && vid.getPpis(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getPpis(index).getSupArchList());
- }
- if (!isEmpty(vid.getPpis(index).getHelp())) {
- p.setHelpText(vid.getPpis(index).getHelp());
- }
- this.ppis.addNewPpi();
- this.ppis.setPpiArray(ppis.getPpiList().size() - 1, p);
- }
- if (vid.getPpis(index).getType().equals(ed.getVPpiType().get(1))) {
- PpiNotify p = PpiNotify.Factory.newInstance();
- if (!isEmpty(vid.getPpis(index).getName())) {
- p.setPpiNotifyCName(vid.getPpis(index).getName());
- }
- if (!isEmpty(vid.getPpis(index).getUsage())) {
- p.setUsage(PpiNotifyUsage.Enum.forString(vid.getPpis(index).getUsage()));
- }
- if (!isEmpty(vid.getPpis(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getPpis(index).getFeatureFlag());
- }
- if (vid.getPpis(index).getSupArchList() != null
- && vid.getPpis(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getPpis(index).getSupArchList());
- }
- if (!isEmpty(vid.getPpis(index).getHelp())) {
- p.setHelpText(vid.getPpis(index).getHelp());
- }
- this.ppis.addNewPpiNotify();
- this.ppis.setPpiNotifyArray(ppis.getPpiNotifyList().size() - 1, p);
- }
- }
- }
-
- this.msa.setPPIs(ppis);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Ppis", e.getMessage());
- Log.err("Update Ppis", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
deleted file mode 100644
index 61c5dd80ae..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
+++ /dev/null
@@ -1,515 +0,0 @@
-/** @file
-
- The file is used to create, update Protocol of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.ProtocolNotifyUsage;
-import org.tianocore.ProtocolUsage;
-import org.tianocore.ProtocolsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.ProtocolsDocument.Protocols;
-import org.tianocore.ProtocolsDocument.Protocols.Protocol;
-import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.ProtocolsDlg;
-
-/**
- The class is used to create, update Protocol of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleProtocols extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -9084913640747858848L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private ProtocolsDocument.Protocols protocols = null;
-
- private ProtocolsIdentification id = null;
-
- private ProtocolsVector vid = new ProtocolsVector();
-
- private EnumerationData ed = new EnumerationData();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Type");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Protocols");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Protocols inProtocols) {
- init();
- this.protocols = inProtocols;
-
- if (this.protocols != null) {
- if (this.protocols.getProtocolList().size() > 0) {
- for (int index = 0; index < this.protocols.getProtocolList().size(); index++) {
- String arg0 = protocols.getProtocolList().get(index).getProtocolCName();
- String arg1 = ed.getVProtocolType().get(0);
- String arg2 = null;
- if (protocols.getProtocolList().get(index).getUsage() != null) {
- arg2 = protocols.getProtocolList().get(index).getUsage().toString();
- }
-
- String arg3 = protocols.getProtocolList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolList().get(index)
- .getSupArchList());
- String arg5 = protocols.getProtocolList().get(index).getHelpText();
- id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addProtocols(id);
- }
- }
- if (this.protocols.getProtocolNotifyList().size() > 0) {
- for (int index = 0; index < this.protocols.getProtocolNotifyList().size(); index++) {
- String arg0 = protocols.getProtocolNotifyList().get(index).getProtocolNotifyCName();
- String arg1 = ed.getVProtocolType().get(1);
- String arg2 = null;
- if (protocols.getProtocolNotifyList().get(index).getUsage() != null) {
- arg2 = protocols.getProtocolNotifyList().get(index).getUsage().toString();
- }
-
- String arg3 = protocols.getProtocolNotifyList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolNotifyList().get(index)
- .getSupArchList());
- String arg5 = protocols.getProtocolNotifyList().get(index).getHelpText();
- id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addProtocols(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleProtocols() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inProtocol The input data of ProtocolsDocument.Protocols
-
- **/
- public ModuleProtocols(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getProtocols());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- ProtocolsDlg dlg = new ProtocolsDlg(vid.getProtocols(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addProtocols(dlg.getId());
- } else {
- this.vid.setProtocols(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Protocols", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeProtocols(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Protocols
- if exists protocols, set the value directly
- if not exists protocols, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.protocols = Protocols.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(0))) {
- Protocol p = Protocol.Factory.newInstance();
- if (!isEmpty(vid.getProtocols(index).getName())) {
- p.setProtocolCName(vid.getProtocols(index).getName());
- }
- if (!isEmpty(vid.getProtocols(index).getUsage())) {
- p.setUsage(ProtocolUsage.Enum.forString(vid.getProtocols(index).getUsage()));
- }
- if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());
- }
- if (vid.getProtocols(index).getSupArchList() != null
- && vid.getProtocols(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getProtocols(index).getSupArchList());
- }
- if (!isEmpty(vid.getProtocols(index).getHelp())) {
- p.setHelpText(vid.getProtocols(index).getHelp());
- }
- this.protocols.addNewProtocol();
- this.protocols.setProtocolArray(protocols.getProtocolList().size() - 1, p);
- }
- if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(1))) {
- ProtocolNotify p = ProtocolNotify.Factory.newInstance();
- if (!isEmpty(vid.getProtocols(index).getName())) {
- p.setProtocolNotifyCName(vid.getProtocols(index).getName());
- }
- if (!isEmpty(vid.getProtocols(index).getUsage())) {
- p.setUsage(ProtocolNotifyUsage.Enum.forString(vid.getProtocols(index).getUsage()));
- }
- if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());
- }
- if (vid.getProtocols(index).getSupArchList() != null
- && vid.getProtocols(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getProtocols(index).getSupArchList());
- }
- if (!isEmpty(vid.getProtocols(index).getHelp())) {
- p.setHelpText(vid.getProtocols(index).getHelp());
- }
- this.protocols.addNewProtocolNotify();
- this.protocols.setProtocolNotifyArray(protocols.getProtocolNotifyList().size() - 1, p);
- }
- }
- }
-
- this.msa.setProtocols(protocols);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Protocols", e.getMessage());
- Log.err("Update Protocols", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java
deleted file mode 100644
index 0d31e10525..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java
+++ /dev/null
@@ -1,491 +0,0 @@
-/** @file
-
- The file is used to create, update SourceFile of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.SourceFilesDocument;
-import org.tianocore.FilenameDocument.Filename;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.SourceFilesDocument.SourceFiles;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.SourceFilesDlg;
-
-/**
- The class is used to create, update SourceFile of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleSourceFiles extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6765742852142775378L;
-
- //
- // Define class members
- //
- private SourceFilesDocument.SourceFiles sourceFiles = null;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JCheckBox jCheckBoxArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private SourceFilesVector vSourceFiles = new SourceFilesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jScrollPaneTable
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("File Name");
- model.addColumn("Tag Name");
- model.addColumn("Tool Code");
- model.addColumn("Tool Chain Family");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleSourceFiles() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param
-
- **/
- public ModuleSourceFiles(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getSourceFiles());
- this.setVisible(true);
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
-
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles
-
- **/
- private void init(SourceFilesDocument.SourceFiles inSourceFiles) {
- init();
- this.sourceFiles = inSourceFiles;
-
- if (this.sourceFiles != null) {
- if (this.sourceFiles.getFilenameList().size() > 0) {
- for (int index = 0; index < this.sourceFiles.getFilenameList().size(); index++) {
- String name = sourceFiles.getFilenameList().get(index).getStringValue();
- String tagName = sourceFiles.getFilenameList().get(index).getTagName();
- String toolCode = sourceFiles.getFilenameList().get(index).getToolCode();
- String tcf = sourceFiles.getFilenameList().get(index).getToolChainFamily();
- String featureFlag = sourceFiles.getFilenameList().get(index).getFeatureFlag();
- Vector<String> arch = Tools.convertListToVector(sourceFiles.getFilenameList().get(index)
- .getSupArchList());
- SourceFilesIdentification sfid = new SourceFilesIdentification(name, tagName, toolCode, tcf,
- featureFlag, arch);
- vSourceFiles.addSourceFiles(sfid);
- }
- }
- }
- showTable();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Source Files");
- this.setViewMode(false);
- }
-
- /**
- Disable all components when the mode is view
-
- @param isView true - The view mode; false - The non-view mode
-
- **/
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jButtonAdd.setEnabled(!isView);
- this.jButtonRemove.setEnabled(!isView);
- this.jButtonUpdate.setEnabled(!isView);
- this.jCheckBoxArch.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- /**
- Save all components of SourceFiles
- if exists sourceFiles, set the value directly
- if not exists sourceFiles, new an instance first
-
- **/
- public void save() {
- try {
- //
- //Save as file name
- //
- int count = this.vSourceFiles.size();
-
- this.sourceFiles = SourceFiles.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- Filename mFilename = Filename.Factory.newInstance();
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getFilename())) {
- mFilename.setStringValue(vSourceFiles.getSourceFiles(index).getFilename());
- }
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getTagName())) {
- mFilename.setTagName(vSourceFiles.getSourceFiles(index).getTagName());
- }
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getToolCode())) {
- mFilename.setToolCode(vSourceFiles.getSourceFiles(index).getToolCode());
- }
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getToolChainFamily())) {
- mFilename.setToolChainFamily(vSourceFiles.getSourceFiles(index).getToolChainFamily());
- }
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getFeatureFlag())) {
- mFilename.setFeatureFlag(vSourceFiles.getSourceFiles(index).getFeatureFlag());
- }
- if (vSourceFiles.getSourceFiles(index).getSupArchList() != null
- && vSourceFiles.getSourceFiles(index).getSupArchList().size() > 0) {
- mFilename.setSupArchList(vSourceFiles.getSourceFiles(index).getSupArchList());
- }
-
- this.sourceFiles.addNewFilename();
- this.sourceFiles.setFilenameArray(index, mFilename);
- }
- }
- this.msa.setSourceFiles(sourceFiles);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Source Files", e.getMessage());
- Log.err("Update Source Files", e.getMessage());
- }
- }
-
- private void showEdit(int index) {
- SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), this.parentFrame, omt.getId());
- int result = sfd.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- for (int indexI = 0; indexI < sfd.getSfid().length; indexI++) {
- this.vSourceFiles.addSourceFiles(sfd.getSfid()[indexI]);
- }
- } else {
- this.vSourceFiles.setSourceFiles(sfd.getSfid()[0], index);
- }
- this.showTable();
- this.save();
- sfd.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- sfd.dispose();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Source Files", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vSourceFiles.removeSourceFiles(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vSourceFiles.size() > 0) {
- for (int index = 0; index < vSourceFiles.size(); index++) {
- model.addRow(vSourceFiles.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- //this.jScrollPane.setViewportView(this.jTable);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java
deleted file mode 100644
index 8bcb18c1de..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/** @file
-
- The file is used to create, update SystemTable of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.SystemTableUsage;
-import org.tianocore.SystemTablesDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.SystemTablesDocument.SystemTables;
-import org.tianocore.SystemTablesDocument.SystemTables.SystemTableCNames;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.SystemTables.SystemTablesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.SystemTables.SystemTablesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.SystemTablesDlg;
-
-/**
- The class is used to create, update SystemTable of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleSystemTables extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 7488769180379442276L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private SystemTablesDocument.SystemTables systemTables = null;
-
- private SystemTablesIdentification id = null;
-
- private SystemTablesVector vid = new SystemTablesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("System Tables");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inSystemTables
-
- **/
- private void init(SystemTables inSystemTables) {
- init();
- this.systemTables = inSystemTables;
-
- if (this.systemTables != null) {
- if (this.systemTables.getSystemTableCNamesList().size() > 0) {
- for (int index = 0; index < this.systemTables.getSystemTableCNamesList().size(); index++) {
- String arg0 = systemTables.getSystemTableCNamesList().get(index).getSystemTableCName();
- String arg1 = null;
- if (systemTables.getSystemTableCNamesList().get(index).getUsage() != null) {
- arg1 = systemTables.getSystemTableCNamesList().get(index).getUsage().toString();
- }
-
- String arg2 = systemTables.getSystemTableCNamesList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(systemTables.getSystemTableCNamesList().get(index)
- .getSupArchList());
- String arg4 = systemTables.getSystemTableCNamesList().get(index).getHelpText();
-
- id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addSystemTables(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleSystemTables() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inSystemTables The input data of SystemTablesDocument.SystemTables
-
- **/
- public ModuleSystemTables(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getSystemTables());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- SystemTablesDlg dlg = new SystemTablesDlg(vid.getSystemTables(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addSystemTables(dlg.getId());
- } else {
- this.vid.setSystemTables(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update System Tables", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeSystemTables(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of SystemTables
- if exists systemTables, set the value directly
- if not exists systemTables, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.systemTables = SystemTables.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- SystemTableCNames p = SystemTableCNames.Factory.newInstance();
- if (!isEmpty(vid.getSystemTables(index).getName())) {
- p.setSystemTableCName(vid.getSystemTables(index).getName());
- }
- if (!isEmpty(vid.getSystemTables(index).getUsage())) {
- p.setUsage(SystemTableUsage.Enum.forString(vid.getSystemTables(index).getUsage()));
- }
- if (!isEmpty(vid.getSystemTables(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getSystemTables(index).getFeatureFlag());
- }
- if (vid.getSystemTables(index).getSupArchList() != null
- && vid.getSystemTables(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getSystemTables(index).getSupArchList());
- }
- if (!isEmpty(vid.getSystemTables(index).getHelp())) {
- p.setHelpText(vid.getSystemTables(index).getHelp());
- }
- this.systemTables.addNewSystemTableCNames();
- this.systemTables.setSystemTableCNamesArray(systemTables.getSystemTableCNamesList().size() - 1, p);
- }
- }
-
- this.msa.setSystemTables(systemTables);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update System Tables", e.getMessage());
- Log.err("Update System Tables", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java
deleted file mode 100644
index 29eb4ff852..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/** @file
-
- The file is used to create, update Variable of MSA/MBD file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.VariableUsage;
-import org.tianocore.VariablesDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.VariablesDocument.Variables;
-import org.tianocore.VariablesDocument.Variables.Variable;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Variables.VariablesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Variables.VariablesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.VariablesDlg;
-
-/**
- The class is used to create, update Variable of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleVariables extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6998982978030439446L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private VariablesDocument.Variables variables = null;
-
- private VariablesIdentification id = null;
-
- private VariablesVector vid = new VariablesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Name");
- model.addColumn("Guid C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Variables");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Variables inVariables) {
- init();
- this.variables = inVariables;
-
- if (this.variables != null) {
- if (this.variables.getVariableList().size() > 0) {
- for (int index = 0; index < this.variables.getVariableList().size(); index++) {
- String arg0 = Tools.convertUnicodeHexStringToString(variables.getVariableList().get(index)
- .getVariableName());
- String arg1 = variables.getVariableList().get(index).getGuidCName();
- String arg2 = null;
- if (variables.getVariableList().get(index).getUsage() != null) {
- arg2 = variables.getVariableList().get(index).getUsage().toString();
- }
-
- String arg3 = variables.getVariableList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(variables.getVariableList().get(index)
- .getSupArchList());
- String arg5 = variables.getVariableList().get(index).getHelpText();
- id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addVariables(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleVariables() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inVariables The input data of VariablesDocument.Variables
-
- **/
- public ModuleVariables(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getVariables());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- VariablesDlg dlg = new VariablesDlg(vid.getVariables(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addVariables(dlg.getId());
- } else {
- this.vid.setVariables(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Variables", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeVariables(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Variables
- if exists variables, set the value directly
- if not exists variables, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.variables = Variables.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- Variable p = Variable.Factory.newInstance();
- if (!isEmpty(vid.getVariables(index).getName())) {
- p.setVariableName(Tools.convertStringToUnicodeHexString(vid.getVariables(index).getName()));
- }
- if (!isEmpty(vid.getVariables(index).getGuid())) {
- p.setGuidCName(vid.getVariables(index).getGuid());
- }
- if (!isEmpty(vid.getVariables(index).getUsage())) {
- p.setUsage(VariableUsage.Enum.forString(vid.getVariables(index).getUsage()));
- }
- if (!isEmpty(vid.getVariables(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getVariables(index).getFeatureFlag());
- }
- if (vid.getVariables(index).getSupArchList() != null
- && vid.getVariables(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getVariables(index).getSupArchList());
- }
- if (!isEmpty(vid.getVariables(index).getHelp())) {
- p.setHelpText(vid.getVariables(index).getHelp());
- }
- this.variables.addNewVariable();
- this.variables.setVariableArray(variables.getVariableList().size() - 1, p);
- }
- }
-
- this.msa.setVariables(variables);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Variables", e.getMessage());
- Log.err("Update Variables", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java
deleted file mode 100644
index 4284af2b10..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java
+++ /dev/null
@@ -1,1696 +0,0 @@
-/** @file
-
- The file is used to create, update MsaHeader of MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.FocusEvent;
-import java.awt.event.ItemEvent;
-import java.util.Vector;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.ExternsDocument;
-import org.tianocore.ModuleDefinitionsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.MsaHeaderDocument;
-import org.tianocore.PcdDriverTypes;
-import org.tianocore.LicenseDocument.License;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import javax.swing.JRadioButton;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-/**
- The class is used to create, update MsaHeader of MSA file
- It extends IInternalFrame
-
-
-
- **/
-public class MsaHeader extends IInternalFrame implements DocumentListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8152099582923006900L;
-
- private int dialogWidth = 500;
-
- private int dialogHeight = 630;
-
- private final int labelWidth = 155;
-
- private int valueWidth = 320;
-
- private final int labelCol = 12;
-
- private final int valueCol = 168;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelBaseName = null;
-
- private JTextField jTextFieldBaseName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelLicense = null;
-
- private JTextArea jTextAreaLicense = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jLabelDescription = null;
-
- private JTextArea jTextAreaDescription = null;
-
- private JLabel jLabelSpecification = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPaneLicense = null;
-
- private JScrollPane jScrollPaneDescription = null;
-
- private JLabel jLabelAbstract = null;
-
- private JTextField jTextFieldAbstract = null;
-
- private JLabel jLabelModuleType = null;
-
- private JComboBox jComboBoxModuleType = null;
-
- private JLabel jLabelArch = null;
-
- private JLabel jLabelBinaryModule = null;
-
- private JLabel jLabelOutputFileBasename = null;
-
- private JTextField jTextFieldOutputFileBasename = null;
-
- private JScrollPane jScrollPaneCopyright = null;
-
- private JTextArea jTextAreaCopyright = null;
-
- private JLabel jLabelURL = null;
-
- private JTextField jTextFieldURL = null;
-
- private JScrollPane jScrollPane = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel6 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private StarLabel jStarLabel10 = null;
-
- private StarLabel jStarLabel12 = null;
-
- private StarLabel jStarLabel13 = null;
-
- private StarLabel jStarLabel14 = null;
-
- private JCheckBox jCheckBoxIa32 = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JCheckBox jCheckBoxEbc = null;
-
- private JCheckBox jCheckBoxArm = null;
-
- private JCheckBox jCheckBoxPpc = null;
-
- private JTextField jComboBoxPcdIsDriver = null;
-
- private JCheckBox jCheckBoxPcd = null;
-
- private JCheckBox jCheckBoxFlashMap = null;
-
- //
- // Not used for UI
- //
- private MsaHeaderDocument.MsaHeader msaHeader = null;
-
- private ModuleDefinitionsDocument.ModuleDefinitions md = null;
-
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
-
- private ExternsDocument.Externs ex = null;
-
- private OpeningModuleType omt = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private JRadioButton jRadioButtonBinaryModuleTrue = null;
-
- private JRadioButton jRadioButtonBinaryModuleFalse = null;
-
- /**
- * This method initializes jCheckBoxIa32
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIa32() {
- if (jCheckBoxIa32 == null) {
- jCheckBoxIa32 = new JCheckBox();
- jCheckBoxIa32.setBounds(new java.awt.Rectangle(valueCol, 505, 55, 20));
- jCheckBoxIa32.setText("IA32");
- jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxIa32;
- }
-
- /**
- * This method initializes jCheckBoxX64
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setBounds(new java.awt.Rectangle(valueCol + 55, 505, 53, 20));
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBoxIpf
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(valueCol + 110, 505, 52, 20));
- jCheckBoxIpf.setText("IPF");
- jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxIpf;
- }
-
- /**
- * This method initializes jCheckBoxEbc
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxEbc() {
- if (jCheckBoxEbc == null) {
- jCheckBoxEbc = new JCheckBox();
- jCheckBoxEbc.setBounds(new java.awt.Rectangle(valueCol + 165, 505, 53, 20));
- jCheckBoxEbc.setText("EBC");
- jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxEbc;
- }
-
- /**
- * This method initializes jCheckBoxArm
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxArm() {
- if (jCheckBoxArm == null) {
- jCheckBoxArm = new JCheckBox();
- jCheckBoxArm.setBounds(new java.awt.Rectangle(valueCol + 220, 505, 54, 20));
- jCheckBoxArm.setText("ARM");
- jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxArm;
- }
-
- /**
- * This method initializes jCheckBoxPpc
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPpc() {
- if (jCheckBoxPpc == null) {
- jCheckBoxPpc = new JCheckBox();
- jCheckBoxPpc.setBounds(new java.awt.Rectangle(valueCol + 285, 505, 53, 20));
- jCheckBoxPpc.setText("PPC");
- jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxPpc;
- }
-
- /**
- This method initializes jTextFieldBaseName
-
- @return javax.swing.JTextField jTextFieldBaseName
-
- **/
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueCol, 10, valueWidth, 20));
- jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldBaseName.addFocusListener(this);
- jTextFieldBaseName.setToolTipText("A brief Identifier, such as USB I/O Library, of the module");
- }
- return jTextFieldBaseName;
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField jTextFieldGuid
-
- **/
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setPreferredSize(new java.awt.Dimension(250, 20));
- jTextFieldGuid.setLocation(new java.awt.Point(valueCol, 60));
- jTextFieldGuid.setSize(new java.awt.Dimension(250, 20));
- jTextFieldGuid.addFocusListener(this);
- jTextFieldGuid.setToolTipText("Guaranteed Unique Identification Number, Registry Format (8-4-4-4-12)");
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jTextFieldVersion
-
- @return javax.swing.JTextField jTextFieldVersion
-
- **/
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldVersion.setLocation(new java.awt.Point(valueCol, 85));
- jTextFieldVersion.setSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldVersion.addFocusListener(this);
- jTextFieldVersion.setToolTipText("A Version Number, 1.0, 1, 1.01, 1.0.1");
- }
- return jTextFieldVersion;
- }
-
- /**
- This method initializes jButtonGenerateGuid
-
- @return javax.swing.JButton jButtonGenerateGuid
-
- **/
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- int genGuidCol = valueCol + 285;
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));
- jButtonGenerateGuid.setSize(new java.awt.Dimension(65, 20));
- jButtonGenerateGuid.setLocation(new java.awt.Point(genGuidCol, 60));
- jButtonGenerateGuid.setText("GEN");
- jButtonGenerateGuid.addActionListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- This method initializes jTextAreaLicense
-
- @return javax.swing.JTextArea jTextAreaLicense
-
- **/
- private JTextArea getJTextAreaLicense() {
- if (jTextAreaLicense == null) {
- jTextAreaLicense = new JTextArea();
- jTextAreaLicense.setText("");
- jTextAreaLicense.setLineWrap(true);
- jTextAreaLicense.addFocusListener(this);
- jTextAreaLicense.setWrapStyleWord(true);
- jTextAreaLicense.setSelectionStart(0);
- jTextAreaLicense.setSelectionEnd(0);
- jTextAreaLicense.setToolTipText("The License for this Module.");
- }
- return jTextAreaLicense;
- }
-
- /**
- This method initializes jTextAreaDescription
-
- @return javax.swing.JTextArea jTextAreaDescription
-
- **/
- private JTextArea getJTextAreaDescription() {
- if (jTextAreaDescription == null) {
- jTextAreaDescription = new JTextArea();
- jTextAreaDescription.setLineWrap(true);
- jTextAreaDescription.addFocusListener(this);
- jTextAreaDescription.setToolTipText("A verbose description of the module.");
- jTextAreaDescription.setWrapStyleWord(true);
- jTextAreaDescription.setSelectionStart(0);
- jTextAreaDescription.setSelectionEnd(0);
- }
- return jTextAreaDescription;
- }
-
- /**
- This method initializes jTextFieldSpecification
-
- @return javax.swing.JTextField jTextFieldSpecification
-
- **/
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- int specWidth = valueWidth + 50;
- jTextFieldSpecification = new JTextField();
-
- jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth, 20));
- jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
- jTextFieldSpecification.setBorder(null);
-
- jTextFieldSpecification.setSize(new java.awt.Dimension(specWidth, 20));
- jTextFieldSpecification.setLocation(new java.awt.Point(labelCol, dialogHeight - 30));
- jTextFieldSpecification.setEditable(false);
- jTextFieldSpecification.addFocusListener(this);
- }
- return jTextFieldSpecification;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton jButtonOk
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setText("OK");
- jButtonOk.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonOk.setBounds(new java.awt.Rectangle(390, 455, 90, 20));
- jButtonOk.addActionListener(this);
- jButtonOk.setVisible(false);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton jButtonCancel
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setText("Cancel");
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 445, 90, 20));
- jButtonCancel.addActionListener(this);
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setVisible(false);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jScrollPaneLicense
-
- @return javax.swing.JScrollPane jScrollPaneLicense
-
- **/
- private JScrollPane getJScrollPaneLicense() {
- if (jScrollPaneLicense == null) {
- jScrollPaneLicense = new JScrollPane();
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneLicense.setSize(new java.awt.Dimension(valueWidth, 120));
- jScrollPaneLicense.setLocation(new java.awt.Point(valueCol, 305));
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());
- jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth, 120));
- }
- return jScrollPaneLicense;
- }
-
- /**
- This method initializes jScrollPaneDescription
-
- @return javax.swing.JScrollPane jScrollPaneDescription
-
- **/
- private JScrollPane getJScrollPaneDescription() {
- if (jScrollPaneDescription == null) {
- jScrollPaneDescription = new JScrollPane();
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneDescription.setSize(new java.awt.Dimension(valueWidth, 120));
- jScrollPaneDescription.setLocation(new java.awt.Point(valueCol, 135));
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());
- jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, 120));
- }
- return jScrollPaneDescription;
- }
-
- /**
- This method initializes jTextFieldAbstract
-
- @return javax.swing.JTextField jTextFieldAbstract
-
- **/
- private JTextField getJTextFieldAbstract() {
- if (jTextFieldAbstract == null) {
- jTextFieldAbstract = new JTextField();
- jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldAbstract.setLocation(new java.awt.Point(valueCol, 110));
- jTextFieldAbstract.setSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldAbstract.addFocusListener(this);
- jTextFieldAbstract.setToolTipText("A one sentence description of this module.");
- }
- return jTextFieldAbstract;
- }
-
- /**
- This method initializes jComboBoxModuleType
-
- @return javax.swing.JComboBox jComboBoxModuleType
-
- **/
- private JComboBox getJComboBoxModuleType() {
- if (jComboBoxModuleType == null) {
- jComboBoxModuleType = new JComboBox();
- jComboBoxModuleType.setBounds(new java.awt.Rectangle(valueCol, 35, valueWidth, 20));
- jComboBoxModuleType.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- }
- return jComboBoxModuleType;
- }
-
- /**
- This method initializes jTextFieldURL
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldURL() {
- if (jTextFieldURL == null) {
- jTextFieldURL = new JTextField();
- jTextFieldURL.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldURL.setLocation(new java.awt.Point(valueCol, 430));
- jTextFieldURL.setSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldURL.addFocusListener(this);
- jTextFieldURL.setToolTipText("A URL for the latest version of the license.");
- }
- return jTextFieldURL;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
-
- **/
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jScrollPaneCopyright
-
- @return javax.swing.JScrollPane
-
- **/
- private JScrollPane getJScrollPaneCopyright() {
- if (jScrollPaneCopyright == null) {
- jScrollPaneCopyright = new JScrollPane();
- jScrollPaneCopyright.setBounds(new java.awt.Rectangle(valueCol, 260, valueWidth, 40));
- jScrollPaneCopyright.setPreferredSize(new java.awt.Dimension(valueWidth, 40));
- jScrollPaneCopyright.setViewportView(getJTextAreaCopyright());
- jScrollPaneCopyright.setSize(new java.awt.Dimension(valueWidth, 40));
- }
- return jScrollPaneCopyright;
- }
-
- /**
- This method initializes jTextAreaCopyright
-
- @return javax.swing.JTextArea
-
- **/
- private JTextArea getJTextAreaCopyright() {
- if (jTextAreaCopyright == null) {
- jTextAreaCopyright = new JTextArea();
- jTextAreaCopyright.setLineWrap(true);
- jTextAreaCopyright.addFocusListener(this);
- jTextAreaCopyright.setWrapStyleWord(true);
- jTextAreaCopyright.setSelectionStart(0);
- jTextAreaCopyright.setSelectionEnd(0);
- jTextAreaCopyright.setBounds(new java.awt.Rectangle(0, 0, valueWidth, 40));
- jTextAreaCopyright.setToolTipText("One or more copyright lines.");
- }
- return jTextAreaCopyright;
- }
-
- /**
- * This method initializes jTextFieldOutputFileBasename
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldOutputFileBasename() {
- if (jTextFieldOutputFileBasename == null) {
- jTextFieldOutputFileBasename = new JTextField();
- jTextFieldOutputFileBasename.setBounds(new java.awt.Rectangle(valueCol, 455, valueWidth, 20));
- jTextFieldOutputFileBasename.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldOutputFileBasename.addFocusListener(this);
- jTextFieldOutputFileBasename.setToolTipText("Enter a single word for generated output file names.");
- }
- return jTextFieldOutputFileBasename;
- }
-
- /**
- * This method initializes jComboBoxPcdIsDriver
- *
- * @return javax.swing.JComboBox
- */
- private JTextField getJComboBoxPcdIsDriver() {
- if (jComboBoxPcdIsDriver == null) {
- jComboBoxPcdIsDriver = new JTextField();
- jComboBoxPcdIsDriver.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jComboBoxPcdIsDriver.setBounds(new java.awt.Rectangle(valueCol, 530, valueWidth, 20));
- jComboBoxPcdIsDriver.setEnabled(false);
- jComboBoxPcdIsDriver.setVisible(false);
- }
- return jComboBoxPcdIsDriver;
- }
-
- /**
- This is the default constructor
-
- **/
- public MsaHeader() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
-
- **/
- public MsaHeader(OpeningModuleType inMsa) {
- super();
- this.omt = inMsa;
- this.msa = omt.getXmlMsa();
-
- //
- // Set module definitions default value
- //
- if (msa.getModuleDefinitions() == null) {
- ModuleDefinitionsDocument.ModuleDefinitions md = ModuleDefinitionsDocument.ModuleDefinitions.Factory
- .newInstance();
- md.setOutputFileBasename(msa.getMsaHeader().getModuleName());
- md.setBinaryModule(false);
- md.setSupportedArchitectures(ed.getVSupportedArchitectures());
- msa.setModuleDefinitions(md);
- }
-
- //
- // Init items of Header, Definitions and Externs
- //
- init(msa.getMsaHeader());
- init(msa.getModuleDefinitions());
- init(msa.getExterns());
- this.addListeners();
-
- this.setVisible(true);
- this.setViewMode(false);
- }
-
- /**
- Disable all components when the mode is view
-
- @param isView true - The view mode; false - The non-view mode
-
- **/
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jTextFieldBaseName.setEnabled(!isView);
- this.jTextFieldGuid.setEnabled(!isView);
- this.jTextFieldVersion.setEnabled(!isView);
- this.jTextAreaLicense.setEnabled(!isView);
- this.jTextAreaCopyright.setEnabled(!isView);
- this.jTextAreaDescription.setEnabled(!isView);
- this.jTextFieldSpecification.setEnabled(!isView);
- this.jTextFieldAbstract.setEnabled(!isView);
- this.jComboBoxModuleType.setEnabled(!isView);
- this.jButtonCancel.setEnabled(!isView);
- this.jButtonGenerateGuid.setEnabled(!isView);
- this.jButtonOk.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(dialogWidth, dialogHeight);
- this.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
- this.setContentPane(getJScrollPane());
- this.setTitle("Module Surface Area Header");
- initFrame();
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
-
- **/
- private void init(MsaHeaderDocument.MsaHeader inMsaHeader) {
- init();
- if (inMsaHeader != null) {
- setMsaHeader(inMsaHeader);
- if (this.msaHeader.getModuleName() != null) {
- this.jTextFieldBaseName.setText(this.msaHeader.getModuleName());
- }
- if (this.msaHeader.getModuleType() != null) {
- this.jComboBoxModuleType.setSelectedItem(this.msaHeader.getModuleType().toString());
- }
- if (this.msaHeader.getGuidValue() != null) {
- this.jTextFieldGuid.setText(this.msaHeader.getGuidValue());
- }
- if (this.msaHeader.getVersion() != null) {
- this.jTextFieldVersion.setText(this.msaHeader.getVersion());
- }
- if (this.msaHeader.getAbstract() != null) {
- this.jTextFieldAbstract.setText(this.msaHeader.getAbstract());
- }
- if (this.msaHeader.getDescription() != null) {
- this.jTextAreaDescription.setText(this.msaHeader.getDescription());
- jTextAreaDescription.setSelectionStart(0);
- jTextAreaDescription.setSelectionEnd(0);
- }
- if (this.msaHeader.getCopyright() != null) {
- this.jTextAreaCopyright.setText(this.msaHeader.getCopyright());
- }
- if (this.msaHeader.getLicense() != null) {
- this.jTextAreaLicense.setText(this.msaHeader.getLicense().getStringValue());
- jTextAreaLicense.setSelectionStart(0);
- jTextAreaLicense.setSelectionEnd(0);
- }
- if (this.msaHeader.getLicense() != null && this.msaHeader.getLicense().getURL() != null) {
- this.jTextFieldURL.setText(this.msaHeader.getLicense().getURL());
- }
- if (this.msaHeader.getSpecification() != null) {
- this.jTextFieldSpecification.setText(this.msaHeader.getSpecification());
- }
- }
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
-
- **/
- private void init(ModuleDefinitionsDocument.ModuleDefinitions inMd) {
- if (inMd != null) {
- this.md = inMd;
- if (md.getSupportedArchitectures() != null) {
- this.setSelectedItems(Tools.convertListToVector(md.getSupportedArchitectures()));
- }
- if (md.getBinaryModule()) {
- this.jRadioButtonBinaryModuleTrue.setSelected(true);
- } else {
- this.jRadioButtonBinaryModuleFalse.setSelected(true);
- }
- if (md.getOutputFileBasename() != null) {
- this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename());
- }
- }
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inEx The input data of ExternsDocument.Externs
-
- **/
- private void init(ExternsDocument.Externs inEx) {
- if (inEx != null) {
- this.ex = inEx;
- if (ex.getPcdIsDriver() != null) {
- this.jCheckBoxPcd.setSelected(true);
- this.jCheckBoxPcd.setEnabled(true);
- }
- this.jCheckBoxFlashMap.setSelected(ex.getTianoR8FlashMapH());
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
-
- jLabelURL = new JLabel();
- jLabelURL.setText("License URL");
- jLabelURL.setLocation(new java.awt.Point(labelCol, 430));
- jLabelURL.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelBaseName = new JLabel();
- jLabelBaseName.setText("Module Name");
- jLabelBaseName.setBounds(new java.awt.Rectangle(labelCol, 10, labelWidth, 20));
- jLabelModuleType = new JLabel();
- jLabelModuleType.setBounds(new java.awt.Rectangle(labelCol, 35, labelWidth, 20));
- jLabelModuleType.setText("Module Type");
- jLabelGuid = new JLabel();
- jLabelGuid.setText("Guid Value");
- jLabelGuid.setLocation(new java.awt.Point(labelCol, 60));
- jLabelGuid.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelVersion = new JLabel();
- jLabelVersion.setText("Version");
- jLabelVersion.setLocation(new java.awt.Point(labelCol, 85));
- jLabelVersion.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelAbstract = new JLabel();
- jLabelAbstract.setText("Abstract");
- jLabelAbstract.setLocation(new java.awt.Point(labelCol, 110));
- jLabelAbstract.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelDescription = new JLabel();
- jLabelDescription.setText("Description");
- jLabelDescription.setLocation(new java.awt.Point(labelCol, 135));
- jLabelDescription.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setLocation(new java.awt.Point(labelCol, 260));
- jLabelCopyright.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelLicense = new JLabel();
- jLabelLicense.setText("License");
- jLabelLicense.setLocation(new java.awt.Point(labelCol, 305));
- jLabelLicense.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelOutputFileBasename = new JLabel();
- jLabelOutputFileBasename.setBounds(new java.awt.Rectangle(labelCol, 455, labelWidth, 20));
- jLabelOutputFileBasename.setText("Output File Basename");
- jLabelBinaryModule = new JLabel();
- jLabelBinaryModule.setBounds(new java.awt.Rectangle(labelCol, 480, labelWidth, 20));
- jLabelBinaryModule.setText("Binary Module");
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(labelCol, 505, labelWidth, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelSpecification = new JLabel();
- jLabelSpecification.setText("Specification");
- jLabelSpecification.setLocation(new java.awt.Point(labelCol, 530));
- jLabelSpecification.setSize(new java.awt.Dimension(labelWidth, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 10, dialogHeight - 10));
-
- jContentPane.addFocusListener(this);
-
- jContentPane.add(jLabelBaseName, null);
- jContentPane.add(getJTextFieldBaseName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelLicense, null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(jLabelDescription, null);
- jContentPane.add(getJTextFieldSpecification(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJScrollPaneLicense(), null);
- jContentPane.add(getJScrollPaneDescription(), null);
- jContentPane.add(jLabelAbstract, null);
- jContentPane.add(getJTextFieldAbstract(), null);
- jContentPane.add(jLabelModuleType, null);
- jContentPane.add(getJComboBoxModuleType(), null);
- jContentPane.add(jLabelURL, null);
- jContentPane.add(getJTextFieldURL(), null);
- jContentPane.add(jLabelOutputFileBasename, null);
- jContentPane.add(getJTextFieldOutputFileBasename(), null);
- jContentPane.add(jLabelBinaryModule, null);
- jContentPane.add(jLabelArch, null);
-
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, 35));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0, 60));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(0, 85));
- jStarLabel6 = new StarLabel();
- jStarLabel6.setLocation(new java.awt.Point(0, 135));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(0, 260));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(0, 305));
- jStarLabel10 = new StarLabel();
- jStarLabel10.setLocation(new java.awt.Point(0, 110));
- jStarLabel12 = new StarLabel();
- jStarLabel12.setLocation(new java.awt.Point(0, 455));
- jStarLabel13 = new StarLabel();
- jStarLabel13.setLocation(new java.awt.Point(0, 480));
- jStarLabel14 = new StarLabel();
- jStarLabel14.setLocation(new java.awt.Point(0, 505));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel6, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(jStarLabel10, null);
- jContentPane.add(jStarLabel12, null);
- jContentPane.add(jStarLabel13, null);
- jContentPane.add(jStarLabel14, null);
- jContentPane.add(getJScrollPaneCopyright(), null);
-
- jContentPane.add(getJCheckBoxIa32(), null);
- jContentPane.add(getJCheckBoxX64(), null);
- jContentPane.add(getJCheckBoxIpf(), null);
- jContentPane.add(getJCheckBoxEbc(), null);
- jContentPane.add(getJCheckBoxArm(), null);
- jContentPane.add(getJCheckBoxPpc(), null);
-
- jContentPane.add(getJCheckBoxPcd(), null);
- jContentPane.add(getJComboBoxPcdIsDriver(), null);
- jContentPane.add(getJCheckBoxFlashMap(), null);
-
- ButtonGroup bg = new ButtonGroup();
- jContentPane.add(getJRadioButtonBinaryModuleTrue(), null);
- jContentPane.add(getJRadioButtonBinaryModuleFalse(), null);
- bg.add(getJRadioButtonBinaryModuleTrue());
- bg.add(getJRadioButtonBinaryModuleFalse());
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonGenerateGuid) {
- jTextFieldGuid.setText(Tools.generateUuidString());
- jTextFieldGuid.requestFocus();
- jButtonGenerateGuid.requestFocus();
- }
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean check() {
- //
- // Check if all required fields are not empty
- // and check if all data fields values are valid
- //
-
- //
- // Check Base Name
- //
- if (isEmpty(this.jTextFieldBaseName.getText())) {
- Log.wrn("Update Msa Header", "Name must be entered!");
- //this.jTextFieldBaseName.requestFocus();
- return false;
- }
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Name, it must start with an alpha character!");
- //this.jTextFieldBaseName.requestFocus();
- return false;
- }
-
- //
- // Check Guid
- //
- if (isEmpty(this.jTextFieldGuid.getText())) {
- Log.wrn("Update Msa Header", "The Guid Value must be entered!");
- //this.jTextFieldGuid.requestFocus();
- return false;
- }
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format, 8-4-4-4-12");
- //this.jTextFieldGuid.requestFocus();
- return false;
- }
-
- //
- // Check Version
- //
- if (isEmpty(this.jTextFieldVersion.getText())) {
- Log.wrn("Update Msa Header", "Version must be entered!");
- //this.jTextFieldVersion.requestFocus();
- return false;
- }
- if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit.");
- //this.jTextFieldVersion.requestFocus();
- return false;
- }
-
- //
- // Check Abstact
- //
- if (isEmpty(this.jTextFieldAbstract.getText())) {
- Log.wrn("Update Msa Header", "Abstract must be entered!");
- //this.jTextFieldAbstract.requestFocus();
- return false;
- }
- if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
- Log.wrn("Update Msa Header",
- "Incorrect data type for Abstract, is should be a sentence describing the module.");
- //this.jTextFieldAbstract.requestFocus();
- return false;
- }
-
- //
- // Check Description
- //
- if (isEmpty(this.jTextAreaDescription.getText())) {
- Log.wrn("Update Msa Header", "Description must be entered!");
- //this.jTextAreaDescription.requestFocus();
- return false;
- }
-
- //
- // Check Copyright
- //
- if (isEmpty(this.jTextAreaCopyright.getText())) {
- Log.wrn("Update Msa Header", "Copyright must be entered!");
- //this.jTextFieldCopyright.requestFocus();
- return false;
- }
-
- //
- // Check License
- //
- if (isEmpty(this.jTextAreaLicense.getText())) {
- Log.wrn("Update Msa Header", "License must be entered!");
- //this.jTextAreaLicense.requestFocus();
- return false;
- }
-
- //
- // Check Specification
- //
- if (isEmpty(this.jTextFieldSpecification.getText())) {
- Log.wrn("Update Msa Header", "Specification must exist.");
- //this.jTextFieldSpecification.requestFocus();
- return false;
- }
- if (!DataValidation.isSpecification(this.jTextFieldSpecification.getText())) {
- // TODO Add code to check the specification number.
- // Future releases of Schema may require that we process these files
- // differently.
- Log.wrn("Update Msa Header", "Incorrect data type for Specification");
- //this.jTextFieldSpecification.requestFocus();
- return false;
- }
-
- return true;
- }
-
- /**
- Save all components of Msa Header
- if exists msaHeader, set the value directly
- if not exists msaHeader, new an instance first
-
- **/
- public void save() {
- try {
- msaHeader.setSpecification(this.jTextFieldSpecification.getText());
- msa.setMsaHeader(msaHeader);
- msa.setModuleDefinitions(md);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Save Module", e.getMessage());
- Log.err("Save Module", e.getMessage());
- }
- }
-
- /**
- This method initializes Module type and Compontent type
-
- **/
- private void initFrame() {
- EnumerationData ed = new EnumerationData();
- Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType());
- this.setSelectedItems(ed.getVSupportedArchitectures());
- }
-
- /**
- Get MsaHeaderDocument.MsaHeader
-
- @return MsaHeaderDocument.MsaHeader
-
- **/
- public MsaHeaderDocument.MsaHeader getMsaHeader() {
- return msaHeader;
- }
-
- /**
- Set MsaHeaderDocument.MsaHeader
-
- @param msaHeader The input data of MsaHeaderDocument.MsaHeader
-
- **/
- public void setMsaHeader(MsaHeaderDocument.MsaHeader msaHeader) {
- this.msaHeader = msaHeader;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
-
- Tools.resizeComponentWidth(this.jTextFieldBaseName, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldGuid, intCurrentWidth, intPreferredWidth + 7);
- Tools.resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneCopyright, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);
-
- Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,
- DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
- }
-
- public void focusLost(FocusEvent arg0) {
- if (this.msaHeader == null) {
- msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
- }
-
- //
- // Check BaseName
- //
- if (arg0.getSource() == this.jTextFieldBaseName) {
- if (isEmpty(this.jTextFieldBaseName.getText())) {
- Log.wrn("Update Msa Header", "The Name must be entered!");
- //this.jTextFieldBaseName.requestFocus();
- return;
- }
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Name, it must begin with an alpha character.");
- //this.jTextFieldBaseName.requestFocus();
- return;
- }
- if (!this.jTextFieldBaseName.getText().equals(msaHeader.getModuleName())) {
- this.msaHeader.setModuleName(this.jTextFieldBaseName.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Guid
- //
- if (arg0.getSource() == this.jTextFieldGuid) {
- if (isEmpty(this.jTextFieldGuid.getText())) {
- Log.wrn("Update Msa Header", "Guid must be entered!");
- //this.jTextFieldGuid.requestFocus();
- return;
- }
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format. (8-4-4-4-12)");
- //this.jTextFieldGuid.requestFocus();
- return;
- }
- if (!this.jTextFieldGuid.getText().equals(msaHeader.getGuidValue())) {
- this.msaHeader.setGuidValue(this.jTextFieldGuid.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Version
- //
- if (arg0.getSource() == this.jTextFieldVersion) {
- if (isEmpty(this.jTextFieldVersion.getText())) {
- Log.wrn("Update Msa Header", "Version must be entered!");
- //this.jTextFieldVersion.requestFocus();
- return;
- }
- if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit.");
- //this.jTextFieldVersion.requestFocus();
- return;
- }
- if (!this.jTextFieldVersion.getText().equals(msaHeader.getVersion())) {
- this.msaHeader.setVersion(this.jTextFieldVersion.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Abstact
- //
- if (arg0.getSource() == this.jTextFieldAbstract) {
- if (isEmpty(this.jTextFieldAbstract.getText())) {
- Log.wrn("Update Msa Header", "Abstract must be entered!");
- //this.jTextFieldAbstract.requestFocus();
- return;
- }
- if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Abstract, it must be sentence.");
- //this.jTextFieldAbstract.requestFocus();
- return;
- }
- if (!this.jTextFieldAbstract.getText().equals(msaHeader.getAbstract())) {
- this.msaHeader.setAbstract(this.jTextFieldAbstract.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Description
- //
- if (arg0.getSource() == this.jTextAreaDescription) {
- if (isEmpty(this.jTextAreaDescription.getText())) {
- Log.wrn("Update Msa Header", "Description must be entered!");
- //this.jTextAreaDescription.requestFocus();
- return;
- }
- if (!this.jTextAreaDescription.getText().equals(msaHeader.getDescription())) {
- this.msaHeader.setDescription(this.jTextAreaDescription.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Copyright
- //
- if (arg0.getSource() == this.jTextAreaCopyright) {
- if (isEmpty(this.jTextAreaCopyright.getText())) {
- Log.wrn("Update Msa Header", "Copyright must be entered!");
- //this.jTextFieldCopyright.requestFocus();
- return;
- }
- if (!this.jTextAreaCopyright.getText().equals(msaHeader.getCopyright())) {
- this.msaHeader.setCopyright(this.jTextAreaCopyright.getText());
- } else {
- return;
- }
- }
-
- //
- // Check License
- //
- if (arg0.getSource() == this.jTextAreaLicense) {
- if (isEmpty(this.jTextAreaLicense.getText())) {
- Log.wrn("Update Msa Header", "License must be entered!");
- //this.jTextAreaLicense.requestFocus();
- return;
- }
- if (this.msaHeader.getLicense() != null) {
- if (!this.jTextAreaLicense.getText().equals(msaHeader.getLicense().getStringValue())) {
- this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());
- } else {
- return;
- }
- } else {
- License mLicense = License.Factory.newInstance();
- mLicense.setStringValue(this.jTextAreaLicense.getText());
- this.msaHeader.setLicense(mLicense);
- }
- }
-
- //
- // Check License URL
- //
- if (arg0.getSource() == this.jTextFieldURL) {
- if (!isEmpty(this.jTextFieldURL.getText())) {
- if (this.msaHeader.getLicense() == null) {
- License mLicense = License.Factory.newInstance();
- mLicense.setURL(this.jTextFieldURL.getText());
- this.msaHeader.setLicense(mLicense);
- } else {
- if (!this.jTextFieldURL.getText().equals(msaHeader.getLicense().getURL())) {
- this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText());
- } else {
- return;
- }
- }
- }
- }
-
- //
- // Check Output File Basename
- //
- if (arg0.getSource() == this.jTextFieldOutputFileBasename) {
- if (isEmpty(this.jTextFieldOutputFileBasename.getText())) {
- Log.wrn("Update Msa Header", "Output File Basename must be entered!");
- // jTextFieldOutputFileBasename.removeFocusListener(this);
- // jTextFieldOutputFileBasename.requestFocus();
- // jTextFieldOutputFileBasename.addFocusListener(this);
- return;
- }
-
- if (!DataValidation.isOutputFileBasename(this.jTextFieldOutputFileBasename.getText())) {
- Log.wrn("Update Msa Header",
- "Incorrect data type for Output File Basename, it must be a valid file name");
- return;
- }
-
- if (!this.jTextFieldOutputFileBasename.getText().equals(md.getOutputFileBasename())) {
- this.md.setOutputFileBasename(this.jTextFieldOutputFileBasename.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Binary Module Type
- //
- if (arg0.getSource() == this.jRadioButtonBinaryModuleTrue) {
- if (jRadioButtonBinaryModuleTrue.isSelected()) {
- if (md.getBinaryModule()) {
- return;
- } else {
- md.setBinaryModule(true);
- }
- }
- }
-
- //
- // Check Binary Module Type
- //
- if (arg0.getSource() == this.jRadioButtonBinaryModuleFalse) {
- if (jRadioButtonBinaryModuleFalse.isSelected()) {
- if (md.getBinaryModule()) {
- md.setBinaryModule(false);
- } else {
- return;
- }
- }
- }
-
- this.save();
- }
-
- private Vector<String> getSelectedItemsVector() {
- Vector<String> v = new Vector<String>();
- if (this.jCheckBoxIa32.isSelected()) {
- v.addElement(jCheckBoxIa32.getText());
- }
- if (this.jCheckBoxX64.isSelected()) {
- v.addElement(jCheckBoxX64.getText());
- }
- if (this.jCheckBoxIpf.isSelected()) {
- v.addElement(jCheckBoxIpf.getText());
- }
- if (this.jCheckBoxEbc.isSelected()) {
- v.addElement(jCheckBoxEbc.getText());
- }
- if (this.jCheckBoxArm.isSelected()) {
- v.addElement(jCheckBoxArm.getText());
- }
- if (this.jCheckBoxPpc.isSelected()) {
- v.addElement(jCheckBoxPpc.getText());
- }
- return v;
- }
-
- private String getSelectedItemsString() {
- String s = "";
- if (this.jCheckBoxIa32.isSelected()) {
- s = s + jCheckBoxIa32.getText() + " ";
- }
- if (this.jCheckBoxX64.isSelected()) {
- s = s + jCheckBoxX64.getText() + " ";
- }
- if (this.jCheckBoxIpf.isSelected()) {
- s = s + jCheckBoxIpf.getText() + " ";
- }
- if (this.jCheckBoxEbc.isSelected()) {
- s = s + jCheckBoxEbc.getText() + " ";
- }
- if (this.jCheckBoxArm.isSelected()) {
- s = s + jCheckBoxArm.getText() + " ";
- }
- if (this.jCheckBoxPpc.isSelected()) {
- s = s + jCheckBoxPpc.getText() + " ";
- }
- return s.trim();
- }
-
- private void setAllItemsSelected(boolean isSelected) {
- this.jCheckBoxIa32.setSelected(true);
- this.jCheckBoxX64.setSelected(isSelected);
- this.jCheckBoxIpf.setSelected(isSelected);
- this.jCheckBoxEbc.setSelected(isSelected);
- this.jCheckBoxArm.setSelected(isSelected);
- this.jCheckBoxPpc.setSelected(isSelected);
- }
-
- private void setSelectedItems(Vector<String> v) {
- setAllItemsSelected(false);
- boolean isIA32Selected = false;
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
- this.jCheckBoxIa32.setSelected(true);
- isIA32Selected = true;
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
- this.jCheckBoxIpf.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxX64.getText())) {
- this.jCheckBoxX64.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
- this.jCheckBoxEbc.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxArm.getText())) {
- this.jCheckBoxArm.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
- this.jCheckBoxPpc.setSelected(true);
- continue;
- }
- }
- if (!isIA32Selected) {
- this.jCheckBoxIa32.setSelected(false);
- }
- }
- }
-
- /**
- * This method initializes jCheckBoxPcd
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPcd() {
- if (jCheckBoxPcd == null) {
- jCheckBoxPcd = new JCheckBox();
- jCheckBoxPcd.setBounds(new java.awt.Rectangle(labelCol, 530, labelWidth, 20));
- jCheckBoxPcd.setText("Is this a PCD Driver?");
- jCheckBoxPcd.addFocusListener(this);
- jCheckBoxPcd.addActionListener(this);
- jCheckBoxPcd.setEnabled(false);
- }
- return jCheckBoxPcd;
- }
-
- /**
- * This method initializes jCheckBoxFlashMap
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFlashMap() {
- if (jCheckBoxFlashMap == null) {
- jCheckBoxFlashMap = new JCheckBox();
- jCheckBoxFlashMap.setBounds(new java.awt.Rectangle(labelCol, 555, 480, 20));
- jCheckBoxFlashMap.setText("Does this module require a legacy FlashMap header file?");
- }
- return jCheckBoxFlashMap;
- }
-
- /**
- * This method initializes jRadioButtonBinaryModuleTrue
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonBinaryModuleTrue() {
- if (jRadioButtonBinaryModuleTrue == null) {
- jRadioButtonBinaryModuleTrue = new JRadioButton();
- jRadioButtonBinaryModuleTrue.setBounds(new java.awt.Rectangle(valueCol, 480, 140, 20));
- jRadioButtonBinaryModuleTrue.setText("True");
- jRadioButtonBinaryModuleTrue.setSelected(true);
- jRadioButtonBinaryModuleTrue.addFocusListener(this);
- jRadioButtonBinaryModuleTrue
- .setToolTipText("<html>Modules are either source modules which can be compiled or binary <br>"
- + "modules which are linked. A module cannot contain both. <br>"
- + "The GUID numbers should be identical for a binary and source MSA, <br>"
- + "however the BINARY MSA should have a higher version number.</html>");
- }
- return jRadioButtonBinaryModuleTrue;
- }
-
- /**
- * This method initializes jRadioButtonBinaryModuleFalse
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonBinaryModuleFalse() {
- if (jRadioButtonBinaryModuleFalse == null) {
- jRadioButtonBinaryModuleFalse = new JRadioButton();
- jRadioButtonBinaryModuleFalse.setBounds(new java.awt.Rectangle(valueCol + 140, 480, 140, 20));
- jRadioButtonBinaryModuleFalse.setText("False");
- jRadioButtonBinaryModuleFalse.addFocusListener(this);
- jRadioButtonBinaryModuleFalse
- .setToolTipText("<html>Modules are either source modules which can be compiled or binary <br>"
- + "modules which are linked. A module cannot contain both. <br>"
- + "The GUID numbers should be identical for a binary and source MSA, <br>"
- + "however the BINARY MSA should have a higher version number.</html>");
- }
- return jRadioButtonBinaryModuleFalse;
- }
-
- public void itemStateChanged(ItemEvent arg0) {
- //
- // Check Supported Arch
- //
- if (arg0.getSource() == this.jCheckBoxIa32 || arg0.getSource() == this.jCheckBoxIpf
- || arg0.getSource() == this.jCheckBoxX64 || arg0.getSource() == this.jCheckBoxEbc
- || arg0.getSource() == this.jCheckBoxArm || arg0.getSource() == this.jCheckBoxPpc) {
- if (!this.jCheckBoxIa32.isSelected() && !this.jCheckBoxX64.isSelected() && !this.jCheckBoxIpf.isSelected()
- && !this.jCheckBoxEbc.isSelected() && !this.jCheckBoxPpc.isSelected()
- && !this.jCheckBoxArm.isSelected()) {
- Log
- .wrn("At lease one Supportted Architecture should be selected! IA32 is selected as default value!");
- this.jCheckBoxIa32.setSelected(true);
- }
-
- if (!this.getSelectedItemsString().equals(md.getSupportedArchitectures().toString())) {
- md.setSupportedArchitectures(this.getSelectedItemsVector());
- this.save();
- }
- }
-
- if (arg0.getSource() == this.jComboBoxModuleType) {
- if (this.jComboBoxModuleType.getSelectedItem().equals("PEIM")
- || this.jComboBoxModuleType.getSelectedItem().equals("DXE_DRIVER")) {
- this.jCheckBoxPcd.setEnabled(true);
- if (this.jCheckBoxPcd.isSelected()) {
- this.jCheckBoxPcd.setSelected(false);
- this.jCheckBoxPcd.setSelected(true);
- }
- } else {
- this.jCheckBoxPcd.setEnabled(false);
- this.jCheckBoxPcd.setSelected(false);
- }
- if (!jComboBoxModuleType.getSelectedItem().toString().equals(msaHeader.getModuleType().toString())) {
- msaHeader.setModuleType(ModuleTypeDef.Enum.forString(jComboBoxModuleType.getSelectedItem().toString()));
- this.save();
- }
- }
-
- //
- // Check Pcd is Driver
- //
- if (arg0.getSource() == this.jCheckBoxPcd) {
- if (this.jCheckBoxPcd.isSelected()) {
- if (this.jComboBoxModuleType.getSelectedItem().toString().equals("DXE_DRIVER")) {
- this.jComboBoxPcdIsDriver.setText("DXE_PCD_DRIVER");
- this.jComboBoxPcdIsDriver.setEnabled(true);
- } else if (this.jComboBoxModuleType.getSelectedItem().toString().equals("PEIM")) {
- this.jComboBoxPcdIsDriver.setText("PEI_PCD_DRIVER");
- this.jComboBoxPcdIsDriver.setEnabled(true);
- }
- }
-
- if ((this.ex == null) && this.jCheckBoxPcd.isSelected()) {
- this.ex = ExternsDocument.Externs.Factory.newInstance();
- this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getText()));
- this.msa.setExterns(this.ex);
- } else if ((this.ex != null) && (this.ex.getPcdIsDriver() == null) && this.jCheckBoxPcd.isSelected()) {
- this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getText()));
- this.msa.setExterns(this.ex);
- } else if ((this.ex != null) && (this.ex.getPcdIsDriver() != null)) {
- if (this.jCheckBoxPcd.isSelected()
- && !this.jComboBoxPcdIsDriver.getText().toString().equals(this.ex.getPcdIsDriver().toString())) {
- this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getText()));
- this.msa.setExterns(this.ex);
- }
- if (!this.jCheckBoxPcd.isSelected()) {
- ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance();
- if (this.ex.getExternList() != null) {
- for (int index = 0; index < this.ex.getExternList().size(); index++) {
- newEx.addNewExtern();
- newEx.setExternArray(index, this.ex.getExternArray(index));
- }
- }
- if (this.ex.getSpecificationList() != null) {
- for (int index = 0; index < this.ex.getSpecificationList().size(); index++) {
- newEx.addNewSpecification();
- newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index));
- }
- }
- if (this.ex.getTianoR8FlashMapH()) {
- newEx.setTianoR8FlashMapH(this.ex.getTianoR8FlashMapH());
- }
- this.ex = newEx;
- this.msa.setExterns(this.ex);
- }
- }
- this.save();
- }
- //
- // Check Flash Map
- //
- if (arg0.getSource() == this.jCheckBoxFlashMap) {
- if ((this.ex == null) && this.jCheckBoxFlashMap.isSelected()) {
- this.ex = ExternsDocument.Externs.Factory.newInstance();
- this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected());
- this.msa.setExterns(this.ex);
- } else if ((this.ex != null) && this.jCheckBoxFlashMap.isSelected()) {
- this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected());
- this.msa.setExterns(this.ex);
- } else if ((this.ex != null) && !this.jCheckBoxFlashMap.isSelected()) {
- ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance();
- if (this.ex.getExternList() != null) {
- for (int index = 0; index < this.ex.getExternList().size(); index++) {
- newEx.addNewExtern();
- newEx.setExternArray(index, this.ex.getExternArray(index));
- }
- }
- if (this.ex.getSpecificationList() != null) {
- for (int index = 0; index < this.ex.getSpecificationList().size(); index++) {
- newEx.addNewSpecification();
- newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index));
- }
- }
- if (this.ex.getPcdIsDriver() != null) {
- newEx.setPcdIsDriver(this.ex.getPcdIsDriver());
- }
- this.ex = newEx;
- this.msa.setExterns(this.ex);
- }
- this.save();
- }
- }
-
- private void addListeners() {
- this.jTextFieldBaseName.getDocument().addDocumentListener(this);
- this.jTextFieldGuid.getDocument().addDocumentListener(this);
- this.jTextFieldAbstract.getDocument().addDocumentListener(this);
- this.jTextAreaCopyright.getDocument().addDocumentListener(this);
- this.jTextAreaDescription.getDocument().addDocumentListener(this);
- this.jTextAreaLicense.getDocument().addDocumentListener(this);
- this.jTextFieldOutputFileBasename.getDocument().addDocumentListener(this);
- this.jTextFieldSpecification.getDocument().addDocumentListener(this);
- this.jTextFieldURL.getDocument().addDocumentListener(this);
- this.jTextFieldVersion.getDocument().addDocumentListener(this);
-
- this.jComboBoxModuleType.addItemListener(this);
-
- this.jCheckBoxIa32.addItemListener(this);
- this.jCheckBoxX64.addItemListener(this);
- this.jCheckBoxIpf.addItemListener(this);
- this.jCheckBoxEbc.addItemListener(this);
- this.jCheckBoxArm.addItemListener(this);
- this.jCheckBoxPpc.addItemListener(this);
-
- this.jCheckBoxPcd.addItemListener(this);
-
- this.jCheckBoxFlashMap.addItemListener(this);
- }
-
- public void insertUpdate(DocumentEvent e) {
- this.omt.setSaved(false);
- }
-
- public void removeUpdate(DocumentEvent e) {
- this.omt.setSaved(false);
- }
-
- public void changedUpdate(DocumentEvent e) {
- // Do nothing
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java
deleted file mode 100644
index 5b5f49dc59..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java
+++ /dev/null
@@ -1,445 +0,0 @@
-/** @file
- <<The file is used to create, update BootModes of MSA file>>
-
- <<The BootModesDlg is called to add or edit a Module's Boot Modes definitions.>>
-
- Copyright (c) 2006, 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.
-
- Package Name: Tools
- Module Name: FrameworkWizard
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update BootModes of MSA/MBD file
- *
- * It extends IDialog
- *
- */
-public class BootModesDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -3888558623432442561L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelBootModeName = null;
-
- private JComboBox jComboBoxBootModeName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private BootModesIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jComboBoxBootModeName
- *
- * @return javax.swing.JComboBox jComboBoxBootModeName
- *
- */
- private JComboBox getJComboBoxBootModeName() {
- if (jComboBoxBootModeName == null) {
- jComboBoxBootModeName = new JComboBox();
- jComboBoxBootModeName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxBootModeName
- .setToolTipText("<html><table>"
- + "<tr><td>FULL</td><td>Boot with full configuration</td></tr>"
- + "<tr><td>MINIMAL</td><td>Boot with minimal configuration</td></tr>"
- + "<tr><td>NO_CHANGE</td><td>Boot assuming no configuration changes</td></tr>"
- + "<tr><td>DIAGNOSTICS</td><td>Boot with full configuration plus diagnostics</td></tr>"
- + "<tr><td>DEFAULT</td><td>Boot with default settings</td></tr>"
- + "<tr><td>BOOT_ON_S#_RESUME</td><td>where # is 2, 3, 4 or 5</td></tr>"
- + "<tr><td>FLASH_UPDATE</td><td>Boot on flash update</td></tr>"
- + "<tr><td>RECOVERY</td><td>Boot in recovery mode</td></tr>"
- + "</table></html>");
- }
- return jComboBoxBootModeName;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Indicates Supports the specified boot mode</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Indicates Supports the specified boot mode on some execution paths</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Always changes the boot mode</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Change the boot mode sometimes</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- * This method initializes jScrollPaneHelpText
- *
- * @return javax.swing.JScrollPane
- *
- */
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 235);
- this.setContentPane(getJScrollPane());
- this.setTitle("Boot Modes");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inBootModesId
- *
- */
- private void init(BootModesIdentification inBootModesId, ModuleIdentification mid) {
- init();
- this.id = inBootModesId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- if (this.id != null) {
- this.jComboBoxBootModeName.setSelectedItem(id.getName());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inBootModesIdentification
- * @param iFrame
- *
- */
- public BootModesDlg(BootModesIdentification inBootModesIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inBootModesIdentification, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jComboBoxBootModeName.setEnabled(!isView);
- this.jComboBoxUsage.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelBootModeName = new JLabel();
- jLabelBootModeName.setText("Boot Mode Name");
- jLabelBootModeName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Archectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- jContentPane.add(jLabelBootModeName, null);
- jContentPane.add(getJComboBoxBootModeName(), null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
-
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes BootModeName groups and Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames());
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVBootModeUsage());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentBootModes();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Boot Modes", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private BootModesIdentification getCurrentBootModes() {
- String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString();
- String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
- String arg4 = this.jTextAreaHelpText.getText();
- id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);
- return id;
- }
-
- public BootModesIdentification getId() {
- return id;
- }
-
- public void setId(BootModesIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BuildOptionsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BuildOptionsDlg.java
deleted file mode 100644
index a4bad7e40a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BuildOptionsDlg.java
+++ /dev/null
@@ -1,495 +0,0 @@
-/** @file
-
- The file is used to create, update SourceFiles section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.BuildOptions.BuildOptionsIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update SourceFiles section of the MSA file
- *
- * It extends IDialog
- *
- **/
-public class BuildOptionsDlg extends IDialog {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6765742852142775378L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelFileName = null;
-
- private JTextField jTextFieldFileOption = null;
-
- private JLabel jLabelToolChainFamily = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelTagName = null;
-
- private JTextField jTextFieldTagName = null;
-
- private JLabel jLabelToolCode = null;
-
- private JTextField jTextFieldToolCode = null;
-
- private IComboBox iComboBoxToolCode = null;
-
- private JTextField jTextFieldToolChainFamily = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPaneBuildTargets = null;
-
- private ICheckBoxList iCheckBoxListBuildTargets = null;
-
- //
- // Not used by UI
- //
- private BuildOptionsIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private JLabel jLabelBuildTargets = null;
-
- /**
- This method initializes jTextFieldFileOption
-
- @return javax.swing.JTextField jTextFieldFileOption
-
- **/
- private JTextField getJTextFieldSourceFilesDirectory() {
- if (jTextFieldFileOption == null) {
- jTextFieldFileOption = new JTextField();
- jTextFieldFileOption.setBounds(new java.awt.Rectangle(168, 12, 340, 20));
- jTextFieldFileOption.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldFileOption.setToolTipText("Path is relative to the MSA file and must include the file name");
- }
- return jTextFieldFileOption;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextFieldTagName
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldTagName() {
- if (jTextFieldTagName == null) {
- jTextFieldTagName = new JTextField();
- jTextFieldTagName.setBounds(new java.awt.Rectangle(168, 37, 340, 20));
- jTextFieldTagName.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldTagName.setToolTipText("You may specify a specific tool chain tag name, such as BILL1");
- }
- return jTextFieldTagName;
- }
-
- private IComboBox getIComboBoxToolCode() {
- if (iComboBoxToolCode == null) {
- iComboBoxToolCode = new IComboBox();
- iComboBoxToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20));
- iComboBoxToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
- iComboBoxToolCode.setToolTipText("<html>You may select a specific tool command from drop down list,<br>"
- + "or you can DOUBLE-CLICK this field to enter your customized<br>"
- + "tool command.<br>"
- + "Press ENTER to save your input or press ESCAPE to quit</html>");
- }
- return iComboBoxToolCode;
- }
-
- /**
- * This method initializes jTextFieldToolCode
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolCode() {
- if (jTextFieldToolCode == null) {
- jTextFieldToolCode = new JTextField();
- jTextFieldToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20));
- jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM");
- jTextFieldToolCode.setVisible(false);
- }
- return jTextFieldToolCode;
- }
-
- /**
- * This method initializes jTextFieldToolChainFamily
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolChainFamily() {
- if (jTextFieldToolChainFamily == null) {
- jTextFieldToolChainFamily = new JTextField();
- jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(168, 87, 340, 20));
- jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldToolChainFamily.setToolTipText("You may specify a specific tool chain family, such as GCC");
- }
- return jTextFieldToolChainFamily;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(317, 202, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(412, 202, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes iCheckBoxListArch
-
- @return ICheckBoxList
- **/
- private ICheckBoxList getICheckBoxListSupModuleList() {
- if (iCheckBoxListBuildTargets == null) {
- iCheckBoxListBuildTargets = new ICheckBoxList();
- }
- return iCheckBoxListBuildTargets;
- }
-
- /**
- This method initializes jScrollPaneBuildTargets
-
- @return javax.swing.JScrollPane
-
- **/
- private JScrollPane getJScrollPaneBuildTargets() {
- if (jScrollPaneBuildTargets == null) {
- jScrollPaneBuildTargets = new JScrollPane();
- jScrollPaneBuildTargets.setBounds(new java.awt.Rectangle(168, 137, 340, 40));
- jScrollPaneBuildTargets.setPreferredSize(new java.awt.Dimension(340, 40));
- jScrollPaneBuildTargets.setViewportView(getICheckBoxListSupModuleList());
- }
- return jScrollPaneBuildTargets;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public BuildOptionsDlg(BuildOptionsIdentification inBuildOptionsIdentification, IFrame iFrame,
- ModuleIdentification mid) {
- super(iFrame, true);
- init(inBuildOptionsIdentification, mid);
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(525, 270);
- this.setContentPane(getJScrollPane());
- this.setTitle("Source Files");
- this.setViewMode(false);
- this.centerWindow();
- Tools.generateComboBoxByVector(iComboBoxToolCode, ed.getVToolCode());
- this.iCheckBoxListBuildTargets.setAllItems(ed.getVBuildTargets());
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
-
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles
-
- **/
- private void init(BuildOptionsIdentification inBuildOptionsIdentification, ModuleIdentification mid) {
- init();
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- if (inBuildOptionsIdentification != null) {
- this.jTextFieldFileOption.setText(inBuildOptionsIdentification.getOption());
- this.jTextFieldTagName.setText(inBuildOptionsIdentification.getTagName());
-
- //
- // Generate Tool Code selection list
- //
- Vector<String> v = ed.getVToolCode();
- boolean isFind = false;
- String strToolCode = inBuildOptionsIdentification.getToolCode();
-
- //
- // If the input value is not in the default list, add it to the list
- //
- if (strToolCode != null) {
- for (int index = 0; index < v.size(); index++) {
- if (v.elementAt(index).equals(strToolCode)) {
- isFind = true;
- break;
- }
- }
- if (!isFind && !isEmpty(strToolCode)) {
- v.addElement(strToolCode);
- }
- }
-
- Tools.generateComboBoxByVector(iComboBoxToolCode, v);
- this.iComboBoxToolCode.setSelectedItem(strToolCode);
-
- this.jTextFieldToolChainFamily.setText(inBuildOptionsIdentification.getToolChainFamily());
-
- this.jArchCheckBox.setSelectedItems(inBuildOptionsIdentification.getSupArchList());
-
- this.iCheckBoxListBuildTargets.setAllItemsUnchecked();
- this.iCheckBoxListBuildTargets.initCheckedItem(true, inBuildOptionsIdentification.getBuildTargets());
- }
- }
-
- /**
- Disable all components when the mode is view
-
- @param isView true - The view mode; false - The non-view mode
-
- **/
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jTextFieldFileOption.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelBuildTargets = new JLabel();
- jLabelBuildTargets.setBounds(new java.awt.Rectangle(12, 137, 155, 20));
- jLabelBuildTargets.setText("Build Targets");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 112, 340, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(340, 20));
- jLabelToolCode = new JLabel();
- jLabelToolCode.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelToolCode.setText("Tool Code");
- jLabelTagName = new JLabel();
- jLabelTagName.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelTagName.setText("Tag Name");
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 112, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelToolChainFamily = new JLabel();
- jLabelToolChainFamily.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelToolChainFamily.setText("Tool Chain Family");
- jLabelFileName = new JLabel();
- jLabelFileName.setText("Option String");
- jLabelFileName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(505, 222));
-
- jContentPane.add(jLabelFileName, null);
- jContentPane.add(getJTextFieldSourceFilesDirectory(), null);
- jContentPane.add(jLabelToolChainFamily, null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jLabelTagName, null);
- jContentPane.add(getJTextFieldTagName(), null);
- jContentPane.add(jLabelToolCode, null);
- jContentPane.add(getJTextFieldToolCode(), null);
- jContentPane.add(getIComboBoxToolCode(), null);
- jContentPane.add(getJTextFieldToolChainFamily(), null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(jLabelBuildTargets, null);
- jContentPane.add(getJScrollPaneBuildTargets(), null);
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentId();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- private BuildOptionsIdentification getCurrentId() {
- String arg0 = this.jTextFieldFileOption.getText();
- Vector<String> arg1 = this.iCheckBoxListBuildTargets.getAllCheckedItemsString();
- String arg2 = this.jTextFieldToolChainFamily.getText();
- String arg3 = this.jTextFieldTagName.getText();
- String arg4 = this.iComboBoxToolCode.getSelectedItem().toString();
- if (arg4.equals(DataType.EMPTY_SELECT_ITEM)) {
- arg4 = "";
- }
- Vector<String> arg5 = this.jArchCheckBox.getSelectedItemsVector();
-
- id = new BuildOptionsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- return id;
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean checkAdd() {
- //
- // Check Option
- //
- if (isEmpty(this.jTextFieldFileOption.getText())) {
- Log.wrn("Update Build Options", "Option String must be entered!");
- return false;
- }
-
- //
- // Check TagName
- //
- if (!isEmpty(this.jTextFieldTagName.getText())) {
- if (!DataValidation.isTagName(this.jTextFieldTagName.getText())) {
- Log.wrn("Update Build Options", "Incorrect data type for Tag Name");
- return false;
- }
- }
-
- //
- // Check ToolCode
- //
- if (!isEmpty(this.jTextFieldToolCode.getText())) {
- if (!DataValidation.isToolCode(this.jTextFieldToolCode.getText())) {
- Log.wrn("Update Build Options", "Incorrect data type for Tool Code");
- return false;
- }
- }
-
- //
- // Check ToolChainFamily
- //
- if (!isEmpty(this.jTextFieldToolChainFamily.getText())) {
- if (!DataValidation.isToolChainFamily(this.jTextFieldToolChainFamily.getText())) {
- Log.wrn("Update Build Options", "Incorrect data type for Tool Chain Family");
- return false;
- }
- }
-
- return true;
- }
-
- public BuildOptionsIdentification getId() {
- return id;
- }
-
- public void setId(BuildOptionsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java
deleted file mode 100644
index a3c6c63838..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/** @file
- <<The file is used to create, update Data Hub Record entries in a MSA file.>>
-
- <<The DataHbsDlg is a dialog called to add or edit a Data Hub Record within a MSA file.>>
-
- Copyright (c) 2006, 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.
-
- Package Name: Tools
- Module Name: FrameworkWizard
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update DataHub of the MSA file
- *
- * It extends IDialog
- *
- */
-public class DataHubsDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -3667906991966638892L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JLabel jLabelDataHubRecord = null;
-
- private JTextField jTextFieldDataHubRecord = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private DataHubsIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jTextFieldDataHubRecord
- *
- * @return javax.swing.JTextField jTextFieldDataHubRecord
- *
- */
- private JTextField getJTextFieldDataHubRecord() {
- if (jTextFieldDataHubRecord == null) {
- jTextFieldDataHubRecord = new JTextField();
- jTextFieldDataHubRecord.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jTextFieldDataHubRecord.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldDataHubRecord.setToolTipText("Enter the C Name of the Data Hub Record");
- }
- return jTextFieldDataHubRecord;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes a Data Hub Entry<br>via registering a filter driver.</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module will use a Data Hub Entry if it exists<br>via registering a filter driver</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Always logs data into the Data Hub</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Log data into the Data Hub under<br>certain circumstances</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- * This method initializes jScrollPaneHelpText
- *
- * @return javax.swing.JScrollPane
- *
- */
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 235);
- this.setContentPane(getJScrollPane());
- this.setTitle("Data Hubs");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inDataHubsId
- *
- */
- private void init(DataHubsIdentification inDataHubsId, ModuleIdentification mid) {
- init();
- this.id = inDataHubsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- if (this.id != null) {
- this.jTextFieldDataHubRecord.setText(id.getName());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inDataHubsIdentification
- * @param iFrame
- *
- */
- public DataHubsDlg(DataHubsIdentification inDataHubsIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inDataHubsIdentification, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jTextFieldDataHubRecord.setEnabled(!isView);
- this.jComboBoxUsage.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelDataHubRecord = new JLabel();
- jLabelDataHubRecord.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jLabelDataHubRecord.setText("Data Hub Record");
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- jContentPane.add(jLabelDataHubRecord, null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(jLabelArch, null);
-
- jContentPane.add(getJTextFieldDataHubRecord(), null);
- jContentPane.add(getJComboBoxUsage(), null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
-
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentDataHubs();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check DataHubRecord
- //
- if (isEmpty(this.jTextFieldDataHubRecord.getText())) {
- Log.wrn("Update Hubs", "Data Hub Record must be entered!");
- return false;
- }
-
- if (!isEmpty(this.jTextFieldDataHubRecord.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldDataHubRecord.getText())) {
- Log.wrn("Update Hubs", "Incorrect data type for Data Hub Record");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Hubs", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private DataHubsIdentification getCurrentDataHubs() {
- String arg0 = this.jTextFieldDataHubRecord.getText();
- String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
- String arg4 = this.jTextAreaHelpText.getText();
-
- id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
- return id;
- }
-
- public DataHubsIdentification getId() {
- return id;
- }
-
- public void setId(DataHubsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java
deleted file mode 100644
index 10e3a174ca..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/** @file
-
- The file is used to create, update Events section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Events.EventsIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Events section of the MSA file
- * It extends IDialog
- *
- * @since ModuleEditor 1.0
- *
- */
-public class EventsDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -4396143706422842331L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelEventType = null;
-
- private JLabel jLabelC_Name = null;
-
- private IComboBox iComboBoxGuidC_Name = null;
-
- private JLabel jLabelUsage = null;
-
- private JLabel jLabelGroup = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JComboBox jComboBoxEventGroup = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private JComboBox jComboBoxEventsType = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelArch = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private EventsIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jComboBoxType
- *
- * @return javax.swing.JComboBox jComboBoxType
- *
- */
- private JComboBox getJComboBoxEventsType() {
- if (jComboBoxEventsType == null) {
- jComboBoxEventsType = new JComboBox();
- jComboBoxEventsType.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxEventsType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxEventsType
- .setToolTipText("<html>Select CreateEvents if the Module has an event that is waiting to be signaled.<br>"
- + "Select SignalEvents if the Module will signal all events in an event group.<br>"
- + "NOTE: Signal events are named by GUID.</html>");
- }
- return jComboBoxEventsType;
- }
-
- /**
- * This method initializes jTextFieldC_Name
- *
- * @return javax.swing.JTextField jTextFieldC_Name
- *
- */
- private IComboBox getIComboBoxGuidC_Name() {
- if (iComboBoxGuidC_Name == null) {
- iComboBoxGuidC_Name = new IComboBox();
- iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Event");
- }
- return iComboBoxGuidC_Name;
- }
-
- /**
- * This method initializes jComboBoxEventsType
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxEventGroup() {
- if (jComboBoxEventGroup == null) {
- jComboBoxEventGroup = new JComboBox();
- jComboBoxEventGroup.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jComboBoxEventGroup.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxEventGroup.setToolTipText("Select Type of Event: Guid or Timer.");
-
- }
- return jComboBoxEventGroup;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 87, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td colspan=2 align=center><b>Create Events</b></td></tr>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module registers a notification function and REQUIRES that it be<br>"
- + "executed for the module to fully function.</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module registers a notification function and calls the function<br>"
- + "when it is signaled</td></tr><tr><td colspan=2 align=center><b>Signal Events</b></td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Module will Always signal the event</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Module will sometimes signal the event</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 182, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- * This method initializes jScrollPaneHelpText
- *
- * @return javax.swing.JScrollPane
- *
- */
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 112));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 212, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 212, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 280);
- this.setContentPane(getJScrollPane());
- this.setTitle("Events");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inEventsId
- *
- */
- private void init(EventsIdentification inEventsId, ModuleIdentification mid) {
- init();
- this.id = inEventsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log
- .wrn("Init Guid",
- "This module hasn't defined any package dependency, so there is no guid value can be added for event");
- }
- //
- // Init guids drop down list
- //
- Tools
- .generateComboBoxByVector(iComboBoxGuidC_Name,
- wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_EFI_EVENT));
-
- this.iComboBoxGuidC_Name.insertItemAt(DataType.EMPTY_SELECT_ITEM, 0);
- this.iComboBoxGuidC_Name.setSelectedIndex(0);
-
- if (this.id != null) {
- String tmpName = id.getName();
- if (isEmpty(tmpName)) {
- tmpName = DataType.EMPTY_SELECT_ITEM;
- }
-
- this.iComboBoxGuidC_Name.setSelectedItem(tmpName);
- this.jComboBoxEventsType.setSelectedItem(id.getType());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
-
- jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- this.jComboBoxEventGroup.setSelectedItem(id.getGroup());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inEventsIdentification
- * @param iFrame
- *
- */
- public EventsDlg(EventsIdentification inEventsIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inEventsIdentification, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.iComboBoxGuidC_Name.setEnabled(!isView);
- this.jComboBoxUsage.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelEventType = new JLabel();
- jLabelEventType.setText("Select Event Type");
- jLabelEventType.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("Guid C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelGroup = new JLabel();
- jLabelGroup.setText("Event Group Type");
- jLabelGroup.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
-
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(2, 87));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 112, 168, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 182, 168, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 157, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 235));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelEventType, null);
- jContentPane.add(getJComboBoxEventsType(), null);
- //jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxGuidC_Name(), null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jLabelGroup, null);
- jContentPane.add(getJComboBoxEventGroup(), null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
-
- }
- return jContentPane;
- }
-
- /**
- * This method initializes events groups and usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType());
- Tools.generateComboBoxByVector(jComboBoxEventGroup, ed.getVEventGroup());
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentEvents();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check Name
- //
- String tmpName = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- if (!tmpName.equals(DataType.EMPTY_SELECT_ITEM) && isEmpty(tmpName)) {
- if (!DataValidation.isC_NameType(this.iComboBoxGuidC_Name.getSelectedItem().toString())) {
- Log.wrn("Update Events", "Incorrect data type for Event Name");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Events", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private EventsIdentification getCurrentEvents() {
- String arg0 = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- String arg1 = this.jComboBoxEventsType.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
- String arg5 = this.jTextAreaHelpText.getText();
- String arg6 = this.jComboBoxEventGroup.getSelectedItem().toString();
- id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- return id;
- }
-
- public EventsIdentification getId() {
- return id;
- }
-
- public void setId(EventsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java
deleted file mode 100644
index 3aa9b4a297..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java
+++ /dev/null
@@ -1,948 +0,0 @@
-/** @file
-
- The file is used to create, update Externs section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Externs section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class ExternsDlg extends IDialog implements ItemListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7382008402932047191L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelName = null;
-
- private JComboBox jComboBoxType = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelSpecification = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JPanel jPanelSpecification = null;
-
- private JPanel jPanelImage = null;
-
- private JPanel jPanelDriver = null;
-
- private JPanel jPanelLibrary = null;
-
- private JPanel jPanelCallBack = null;
-
- private JLabel jLabelModuleEntryPoint = null;
-
- private JTextField jTextFieldModuleEntryPoint = null;
-
- private JLabel jLabelModuleUnloadImage = null;
-
- private JTextField jTextFieldModuleUnloadImage = null;
-
- private JLabel jLabelDriverBinding = null;
-
- private JTextField jTextFieldDriverBinding = null;
-
- private JLabel jLabelComponentName = null;
-
- private JTextField jTextFieldComponentName = null;
-
- private JLabel jLabelDriverConfig = null;
-
- private JTextField jTextFieldDriverConfig = null;
-
- private JLabel jLabelDriverDiagnostic = null;
-
- private JTextField jTextFieldDriverDiagnostic = null;
-
- private JLabel jLabelConstructor = null;
-
- private JTextField jTextFieldConstructor = null;
-
- private JLabel jLabelDestructor = null;
-
- private JTextField jTextFieldDestructor = null;
-
- private JLabel jLabelVirtualAddressMap = null;
-
- private JTextField jTextFieldVirtualAddressMap = null;
-
- private JLabel jLabelExitBootServices = null;
-
- private JTextField jTextFieldExitBootServices = null;
-
- //
- // Not used by UI
- //
- private ExternsIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private Vector<String> vArchList = new Vector<String>();
-
- /**
- This method initializes jComboBoxType
-
- @return javax.swing.JComboBox jComboBoxType
-
- **/
- private JComboBox getJComboBoxType() {
- if (jComboBoxType == null) {
- jComboBoxType = new JComboBox();
- jComboBoxType.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxType.addItemListener(this);
- }
- return jComboBoxType;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jTextFieldC_Name
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- jTextFieldSpecification = new JTextField();
- jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldSpecification;
- }
-
- /**
- This method initializes jTextFieldFeatureFlag
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 87, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(300, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(400, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jPanelSpecification
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSpecification() {
- if (jPanelSpecification == null) {
- jPanelSpecification = new JPanel();
- jPanelSpecification.setBounds(new java.awt.Rectangle(0, 37, 505, 20));
- jPanelSpecification.setLayout(null);
-
- jLabelSpecification = new JLabel();
- jLabelSpecification.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelSpecification.setText("Specification Name");
-
- jPanelSpecification.add(jLabelSpecification, null);
- jPanelSpecification.add(getJTextFieldSpecification(), null);
- }
- return jPanelSpecification;
- }
-
- /**
- * This method initializes jPanelImage
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelImage() {
- if (jPanelImage == null) {
- jLabelModuleUnloadImage = new JLabel();
- jLabelModuleUnloadImage.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
- jLabelModuleUnloadImage.setText("Module Unload Image");
- jLabelModuleEntryPoint = new JLabel();
- jLabelModuleEntryPoint.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelModuleEntryPoint.setText("Module Entry Point");
- jPanelImage = new JPanel();
- jPanelImage.setBounds(new java.awt.Rectangle(0, 37, 505, 45));
- jPanelImage.setLayout(null);
- jPanelImage.add(jLabelModuleEntryPoint, null);
- jPanelImage.add(getJTextFieldModuleEntryPoint(), null);
- jPanelImage.add(jLabelModuleUnloadImage, null);
- jPanelImage.add(getJTextFieldModuleUnloadImage(), null);
- }
- return jPanelImage;
- }
-
- /**
- * This method initializes jPanelDriver
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelDriver() {
- if (jPanelDriver == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 0));
- jLabelDriverDiagnostic = new JLabel();
- jLabelDriverDiagnostic.setBounds(new java.awt.Rectangle(12, 75, 140, 20));
- jLabelDriverDiagnostic.setText("Driver Diagnostic");
- jLabelDriverConfig = new JLabel();
- jLabelDriverConfig.setBounds(new java.awt.Rectangle(12, 50, 140, 20));
- jLabelDriverConfig.setText("Driver Config");
- jLabelComponentName = new JLabel();
- jLabelComponentName.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
- jLabelComponentName.setText("Component Name");
- jLabelDriverBinding = new JLabel();
- jLabelDriverBinding.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelDriverBinding.setText("Driver Binding");
- jPanelDriver = new JPanel();
- jPanelDriver.setBounds(new java.awt.Rectangle(0, 37, 505, 95));
- jPanelDriver.setLayout(null);
- jPanelDriver.add(jStarLabel1, null);
- jPanelDriver.add(jLabelDriverBinding, null);
- jPanelDriver.add(getJTextFieldDriverBinding(), null);
- jPanelDriver.add(jLabelComponentName, null);
- jPanelDriver.add(getJTextFieldComponentName(), null);
- jPanelDriver.add(jLabelDriverConfig, null);
- jPanelDriver.add(getJTextFieldDriverConfig(), null);
- jPanelDriver.add(jLabelDriverDiagnostic, null);
- jPanelDriver.add(getJTextFieldDriverDiagnostic(), null);
- }
- return jPanelDriver;
- }
-
- /**
- * This method initializes jPanelLibrary
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibrary() {
- if (jPanelLibrary == null) {
- jLabelDestructor = new JLabel();
- jLabelDestructor.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
- jLabelDestructor.setText("Destructor");
- jLabelConstructor = new JLabel();
- jLabelConstructor.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelConstructor.setText("Constructor");
- jPanelLibrary = new JPanel();
- jPanelLibrary.setBounds(new java.awt.Rectangle(0, 37, 505, 45));
- jPanelLibrary.setLayout(null);
- jPanelLibrary.add(jLabelConstructor, null);
- jPanelLibrary.add(getJTextFieldConstructor(), null);
- jPanelLibrary.add(jLabelDestructor, null);
- jPanelLibrary.add(getJTextFieldDestructor(), null);
- }
- return jPanelLibrary;
- }
-
- /**
- * This method initializes jPanelCallBack
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelCallBack() {
- if (jPanelCallBack == null) {
- jLabelExitBootServices = new JLabel();
- jLabelExitBootServices.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
- jLabelExitBootServices.setText("Exit Boot Services");
- jLabelVirtualAddressMap = new JLabel();
- jLabelVirtualAddressMap.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelVirtualAddressMap.setText("Virtual Address Map");
- jPanelCallBack = new JPanel();
- jPanelCallBack.setBounds(new java.awt.Rectangle(0, 37, 505, 45));
- jPanelCallBack.setLayout(null);
- jPanelCallBack.add(jLabelVirtualAddressMap, null);
- jPanelCallBack.add(getJTextFieldVirtualAddressMap(), null);
- jPanelCallBack.add(jLabelExitBootServices, null);
- jPanelCallBack.add(getJTextFieldExitBootServices(), null);
- }
- return jPanelCallBack;
- }
-
- /**
- * This method initializes jTextFieldModuleEntryPoint
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldModuleEntryPoint() {
- if (jTextFieldModuleEntryPoint == null) {
- jTextFieldModuleEntryPoint = new JTextField();
- jTextFieldModuleEntryPoint.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldModuleEntryPoint;
- }
-
- /**
- * This method initializes jTextFieldModuleUnloadImage
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldModuleUnloadImage() {
- if (jTextFieldModuleUnloadImage == null) {
- jTextFieldModuleUnloadImage = new JTextField();
- jTextFieldModuleUnloadImage.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
- }
- return jTextFieldModuleUnloadImage;
- }
-
- /**
- * This method initializes jTextFieldDriverBinding
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDriverBinding() {
- if (jTextFieldDriverBinding == null) {
- jTextFieldDriverBinding = new JTextField();
- jTextFieldDriverBinding.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldDriverBinding;
- }
-
- /**
- * This method initializes jTextFieldComponentName
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldComponentName() {
- if (jTextFieldComponentName == null) {
- jTextFieldComponentName = new JTextField();
- jTextFieldComponentName.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
- }
- return jTextFieldComponentName;
- }
-
- /**
- * This method initializes jTextFieldDriverConfig
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDriverConfig() {
- if (jTextFieldDriverConfig == null) {
- jTextFieldDriverConfig = new JTextField();
- jTextFieldDriverConfig.setBounds(new java.awt.Rectangle(168, 50, 320, 20));
- }
- return jTextFieldDriverConfig;
- }
-
- /**
- * This method initializes jTextFieldDriverDiagnostic
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDriverDiagnostic() {
- if (jTextFieldDriverDiagnostic == null) {
- jTextFieldDriverDiagnostic = new JTextField();
- jTextFieldDriverDiagnostic.setBounds(new java.awt.Rectangle(168, 75, 320, 20));
- }
- return jTextFieldDriverDiagnostic;
- }
-
- /**
- * This method initializes jTextFieldConstructor
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldConstructor() {
- if (jTextFieldConstructor == null) {
- jTextFieldConstructor = new JTextField();
- jTextFieldConstructor.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldConstructor;
- }
-
- /**
- * This method initializes jTextFieldDestructor
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDestructor() {
- if (jTextFieldDestructor == null) {
- jTextFieldDestructor = new JTextField();
- jTextFieldDestructor.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
- }
- return jTextFieldDestructor;
- }
-
- /**
- * This method initializes jTextFieldVirtualAddressMap
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVirtualAddressMap() {
- if (jTextFieldVirtualAddressMap == null) {
- jTextFieldVirtualAddressMap = new JTextField();
- jTextFieldVirtualAddressMap.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldVirtualAddressMap;
- }
-
- /**
- * This method initializes jTextFieldExitBootServices
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldExitBootServices() {
- if (jTextFieldExitBootServices == null) {
- jTextFieldExitBootServices = new JTextField();
- jTextFieldExitBootServices.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
- }
- return jTextFieldExitBootServices;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(515, 250);
- this.setContentPane(getJScrollPane());
- this.setTitle("Externs");
- initFrame();
- this.centerWindow();
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inExternsId
-
- **/
- private void init(ExternsIdentification inExternsId, ModuleIdentification mid) {
- init();
- this.id = inExternsId;
-
- //
- // Init arch with module's arch
- //
- this.vArchList = wt.getModuleArch(mid);
-
- if (this.id != null) {
- String type = id.getType();
- //
- // Filter the type to lock down the type
- //
- this.jComboBoxType.removeAllItems();
- this.jComboBoxType.addItem(type);
-
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
-
- //
- // Init specification
- //
- if (type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- this.jTextFieldSpecification.setText(id.getName0());
- }
-
- //
- // Init image
- //
- if (type.equals(EnumerationData.EXTERNS_IMAGE)) {
- this.jTextFieldModuleEntryPoint.setText(id.getName0());
- this.jTextFieldModuleUnloadImage.setText(id.getName1());
- }
-
- //
- // Init library
- //
- if (type.equals(EnumerationData.EXTERNS_LIBRARY)) {
- this.jTextFieldConstructor.setText(id.getName0());
- this.jTextFieldDestructor.setText(id.getName1());
- }
-
- //
- // Init driver
- //
- if (type.equals(EnumerationData.EXTERNS_DRIVER)) {
- this.jTextFieldDriverBinding.setText(id.getName0());
- this.jTextFieldComponentName.setText(id.getName1());
- this.jTextFieldDriverConfig.setText(id.getName2());
- this.jTextFieldDriverDiagnostic.setText(id.getName3());
- }
-
- //
- // Init library
- //
- if (type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
- this.jTextFieldVirtualAddressMap.setText(id.getName0());
- this.jTextFieldExitBootServices.setText(id.getName1());
- }
- }
- }
-
- /**
- This is the override edit constructor
-
- @param inBootModesIdentification
- @param iFrame
-
- **/
- public ExternsDlg(ExternsIdentification inExternsIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inExternsIdentification, mid);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jLabelName = new JLabel();
- jLabelName.setText("Choose Extern Type");
- jLabelName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(505, 200));
-
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJComboBoxType(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
-
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
-
- jContentPane.add(getJPanelSpecification(), null);
- jContentPane.add(getJPanelImage(), null);
- jContentPane.add(getJPanelDriver(), null);
- jContentPane.add(getJPanelLibrary(), null);
- jContentPane.add(getJPanelCallBack(), null);
- }
- return jContentPane;
- }
-
- /**
- This method initializes Usage type and Externs type
-
- **/
- private void initFrame() {
- Tools.generateComboBoxByVector(this.jComboBoxType, ed.getVExternTypes());
- this.jPanelSpecification.setVisible(true);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.setVisible(false);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- this.getCurrentExterns();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check specification
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- if (isEmpty(this.jTextFieldSpecification.getText())) {
- Log.wrn("Update Externs", "Please type specification's name");
- return false;
- }
- if (!DataValidation.isSentence(this.jTextFieldSpecification.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Specification");
- return false;
- }
-
- //
- // No need to check feature flag, return true directly here.
- //
- return true;
- }
-
- //
- // Check image
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_IMAGE)) {
- if (isEmpty(this.jTextFieldModuleEntryPoint.getText())
- && isEmpty(this.jTextFieldModuleUnloadImage.getText())) {
- Log.wrn("Update Externs", "At least one of ModuleEntryPoint or ModuleUnloadImage should have a value");
- return false;
- }
- if (!isEmpty(this.jTextFieldModuleEntryPoint.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldModuleEntryPoint.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Module Entry Point");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldModuleUnloadImage.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldModuleUnloadImage.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Module Unload Image");
- return false;
- }
- }
- }
-
- //
- // Check library
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_LIBRARY)) {
- if (isEmpty(this.jTextFieldConstructor.getText()) && isEmpty(this.jTextFieldDestructor.getText())) {
- Log.wrn("Update Externs", "At least one of Constructor or Destructor should have a value");
- return false;
- }
- if (isEmpty(this.jTextFieldConstructor.getText()) && !isEmpty(this.jTextFieldDestructor.getText())) {
- Log.wrn("Update Externs", "You must define a Constructor at the same time when you declare a Destructor");
- return false;
- }
- if (!isEmpty(this.jTextFieldConstructor.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldConstructor.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Constructor");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldDestructor.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldDestructor.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Destructor");
- return false;
- }
- }
- }
-
- //
- // Check driver
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_DRIVER)) {
- if (isEmpty(this.jTextFieldDriverBinding.getText())) {
- Log.wrn("Update Externs", "DriverBinding must have a value");
- return false;
- }
- if (!isEmpty(this.jTextFieldDriverBinding.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldDriverBinding.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for DriverBinding");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldComponentName.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldComponentName.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for ComponentName");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldDriverConfig.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldDriverConfig.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for DriverConfig");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldDriverDiagnostic.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldDriverDiagnostic.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for DriverDiagnostic");
- return false;
- }
- }
- }
-
- //
- // Check call back
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- if (isEmpty(this.jTextFieldVirtualAddressMap.getText())
- && isEmpty(this.jTextFieldExitBootServices.getText())) {
- Log.wrn("Update Externs", "At least one of VirtualAddressMap or ExitBootServices should have a value");
- return false;
- }
- if (!isEmpty(this.jTextFieldVirtualAddressMap.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldVirtualAddressMap.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Virtual Address Map");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldExitBootServices.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldExitBootServices.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Exit Boot Services");
- return false;
- }
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private ExternsIdentification getCurrentExterns() {
- String arg0 = "";
- String arg1 = "";
- String arg2 = "";
- String arg3 = "";
-
- String type = this.jComboBoxType.getSelectedItem().toString();
- String featureFlag = this.jTextFieldFeatureFlag.getText();
- Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();
-
- if (type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- arg0 = this.jTextFieldSpecification.getText();
- id = new ExternsIdentification(arg0, type);
- }
-
- if (type.equals(EnumerationData.EXTERNS_IMAGE)) {
- arg0 = this.jTextFieldModuleEntryPoint.getText();
- arg1 = this.jTextFieldModuleUnloadImage.getText();
- id = new ExternsIdentification(arg0, arg1, type, featureFlag, arch);
- }
-
- if (type.equals(EnumerationData.EXTERNS_LIBRARY)) {
- arg0 = this.jTextFieldConstructor.getText();
- arg1 = this.jTextFieldDestructor.getText();
- id = new ExternsIdentification(arg0, arg1, type, featureFlag, arch);
- }
-
- if (type.equals(EnumerationData.EXTERNS_DRIVER)) {
- arg0 = this.jTextFieldDriverBinding.getText();
- arg1 = this.jTextFieldComponentName.getText();
- arg2 = this.jTextFieldDriverConfig.getText();
- arg3 = this.jTextFieldDriverDiagnostic.getText();
- id = new ExternsIdentification(arg0, arg1, arg2, arg3, type, featureFlag, arch);
- }
-
- if (type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
- arg0 = this.jTextFieldVirtualAddressMap.getText();
- arg1 = this.jTextFieldExitBootServices.getText();
- id = new ExternsIdentification(arg0, arg1, type, featureFlag, arch);
- }
-
- return id;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- *
- * Reflesh the frame when selected item changed
- *
- */
- public void itemStateChanged(ItemEvent arg0) {
- if (arg0.getSource() == jComboBoxType && arg0.getStateChange() == ItemEvent.SELECTED) {
- if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- this.jPanelSpecification.setVisible(true);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.setVisible(false);
- this.jLabelArch.setEnabled(false);
- this.jArchCheckBox.setAllItemsEnabled(false);
- this.jLabelArch.setLocation(12, 62);
- this.jArchCheckBox.setLocation(168, 62);
- this.jLabelFeatureFlag.setLocation(12, 87);
- this.jTextFieldFeatureFlag.setLocation(168, 87);
- } else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_IMAGE)) {
- this.jPanelSpecification.setVisible(false);
- this.jPanelImage.setVisible(true);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.setVisible(false);
- this.jLabelArch.setEnabled(true);
- this.jArchCheckBox.setEnabledItems(this.vArchList);
- this.jLabelArch.setLocation(12, 87);
- this.jArchCheckBox.setLocation(168, 87);
- this.jLabelFeatureFlag.setLocation(12, 112);
- this.jTextFieldFeatureFlag.setLocation(168, 112);
- } else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_LIBRARY)) {
- this.jPanelSpecification.setVisible(false);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(true);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.setVisible(false);
- this.jLabelArch.setEnabled(true);
- this.jArchCheckBox.setEnabledItems(this.vArchList);
- this.jLabelArch.setLocation(12, 87);
- this.jArchCheckBox.setLocation(168, 87);
- this.jLabelFeatureFlag.setLocation(12, 112);
- this.jTextFieldFeatureFlag.setLocation(168, 112);
- } else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_DRIVER)) {
- this.jPanelSpecification.setVisible(false);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(true);
- this.jPanelCallBack.setVisible(false);
- this.jLabelArch.setEnabled(true);
- this.jArchCheckBox.setEnabledItems(this.vArchList);
- this.jLabelArch.setLocation(12, 137);
- this.jArchCheckBox.setLocation(168, 137);
- this.jLabelFeatureFlag.setLocation(12, 162);
- this.jTextFieldFeatureFlag.setLocation(168, 162);
- } else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- this.jPanelSpecification.setVisible(false);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.setVisible(true);
- this.jLabelArch.setEnabled(true);
- this.jArchCheckBox.setEnabledItems(this.vArchList);
- this.jLabelArch.setLocation(12, 87);
- this.jArchCheckBox.setLocation(168, 87);
- this.jLabelFeatureFlag.setLocation(12, 112);
- this.jTextFieldFeatureFlag.setLocation(168, 112);
- }
- }
- }
-
- public ExternsIdentification getId() {
- return id;
- }
-
- public void setId(ExternsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java
deleted file mode 100644
index cf22e2c102..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java
+++ /dev/null
@@ -1,465 +0,0 @@
-/** @file
- <<The file is used to create, update Guids of the MSA file>>
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Guids of the MSA file
- *
- * It extends IDialog
- *
- */
-public class GuidsDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = 6710858997766979803L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelC_Name = null;
-
- private IComboBox iComboBoxCName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private GuidsIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jTextFieldC_Name
- *
- * @return javax.swing.JTextField jTextFieldC_Name
- *
- */
- private IComboBox getIComboBoxCName() {
- if (iComboBoxCName == null) {
- iComboBoxCName = new IComboBox();
- iComboBoxCName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- iComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxCName.setToolTipText("Select the C Name of the GUID");
- }
- return iComboBoxCName;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the GUID</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module will use the GUID only if it is present</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Module always produces the GUID</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Module will sometimes produce the GUID</td></tr>"
- + "<tr><td>DEFAULT</td><td>Default is the the GUID that specified the<br>instance of the package</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- *
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- *
- * This method initializes jScrollPaneHelpText
- *
- * @return javax.swing.JScrollPane jScrollPaneHelpText
- *
- **/
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- *
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 235);
- this.setContentPane(getJScrollPane());
- this.setTitle("Guids");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- *
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inGuidsId
- *
- */
- private void init(GuidsIdentification inGuidsId, ModuleIdentification mid) {
- init();
- this.id = inGuidsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Guid", "This module hasn't defined any package dependency, so there is no guid can be added");
- }
-
- Tools.generateComboBoxByVector(this.iComboBoxCName,
- wt.getAllGuidDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid),
- EnumerationData.GUID_TYPE_GUID));
-
-
- if (this.id != null) {
- this.iComboBoxCName.setSelectedItem(id.getName());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inGuidsIdentification
- * @param iFrame
- *
- */
- public GuidsDlg(GuidsIdentification inGuidsIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inGuidsIdentification, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jComboBoxUsage.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("Select GUID's C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxCName(), null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVGuidUsage());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentGuids();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check Name
- //
- if (this.iComboBoxCName.getSelectedItem() == null) {
- Log.wrn("Update Guids", "Please select one Guid Name");
- return false;
- }
-
- if (!isEmpty(this.iComboBoxCName.getSelectedItem().toString())) {
- if (!DataValidation.isC_NameType(this.iComboBoxCName.getSelectedItem().toString())) {
- Log.wrn("Update Guids", "Incorrect data type for Guid Name");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Guids", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private GuidsIdentification getCurrentGuids() {
- String arg0 = this.iComboBoxCName.getSelectedItem().toString();
- String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
- String arg4 = this.jTextAreaHelpText.getText();
-
- id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
- return id;
- }
-
- public GuidsIdentification getId() {
- return id;
- }
-
- public void setId(GuidsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java
deleted file mode 100644
index 906be0b9ff..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/** @file
-
- The file is used to create, update Hii Packages section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPackagesIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Hii Packages of the MSA file
- *
- * It extends IDialog
- *
- */
-public class HiiPackagesDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -6851574146786158116L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelName = null;
-
- private JTextField jTextFieldName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private HiiPackagesIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- *
- * This method initializes jTextFieldName
- *
- * @return javax.swing.JTextField jTextFieldName
- *
- */
- private JTextField getJTextFieldName() {
- if (jTextFieldName == null) {
- jTextFieldName = new JTextField();
- jTextFieldName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jTextFieldName.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldName.setToolTipText("Enter the C Name of the HII Package");
- }
- return jTextFieldName;
- }
-
- /**
- *
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Hii is always registered</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Some executions paths will require the Hii to be registered</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- *
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- *
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- *
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- *
- * This method initializes jTextAreaHelpText
- *
- * @return javax.swing.JTextArea jTextAreaHelpText
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- *
- * This method initializes jScrollPaneHelpText
- *
- * @return javax.swing.JScrollPane
- *
- */
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- *
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- *
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- *
- * This method initializes this
- *
- **/
- private void init() {
- this.setSize(505, 235);
- this.setContentPane(getJScrollPane());
- this.setTitle("Hii Packages");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inHiiPackagesId
- *
- **/
- private void init(HiiPackagesIdentification inHiiPackagesId, ModuleIdentification mid) {
- init();
- this.id = inHiiPackagesId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- if (this.id != null) {
- this.jTextFieldName.setText(id.getName());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inHiiPackagesIdentification
- * @param iFrame
- *
- **/
- public HiiPackagesDlg(HiiPackagesIdentification inHiiPackagesIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inHiiPackagesIdentification, mid);
- }
-
- /**
- *
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- **/
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jTextFieldName.setEnabled(!isView);
- this.jComboBoxUsage.setEnabled(!isView);
- }
- }
-
- /**
- *
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelName = new JLabel();
- jLabelName.setText("Hii Package C Name");
- jLabelName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJTextFieldName(), null);
-
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
-
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
-
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
-
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jArchCheckBox, null);
-
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- *
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHiiPackageUsage());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentHiiPackages();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- *
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check Hii Package Name
- //
- if (isEmpty(this.jTextFieldName.getText())) {
- Log.wrn("Update Hii Packages", "Hii Package Name Record must be entered!");
- return false;
- }
-
- if (!isEmpty(this.jTextFieldName.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldName.getText())) {
- Log.wrn("Update Hii Packages", "Incorrect data type for Hii Package Name");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Hii Packages", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private HiiPackagesIdentification getCurrentHiiPackages() {
- String arg0 = this.jTextFieldName.getText();
- String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
- String arg4 = this.jTextAreaHelpText.getText();
-
- id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);
- return id;
- }
-
- public HiiPackagesIdentification getId() {
- return id;
- }
-
- public void setId(HiiPackagesIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java
deleted file mode 100644
index caf1649984..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/** @file
-
- The file is used to create, update Hob section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Hobs.HobsIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Hob of the MSA file
- *
- * It extends IDialog
- *
- */
-public class HobsDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -553473437579358325L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelC_Name = null;
-
- private IComboBox iComboBoxGuidC_Name = null;
-
- private JLabel jLabelUsage = null;
-
- private JLabel jLabelHobType = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JComboBox jComboBoxHobType = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private HobsIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField jTextFieldC_Name
- *
- */
- private IComboBox getIComboBoxGuidC_Name() {
- if (iComboBoxGuidC_Name == null) {
- iComboBoxGuidC_Name = new IComboBox();
- iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Hob");
- }
- return iComboBoxGuidC_Name;
- }
-
- /**
- * This method initializes jComboBoxHobType
- *
- * @return javax.swing.JComboBox jComboBoxHobType
- *
- */
- private JComboBox getJComboBoxHobType() {
- if (jComboBoxHobType == null) {
- jComboBoxHobType = new JComboBox();
- jComboBoxHobType.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxHobType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxHobType
- .setToolTipText("<html><table>"
- + "<tr><td>PHIT</td><td>EFI_HOB_TYPE_HANDOFF</td></tr>"
- + "<tr><td>MEMORY_ALLOCATION</td><td>EFI_HOB_TYPE_MEMORY_ALLOCATION and $BaseName</td></tr>"
- + "<tr><td>RESOURCE_DESCRIPTOR</td><td>EFI_HOB_TYPE_RESOURCE_DESCRIPTOR</td></tr>"
- + "<tr><td>GUID_EXTENTION</td><td>EFI_HOB_TYPE_GUID_EXTENSION and BaseName of GUID</td></tr>"
- + "<tr><td>FIRMWARE_VOLUME</td><td>EFI_HOB_TYPE_FV</td></tr>"
- + "<tr><td>CPU</td><td>EFI_HOB_TYPE_CPU</td></tr>"
- + "<tr><td>POOL</td><td>EFI_HOB_TYPE_PEI_MEMORY_POOL</td></tr>"
- + "<tr><td>CAPSULE_VOLUME</td><td>EFI_HOB_TYPE_CV</td></tr>"
- + "</table></html>");
- }
- return jComboBoxHobType;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>HOB must be present in the system</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>HOB will be used if it's present</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>HOB is always produced</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>HOB will sometimes be produced by the module</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jTextFieldHelpText
- *
- * @return javax.swing.JTextField
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- * This method initializes jScrollPaneHelpText
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 87));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 260);
- this.setContentPane(getJScrollPane());
- this.setTitle("Hobs");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inHobsId
- *
- */
- private void init(HobsIdentification inHobsId, ModuleIdentification mid) {
- init();
- this.id = inHobsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log
- .wrn("Init Guid",
- "This module hasn't defined any package dependency, so there is no guid value can be added for hob");
- }
- //
- // Init guids drop down list
- //
- Tools
- .generateComboBoxByVector(iComboBoxGuidC_Name,
- wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_HOB));
- this.iComboBoxGuidC_Name.insertItemAt(DataType.EMPTY_SELECT_ITEM, 0);
- this.iComboBoxGuidC_Name.setSelectedIndex(0);
-
-
- if (this.id != null) {
- String tmpName = id.getName();
- if (isEmpty(tmpName)) {
- tmpName = DataType.EMPTY_SELECT_ITEM;
- }
- this.iComboBoxGuidC_Name.setSelectedItem(tmpName);
- this.jComboBoxHobType.setSelectedItem(id.getType());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inHobsIdentification
- * @param iFrame
- *
- */
- public HobsDlg(HobsIdentification inHobsIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inHobsIdentification, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.iComboBoxGuidC_Name.setEnabled(!isView);
- this.jComboBoxUsage.setEnabled(!isView);
- this.jComboBoxHobType.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- public JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("Hob's Guid C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelHobType = new JLabel();
- jLabelHobType.setText("Hob Type");
- jLabelHobType.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
-
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxGuidC_Name(), null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelHobType, null);
- jContentPane.add(getJComboBoxHobType(), null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes Usage type and Hob type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage());
- Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentHobs();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check Name
- //
- String tmpName = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- if (!tmpName.equals(DataType.EMPTY_SELECT_ITEM) && isEmpty(tmpName)) {
- if (!DataValidation.isC_NameType(this.iComboBoxGuidC_Name.getSelectedItem().toString())) {
- Log.wrn("Update Hobs", "Incorrect data type for Hob Name");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Hobs", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private HobsIdentification getCurrentHobs() {
- String arg0 = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- String arg1 = this.jComboBoxHobType.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
- String arg5 = this.jTextAreaHelpText.getText();
- id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- return id;
- }
-
- public HobsIdentification getId() {
- return id;
- }
-
- public void setId(HobsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java
deleted file mode 100644
index 5c48303a26..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java
+++ /dev/null
@@ -1,589 +0,0 @@
-/** @file
-
- The file is used to create, update Library Class Definition section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.find.Find;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Library Class Definition section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class LibraryClassDefsDlg extends IDialog {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1743248695411382857L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private IComboBox iComboBoxLibraryClassName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JLabel jLabelLibraryClassName = null;
-
- private JScrollPane jScrollPane = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelRecommendedInstanceVersion = null;
-
- private JTextField jTextFieldRecommendedInstanceVersion = null;
-
- private JLabel jLabelRecommendedInstanceGuid = null;
-
- private JTextField jTextFieldRecommendedInstanceGuid = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JLabel jLabelModuleList = null;
-
- private JScrollPane jScrollPaneModuleList = null;
-
- private ICheckBoxList iCheckBoxListModule = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextField jTextFieldHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not for UI
- //
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private LibraryClassIdentification lcid = null;
-
- /**
- This method initializes jComboBoxSelect
-
- @return javax.swing.JComboBox jComboBoxSelect
-
- **/
- private IComboBox getIComboBoxLibraryClassName() {
- if (iComboBoxLibraryClassName == null) {
- iComboBoxLibraryClassName = new IComboBox();
- iComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- iComboBoxLibraryClassName.setPreferredSize(new Dimension(320, 20));
- iComboBoxLibraryClassName.setEnabled(true);
- }
- return iComboBoxLibraryClassName;
- }
-
- /**
- This method initializes jComboBoxUsage
-
- @return javax.swing.JComboBox jComboBoxUsage
-
- **/
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new Dimension(320, 20));
- }
- return jComboBoxUsage;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextFieldRecommendedInstanceVersion
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldRecommendedInstanceVersion() {
- if (jTextFieldRecommendedInstanceVersion == null) {
- jTextFieldRecommendedInstanceVersion = new JTextField();
- jTextFieldRecommendedInstanceVersion.setPreferredSize(new java.awt.Dimension(260, 20));
- jTextFieldRecommendedInstanceVersion.setSize(new java.awt.Dimension(260, 20));
- jTextFieldRecommendedInstanceVersion.setLocation(new java.awt.Point(220, 85));
- jTextFieldRecommendedInstanceVersion.setVisible(false);
- }
- return jTextFieldRecommendedInstanceVersion;
- }
-
- /**
- * This method initializes jTextFieldRecommendedInstanceGuid
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldRecommendedInstanceGuid() {
- if (jTextFieldRecommendedInstanceGuid == null) {
- jTextFieldRecommendedInstanceGuid = new JTextField();
- jTextFieldRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(220, 110, 190, 20));
- jTextFieldRecommendedInstanceGuid.setPreferredSize(new java.awt.Dimension(190, 20));
- jTextFieldRecommendedInstanceGuid.setVisible(false);
- }
- return jTextFieldRecommendedInstanceGuid;
- }
-
- /**
- * This method initializes jButtonGenerateGuid
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 112, 65, 20));
- jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));
- jButtonGenerateGuid.setText("GEN");
- jButtonGenerateGuid.setVisible(false);
- jButtonGenerateGuid.addActionListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 197, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- This method initializes iCheckBoxListArch
-
- @return ICheckBoxList
- **/
- private ICheckBoxList getICheckBoxListSupModuleList() {
- if (iCheckBoxListModule == null) {
- iCheckBoxListModule = new ICheckBoxList();
- }
- return iCheckBoxListModule;
- }
-
- /**
- This method initializes jScrollPaneModuleList
-
- @return javax.swing.JScrollPane
-
- **/
- private JScrollPane getJScrollPaneModuleList() {
- if (jScrollPaneModuleList == null) {
- jScrollPaneModuleList = new JScrollPane();
- jScrollPaneModuleList.setBounds(new java.awt.Rectangle(168, 112, 320, 80));
- jScrollPaneModuleList.setPreferredSize(new java.awt.Dimension(320, 80));
- jScrollPaneModuleList.setViewportView(getICheckBoxListSupModuleList());
- }
- return jScrollPaneModuleList;
- }
-
- /**
- This method initializes jTextFieldHelpText
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldHelpText() {
- if (jTextFieldHelpText == null) {
- jTextFieldHelpText = new JTextField();
- jTextFieldHelpText.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
- }
- return jTextFieldHelpText;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(300, 232, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(400, 232, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame,
- ModuleIdentification mid) {
- super(iFrame, true);
- init(inLibraryClassIdentification, mid);
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setContentPane(getJScrollPane());
- this.setTitle("Library Class Definitions");
- this.setBounds(new java.awt.Rectangle(0, 0, 505, 305));
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- This method initializes this
-
- **/
- private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) {
- init();
- this.lcid = inLibraryClassIdentification;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined library classes from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Library Class",
- "This module hasn't defined any package dependency, so there is no library class can be added");
- }
-
- Tools
- .generateComboBoxByVector(
- this.iComboBoxLibraryClassName,
- wt
- .getAllLibraryClassDefinitionsFromPackages(wt
- .getPackageDependenciesOfModule(mid)));
-
- if (lcid != null) {
- this.iComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());
- this.jComboBoxUsage.setSelectedItem(lcid.getUsage());
- this.jTextFieldRecommendedInstanceVersion.setText(lcid.getRecommendedInstanceVersion());
- this.jTextFieldRecommendedInstanceGuid.setText(lcid.getRecommendedInstanceGuid());
- this.jTextFieldFeatureFlag.setText(lcid.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(lcid.getSupArchList());
- this.iCheckBoxListModule.setAllItemsUnchecked();
- this.iCheckBoxListModule.initCheckedItem(true, lcid.getSupModuleList());
- this.jTextFieldHelpText.setText(lcid.getHelp());
- }
- }
-
- /**
- Disable all components when the mode is view
-
- @param isView true - The view mode; false - The non-view mode
-
- **/
- public void setViewMode(boolean isView) {
- if (isView) {
- this.iComboBoxLibraryClassName.setEnabled(!isView);
- this.jComboBoxUsage.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 87, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
- jLabelHelpText.setText("Help Text");
- jLabelModuleList = new JLabel();
- jLabelModuleList.setBounds(new java.awt.Rectangle(12, 112, 168, 20));
- jLabelModuleList.setText("Supported Module Types");
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 197, 168, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelRecommendedInstanceGuid = new JLabel();
- jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(12, 87, 200, 20));
- jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid");
- jLabelRecommendedInstanceGuid.setVisible(false);
- jLabelRecommendedInstanceVersion = new JLabel();
- jLabelRecommendedInstanceVersion.setBounds(new java.awt.Rectangle(12, 87, 200, 20));
- jLabelRecommendedInstanceVersion.setText("Recommended Instance Version");
- jLabelRecommendedInstanceVersion.setVisible(false);
- jLabelLibraryClassName = new JLabel();
- jLabelLibraryClassName.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
- jLabelLibraryClassName.setText("Library Class Name");
- jLabelUsage = new JLabel();
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
- jLabelUsage.setText("Usage");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(495, 255));
-
- jContentPane.add(getIComboBoxLibraryClassName(), null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
- jContentPane.add(jLabelLibraryClassName, null);
- jContentPane.add(jLabelRecommendedInstanceVersion, null);
- jContentPane.add(getJTextFieldRecommendedInstanceVersion(), null);
- jContentPane.add(jLabelRecommendedInstanceGuid, null);
- jContentPane.add(getJTextFieldRecommendedInstanceGuid(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 10));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 35));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelModuleList, null);
- jContentPane.add(getJScrollPaneModuleList(), null);
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJTextFieldHelpText(), null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- This method initializes all existing libraries and usage types
-
- **/
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVLibraryUsage());
- this.iCheckBoxListModule.setAllItems(ed.getVFrameworkModuleTypes());
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonGenerateGuid) {
- this.jTextFieldRecommendedInstanceGuid.setText(Tools.generateUuidString());
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentLibraryClass();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean checkAdd() {
- //
- // Check LibraryClass
- //
- if (this.iComboBoxLibraryClassName.getSelectedItem() == null) {
- Log.wrn("Update Library Class Definitions", "Please select one Library Class");
- return false;
- }
- if (!DataValidation.isLibraryClass(this.iComboBoxLibraryClassName.getSelectedItem().toString())) {
- Log.wrn("Update Library Class Definitions", "Incorrect data type for Library Class");
- return false;
- }
-
- //
- // Check RecommendedInstanceVersion
- //
- // if (!isEmpty(this.jTextFieldRecommendedInstanceVersion.getText())) {
- // if (!DataValidation.isRecommendedInstanceVersion(this.jTextFieldRecommendedInstanceVersion.getText())) {
- // Log.err("Incorrect data type for Recommended Instance Version");
- // return false;
- // }
- // }
-
- //
- // Check RecommendedInstanceGuid
- //
- // if (!isEmpty(this.jTextFieldRecommendedInstanceGuid.getText())) {
- // if (!DataValidation.isGuid(this.jTextFieldRecommendedInstanceGuid.getText())) {
- // Log.err("Incorrect data type for Recommended Instance Guid");
- // return false;
- // }
- // }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Library Class Definitions", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- //
- // Check if the library is produced
- //
- String strUsage = this.jComboBoxUsage.getSelectedItem().toString();
- //
- // Check only when the library class is consumed
- //
- if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- LibraryClassVector v = Find.getAllLibraryClassVector();
- boolean isFind = false;
- for (int index = 0; index < v.size(); index++) {
- LibraryClassIdentification lid = v.getLibraryClass(index);
- if (lid.getLibraryClassName().equals(this.iComboBoxLibraryClassName.getSelectedItem().toString())) {
- if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isFind = true;
- break;
- }
- }
- }
- if (!isFind) {
- Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet. It may have some errors in build time.");
- //return false;
- }
- }
-
- return true;
- }
-
- private LibraryClassIdentification getCurrentLibraryClass() {
- String name = this.iComboBoxLibraryClassName.getSelectedItem().toString();
- String usage = this.jComboBoxUsage.getSelectedItem().toString();
- String version = this.jTextFieldRecommendedInstanceVersion.getText();
- String guid = this.jTextFieldRecommendedInstanceGuid.getText();
- String featureFlag = this.jTextFieldFeatureFlag.getText();
- Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();
- Vector<String> module = this.iCheckBoxListModule.getAllCheckedItemsString();
- String help = this.jTextFieldHelpText.getText();
- lcid = new LibraryClassIdentification(name, usage, version, guid, arch, featureFlag, module, help);
- return lcid;
- }
-
- public LibraryClassIdentification getLcid() {
- return lcid;
- }
-
- public void setLcid(LibraryClassIdentification lcid) {
- this.lcid = lcid;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java
deleted file mode 100644
index fa3d4a4f33..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java
+++ /dev/null
@@ -1,611 +0,0 @@
-/** @file
-
- The file is used to create, update PcdCode section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update PcdCoded section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class PCDsDlg extends IDialog implements ItemListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = 2227717658188438696L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelItemType = null;
-
- private JLabel jLabelC_Name = null;
-
- private JComboBox jComboBoxItemType = null;
-
- private JComboBox jComboBoxCName = null;
-
- private JLabel jLabelDefaultValue = null;
-
- private JTextField jTextFieldDefaultValue = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelTokenSpaceGuid = null;
-
- private JTextField jTextFieldTokenSpaceGuid = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- //
- // Not used by UI
- //
- private PcdCodedIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private PcdVector pcd = wt.getAllPcdDeclarationsFromWorkspace();
-
- /**
- * This method initializes jComboBoxItemType
- *
- * @return javax.swing.JComboBox jComboBoxItemType
- *
- */
- private JComboBox getJComboBoxItemType() {
- if (jComboBoxItemType == null) {
- jComboBoxItemType = new JComboBox();
- jComboBoxItemType.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxItemType.setPreferredSize(new java.awt.Dimension(320, 20));
- }
- return jComboBoxItemType;
- }
-
- /**
- * This method initializes jTextFieldC_Name
- *
- * @return javax.swing.JTextField jTextFieldC_Name
- *
- */
- private JComboBox getJComboBoxCName() {
- if (jComboBoxCName == null) {
- jComboBoxCName = new JComboBox();
- jComboBoxCName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxCName.addItemListener(this);
- }
- return jComboBoxCName;
- }
-
- /**
- * This method initializes jTextFieldDefaultValue
- *
- * @return javax.swing.JTextField jTextFieldDefaultValue
- *
- */
- private JTextField getJTextFieldDefaultValue() {
- if (jTextFieldDefaultValue == null) {
- jTextFieldDefaultValue = new JTextField();
- jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(320, 20));
- }
- return jTextFieldDefaultValue;
- }
-
- /**
- * This method initializes jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- * This method initializes jScrollPaneHelpText
- *
- * @return javax.swing.JScrollPane
- *
- */
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 112));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextFieldTokenSpaceGuid
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldTokenSpaceGuid() {
- if (jTextFieldTokenSpaceGuid == null) {
- jTextFieldTokenSpaceGuid = new JTextField();
- jTextFieldTokenSpaceGuid.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jTextFieldTokenSpaceGuid.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldTokenSpaceGuid.setVisible(false);
- }
- return jTextFieldTokenSpaceGuid;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 182, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 212, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 212, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 87, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- }
- return jComboBoxUsage;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 280);
- this.setContentPane(getJScrollPane());
- this.setTitle("Pcd Coded");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inPcdCodedId
- *
- */
- private void init(PcdCodedIdentification inPcdCodedId, ModuleIdentification mid) {
- init();
- this.id = inPcdCodedId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined pcds from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Pcd", "This module hasn't defined any package dependency, so there is no pcd can be added");
- }
-
- pcd = wt.getAllPcdDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid));
- for (int index = 0; index < pcd.size(); index++) {
- jComboBoxCName.addItem(pcd.getPcd(index));
- }
-
- if (this.id != null) {
- for (int index = 0; index < this.jComboBoxCName.getItemCount(); index++) {
- if (this.jComboBoxCName.getItemAt(index).toString().equals(id.getName())) {
- this.jComboBoxCName.setSelectedIndex(index);
- break;
- }
- }
- this.jTextFieldTokenSpaceGuid.setText(id.getGuid());
- this.jTextFieldDefaultValue.setText(id.getValue());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jComboBoxItemType.setSelectedItem(id.getType());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inPcdCodedId
- * @param iFrame
- *
- */
- public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inPcdCodedId, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jTextFieldDefaultValue.setEnabled(!isView);
- this.jComboBoxItemType.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelUsage = new JLabel();
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
- jLabelUsage.setText("Usge");
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("PCD C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelItemType = new JLabel();
- jLabelItemType.setText("PCD Item Type");
- jLabelItemType.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
-
- jLabelDefaultValue = new JLabel();
- jLabelDefaultValue.setText("Default Value");
- jLabelDefaultValue.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 112));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setText("Help Text");
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 112, 168, 20));
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 182, 168, 20));
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelTokenSpaceGuid = new JLabel();
- jLabelTokenSpaceGuid.setText("Token Space C Name");
- jLabelTokenSpaceGuid.setVisible(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setText("Supported Architectures");
- jLabelArch.setBounds(new java.awt.Rectangle(12, 157, 168, 20));
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
-
- // Hidden field
- jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(12, 62, 140, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 235));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getJComboBoxCName(), null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelItemType, null);
- jContentPane.add(getJComboBoxItemType(), null);
- jContentPane.add(jLabelDefaultValue, null);
- jContentPane.add(getJTextFieldDefaultValue(), null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jArchCheckBox, null);
- // Hidden
- jContentPane.add(getJTextFieldTokenSpaceGuid(), null);
- jContentPane.add(jLabelTokenSpaceGuid, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes Usage type, Item type and Datum type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPcdUsage());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentPcdCoded();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check C_Name
- //
- if (this.jComboBoxCName.getSelectedItem() == null) {
- Log.wrn("Update Pcd", "Please select one Pcd Name");
- return false;
- }
-
- if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
- if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
- Log.wrn("Update PcdCoded", "Incorrect data type for C Name");
- return false;
- }
- }
-
- //
- // Check TokenSpaceGuid
- //
- if (!isEmpty(this.jTextFieldTokenSpaceGuid.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldTokenSpaceGuid.getText())) {
- Log.wrn("Update PcdCoded",
- "Incorrect data type for the selected pcd entry, please check the datatype specified in the spd file");
- return false;
- }
- }
-
- //
- // Check DefaultValue
- //
- if (!isEmpty(this.jTextFieldDefaultValue.getText())) {
- if (!DataValidation.isDefaultValueType(this.jTextFieldDefaultValue.getText())) {
- Log.wrn("Update PcdCoded", "Incorrect data type for Default Value");
- return false;
- }
- }
-
- //
- // Check HelpText
- //
- if (isEmpty(this.jTextAreaHelpText.getText())) {
- Log.wrn("Update PcdCoded", "Help Text should not be empty");
- return false;
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update PcdCoded", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private PcdCodedIdentification getCurrentPcdCoded() {
- String arg0 = this.jComboBoxCName.getSelectedItem().toString();
- String arg1 = this.jTextFieldTokenSpaceGuid.getText();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
-
- String arg4 = this.jTextFieldDefaultValue.getText();
- String arg5 = this.jTextAreaHelpText.getText();
- String arg6 = this.jComboBoxItemType.getSelectedItem().toString();
- String arg7 = this.jComboBoxUsage.getSelectedItem().toString();
- if (arg7.equals(DataType.EMPTY_SELECT_ITEM)) {
- arg7 = "";
- }
-
- id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- return id;
- }
-
- public PcdCodedIdentification getId() {
- return id;
- }
-
- public void setId(PcdCodedIdentification id) {
- this.id = id;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- *
- * Reflesh the frame when selected item changed
- *
- */
- public void itemStateChanged(ItemEvent arg0) {
- int index = this.jComboBoxCName.getSelectedIndex();
- if (arg0.getSource() == this.jComboBoxCName && arg0.getStateChange() == ItemEvent.SELECTED) {
- if (pcd.getPcd(index).getGuidCName() == null || isEmpty(pcd.getPcd(index).getGuidCName())
- || pcd.getPcd(index).getType() == null || pcd.getPcd(index).getHelp() == null
- || isEmpty(pcd.getPcd(index).getHelp())) {
- Log.wrn("select pcd entry when editing msa",
- "The selected value is defined incorrectly.\r\nPlease check it in the spd file");
- } else {
- this.jTextFieldTokenSpaceGuid.setText(pcd.getPcd(index).getGuidCName());
- Tools.generateComboBoxByVector(this.jComboBoxItemType, pcd.getPcd(index).getType());
- this.jTextAreaHelpText.setText(pcd.getPcd(index).getHelp());
- this.jTextAreaHelpText.setSelectionStart(0);
- this.jTextAreaHelpText.setSelectionEnd(0);
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java
deleted file mode 100644
index 00161b5ecb..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/** @file
-
- The file is used to create, update Package Dependencies section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PackageDependencies.PackageDependenciesIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Package Dependencies section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class PackageDepDlg extends IDialog implements ItemListener {
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = 3465193035145152131L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelPackageName = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JComboBox jComboBoxPackageName = null;
-
- private JLabel jLabelPackageGuid = null;
-
- private JTextField jTextFieldPackageGuid = null;
-
- private JLabel jLabelPackageVersion = null;
-
- private JTextField jTextFieldPackageVersion = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelArch = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private PackageDependenciesIdentification pdid = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private Vector<PackageIdentification> vPackage = wt.getAllPackages();
-
- /**
- * This method initializes jComboBoxPackageName
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxPackageName() {
- if (jComboBoxPackageName == null) {
- jComboBoxPackageName = new JComboBox();
- jComboBoxPackageName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxPackageName.setToolTipText("If your Module requires a package, list that here.");
- jComboBoxPackageName.addItemListener(this);
- }
- return jComboBoxPackageName;
- }
-
- /**
- * This method initializes jTextFieldPackageGuid
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldPackageGuid() {
- if (jTextFieldPackageGuid == null) {
- jTextFieldPackageGuid = new JTextField();
- jTextFieldPackageGuid.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jTextFieldPackageGuid.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldPackageGuid.setEditable(false);
- jTextFieldPackageGuid.setVisible(false);
- }
- return jTextFieldPackageGuid;
- }
-
- /**
- * This method initializes jTextFieldPackageVersion
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldPackageVersion() {
- if (jTextFieldPackageVersion == null) {
- jTextFieldPackageVersion = new JTextField();
- jTextFieldPackageVersion.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jTextFieldPackageVersion.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldPackageVersion
- .setToolTipText("<html>If this module depends on a specific version of a package, <br>"
- + "enter the package version here. <br>"
- + "If the module can use the latest version <br>"
- + "that does not break backward compatibility, <br>"
- + "leave this field blank</html>");
- }
- return jTextFieldPackageVersion;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 87, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 122, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 122, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 216);
- this.setContentPane(getJScrollPane());
- this.setTitle("Package Dependencies");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this
- *
- */
- private void init(PackageDependenciesIdentification inPackageDependenciesIdentification, ModuleIdentification mid) {
- init();
- this.pdid = inPackageDependenciesIdentification;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- if (pdid != null) {
- this.jComboBoxPackageName.setSelectedItem(pdid.getName());
- this.jTextFieldPackageVersion.setText(pdid.getVersion());
- this.jTextFieldPackageGuid.setText(pdid.getGuid());
- jTextFieldFeatureFlag.setText(pdid.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(pdid.getSupArchList());
- }
- }
-
- /**
- * This is the default constructor
- *
- */
- public PackageDepDlg(PackageDependenciesIdentification inPackageDependenciesIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inPackageDependenciesIdentification, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jComboBoxPackageName.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelPackageName = new JLabel();
- jLabelPackageName.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
- jLabelPackageName.setText("Package Name");
-
- jLabelPackageVersion = new JLabel();
- jLabelPackageVersion.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
- jLabelPackageVersion.setText("Package Version");
-
- jLabelPackageGuid = new JLabel();
- jLabelPackageGuid.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
- jLabelPackageGuid.setText("Package Guid");
- jLabelPackageGuid.setVisible(false);
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 170));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelPackageName, null);
- jContentPane.add(getJComboBoxPackageName(), null);
- jContentPane.add(jLabelPackageGuid, null);
- jContentPane.add(getJTextFieldPackageGuid(), null);
- jContentPane.add(jLabelPackageVersion, null);
- jContentPane.add(getJTextFieldPackageVersion(), null);
- // LAH Not Used here
- // jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentPackageDependencies();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * This method initializes Usage type, Package type and Arch type
- *
- */
- private void initFrame() {
- for (int index = 0; index < vPackage.size(); index++) {
- jComboBoxPackageName.addItem(vPackage.elementAt(index).getName());
- }
- }
-
- /**
- * Data validation for all fields before add current item to Vector
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check PackageGuid
- //
- // if (!isEmpty(this.jTextFieldPackageGuid.getText())) {
- // if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) {
- // Log.err("Incorrect data type for Package Guid");
- // return false;
- // }
- // }
-
- //
- // Check PackageVersion
- //
- if (!isEmpty(this.jTextFieldPackageVersion.getText())) {
- if (!DataValidation.isVersion(this.jTextFieldPackageVersion.getText())) {
- Log.wrn("Update Package Dependencies", "Incorrect data type for Package Version");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Package Dependencies", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private PackageDependenciesIdentification getCurrentPackageDependencies() {
- String arg0 = this.jComboBoxPackageName.getSelectedItem().toString();
- String arg1 = this.jTextFieldPackageVersion.getText();
- String arg2 = this.jTextFieldPackageGuid.getText();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
- pdid = new PackageDependenciesIdentification(arg0, arg1, arg2, arg3, arg4);
- return pdid;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- *
- * Reflesh the frame when selected item changed
- *
- */
- public void itemStateChanged(ItemEvent arg0) {
- if (arg0.getSource() == this.jComboBoxPackageName && arg0.getStateChange() == ItemEvent.SELECTED) {
- for (int index = 0; index < vPackage.size(); index++) {
- if (this.jComboBoxPackageName.getSelectedItem().toString().equals(vPackage.get(index).getName())) {
- this.jTextFieldPackageGuid.setText(vPackage.get(index).getGuid());
- }
- }
- }
- }
-
- public PackageDependenciesIdentification getPdid() {
- return pdid;
- }
-
- public void setPdid(PackageDependenciesIdentification pdid) {
- this.pdid = pdid;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java
deleted file mode 100644
index c649d13508..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java
+++ /dev/null
@@ -1,493 +0,0 @@
-/** @file
-
- The file is used to create, update Ppi section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Ppi section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class PpisDlg extends IDialog implements ItemListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -4284901202357037724L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelC_Name = null;
-
- private IComboBox iComboBoxCName = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JLabel jLabelPpiType = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JComboBox jComboBoxPpiType = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private PpisIdentification id = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private EnumerationData ed = new EnumerationData();
-
- /**
- * This method initializes jComboBoxPpiType
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxPpiType() {
- if (jComboBoxPpiType == null) {
- jComboBoxPpiType = new JComboBox();
- jComboBoxPpiType.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxPpiType.addItemListener(this);
- jComboBoxPpiType
- .setToolTipText("<html>PPIs are named by GUID.<br>PPI Notify is consumed via a register PPI Notify mechanism</html>");
- }
- return jComboBoxPpiType;
- }
-
- /**
- * This method initializes jTextFieldC_Name
- *
- * @return javax.swing.JTextField jTextFieldC_Name
- *
- */
- private IComboBox getIComboBoxCName() {
- if (iComboBoxCName == null) {
- iComboBoxCName = new IComboBox();
- iComboBoxCName.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- iComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxCName.setToolTipText("Select Guid C Name of PPI");
- }
- return iComboBoxCName;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table><tr><td colspan=2 align=center><b>PPI</b></td></tr><tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the PPI</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module sometimes consumes the PPI</td></tr><tr><td>ALWAYS_PRODUCED</td><td>Module always produces the PPI</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Module sometimes produces the PPI</td></tr><tr><td colspan=2 align=center><b>PPI Notify</b></td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module will consume the PPI if it is produced. Consumption<br>is defined by executing the PPI notify function</td></tr></table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField jTextFieldFeatureFlag
- *
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- * This method initializes jScrollPaneHelpText
- *
- * @return javax.swing.JScrollPane
- *
- */
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 87));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 260);
- this.setContentPane(getJScrollPane());
- this.setTitle("PPI Definitions");
- initFrame();
- this.centerWindow();
- }
-
- /**
- This method initializes this Fill values to all fields if these values are
- not empty
-
- @param inPpisId
- @param mid
-
- **/
- private void init(PpisIdentification inPpisId, ModuleIdentification mid) {
- init();
- this.id = inPpisId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined ppis from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Ppi", "This module hasn't defined any package dependency, so there is no ppi can be added");
- }
-
- Tools.generateComboBoxByVector(this.iComboBoxCName,
- wt.getAllPpiDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid)));
-
- if (this.id != null) {
- this.iComboBoxCName.setSelectedItem(id.getName());
- this.jComboBoxPpiType.setSelectedItem(id.getType());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inProtocolsIdentification
- * @param iFrame
- *
- */
- public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inPpisIdentification, mid);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelPpiType = new JLabel();
- jLabelPpiType.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
- jLabelPpiType.setText("Select Ppi Type");
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("PPI GUID C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(14, 87, 168, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 168, 20));
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelPpiType, null);
- jContentPane.add(getJComboBoxPpiType(), null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxCName(), null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType());
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentPpis();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check Name
- //
- if (this.iComboBoxCName.getSelectedItem() == null) {
- Log.wrn("Update Ppis", "Please select one Ppi/PpiNotify Name");
- return false;
- }
-
- if (!isEmpty(this.iComboBoxCName.getSelectedItem().toString())) {
- if (!DataValidation.isC_NameType(this.iComboBoxCName.getSelectedItem().toString())) {
- Log.wrn("Update Ppis", "Incorrect data type for Ppi/PpiNotify Name");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Ppis", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private PpisIdentification getCurrentPpis() {
- String arg0 = this.iComboBoxCName.getSelectedItem().toString();
- String arg1 = this.jComboBoxPpiType.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
- String arg5 = this.jTextAreaHelpText.getText();
-
- id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- return id;
- } /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- *
- * Reflesh the frame when selected item changed
- *
- */
-
- public void itemStateChanged(ItemEvent arg0) {
- if (arg0.getSource() == this.jComboBoxPpiType && arg0.getStateChange() == ItemEvent.SELECTED) {
- if (this.jComboBoxPpiType.getSelectedItem().toString().equals(ed.getVPpiType().get(0))) {
- Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiUsage());
- } else {
- Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiNotifyUsage());
- }
- }
- }
-
- public PpisIdentification getId() {
- return id;
- }
-
- public void setId(PpisIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java
deleted file mode 100644
index aa7c453290..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java
+++ /dev/null
@@ -1,523 +0,0 @@
-/** @file
-
- The file is used to create, update Protocol of section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Protocol of MSA file
- *
- * It extends IDialog
- *
- */
-public class ProtocolsDlg extends IDialog implements ItemListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -9084913640747858848L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelC_Name = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JLabel jLabelProtocolType = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JComboBox jComboBoxProtocolType = null;
-
- private IComboBox iComboBoxCName = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private ProtocolsIdentification id = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private EnumerationData ed = new EnumerationData();
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField jTextFieldFeatureFlag
- *
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxProtocolUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table><tr><td colspan=2 align=center><b>Protocol</b></td></tr>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the protocol</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMES</td><td>Module sometimes consumes the protocol</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Module always produces the protocol</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Module sometimes produces the protocol</td></tr>"
- + "<tr><td>TO_START</td><td>The protocol is consumed by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr>"
- + "<tr><td>BY_START</td><td>Protocol is produced by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr>"
- + "<tr><td colspan=2 align=center><b>Protocol Notify</b></td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module will consume the protocol if it is produced.<br>Consumption is defined by executing the protocol notify<br>function.</td></tr></table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jComboBoxProtocolType
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxProtocolType() {
- if (jComboBoxProtocolType == null) {
- jComboBoxProtocolType = new JComboBox();
- jComboBoxProtocolType.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxProtocolType.addItemListener(this);
- jComboBoxProtocolType
- .setToolTipText("<html>Select Protocol Type<br>Protocol Notify is a register protocol notify mechanism.");
- }
- return jComboBoxProtocolType;
- }
-
- /**
- * This method initializes iComboBoxCName
- *
- * @return javax.swing.JComboBox
- */
- private IComboBox getIComboBoxCName() {
- if (iComboBoxCName == null) {
- iComboBoxCName = new IComboBox();
- iComboBoxCName.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- iComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxCName.setToolTipText("Select Guid C Name of the Protocol");
-
- }
- return iComboBoxCName;
- }
-
- /**
- * This method initializes jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- * This method initializes jScrollPaneHelpText
- *
- * @return javax.swing.JScrollPane
- *
- */
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 87));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- // Width must be 20 larger than Content Pane PreferredSize width for MSFT
- // Height must be 45 larger than ContentPane PreferredSize height for MSFT
- this.setSize(505, 260);
- this.setContentPane(getJScrollPane());
- this.setTitle("Protocols");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inProtocolsId
- *
- */
- private void init(ProtocolsIdentification inProtocolsId, ModuleIdentification mid) {
- init();
- this.id = inProtocolsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined protocols from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Protocol", "This module hasn't defined any package dependency, so there is no protocol can be added");
- }
-
- Tools.generateComboBoxByVector(this.iComboBoxCName,
- wt.getAllProtocolDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid)));
-
- if (this.id != null) {
- this.iComboBoxCName.setSelectedItem(id.getName());
- this.jComboBoxProtocolType.setSelectedItem(id.getType());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inProtocolsIdentification
- * @param iFrame
- *
- */
- public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inProtocolsIdentification, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jComboBoxUsage.setEnabled(!isView);
- this.jTextFieldFeatureFlag.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelProtocolType = new JLabel();
- jLabelProtocolType.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jLabelProtocolType.setText("Select Protocol Type");
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("Protocol Guid C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 155, 20));
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelProtocolType, null);
- jContentPane.add(getJComboBoxProtocolType(), null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxCName(), null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxProtocolUsage(), null);
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType());
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentProtocols();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check Name
- //
- if (this.iComboBoxCName.getSelectedItem() == null) {
- Log.wrn("Update protocols", "Please select one Protocol/ProtocolNotify Name");
- return false;
- }
-
- if (!isEmpty(this.iComboBoxCName.getSelectedItem().toString())) {
- if (!DataValidation.isC_NameType(this.iComboBoxCName.getSelectedItem().toString())) {
- Log.wrn("Update Protocols", "Incorrect data type for Protocol/ProtocolNotify Name");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Protocols", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private ProtocolsIdentification getCurrentProtocols() {
- String arg0 = this.iComboBoxCName.getSelectedItem().toString();
- String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
- String arg5 = this.jTextAreaHelpText.getText();
- id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- return id;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- *
- * Reflesh the frame when selected item changed
- *
- */
-
- public void itemStateChanged(ItemEvent arg0) {
- if (arg0.getSource() == this.jComboBoxProtocolType && arg0.getStateChange() == ItemEvent.SELECTED) {
- if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(ed.getVProtocolType().get(0))) {
- Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolUsage());
- } else {
- Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolNotifyUsage());
- }
- }
- }
-
- public ProtocolsIdentification getId() {
- return id;
- }
-
- public void setId(ProtocolsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java
deleted file mode 100644
index 238c000cde..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java
+++ /dev/null
@@ -1,547 +0,0 @@
-/** @file
-
- The file is used to create, update SourceFiles section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update SourceFiles section of the MSA file
- *
- * It extends IDialog
- *
- **/
-public class SourceFilesDlg extends IDialog {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6765742852142775378L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelFileName = null;
-
- private JTextField jTextFieldFileName = null;
-
- private JButton jButtonOpenFile = null;
-
- private JLabel jLabelToolChainFamily = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelTagName = null;
-
- private JTextField jTextFieldTagName = null;
-
- private JLabel jLabelToolCode = null;
-
- private JTextField jTextFieldToolCode = null;
-
- private IComboBox iComboBoxToolCode = null;
-
- private JTextField jTextFieldToolChainFamily = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private SourceFilesIdentification sfid[] = null;
-
- private String msaFileName = "";
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- This method initializes jTextFieldFileName
-
- @return javax.swing.JTextField jTextFieldFileName
-
- **/
- private JTextField getJTextFieldSourceFilesDirectory() {
- if (jTextFieldFileName == null) {
- jTextFieldFileName = new JTextField();
- jTextFieldFileName.setBounds(new java.awt.Rectangle(168, 12, 250, 20));
- jTextFieldFileName.setPreferredSize(new java.awt.Dimension(250, 20));
- jTextFieldFileName.setToolTipText("Path is relative to the MSA file and must include the file name");
- }
- return jTextFieldFileName;
- }
-
- /**
- This method initializes jButtonOpenFile
-
- @return javax.swing.JButton jButtonOpenFile
-
- **/
- private JButton getJButtonOpenFile() {
- if (jButtonOpenFile == null) {
- jButtonOpenFile = new JButton();
- jButtonOpenFile.setText("Browse");
- jButtonOpenFile.setBounds(new java.awt.Rectangle(422, 12, 85, 20));
- jButtonOpenFile.setPreferredSize(new java.awt.Dimension(85, 20));
- jButtonOpenFile.addActionListener(this);
- }
- return jButtonOpenFile;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextFieldTagName
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldTagName() {
- if (jTextFieldTagName == null) {
- jTextFieldTagName = new JTextField();
- jTextFieldTagName.setBounds(new java.awt.Rectangle(168, 37, 340, 20));
- jTextFieldTagName.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldTagName.setToolTipText("You may specify a specific tool chain tag name, such as BILL1");
- }
- return jTextFieldTagName;
- }
-
- private IComboBox getIComboBoxToolCode() {
- if (iComboBoxToolCode == null) {
- iComboBoxToolCode = new IComboBox();
- iComboBoxToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20));
- iComboBoxToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
- iComboBoxToolCode.setToolTipText("<html>You may select a specific tool command from drop down list,<br>"
- + "or you can DOUBLE-CLICK this field to enter your customized<br>"
- + "tool command.<br>"
- + "Press ENTER to save your input or press ESCAPE to quit</html>");
- }
- return iComboBoxToolCode;
- }
-
- /**
- * This method initializes jTextFieldToolCode
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolCode() {
- if (jTextFieldToolCode == null) {
- jTextFieldToolCode = new JTextField();
- jTextFieldToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20));
- jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM");
- jTextFieldToolCode.setVisible(false);
- }
- return jTextFieldToolCode;
- }
-
- /**
- * This method initializes jTextFieldToolChainFamily
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolChainFamily() {
- if (jTextFieldToolChainFamily == null) {
- jTextFieldToolChainFamily = new JTextField();
- jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(168, 87, 340, 20));
- jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldToolChainFamily.setToolTipText("You may specify a specific tool chain family, such as GCC");
- }
- return jTextFieldToolChainFamily;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 137, 340, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldFeatureFlag.setToolTipText("RESERVED FOR FUTURE USE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(317, 172, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(412, 172, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inSourceFilesIdentification, mid);
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(525, 240);
- this.setContentPane(getJScrollPane());
- this.setTitle("Source Files");
- this.setViewMode(false);
- this.centerWindow();
- Tools.generateComboBoxByVector(iComboBoxToolCode, ed.getVToolCode());
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
-
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles
-
- **/
- private void init(SourceFilesIdentification inSourceFilesIdentifications, ModuleIdentification mid) {
- init();
- this.msaFileName = mid.getPath();
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- if (inSourceFilesIdentifications != null) {
- this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename());
- this.jTextFieldTagName.setText(inSourceFilesIdentifications.getTagName());
-
-// //
-// // Generate Tool Code selection list
-// //
-// Vector<String> v = ed.getVToolCode();
-// boolean isFind = false;
-// String strToolCode = inSourceFilesIdentifications.getToolCode();
-//
-// //
-// // If the input value is not in the default list, add it to the list
-// //
-// if (strToolCode != null) {
-// for (int index = 0; index < v.size(); index++) {
-// if (v.elementAt(index).equals(strToolCode)) {
-// isFind = true;
-// break;
-// }
-// }
-// if (!isFind && !isEmpty(strToolCode)) {
-// v.addElement(strToolCode);
-// }
-// }
-
- Tools.generateComboBoxByVector(iComboBoxToolCode, ed.getVToolCode());
- this.iComboBoxToolCode.setSelectedItem(inSourceFilesIdentifications.getToolCode());
-
- this.jTextFieldToolChainFamily.setText(inSourceFilesIdentifications.getToolChainFamily());
- jTextFieldFeatureFlag.setText(inSourceFilesIdentifications.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(inSourceFilesIdentifications.getSupArchList());
- }
- }
-
- /**
- Disable all components when the mode is view
-
- @param isView true - The view mode; false - The non-view mode
-
- **/
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jTextFieldFileName.setEnabled(!isView);
- this.jButtonOpenFile.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 112, 340, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(340, 20));
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 137, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelToolCode = new JLabel();
- jLabelToolCode.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelToolCode.setText("Tool Code");
- jLabelTagName = new JLabel();
- jLabelTagName.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelTagName.setText("Tag Name");
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 112, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelToolChainFamily = new JLabel();
- jLabelToolChainFamily.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelToolChainFamily.setText("Tool Chain Family");
- jLabelFileName = new JLabel();
- jLabelFileName.setText("File Name");
- jLabelFileName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(505, 192));
-
- jContentPane.add(jLabelFileName, null);
- jContentPane.add(getJTextFieldSourceFilesDirectory(), null);
- jContentPane.add(getJButtonOpenFile(), null);
- jContentPane.add(jLabelToolChainFamily, null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jLabelTagName, null);
- jContentPane.add(getJTextFieldTagName(), null);
- jContentPane.add(jLabelToolCode, null);
- jContentPane.add(getJTextFieldToolCode(), null);
- jContentPane.add(getIComboBoxToolCode(), null);
- jContentPane.add(getJTextFieldToolChainFamily(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOpenFile) {
- selectFile();
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentSourceFiles();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- private SourceFilesIdentification[] getCurrentSourceFiles() {
- String name = this.jTextFieldFileName.getText();
- String s[] = name.split(";");
- String tagName = this.jTextFieldTagName.getText();
- String toolCode = this.iComboBoxToolCode.getSelectedItem().toString();
- if (toolCode.equals(DataType.EMPTY_SELECT_ITEM)) {
- toolCode = "";
- }
- String tcf = this.jTextFieldToolChainFamily.getText();
- String featureFlag = this.jTextFieldFeatureFlag.getText();
- Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();
- sfid = new SourceFilesIdentification[s.length];
- for (int index = 0; index < s.length; index++) {
- sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch);
- }
- return sfid;
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean checkAdd() {
- //
- // Check Filename
- //
- if (isEmpty(this.jTextFieldFileName.getText())) {
- Log.wrn("Update Source Files", "File Name must be entered!");
- return false;
- }
- if (!DataValidation.isFilename(this.jTextFieldFileName.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for File Name");
- return false;
- }
-
- //
- // Check TagName
- //
- if (!isEmpty(this.jTextFieldTagName.getText())) {
- if (!DataValidation.isTagName(this.jTextFieldTagName.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for Tag Name");
- return false;
- }
- }
-
- //
- // Check ToolCode
- //
- if (!isEmpty(this.jTextFieldToolCode.getText())) {
- if (!DataValidation.isToolCode(this.jTextFieldToolCode.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for Tool Code");
- return false;
- }
- }
-
- //
- // Check ToolChainFamily
- //
- if (!isEmpty(this.jTextFieldToolChainFamily.getText())) {
- if (!DataValidation.isToolChainFamily(this.jTextFieldToolChainFamily.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for Tool Chain Family");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- /**
- Display a file open browser to let user select file
-
- **/
- private void selectFile() {
- JFileChooser fc = new JFileChooser();
- fc.setCurrentDirectory(new File(Tools.getFilePathOnly(msaFileName)));
- fc.setMultiSelectionEnabled(true);
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- File f[] = fc.getSelectedFiles();
- String s = "";
- for (int index = 0; index < f.length; index++) {
- String relativePath = "";
- relativePath = Tools.getRelativePath(Tools.getFilePathOnly(f[index].getPath()), Tools.getFilePathOnly(msaFileName));
- if (!Tools.isEmpty(relativePath)) {
- relativePath = relativePath + DataType.UNIX_FILE_SEPARATOR;
- }
- s = s + relativePath + f[index].getName() + ";";
- }
- this.jTextFieldFileName.setText(s);
- }
- }
-
- public SourceFilesIdentification[] getSfid() {
- return sfid;
- }
-
- public void setSfid(SourceFilesIdentification[] sfid) {
- this.sfid = sfid;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java
deleted file mode 100644
index 83d29cec2c..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java
+++ /dev/null
@@ -1,458 +0,0 @@
-/** @file
- <<The file is used to create, update SystemTable in the MSA file>>
-
- <<This dialog is used to add or edit a System Table entry in the MSA file.>>
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.SystemTables.SystemTablesIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update SystemTables section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class SystemTablesDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = 7488769180379442276L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelEntry = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private IComboBox iComboBoxGuidC_Name = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private SystemTablesIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes iComboBoxGuidC_Name
- *
- * @return javax.swing.JComboBox iComboBoxGuidC_Name
- *
- */
- private IComboBox getIComboBoxGuidC_Name() {
- if (iComboBoxGuidC_Name == null) {
- iComboBoxGuidC_Name = new IComboBox();
- iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the System Table");
- }
- return iComboBoxGuidC_Name;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module requires a GUIDed entry in the system table</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module consumes a GUIDed entry in the system<br>table if it is present</td>"
- + "</tr><tr><td>ALWAYS_PRODUCED</td><td>Module always produces a GUIDed entry in the system table</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Module produces a GUIDed entry in the system table<br>for some of its execution flows.</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- return jTextAreaHelpText;
- }
-
- /**
- * This method initializes jScrollPaneHelpText
- *
- * @returns javax.swing.JScrollPane jScrollPaneHelpText
- */
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 235);
- this.setContentPane(getJScrollPane());
- this.setTitle("System Tables");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inSystemTablesId
- *
- */
- private void init(SystemTablesIdentification inSystemTablesId, ModuleIdentification mid) {
- init();
- this.id = inSystemTablesId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log
- .wrn("Init Guid",
- "This module hasn't defined any package dependency, so there is no guid value can be added for system table");
- }
- //
- // Init guids drop down list
- //
- Tools
- .generateComboBoxByVector(iComboBoxGuidC_Name,
- wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_EFI_SYSTEM_CONFIGURATION_TABLE));
-
-
- if (this.id != null) {
- this.iComboBoxGuidC_Name.setSelectedItem(id.getName());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inBootModesIdentification
- * @param iFrame
- *
- */
- public SystemTablesDlg(SystemTablesIdentification inSystemTablesIdentification, IFrame iFrame,
- ModuleIdentification mid) {
- super(iFrame, true);
- init(inSystemTablesIdentification, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jComboBoxUsage.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelEntry = new JLabel();
- jLabelEntry.setText("Table's GUID C Name");
- jLabelEntry.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- jContentPane.add(jLabelEntry, null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(getIComboBoxGuidC_Name(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
-
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVSystemTableUsage());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentSystemTables();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check Name
- //
- if (this.iComboBoxGuidC_Name.getSelectedItem() == null) {
- Log.wrn("Update Guids", "Please select one System Table Name");
- return false;
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update System Tables", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private SystemTablesIdentification getCurrentSystemTables() {
- String arg0 = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
- String arg4 = this.jTextAreaHelpText.getText();
-
- id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4);
- return id;
- }
-
- public SystemTablesIdentification getId() {
- return id;
- }
-
- public void setId(SystemTablesIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java
deleted file mode 100644
index b906e9adff..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java
+++ /dev/null
@@ -1,498 +0,0 @@
-/** @file
-
- The file is used to create, update Variables section of the MSA file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IComboBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Variables.VariablesIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Variables section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class VariablesDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -6998982978030439446L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelVariableName = null;
-
- private JTextField jTextFieldVariableName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelGuidCName = null;
-
- private IComboBox iComboBoxGuidC_Name = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private VariablesIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jTextFieldString
- *
- * @return javax.swing.JTextField jTextFieldString
- *
- */
- private JTextField getJTextFieldString() {
- if (jTextFieldVariableName == null) {
- jTextFieldVariableName = new JTextField();
- jTextFieldVariableName.setSize(new java.awt.Dimension(320, 20));
- jTextFieldVariableName.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldVariableName.setLocation(new java.awt.Point(168, 12));
- jTextFieldVariableName.setToolTipText("Enter a string; the tool will convert to Unicode hex");
- }
- return jTextFieldVariableName;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>The module requires the variable entry to be set</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>The module will use the variable entry if it is set.</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>The module will always write the variable.</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>The module will sometimes write the variable.</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField jTextFieldFeatureFlag
- *
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jTextFieldHelpText
- *
- * @return javax.swing.JTextField
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- jTextAreaHelpText.setToolTipText("Enter information on how to use this Variable.");
- }
- return jTextAreaHelpText;
- }
-
- private JScrollPane getJScrollPaneHelpText() {
- if (jScrollPaneHelpText == null) {
- jScrollPaneHelpText = new JScrollPane();
- jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
- jScrollPaneHelpText.setLocation(new java.awt.Point(168, 87));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes iComboBoxGuidC_Name
- *
- * @return javax.swing.JComboBox iComboBoxGuidC_Name
- *
- */
- private IComboBox getIComboBoxGuidC_Name() {
- if (iComboBoxGuidC_Name == null) {
- iComboBoxGuidC_Name = new IComboBox();
- iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Variable.");
- }
- return iComboBoxGuidC_Name;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 260);
- this.setContentPane(getJScrollPane());
- this.setTitle("Variables");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param inVariablesId
- *
- */
- private void init(VariablesIdentification inVariablesId, ModuleIdentification mid) {
- init();
- this.id = inVariablesId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log
- .wrn("Init Guid",
- "This module hasn't defined any package dependency, so there is no guid value can be added for variable");
- }
- //
- // Init guids drop down list
- //
- Tools
- .generateComboBoxByVector(iComboBoxGuidC_Name,
- wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_EFI_VARIABLE));
-
- if (this.id != null) {
- this.jTextFieldVariableName.setText(id.getName());
- this.iComboBoxGuidC_Name.setSelectedItem(id.getGuid());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inVariablesIdentification
- * @param iFrame
- *
- */
- public VariablesDlg(VariablesIdentification inVariablesIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inVariablesIdentification, mid);
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jTextFieldVariableName.setEnabled(!isView);
- this.jComboBoxUsage.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelVariableName = new JLabel();
- jLabelVariableName.setText("Variable Name");
- jLabelVariableName.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelGuidCName = new JLabel();
- jLabelGuidCName.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
- jLabelGuidCName.setText("Variable Guid C Name");
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 168, 20));
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelVariableName, null);
- jContentPane.add(getJTextFieldString(), null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelGuidCName, null);
- jContentPane.add(getIComboBoxGuidC_Name(), null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJScrollPaneHelpText(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentVariables();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
- }
-
- /**
- * Data validation for all fields
- *
- * @retval true - All datas are valid
- * @retval false - At least one data is invalid
- *
- */
- public boolean checkAdd() {
- //
- // Check if all fields have correct data types
- //
-
- //
- // Check VariableName
- //
- if (isEmpty(this.jTextFieldVariableName.getText())) {
- Log.wrn("Update Variables", "Variable Name must be entered!");
- return false;
- }
-
- //
- // Check Guid Value
- //
- if (this.iComboBoxGuidC_Name.getSelectedItem() == null) {
- Log.wrn("Update Guids", "Please select one Varibale Guid value");
- return false;
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Variables", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private VariablesIdentification getCurrentVariables() {
- String arg0 = this.jTextFieldVariableName.getText();
- String arg1 = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
- String arg5 = this.jTextAreaHelpText.getText();
-
- id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- return id;
- }
-
- public VariablesIdentification getId() {
- return id;
- }
-
- public void setId(VariablesIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java
deleted file mode 100644
index e986f55baf..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/** @file
-
- The file is used to save basic information of package
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.packaging;
-
-import java.io.File;
-
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class PackageIdentification extends Identification{
-
- public PackageIdentification(String name, String guid, String version){
- super(name, guid, version);
- }
-
- public PackageIdentification(String name, String guid, String version, String path){
- super(name, guid, version, path);
- }
-
- public PackageIdentification(Identification id){
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- }
-
- public File getSpdFile(){
- File spdFile = new File(this.getPath());
- return spdFile;
- }
-
- public String toString() {
- return getName() + " " + getVersion() + " [" + Tools.getRelativePath(getSpdFile().getPath(), Workspace.getCurrentWorkspace()) + "]";
- }
-
- public boolean equals(String packageGuid, String packageVersion) {
- boolean b = false;
- if (this.getGuid().equals(packageGuid)) {
- b = true;
- //
- // Check Version
- //
- if (packageVersion != null) {
- if (!Tools.isEmpty(packageVersion)) {
- if (!packageVersion.equals(this.getVersion())) {
- b = false;
- }
- }
- }
- }
- return b;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java
deleted file mode 100644
index b219c9ed70..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java
+++ /dev/null
@@ -1,445 +0,0 @@
-/** @file
- Java class GenGuidDialog.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import java.awt.GridLayout;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JRadioButton;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.KeyStroke;
-
-import org.tianocore.frameworkwizard.common.Tools;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-/**
- Dialog for GUID generation.
- @since PackageEditor 1.0
-**/
-public class GenGuidDialog extends JDialog implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public static final String guidArrayPat = "0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?";
-
- public static final String guidRegistryPat = "[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}";
-
- static private JFrame frame;
- private JPanel jContentPane = null;
- private JPanel jPanelEast = null;
- private JPanel jPanelCenter = null;
- private JTextField jTextField = null;
- private JLabel jLabel = null;
- private JRadioButton jRadioButton = null;
- private JRadioButton jRadioButtonReg = null;
- private JButton jButtonCancel = null;
- private JButton jButtonNew = null;
- private JButton jButtonOk = null;
- private ActionListener outerListener = null;
-
-// private String guid = null;
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (arg0.getSource() == jButtonNew){
- String uuid = Tools.generateUuidString();
- if (jRadioButtonReg.isSelected()) {
- jTextField.setText(uuid);
- }
- else {
- //ToDo: transform to comma-sep guid
- String s = GenGuidDialog.formatGuidString(uuid);
- if (s.equals("0")) {
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
- return;
- }
- jTextField.setText(s);
- }
- }
-
- if (arg0.getSource() == jRadioButtonReg){
-
- //ToDo: check text field value against RegExp and transform if needed
- if (jTextField.getText().matches(GenGuidDialog.guidRegistryPat)){
- return;
- }
- if (jTextField.getText().matches(GenGuidDialog.guidArrayPat)) {
- jTextField.setText(GenGuidDialog.formatGuidString(jTextField.getText()));
- return;
- }
- if (jTextField.getText().length()>0)
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
-
- }
-
- if (arg0.getSource() == jRadioButton){
-
- //ToDo: check text field value against RegExp and transform if needed
- if (jTextField.getText().matches(GenGuidDialog.guidArrayPat)){
- return;
- }
- if (jTextField.getText().matches(GenGuidDialog.guidRegistryPat)) {
- jTextField.setText(GenGuidDialog.formatGuidString(jTextField.getText()));
- return;
- }
- if (jTextField.getText().length()>0)
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
-
- }
-
- if (arg0.getSource() == jButtonOk){
-// if (jTextField.getText().matches(Tools.guidArrayPat)
-// || jTextField.getText().matches(Tools.guidRegistryPat)){
-// this.setVisible(false);
-// }
-// else {
-// JOptionPane.showMessageDialog(frame, "Incorrect GUID Value Format.");
-// }
-// this.dispose();
- }
-
- if (arg0.getSource() == jButtonCancel){
- this.dispose();
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelEast() {
- if (jPanelEast == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setVgap(10);
- jPanelEast = new JPanel();
- jPanelEast.setLayout(flowLayout);
- jPanelEast.setPreferredSize(new java.awt.Dimension(100,30));
- jPanelEast.add(getJButtonNew(), null);
- jPanelEast.add(getJButtonOk(), null);
- jPanelEast.add(getJButtonCancel(), null);
- }
- return jPanelEast;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelCenter() {
- if (jPanelCenter == null) {
- jLabel = new JLabel();
- jLabel.setText("GUID Value");
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(4);
- jPanelCenter = new JPanel();
- jPanelCenter.setLayout(gridLayout);
- jPanelCenter.add(getJRadioButtonReg(), null);
- jPanelCenter.add(getJRadioButton(), null);
- jPanelCenter.add(jLabel, null);
- jPanelCenter.add(getJTextField(), null);
- ButtonGroup bg = new ButtonGroup();
- bg.add(jRadioButtonReg);
- bg.add(jRadioButton);
- }
- return jPanelCenter;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setHorizontalAlignment(JTextField.LEADING);
- jTextField.setPreferredSize(new java.awt.Dimension(100,20));
- }
- return jTextField;
- }
-
- /**
- * This method initializes jRadioButton
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButton() {
- if (jRadioButton == null) {
- jRadioButton = new JRadioButton();
- jRadioButton.setText("Comma-Seperated Format");
- jRadioButton.setEnabled(false);
- jRadioButton.addActionListener(this);
- }
- return jRadioButton;
- }
-
- /**
- * This method initializes jRadioButton1
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonReg() {
- if (jRadioButtonReg == null) {
- jRadioButtonReg = new JRadioButton();
- jRadioButtonReg.setText("Registry Format");
- jRadioButtonReg.setSelected(true);
- jRadioButtonReg.addActionListener(this);
- }
- return jRadioButtonReg;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- jButtonCancel.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNew() {
- if (jButtonNew == null) {
- jButtonNew = new JButton();
- jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonNew.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
- jButtonNew.setText("New");
- jButtonNew.addActionListener(this);
- jButtonNew.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonNew;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("GenGuidValue");
-// jButtonOk.addActionListener(this);
- jButtonOk.registerKeyboardAction(outerListener, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
-
- }
- return jButtonOk;
- }
-
- public String getGuid(){
- return jTextField.getText();
- }
-
- public void setGuid(String s){
- jTextField.setText(s);
- }
- /**
- * This is the default constructor
- */
- public GenGuidDialog() {
- super();
- initialize();
- }
-
- public GenGuidDialog(ActionListener i, JFrame frame){
- super(frame);
- outerListener = i;
- initialize();
- jButtonOk.addActionListener(i);
- this.addWindowListener(new WindowAdapter(){
-
- @Override
- public void windowActivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
- super.windowActivated(arg0);
- if ((jRadioButtonReg.isSelected() && jTextField.getText().matches(GenGuidDialog.guidArrayPat))
- || (jRadioButton.isSelected() && jTextField.getText().matches(GenGuidDialog.guidRegistryPat))) {
- jTextField.setText(GenGuidDialog.formatGuidString(jTextField.getText()));
- }
-
-// if (!jTextField.getText().matches(Tools.guidArrayPat) || !jTextField.getText().matches(Tools.guidRegistryPat)) {
-// JOptionPane.showMessageDialog(frame, "InitVal: Incorrect GUID Value Format.");
-// return;
-// }
- }
-
- });
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(466, 157);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setModal(true);
- this.setTitle("Editing GUID Value");
- this.setContentPane(getJContentPane());
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJPanelCenter(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
- public static String formatGuidString (String guidNameConv) {
- String[] strList;
- String guid = "";
- int index = 0;
- if (guidNameConv
- .matches(GenGuidDialog.guidRegistryPat)) {
- strList = guidNameConv.split("-");
- guid = "0x" + strList[0] + ", ";
- guid = guid + "0x" + strList[1] + ", ";
- guid = guid + "0x" + strList[2] + ", ";
-
- guid = guid + "0x" + strList[3].substring(0, 2) + ", ";
- guid = guid + "0x" + strList[3].substring(2, 4);
-
- while (index < strList[4].length()) {
- guid = guid + ", ";
- guid = guid + "0x" + strList[4].substring(index, index + 2);
- index = index + 2;
- }
-
- return guid;
- }
- else if (guidNameConv
- .matches(GenGuidDialog.guidArrayPat)) {
- strList = guidNameConv.split(",");
-
- //
- // chang ANSI c form to registry form
- //
- for (int i = 0; i < strList.length; i++){
- strList[i] = strList[i].substring(strList[i].lastIndexOf("x") + 1);
- }
- if (strList[strList.length - 1].endsWith("}")) {
- strList[strList.length -1] = strList[strList.length-1].substring(0, strList[strList.length-1].length()-1);
- }
- //
- //inserting necessary leading zeros
- //
-
- int segLen = strList[0].length();
- if (segLen < 8){
- for (int i = 0; i < 8 - segLen; ++i){
- strList[0] = "0" + strList[0];
- }
- }
-
- segLen = strList[1].length();
- if (segLen < 4){
- for (int i = 0; i < 4 - segLen; ++i){
- strList[1] = "0" + strList[1];
- }
- }
- segLen = strList[2].length();
- if (segLen < 4){
- for (int i = 0; i < 4 - segLen; ++i){
- strList[2] = "0" + strList[2];
- }
- }
- for (int i = 3; i < 11; ++i) {
- segLen = strList[i].length();
- if (segLen < 2){
- strList[i] = "0" + strList[i];
- }
- }
-
- for (int i = 0; i < 3; i++){
- guid += strList[i] + "-";
- }
-
- guid += strList[3];
- guid += strList[4] + "-";
-
- for (int i = 5; i < strList.length; ++i){
- guid += strList[i];
- }
-
-
- return guid;
- } else {
-
- return "0";
-
- }
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java
deleted file mode 100644
index 0d00f4a014..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/** @file
- Java class GuidEditor.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-//import java.awt.event.KeyEvent;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-//import javax.swing.JComponent;
-import javax.swing.JTable;
-//import javax.swing.KeyStroke;
-import javax.swing.table.TableCellEditor;
-
-
-/**
- Editor for table cell with GUID value.
- @since PackageEditor 1.0
- **/
-public class GuidEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- String currentGuid;
- JButton button;
- GenGuidDialog dialog;
- protected static final String EDIT = "edit";
-
- public GuidEditor(JFrame frame) {
-
- button = new JButton();
- button.setActionCommand(EDIT);
- button.addActionListener(this);
-// button.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0, false), JComponent.WHEN_FOCUSED);
- button.setBorderPainted(false);
-
-
- dialog = new GenGuidDialog(this, frame);
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
- */
- public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
- // TODO Auto-generated method stub
- currentGuid = (String)arg1;
- return button;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.CellEditor#getCellEditorValue()
- */
- public Object getCellEditorValue() {
- // TODO Auto-generated method stub
- return currentGuid;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (EDIT.equals(arg0.getActionCommand())) {
- //The user has clicked the cell, so
- //bring up the dialog.
- button.setText(currentGuid);
- dialog.setGuid(currentGuid);
- dialog.setVisible(true);
-
- //Make the renderer reappear.
- fireEditingStopped();
- }
- else { //User pressed dialog's "OK" button.
- currentGuid = dialog.getGuid();
-// button.setText(currentGuid);
- dialog.dispose();
- }
-
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java
deleted file mode 100644
index 922d1355e8..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java
+++ /dev/null
@@ -1,1885 +0,0 @@
-/** @file
- Java class SpdFileContents is used to parse spd xml file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-
-
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlCursor;
-
-import org.tianocore.GuidDeclarationsDocument;
-
-import org.tianocore.LibraryClassDeclarationsDocument;
-
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.MsaFilesDocument;
-import org.tianocore.PackageDefinitionsDocument;
-import org.tianocore.PackageHeadersDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PcdDataTypes;
-import org.tianocore.PcdDeclarationsDocument;
-import org.tianocore.PpiDeclarationsDocument;
-import org.tianocore.ProtocolDeclarationsDocument;
-import org.tianocore.SpdHeaderDocument;
-import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;
-
-/**
- This class processes spd file contents such as add remove xml elements.
-
- @since PackageEditor 1.0
-**/
-
-public class SpdFileContents {
-
- private File file = null;
-
- private PackageSurfaceAreaDocument psad = null;
-
- private PackageSurfaceAreaDocument.PackageSurfaceArea psaRoot = null;
-
- private SpdHeaderDocument.SpdHeader spdHdr = null;
-
- private PackageDefinitionsDocument.PackageDefinitions spdPkgDefs = null;
-
- private LibraryClassDeclarationsDocument.LibraryClassDeclarations spdLibClassDeclarations = null;
-
- private MsaFilesDocument.MsaFiles spdMsaFiles = null;
-
- private PackageHeadersDocument.PackageHeaders spdModHdrs = null;
-
- private GuidDeclarationsDocument.GuidDeclarations spdGuidDeclarations = null;
-
- private ProtocolDeclarationsDocument.ProtocolDeclarations spdProtocolDeclarations = null;
-
- private PpiDeclarationsDocument.PpiDeclarations spdPpiDeclarations = null;
-
- private PcdDeclarationsDocument.PcdDeclarations spdPcdDefinitions = null;
-
- /**
- Constructor to create a new spd file
- **/
- public SpdFileContents() {
-
- psad = PackageSurfaceAreaDocument.Factory.newInstance();
- psaRoot = psad.addNewPackageSurfaceArea();
-
- }
-
- /**
- Constructor for existing document object
- @param psa
- **/
- public SpdFileContents(PackageSurfaceAreaDocument.PackageSurfaceArea psa) {
- psaRoot = psa;
- spdHdr = psaRoot.getSpdHeader();
- spdPkgDefs = psaRoot.getPackageDefinitions();
- }
- /**
- Constructor based on an existing spd file
-
- @param f Existing spd file
- **/
- public SpdFileContents(File f) {
- try {
- psad = PackageSurfaceAreaDocument.Factory.parse(f);
- psaRoot = psad.getPackageSurfaceArea();
- file = f;
- } catch (Exception e) {
- System.out.println(e.toString());
- }
- }
-
- /**
- Remove existing pcd definitions elements using XmlCursor
- **/
- public void removeSpdPcdDefinition() {
- XmlObject o = psaRoot.getPcdDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdPcdDefinitions = null;
- cursor.dispose();
- }
-
- public void removeSpdPcdDefinition(int i){
- XmlObject o = psaRoot.getPcdDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdPcdDefinitionCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing ppi declarations using XmlCursor
- **/
- public void removeSpdPpiDeclaration() {
- XmlObject o = psaRoot.getPpiDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdPpiDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdPpiDeclaration(int i){
- XmlObject o = psaRoot.getPpiDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdPpiDeclarationCount() == 0){
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
- /**
- Remove existing protocols declarations using XmlCursor
- **/
- public void removeSpdProtocolDeclaration() {
- XmlObject o = psaRoot.getProtocolDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdProtocolDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdProtocolDeclaration(int i) {
- XmlObject o = psaRoot.getProtocolDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdProtocolDeclarationCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
- /**
- Remove existing GUID declarations using XmlCursor
- **/
- public void removeSpdGuidDeclaration() {
- XmlObject o = psaRoot.getGuidDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdGuidDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdGuidDeclaration(int i) {
- XmlObject o = psaRoot.getGuidDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdGuidDeclarationCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing spd package include files using XmlCursor
- **/
- public void removeSpdPkgHeader() {
- XmlObject o = psaRoot.getPackageHeaders();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdModHdrs = null;
- cursor.dispose();
- }
-
- public void removeSpdPkgHeader(int i){
- XmlObject o = psaRoot.getPackageHeaders();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdPackageHeaderCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing msa files using XmlCursor
- **/
- public void removeSpdMsaFile() {
- XmlObject o = psaRoot.getMsaFiles();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdMsaFiles = null;
- cursor.dispose();
- }
-
- public void removeSpdMsaFile(int i){
- XmlObject o = psaRoot.getMsaFiles();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdMsaFileCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing library class declarations using XmlCursor
- **/
- public void removeSpdLibClass() {
- XmlObject o = psaRoot.getLibraryClassDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdLibClassDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdLibClass(int i) {
- XmlObject o = psaRoot.getLibraryClassDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdLibClassDeclarationCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateSpdLibClass(int i, String lib, String hdr, String hlp, String clsUsage, String instanceVer, String hdrAttribArch, String hdrAttribModType) {
- XmlObject o = psaRoot.getLibraryClassDeclarations();
- if (o == null)
- return;
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass)cursor.getObject();
- lc.setName(lib);
- lc.setIncludeHeader(hdr);
- lc.setHelpText(hlp);
- if (clsUsage != null) {
- lc.setRecommendedInstanceGuid(clsUsage);
- if (instanceVer != null){
- lc.setRecommendedInstanceVersion(instanceVer);
- } else {
- if (lc.isSetRecommendedInstanceVersion()) {
- lc.unsetRecommendedInstanceVersion();
- }
- }
- } else {
- if (lc.isSetRecommendedInstanceGuid()) {
- lc.unsetRecommendedInstanceGuid();
- }
- if (lc.isSetRecommendedInstanceVersion()) {
- lc.unsetRecommendedInstanceVersion();
- }
- }
-
- if (stringToList(hdrAttribArch) != null){
- lc.setSupArchList(stringToList(hdrAttribArch));
- } else {
- if (lc.isSetSupArchList()) {
- lc.unsetSupArchList();
- }
- }
- if (stringToList(hdrAttribModType) != null){
- lc.setSupModuleList(stringToList(hdrAttribModType));
- } else {
- if (lc.isSetSupModuleList()) {
- lc.unsetSupModuleList();
- }
- }
- }
-
- cursor.dispose();
- }
-
- public void updateSpdMsaFile(int i, String msaFile, String mName, String v, String g){
- XmlObject o = psaRoot.getMsaFiles();
- if (o == null)
- return;
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.setTextValue(msaFile);
-
- }
-
- cursor.dispose();
- }
-
- public void updateSpdGuidDecl(int i, String name, String cName, String guid, String hlp, String archList,
- String modTypeList, String guidTypeList){
- XmlObject o = psaRoot.getGuidDeclarations();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry)cursor.getObject();
- e.setName(name);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null) {
- e.setGuidTypeList(stringToList(guidTypeList));
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
-
- }
- cursor.dispose();
- }
-
- public void updateSpdPpiDecl(int i, String name, String cName, String guid, String hlp, String archList,
- String modTypeList, String guidTypeList){
- XmlObject o = psaRoot.getPpiDeclarations();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry)cursor.getObject();
- e.setName(name);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null) {
- e.setGuidTypeList(stringToList(guidTypeList));
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
- }
- cursor.dispose();
- }
-
- public void updateSpdProtocolDecl(int i, String name, String cName, String guid, String hlp, String archList,
- String modTypeList, String guidTypeList){
- XmlObject o = psaRoot.getProtocolDeclarations();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry)cursor.getObject();
- e.setName(name);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null) {
- e.setGuidTypeList(stringToList(guidTypeList));
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
- }
- cursor.dispose();
- }
-
- public void updateSpdPkgHdr(int i, String pkgName, String hdrName){
- XmlObject o = psaRoot.getPackageHeaders();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
-
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader iph = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader)cursor.getObject();
- iph.setModuleType(ModuleTypeDef.Enum.forString(pkgName));
- iph.setStringValue(hdrName);
- }
- cursor.dispose();
- }
-
- public void updateSpdPcdDefinition(int i, String cName, String token, String dataType, String pcdItemTypes,
- String spaceGuid, String defaultString, String help, String archList, String modTypeList){
- XmlObject o = psaRoot.getPcdDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)cursor.getObject();
- e.setCName(cName);
- e.setToken(token);
- e.setDatumType(PcdDataTypes.Enum.forString(dataType));
- if (pcdItemTypes != null && pcdItemTypes.length() > 0) {
- String usage[] = pcdItemTypes.split("( )+");
- List<String> l = new ArrayList<String>();
- for (int k = 0; k < usage.length; ++k) {
- l.add(usage[k]);
- }
- e.setValidUsage(l);
- }
-
- e.setTokenSpaceGuidCName(spaceGuid);
- e.setDefaultValue(defaultString);
- e.setHelpText(help);
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
-
- }
- cursor.dispose();
- }
- /**
- Get spd file header contents into String array
-
- @param s Caller allocated String array
- **/
- public void getSpdHdrDetails(String[] s) {
- if (getSpdHdr() == null) {
- spdHdr = psaRoot.addNewSpdHeader();
- }
- s[0] = getSpdHdrPkgName();
- s[1] = getSpdHdr().getGuidValue();
- s[2] = getSpdHdrVer();
-// s[3] = getSpdHdr().getAbstract();
- s[4] = getSpdHdr().getDescription();
- s[5] = getSpdHdr().getCopyright();
- s[6] = getSpdHdrLicense();
-
- }
-
- /**
- Get the number of library class declarations from the size of List
-
- @return int
- **/
- public int getSpdLibClassDeclarationCount() {
- if (psaRoot.getLibraryClassDeclarations() == null
- || psaRoot.getLibraryClassDeclarations().getLibraryClassList() == null) {
- return 0;
- }
- return psaRoot.getLibraryClassDeclarations().getLibraryClassList().size();
- }
-
- /**
- Get available library class declaration into String array
- @param libClass Caller allocated two-dimentional String array
- **/
- public void getSpdLibClassDeclarations(String[][] libClass) {
- if (psaRoot.getLibraryClassDeclarations() == null){
- return;
- }
-
- List<LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass> l = psaRoot.getLibraryClassDeclarations().getLibraryClassList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) li.next();
- if (lc != null) {
- libClass[i][0] = lc.getName();
- libClass[i][1] = lc.getIncludeHeader();
- libClass[i][2] = lc.getHelpText();
-// LAH added logic so you cannot set the version unless the GUID is defined.
-
-// if (lc.getRecommendedInstanceGuid() != null) {
- libClass[i][3] = lc.getRecommendedInstanceGuid();
-// if (lc.getRecommendedInstanceVersion() != null) {
- libClass[i][4] = lc.getRecommendedInstanceVersion();
-// }
-// }
-
- if (lc.getSupArchList() != null) {
- libClass[i][5] = listToString(lc.getSupArchList());
- }
- if (lc.getSupModuleList() != null) {
- libClass[i][6] = listToString(lc.getSupModuleList());
- }
-
- }
-
- i++;
- }
-
- }
-
- /**
- Get the number of Msa files from the size of List
-
- @return int
- **/
- public int getSpdMsaFileCount() {
- if (psaRoot.getMsaFiles() == null || psaRoot.getMsaFiles().getFilenameList() == null) {
- return 0;
- }
- return psaRoot.getMsaFiles().getFilenameList().size();
- }
-
- /**
- Get available Msa file into String array
-
- @param msaFile Caller allocated two-dimentional String array
- **/
- public void getSpdMsaFiles(String[][] msaFile) {
- if (psaRoot.getMsaFiles() == null) {
- return;
- }
- List<String> l = psaRoot.getMsaFiles().getFilenameList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- msaFile[i][0] = (String)li.next();
-
- i++;
- }
- }
-
- /**
- Get the number of include header files in PackageHeaders from the size of List
-
- @return int
- **/
- public int getSpdPackageHeaderCount() {
- if (psaRoot.getPackageHeaders() == null || psaRoot.getPackageHeaders().getIncludePkgHeaderList() == null) {
- return 0;
- }
- return psaRoot.getPackageHeaders().getIncludePkgHeaderList().size();
- }
-
- /**
- Get available package header contents into String array
-
- @param pkgHeader Caller allocated two-dimentional String array
- **/
- public void getSpdPackageHeaders(String[][] pkgHeader) {
- if (psaRoot.getPackageHeaders() == null) {
- return;
- }
-
- List<PackageHeadersDocument.PackageHeaders.IncludePkgHeader> l = psaRoot.getPackageHeaders().getIncludePkgHeaderList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) li.next();
- if (ih.getModuleType() != null) {
- pkgHeader[i][0] = ih.getModuleType().toString();
- }
-
- pkgHeader[i][1] = ih.getStringValue();
- i++;
- }
- }
-
- public void getSpdGuidDeclWithType (Vector<String> vGuidCName, String type) {
- if (psaRoot.getGuidDeclarations() == null) {
- return;
- }
- List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();
- for (int i = 0; i < l.size(); ++i) {
- if (l.get(i).getGuidTypeList() == null || l.get(i).getGuidTypeList().contains(type)) {
- vGuidCName.add(l.get(i).getCName());
- }
- }
- }
- /**
- Get the number of GUID declarations from the size of List
-
- @return int
- **/
- public int getSpdGuidDeclarationCount() {
- if (psaRoot.getGuidDeclarations() == null || psaRoot.getGuidDeclarations().getEntryList() == null) {
- return 0;
- }
- return psaRoot.getGuidDeclarations().getEntryList().size();
- }
-
- /**
- Get available Guid declaration contents into String array
-
- @param guid Caller allocated two-dimentional String array
- **/
- public void getSpdGuidDeclarations(String[][] guid) {
- if (psaRoot.getGuidDeclarations() == null) {
- return;
- }
-
- List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry) li
- .next();
- guid[i][0] = e.getName();
- guid[i][1] = e.getCName();
- if (e.getGuidValue() != null) {
- guid[i][2] = e.getGuidValue();
- }
- guid[i][3] = e.getHelpText();
- guid[i][4] = listToString(e.getSupArchList());
- guid[i][5] = listToString(e.getSupModuleList());
- guid[i][6] = listToString(e.getGuidTypeList());
- i++;
- }
- }
-
- /**
- Get the number of protocol declarations from the size of List
-
- @return int
- **/
- public int getSpdProtocolDeclarationCount() {
- if (psaRoot.getProtocolDeclarations() == null || psaRoot.getProtocolDeclarations().getEntryList() == null) {
- return 0;
- }
- return psaRoot.getProtocolDeclarations().getEntryList().size();
- }
-
- /**
- Get available protocol declaration contents into String array
-
- @param protocol Caller allocated two-dimentional String array
- **/
- public void getSpdProtocolDeclarations(String[][] protocol) {
- if (psaRoot.getProtocolDeclarations() == null) {
- return;
- }
-
- List<ProtocolDeclarationsDocument.ProtocolDeclarations.Entry> l = psaRoot.getProtocolDeclarations()
- .getEntryList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) li
- .next();
- protocol[i][0] = e.getName();
- protocol[i][1] = e.getCName();
- if (e.getGuidValue() != null) {
- protocol[i][2] = e.getGuidValue();
- }
- protocol[i][3] = e.getHelpText();
- protocol[i][4] = listToString(e.getSupArchList());
- protocol[i][5] = listToString(e.getSupModuleList());
- protocol[i][6] = listToString(e.getGuidTypeList());
- i++;
- }
- }
-
- /**
- Get the number of Ppi declarations from the size of List
-
- @return int
- **/
- public int getSpdPpiDeclarationCount() {
- if (psaRoot.getPpiDeclarations() == null || psaRoot.getPpiDeclarations().getEntryList() == null) {
- return 0;
- }
- return psaRoot.getPpiDeclarations().getEntryList().size();
- }
-
- /**
- Get available Ppi declaration contents into String array
-
- @param ppi Caller allocated two-dimentional String array
- **/
- public void getSpdPpiDeclarations(String[][] ppi) {
- if (psaRoot.getPpiDeclarations() == null) {
- return;
- }
-
- List<PpiDeclarationsDocument.PpiDeclarations.Entry> l = psaRoot.getPpiDeclarations().getEntryList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry) li.next();
- ppi[i][0] = e.getName();
- ppi[i][1] = e.getCName();
- if (e.getGuidValue() != null) {
- ppi[i][2] = e.getGuidValue();
- }
- ppi[i][3] = e.getHelpText();
- ppi[i][4] = listToString(e.getSupArchList());
- ppi[i][5] = listToString(e.getSupModuleList());
- ppi[i][6] = listToString(e.getGuidTypeList());
- i++;
- }
- }
-
- /**
- Get the number of Pcd definitions from the size of List
-
- @return int
- **/
- public int getSpdPcdDefinitionCount() {
- if (psaRoot.getPcdDeclarations() == null || psaRoot.getPcdDeclarations().getPcdEntryList() == null) {
- return 0;
- }
- return psaRoot.getPcdDeclarations().getPcdEntryList().size();
- }
-
- /**
- Get available Pcd definition contents into String array
-
- @param pcd Caller allocated two-dimentional String array
- **/
- public void getSpdPcdDefinitions(String[][] pcd, String pcdUsage[][]) {
- if (psaRoot.getPcdDeclarations() == null) {
- return;
- }
-
- List<PcdDeclarationsDocument.PcdDeclarations.PcdEntry> l = psaRoot.getPcdDeclarations().getPcdEntryList();
- int i = 0;
- while (i < l.size()) {
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)l.get(i);
- pcd[i][0] = e.getCName();
- pcd[i][1] = e.getToken() + "";
- pcd[i][2] = e.getTokenSpaceGuidCName();
- if (e.getDatumType() != null) {
- pcd[i][3] = e.getDatumType().toString();
- }
- pcd[i][4] = e.getDefaultValue()+"";
- pcd[i][5] = e.getHelpText();
- String archList = listToString(e.getSupArchList());
- if (archList != null) {
- pcd[i][6] = archList;
- }
- String modTypeList = listToString(e.getSupModuleList());
- if (modTypeList != null) {
- pcd[i][7] = modTypeList;
- }
-
- int j = 0;
- while (j < e.getValidUsage().size() && j < 5) {
- pcdUsage[i][j] = (String)e.getValidUsage().get(j);
- ++j;
- }
- i++;
- }
- }
-
- /**
- Save the processed xml contents to file
-
- @param spdFile The file to save xml contents
- @throws IOException Exceptions during file operation
- **/
- public void saveAs(File spdFile) throws IOException {
-
- XmlOptions options = new XmlOptions();
-
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- try {
- psad.save(spdFile, options);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- /**
- Generate SpdHeader contents using parameters passed in.
-
- @param pkgName PackageName
- @param pkgGuid Guid
- @param pkgVer Version
- @param pkgAbs Abstract
- @param pkgDes Description
- @param pkgCpRight Copyright
- @param pkgLicense License
- @param pkgCreateDate Created
- @param pkgUpdateDate Updated
- @param pkgURL URL
- @param pkgType PackageType
- @param pkgRdOnly ReadOnly
- @param pkgRePkg RePackage
- @param pkgSpec Reserved
- @param pkgOutDir Reserved
- **/
- public void genSpdHeader(String pkgName, String pkgGuid, String pkgVer, String pkgAbs, String pkgDes,
- String pkgCpRight, String pkgLicense, String pkgCreateDate, String pkgUpdateDate,
- String pkgURL, String pkgType, String pkgRdOnly, String pkgRePkg, String pkgSpec,
- String pkgOutDir) {
- if (getSpdHdr() == null) {
- spdHdr = psaRoot.addNewSpdHeader();
- }
-
- setSpdHdrPkgName(pkgName);
- setSpdHdrGuidValue(pkgGuid);
- setSpdHdrVer(pkgVer);
- setSpdHdrAbs(pkgAbs);
- setSpdHdrDescription(pkgDes);
- setSpdHdrCopyright(pkgCpRight);
- setSpdHdrLicense(pkgLicense);
-
-
- setSpdHdrSpec(pkgSpec);
- }
-
- /**
- Generate library class declaration element using parameters passed in
-
- @param libClassBaseName LibraryClass element value
- @param libClassUsage Reserved
- @param incHdrFileName IncludeHeader element value
- @param incHdrAttribGuid Reserved
- @param incHdrAttribArch Reserved
- @param incHdrAttribPath Reserved
- @param incHdrAttribClass Reserved
- @param incHdrAttribVer Reserved
- @param incHdrAttribOverrideID Reserved
- @param incHdrAttribModuleType Reserved
- **/
- public void genSpdLibClassDeclarations(String libClassBaseName, String instanceUsage, String incHdrFileName,
- String help, String incHdrAttribArch, String incHdrAttribPath,
- String incHdrAttribClass, String incHdrAttribVer,
- String incHdrAttribOverrideID, String incHdrAttribModuleType) {
- if (getSpdLibClassDeclarations() == null) {
- spdLibClassDeclarations = psaRoot.addNewLibraryClassDeclarations();
- }
- //
- // add contents under LibraryClassDeclarations tag
- //
- setSpdLibClassDeclaration(libClassBaseName, instanceUsage, incHdrFileName, help, incHdrAttribArch,
- incHdrAttribPath, incHdrAttribClass, incHdrAttribVer, incHdrAttribOverrideID,
- incHdrAttribModuleType, spdLibClassDeclarations);
- }
-
- public void getSpdLibClassDeclaration(String[] sa, int i) {
- if (getSpdLibClassDeclarations() == null) {
- return;
- }
- XmlCursor cursor = getSpdLibClassDeclarations().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass)cursor.getObject();
- sa[0] = lc.getName();
- sa[1] = lc.getIncludeHeader();
- sa[2] = lc.getHelpText();
- sa[3] = lc.getRecommendedInstanceGuid();
- sa[4] = lc.getRecommendedInstanceVersion();
- sa[5] = listToString(lc.getSupArchList());
- sa[6] = listToString(lc.getSupModuleList());
- }
- cursor.dispose();
- }
-
- /**
- Set library class declaration contents under parent tag
-
- @param clsName LibraryClass element value
- @param clsUsage Reserved
- @param hdrFile IncludeHeader element value
- @param hdrAttribGuid Reserved
- @param hdrAttribArch Reserved
- @param hdrAttribPath Reserved
- @param hdrAttribClass Reserved
- @param hdrAttribVer Reserved
- @param hdrAttribOverID Reserved
- @param hdrAttribModType Reserved
- @param parent The tag under which library class declaration goes to
- **/
- public void setSpdLibClassDeclaration(String clsName, String clsUsage, String hdrFile, String help,
- String hdrAttribArch, String hdrAttribPath, String hdrAttribClass,
- String instanceVer, String hdrAttribOverID, String hdrAttribModType,
- XmlObject parent) {
-
- setSpdLibraryClass(clsName, hdrFile, help, clsUsage, instanceVer, hdrAttribArch, hdrAttribModType, parent);
-
- }
-
- /**
- Set the contents of LibraryClass under parent element
-
- @param clsName LibraryClass element value
- @param clsUsage Reserved
- @param parent The tag under which library class declaration goes to
- **/
- public void setSpdLibraryClass(String clsName, String clsIncludeFile, String help, String clsUsage, String instanceVer, String hdrAttribArch, String hdrAttribModType, XmlObject parent) {
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = ((LibraryClassDeclarationsDocument.LibraryClassDeclarations) parent).addNewLibraryClass();
- lc.setName(clsName);
- lc.setIncludeHeader(clsIncludeFile);
- lc.setHelpText(help);
-// LAH added logic so you cannot set the version unless the GUID is defined.
-
- if (clsUsage != null) {
- lc.setRecommendedInstanceGuid(clsUsage);
- if (instanceVer != null) {
- lc.setRecommendedInstanceVersion(instanceVer);
- }
- }
- else {
- if (lc.isSetRecommendedInstanceGuid()) {
- lc.unsetRecommendedInstanceGuid();
- }
- if (lc.isSetRecommendedInstanceVersion()) {
- lc.unsetRecommendedInstanceVersion();
- }
- }
-
- if (hdrAttribArch != null) {
- lc.setSupArchList(stringToList(hdrAttribArch));
- } else {
- if (lc.isSetSupArchList()) {
- lc.unsetSupArchList();
- }
- }
-
- if (hdrAttribModType != null) {
- lc.setSupModuleList(stringToList(hdrAttribModType));
- } else {
- if (lc.isSetSupModuleList()) {
- lc.unsetSupModuleList();
- }
- }
-
- }
-
- /**
- Set contents of IncludeHeader under parent element
-
- @param modType Reserved
- @param hdrFile IncludeHeader element value
- @param hdrAttribGuid Reserved
- @param hdrAttribArch Reserved
- @param hdrAttribPath Reserved
- @param hdrAttribClass Reserved
- @param hdrAttribVer Reserved
- @param hdrAttribOverID Reserved
- @param parent The tag under which library class declaration goes to
- **/
- public void setSpdIncludeHeader(String modType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,
- String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,
- String hdrAttribOverID, XmlObject parent) {
-
- if (parent instanceof LibraryClassDeclarationsDocument.LibraryClassDeclarations) {
- } else if (parent instanceof PackageHeadersDocument.PackageHeaders) {
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = null;
- ih = ((PackageHeadersDocument.PackageHeaders) parent).addNewIncludePkgHeader();
- ih.setStringValue(hdrFile);
- ih.setModuleType(ModuleTypeDef.Enum.forString(modType));
- } else {
- return;
- }
-
- if (hdrAttribGuid != null) {
- }
- if (hdrAttribPath != null) {
- }
- if (hdrAttribClass != null) {
- }
- if (hdrAttribVer != null) {
- }
- if (hdrAttribOverID != null) {
- }
-
- }
-
- /**
- Generate MsaFile element.
-
- @param msaFileName MsaFile element value
- @param archType Reserved
- **/
- public void genSpdMsaFiles(String msaFileName, String moduleName, String ver, String guid) {
- if (getSpdMsaFiles() == null) {
- spdMsaFiles = psaRoot.addNewMsaFiles();
- }
- setSpdMsaFile(msaFileName, moduleName, ver, guid, spdMsaFiles);
-
- }
-
- public void getSpdMsaFile (String[] sa, int i) {
- if (getSpdMsaFiles() == null) {
- return;
- }
- XmlCursor cursor = getSpdMsaFiles().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- sa[0] = cursor.getTextValue();
- }
- cursor.dispose();
- }
-
- /**
- Set MsaFile contents under parent element.
-
- @param msaFileName MsaFile element value
- @param parent Element under which MsaFile goes to
- **/
- public void setSpdMsaFile(String msaFileName, String moduleName, String ver, String guid, XmlObject parent) {
- MsaFilesDocument.MsaFiles f = (MsaFilesDocument.MsaFiles)parent;
- f.addNewFilename().setStringValue(msaFileName);
-// f.setFilename(msaFileName);
-// f.setModuleName(moduleName);
-// f.setModuleVersion(ver);
-// f.setModuleGuid(guid);
- }
-
- /**
- Generate PackageHeader element using parameters passed in.
-
- @param ModHdrModType ModuleType attribute of IncludeHeader element
- @param hdrFile IncludeHeader element value
- @param hdrAttribGuid Reserved
- @param hdrAttribArch Reserved
- @param hdrAttribPath Reserved
- @param hdrAttribClass Reserved
- @param hdrAttribVer Reserved
- @param hdrAttribOverID Reserved
- **/
- public void genSpdModuleHeaders(String ModHdrModType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,
- String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,
- String hdrAttribOverID) {
- if (getSpdModHdrs() == null) {
- spdModHdrs = psaRoot.addNewPackageHeaders();
- }
-
- //
- // add IncludeHeader under PackageHeaders element
- //
- setSpdIncludeHeader(ModHdrModType, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass,
- hdrAttribVer, hdrAttribOverID, spdModHdrs);
- }
-
- public void getSpdModuleHeader(String[] sa, int i) {
- if (getSpdModHdrs() == null) {
- return;
- }
- XmlCursor cursor = getSpdModHdrs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader)cursor.getObject();
- sa[0] = ih.getModuleType()+"";
- sa[1] = ih.getStringValue();
- }
- cursor.dispose();
- }
-
- /**
- Generate GUID declaration element using parameters passed in.
-
- @param guidDeclEntryName Name attribute of Entry element
- @param guidDeclCName CName element value
- @param guidDeclGuid Guid element value
- @param guidDeclFeatureFlag Reserved
- **/
- public void genSpdGuidDeclarations(String guidDeclEntryName, String guidDeclCName, String guidDeclGuid,
- String guidDeclHelp, Vector<String> archList, Vector<String> modTypeList,
- Vector<String> guidTypeList) {
- if (getSpdGuidDeclarations() == null) {
- spdGuidDeclarations = psaRoot.addNewGuidDeclarations();
- }
-
- setSpdEntry(guidDeclEntryName, guidDeclCName, guidDeclGuid, guidDeclHelp, archList, modTypeList, guidTypeList, spdGuidDeclarations);
- }
-
- /**
- Generate protocol declaration element using parameters passed in.
-
- @param protocolDeclEntryName Name attribute of Entry element
- @param protocolDeclCName CName element value
- @param protocolDeclGuid Guid element value
- @param protocolDeclFeatureFlag Reserved
- **/
- public void genSpdProtocolDeclarations(String protocolDeclEntryName, String protocolDeclCName,
- String protocolDeclGuid, String protocolDeclFeatureFlag,
- Vector<String> archList, Vector<String> modTypeList, Vector<String> guidTypeList) {
- if (getSpdProtocolDeclarations() == null) {
- spdProtocolDeclarations = psaRoot.addNewProtocolDeclarations();
- }
-
- setSpdEntry(protocolDeclEntryName, protocolDeclCName, protocolDeclGuid, protocolDeclFeatureFlag,
- archList, modTypeList, guidTypeList, spdProtocolDeclarations);
- }
-
- /**
- Generate PPI declaration element using parameters passed in.
-
- @param ppiDeclEntryName Name attribute of Entry element
- @param ppiDeclCName CName element value
- @param ppiDeclGuid Guid element value
- @param ppiDeclFeatureFlag Reserved
- **/
- public void genSpdPpiDeclarations(String ppiDeclEntryName, String ppiDeclCName, String ppiDeclGuid,
- String ppiDeclFeatureFlag, Vector<String> archList, Vector<String> modTypeList, Vector<String> guidTypeList) {
- if (getSpdPpiDeclarations() == null) {
- spdPpiDeclarations = psaRoot.addNewPpiDeclarations();
- }
-
- setSpdEntry(ppiDeclEntryName, ppiDeclCName, ppiDeclGuid, ppiDeclFeatureFlag, archList, modTypeList, guidTypeList, spdPpiDeclarations);
- }
-
- public void getSpdGuidDeclaration(String[] sa, int i) {
- if (getSpdGuidDeclarations() == null) {
- return;
- }
- getSpdEntry(sa, i, getSpdGuidDeclarations());
- }
-
- public void getSpdProtocolDeclaration(String[] sa, int i) {
- if (getSpdProtocolDeclarations() == null) {
- return;
- }
- getSpdEntry(sa, i, getSpdProtocolDeclarations());
- }
-
- public void getSpdPpiDeclaration(String[] sa, int i) {
- if (getSpdPpiDeclarations() == null) {
- return;
- }
- getSpdEntry(sa, i, getSpdPpiDeclarations());
- }
-
- public void getSpdEntry(String[] sa, int i, XmlObject parent) {
- XmlCursor cursor = parent.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry)cursor.getObject();
- sa[0] = e.getName();
- sa[1] = e.getCName();
- sa[2] = e.getGuidValue();
- sa[3] = e.getHelpText();
- sa[4] = listToString(e.getSupArchList());
- sa[5] = listToString(e.getSupModuleList());
- sa[6] = listToString(e.getGuidTypeList());
- }
-
- if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry)cursor.getObject();
- sa[0] = e.getName();
- sa[1] = e.getCName();
- sa[2] = e.getGuidValue();
- sa[3] = e.getHelpText();
- sa[4] = listToString(e.getSupArchList());
- sa[5] = listToString(e.getSupModuleList());
- sa[6] = listToString(e.getGuidTypeList());
- }
-
- if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry)cursor.getObject();
- sa[0] = e.getName();
- sa[1] = e.getCName();
- sa[2] = e.getGuidValue();
- sa[3] = e.getHelpText();
- sa[4] = listToString(e.getSupArchList());
- sa[5] = listToString(e.getSupModuleList());
- sa[6] = listToString(e.getGuidTypeList());
- }
-
- }
- cursor.dispose();
- }
- /**
- Set Entry contents using parameters passed in
-
- @param entryName Name attribute of Entry element
- @param cName CName element value
- @param guid Guid element value
- @param featureFlag Reserved
- @param parent The tag under which Entry element goes to
- **/
- public void setSpdEntry(String entryName, String cName, String guid, String help,
- Vector<String> archList, Vector<String> modTypeList,
- Vector<String> guidTypeList, XmlObject parent) {
-
- if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {
- GuidDeclarationsDocument.GuidDeclarations.Entry e = ((GuidDeclarations) parent).addNewEntry();
- e.setName(entryName);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(help);
- if (guidTypeList != null) {
- e.setGuidTypeList(guidTypeList);
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (archList != null) {
- e.setSupArchList(archList);
- }
- else {
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- e.setSupModuleList(modTypeList);
- }
- else {
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
-
- return;
- }
- if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry pe = ((ProtocolDeclarationsDocument.ProtocolDeclarations) parent)
- .addNewEntry();
- pe.setName(entryName);
- pe.setCName(cName);
- pe.setGuidValue(guid);
- pe.setHelpText(help);
- if (guidTypeList != null) {
- pe.setGuidTypeList(guidTypeList);
- }
- else{
- if (pe.isSetGuidTypeList()) {
- pe.unsetGuidTypeList();
- }
- }
- if (archList != null) {
- pe.setSupArchList(archList);
- }
- else {
- if (pe.isSetSupArchList()) {
- pe.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- pe.setSupModuleList(modTypeList);
- }
- else {
- if (pe.isSetSupModuleList()) {
- pe.unsetSupModuleList();
- }
- }
-
- return;
- }
- if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
- PpiDeclarationsDocument.PpiDeclarations.Entry ppe = ((PpiDeclarationsDocument.PpiDeclarations) parent)
- .addNewEntry();
- ppe.setName(entryName);
- ppe.setCName(cName);
- ppe.setGuidValue(guid);
- ppe.setHelpText(help);
- if (guidTypeList != null) {
- ppe.setGuidTypeList(guidTypeList);
- }
- else{
- if (ppe.isSetGuidTypeList()) {
- ppe.unsetGuidTypeList();
- }
- }
- if (archList != null) {
- ppe.setSupArchList(archList);
- }
- else {
- if (ppe.isSetSupArchList()) {
- ppe.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- ppe.setSupModuleList(modTypeList);
- }
- else {
- if (ppe.isSetSupModuleList()) {
- ppe.unsetSupModuleList();
- }
- }
-
- return;
- }
-
- return;
-
- }
-
- /**
- Generate Pcd definition using parameters passed in
-
- @param pcdItemTypes ItemType attribute of PcdEntry element
- @param cName C_Name element value
- @param token Token element value
- @param dataType DatumType element value
- @param skuEnable Reserved
- @param sku Reserved
- @param maxSku Reserved
- @param hiiEnable Reserved
- @param varGuid Reserved
- @param varName Reserved
- @param defaultString DefaultString element value
- **/
- public void genSpdPcdDefinitions(String cName, String token, String dataType, String pcdItemTypes,
- String spaceGuid, String defaultString, String help, String archList,
- String modTypeList) {
- if (getSpdPcdDefinitions() == null) {
- spdPcdDefinitions = psaRoot.addNewPcdDeclarations();
- }
-
- setSpdPcdEntry(pcdItemTypes, cName, token, dataType, spaceGuid, help,
- defaultString, archList, modTypeList, spdPcdDefinitions);
- }
-
- public void getSpdPcdDeclaration(String[] sa, int i) {
- if (getSpdPcdDefinitions() == null) {
- return;
- }
-
- XmlCursor cursor = getSpdPcdDefinitions().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry pe = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)cursor.getObject();
- sa[0] = pe.getCName();
- sa[1] = pe.getToken()+"";
- sa[2] = pe.getTokenSpaceGuidCName();
- sa[3] = pe.getDatumType()+"";
- sa[4] = pe.getDefaultValue();
- sa[5] = pe.getHelpText();
- sa[6] = listToString(pe.getValidUsage());
- sa[7] = listToString(pe.getSupArchList());
- sa[8] = listToString(pe.getSupModuleList());
- }
- cursor.dispose();
- }
-
- /**
- Set Pcd entry contents under parent tag
-
- @param pcdItemTypes ItemType attribute of PcdEntry element
- @param cName C_Name element value
- @param token Token element value
- @param dataType DatumType element value
- @param spaceGuid Reserved
- @param help Reserved
- @param defaultString DefaultString element value
- @param parent Tag under which PcdEntry goes to
- **/
- public void setSpdPcdEntry(String pcdItemTypes, String cName, String token, String dataType, String spaceGuid, String help,
- String defaultString, String archList, String modTypeList, XmlObject parent) {
-
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry pe = ((PcdDeclarationsDocument.PcdDeclarations) parent).addNewPcdEntry();
-
- //ToDo: maybe multiple types in, need parse pcdItemTypes.
- String usage[] = pcdItemTypes.split("( )+");
- List<String> l = new ArrayList<String>();
- for (int i = 0; i < usage.length; ++i) {
- l.add(usage[i]);
- }
- pe.setValidUsage(l);
- pe.setCName(cName);
- pe.setToken(token);
- pe.setDatumType(PcdDataTypes.Enum.forString(dataType));
- pe.setDefaultValue(defaultString);
- pe.setTokenSpaceGuidCName(spaceGuid);
- pe.setHelpText(help);
- if (archList != null){
- pe.setSupArchList(stringToList(archList));
- } else {
- if (pe.isSetSupArchList()) {
- pe.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- pe.setSupModuleList(stringToList(modTypeList));
- } else {
- if (pe.isSetSupModuleList()) {
- pe.unsetSupModuleList();
- }
- }
- }
-
- /**
- Get PpiDeclarations element
-
- @return PpiDeclarationsDocument.PpiDeclarations
- **/
- public PpiDeclarationsDocument.PpiDeclarations getSpdPpiDeclarations() {
- if (spdPpiDeclarations == null) {
- spdPpiDeclarations = psaRoot.getPpiDeclarations();
- }
- return spdPpiDeclarations;
- }
-
- /**
- Get ProtocolDeclarations element
-
- @return ProtocolDeclarationsDocument.ProtocolDeclarations
- **/
- public ProtocolDeclarationsDocument.ProtocolDeclarations getSpdProtocolDeclarations() {
- if (spdProtocolDeclarations == null) {
- spdProtocolDeclarations = psaRoot.getProtocolDeclarations();
- }
- return spdProtocolDeclarations;
- }
-
- /**
- Get GuidDeclarations element
-
- @return GuidDeclarationsDocument.GuidDeclarations
- **/
- public GuidDeclarationsDocument.GuidDeclarations getSpdGuidDeclarations() {
- if (spdGuidDeclarations == null) {
- spdGuidDeclarations = psaRoot.getGuidDeclarations();
- }
- return spdGuidDeclarations;
- }
-
- /**
- Get PcdDefinitions element
-
- @return PcdDefinitionsDocument.PcdDefinitions
- **/
- public PcdDeclarationsDocument.PcdDeclarations getSpdPcdDefinitions() {
- if (spdPcdDefinitions == null) {
- spdPcdDefinitions = psaRoot.getPcdDeclarations();
- }
- return spdPcdDefinitions;
- }
-
- /**
- Get PackageHeaders element
-
- @return PackageHeadersDocument.PackageHeaders
- **/
- public PackageHeadersDocument.PackageHeaders getSpdModHdrs() {
- if (spdModHdrs == null) {
- spdModHdrs = psaRoot.getPackageHeaders();
- }
- return spdModHdrs;
- }
-
- /**
- Get MsaFiles element
-
- @return MsaFilesDocument.MsaFiles
- **/
- public MsaFilesDocument.MsaFiles getSpdMsaFiles() {
- if (spdMsaFiles == null) {
- spdMsaFiles = psaRoot.getMsaFiles();
- }
- return spdMsaFiles;
- }
-
- /**
- Get LibraryClassDeclarations element
-
- @return LibraryClassDeclarationsDocument.LibraryClassDeclarations
- **/
- public LibraryClassDeclarationsDocument.LibraryClassDeclarations getSpdLibClassDeclarations() {
- if (spdLibClassDeclarations == null) {
- spdLibClassDeclarations = psaRoot.getLibraryClassDeclarations();
- }
- return spdLibClassDeclarations;
- }
-
- public PackageDefinitionsDocument.PackageDefinitions getSpdPkgDefs() {
- if (spdPkgDefs == null) {
- spdPkgDefs = psaRoot.addNewPackageDefinitions();
- }
- return spdPkgDefs;
- }
- /**
- Get SpdHeader element
-
- @return SpdHeaderDocument.SpdHeader
- **/
- public SpdHeaderDocument.SpdHeader getSpdHdr() {
- if (spdHdr == null) {
- spdHdr = psaRoot.addNewSpdHeader();
- }
- return spdHdr;
- }
-
- /**
- Set value to Guid element
-
- @param guid The value set to Guid element
- **/
- public void setSpdHdrGuidValue(String guid) {
- getSpdHdr().setGuidValue(guid);
- }
-
- /**
- Get Version element under SpdHdr
-
- @return String
- **/
- public String getSpdHdrVer() {
- return getSpdHdr().getVersion();
- }
-
- /**
- Set value to Version element
-
- @param ver The value set to Version element
- **/
- public void setSpdHdrVer(String ver) {
- getSpdHdr().setVersion(ver);
- }
-
- public String getSpdHdrAbs(){
- return getSpdHdr().getAbstract();
-
- }
-
- /**
- Set value to Abstract element
-
- @param abs The value set to Abstract element
- **/
- public void setSpdHdrAbs(String abs) {
-
- getSpdHdr().setAbstract(abs);
- }
-
- public String getSpdHdrDescription(){
- return getSpdHdr().getDescription();
- }
- /**
- Set value to Description element
-
- @param des The value set to Description element
- **/
- public void setSpdHdrDescription(String des) {
- getSpdHdr().setDescription(des);
- }
-
- public String getSpdHdrCopyright(){
- return getSpdHdr().getCopyright();
- }
- /**
- Set value to Copyright element
-
- @param cpRit The value set to Copyright element
- **/
- public void setSpdHdrCopyright(String cpRit) {
-
- getSpdHdr().setCopyright(cpRit);
-
- }
- /**
- Get License element under SpdHdr
-
- @return String
- **/
- public String getSpdHdrLicense() {
- if (getSpdHdr().getLicense() != null) {
- return getSpdHdr().getLicense().getStringValue();
- }
- return null;
- }
-
- /**
- Set value to License element
-
- @param license The value set to License element
- **/
- public void setSpdHdrLicense(String license) {
- if (getSpdHdr().getLicense() == null){
- getSpdHdr().addNewLicense().setStringValue(license);
- }
- else {
- getSpdHdr().getLicense().setStringValue(license);
- }
- }
-
- public String getSpdHdrUrl(){
- if (getSpdHdr().getLicense() != null) {
- return getSpdHdr().getLicense().getURL();
- }
- return null;
- }
-
- public void setSpdHdrUrl(String url){
- getSpdHdr().getLicense().setURL(url);
- }
-
- /**
- Get PackageName element under SpdHdr
-
- @return String
- **/
- public String getSpdHdrPkgName() {
-
- return getSpdHdr().getPackageName();
- }
-
- /**
- Set value to PackageName element
-
- @param pkgName The value set to PackageName element
- **/
- public void setSpdHdrPkgName(String pkgName) {
- getSpdHdr().setPackageName(pkgName);
- }
-
- public String getSpdHdrGuidValue(){
- return getSpdHdr().getGuidValue();
- }
-
- /**
- Reserved method
-
- @return SpecificationDocument.Specification
- **/
- public String getSpdHdrSpec() {
- return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
-// return getSpdHdr().getSpecification();
- }
-
- /**
- Reserved method
-
- @param spec
- **/
- public void setSpdHdrSpec(String spec) {
- spec = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
- getSpdHdr().setSpecification(spec);
-
- }
-
- public String getSpdPkgDefsRdOnly(){
- return getSpdPkgDefs().getReadOnly() + "";
- }
- /**
- Set value to ReadOnly element
-
- @param rdOnly The value set to ReadOnly element
- **/
- public void setSpdPkgDefsRdOnly(String rdOnly) {
-
- getSpdPkgDefs().setReadOnly(new Boolean(rdOnly));
- }
-
- public String getSpdPkgDefsRePkg(){
- return getSpdPkgDefs().getRePackage() + "";
- }
- /**
- Set value to RePackage element
-
- @param rePkg The value set to RePackage element
- **/
- public void setSpdPkgDefsRePkg(String rePkg) {
-
- getSpdPkgDefs().setRePackage(new Boolean(rePkg));
- }
-
- /**
- Set value to URL element
-
- @param url The value set to URL element
- **/
-// public void setSpdHdrURL(String url) {
-// getSpdHdr().setURL(url);
-// }
-
- /**
- Get xml file
-
- @return File
- **/
- public File getFile() {
- return file;
- }
-
- /**
- Set file
-
- @param file File with xml format
- **/
- public void setFile(File file) {
- this.file = file;
- }
-
- private List<String> stringToList(String s){
- if (s == null || s.length() == 0) {
- return null;
- }
- Vector<String> al = new Vector<String>();
- String[] sArray = s.split(" ");
- for(int i = 0; i < sArray.length; ++i){
- al.add(sArray[i]);
- }
- return al;
- }
-
- private String listToString(List l) {
- if (l == null) {
- return null;
- }
- String s = " ";
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- s += li.next();
- s += " ";
- }
- return s.trim();
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java
deleted file mode 100644
index 8f39783a8f..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java
+++ /dev/null
@@ -1,941 +0,0 @@
-/** @file
- Java class SpdGuidDecls is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.util.Vector;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private JTable jTable = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JScrollPane jScrollPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonGen = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- protected int selectedRow = -1;
-
- private JLabel jLabelName = null;
-
- private JScrollPane jScrollPaneModule = null;
-
- private JTextField jTextFieldName = null;
-
- private JScrollPane jScrollPaneArch = null;
-
- private JScrollPane jScrollPaneGuid = null;
-
- private JLabel jLabelGuid = null;
-
- private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="10,213"
-
- private JLabel jLabelCName = null;
-
- private GenGuidDialog guidDialog = null;
-
- private JTextField jTextFieldCName = null;
-
- private JLabel jLabelHelp = null;
-
- private JTextField jTextFieldHelp = null;
-
- private JLabel jLabelSupMod = null;
-
- private JLabel jLabelSupArch = null;
-
- private ICheckBoxList iCheckBoxListArch = null;
-
- private ICheckBoxList iCheckBoxListGuid = null;
-
- private ICheckBoxList iCheckBoxListMod = null;
-
- private JLabel jLabelGuidType = null;
-
- protected String[][] saa = null;
-
- protected StarLabel starLabel = null;
-
- private final int guidNameMinWidth = 200;
- private final int guidCNameMinWidth = 200;
- private final int guidValueMinWidth = 300;
- private final int helpTextMinWidth = 300;
- private final int supArchMinWidth = 200;
- private final int supModMinWidth = 200;
- private final int guidTypeMinWidth = 200;
-
-
- /**
- This method initializes this
-
- **/
- protected void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField
- **/
- protected JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(137,60,336,20));
- jTextFieldGuid.setPreferredSize(new java.awt.Dimension(200,20));
-
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- **/
- protected JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(5,256,472,292));
- jScrollPane.setViewportView(getJTable());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- protected JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- model.addColumn("Name");
- model.addColumn("The C Name");
- model.addColumn("GUID Value");
- model.addColumn("Help Text");
- model.addColumn("Supported Architectures");
- model.addColumn("Supported Module Types");
- model.addColumn("GuidTypes");
-
- TableColumn column = jTable.getColumnModel().getColumn(0);
- column.setMinWidth(this.guidNameMinWidth);
- column = jTable.getColumnModel().getColumn(1);
- column.setMinWidth(this.guidCNameMinWidth);
- column = jTable.getColumnModel().getColumn(2);
- column.setMinWidth(this.guidValueMinWidth);
- column = jTable.getColumnModel().getColumn(3);
- column.setMinWidth(this.helpTextMinWidth);
- column = jTable.getColumnModel().getColumn(4);
- column.setMinWidth(this.supArchMinWidth);
- column = jTable.getColumnModel().getColumn(5);
- column.setMinWidth(this.supModMinWidth);
- column = jTable.getColumnModel().getColumn(6);
- column.setMinWidth(this.guidTypeMinWidth);
-
- jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor(topFrame));
- jTable.getColumnModel().getColumn(3).setCellEditor(new LongTextEditor(topFrame));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTable.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch, topFrame));
-
- Vector<String> vModule = new Vector<String>();
- vModule.add("BASE");
- vModule.add("SEC");
- vModule.add("PEI_CORE");
- vModule.add("PEIM");
- vModule.add("DXE_CORE");
- vModule.add("DXE_DRIVER");
- vModule.add("DXE_RUNTIME_DRIVER");
- vModule.add("DXE_SAL_DRIVER");
- vModule.add("DXE_SMM_DRIVER");
- vModule.add("UEFI_DRIVER");
- vModule.add("UEFI_APPLICATION");
- vModule.add("USER_DEFINED");
- jTable.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vModule, topFrame));
-
- Vector<String> vGuid = new Vector<String>();
- vGuid.add("DATA_HUB_RECORD");
- vGuid.add("EFI_EVENT");
- vGuid.add("EFI_SYSTEM_CONFIGURATION_TABLE");
- vGuid.add("EFI_VARIABLE");
- vGuid.add("GUID");
- vGuid.add("HII_PACKAGE_LIST");
- vGuid.add("HOB");
- vGuid.add("TOKEN_SPACE_GUID");
- ListEditor le = new ListEditor(vGuid, topFrame);
- le.setCanNotBeEmpty(true);
- jTable.getColumnModel().getColumn(6).setCellEditor(le);
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
-
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
-
- updateRow(row, column, m);
- }
- }
-
- protected void updateRow(int row, int column, TableModel m){
- String[] sa = new String[7];
- sfc.getSpdGuidDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
-
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
-
- String name = m.getValueAt(row, 0) + "";
- String cName = m.getValueAt(row, 1) + "";
- String guid = m.getValueAt(row, 2) + "";
- String help = m.getValueAt(row, 3) + "";
- String archList = null;
- if (m.getValueAt(row, 4) != null){
- archList = m.getValueAt(row, 4).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 5) != null) {
- modTypeList = m.getValueAt(row, 5).toString();
- }
- String guidTypeList = null;
- if (m.getValueAt(row, 6) != null){
- guidTypeList = m.getValueAt(row, 6).toString();
- }
- String[] rowData = {name, cName, guid, help};
- if (!dataValidation(rowData)){
- return;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
- }
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(167,227,90,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(270,227,90,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(380,227,90,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setLocation(new java.awt.Point(390, 305));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jButton
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setSize(new java.awt.Dimension(90, 20));
- jButtonOk.setText("OK");
- jButtonOk.setLocation(new java.awt.Point(290, 305));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This is the default constructor
- **/
- public SpdGuidDecls(JFrame frame) {
- super();
- topFrame = frame;
- initialize();
- init();
-
- }
-
- public SpdGuidDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdGuidDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
- }
- /**
- This method initializes this
-
- @return void
- **/
- protected void init() {
- this.setContentPane(getJContentPane());
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- }
-
- protected void init(SpdFileContents sfc){
- if (sfc.getSpdGuidDeclarationCount() == 0) {
- return ;
- }
- //
- // initialize table using SpdFileContents object
- //
- saa = new String[sfc.getSpdGuidDeclarationCount()][7];
- sfc.getSpdGuidDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- protected JScrollPane getJContentPane(){
- if (topScrollPane == null){
- topScrollPane = new JScrollPane();
- topScrollPane.setSize(new java.awt.Dimension(617,500));
- topScrollPane.setPreferredSize(new java.awt.Dimension(498,500));
- topScrollPane.setViewportView(getJContentPane1());
- }
- return topScrollPane;
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- protected JPanel getJContentPane1() {
- if (jContentPane == null) {
-
- jLabelGuidType = new JLabel();
- jLabelGuidType.setBounds(new java.awt.Rectangle(420,122,103,16));
- jLabelGuidType.setText("GUID Type List");
- jLabelGuidType.setEnabled(true);
- starLabel = new StarLabel();
- starLabel.setLocation(new Point(jLabelGuidType.getX() - 10, jLabelGuidType.getY()));
- starLabel.setVisible(true);
- jLabelSupArch = new JLabel();
- jLabelSupArch.setBounds(new java.awt.Rectangle(197,122,108,16));
- jLabelSupArch.setText("Supported Architectures");
- jLabelSupArch.setEnabled(true);
- FontMetrics fm = jLabelSupArch.getFontMetrics(jLabelSupArch.getFont());
- jLabelSupArch.setSize(fm.stringWidth(jLabelSupArch.getText()) + 10, 20);
- jLabelSupMod = new JLabel();
- jLabelSupMod.setBounds(new java.awt.Rectangle(14,120,110,16));
- jLabelSupMod.setText("Supported Module Types");
- jLabelSupMod.setEnabled(true);
- fm = jLabelSupMod.getFontMetrics(jLabelSupMod.getFont());
- jLabelSupMod.setSize(fm.stringWidth(jLabelSupMod.getText()) + 10, 20);
- jLabelHelp = new JLabel();
- jLabelHelp.setText("HelpText");
- jLabelHelp.setSize(new java.awt.Dimension(109,20));
- jLabelHelp.setLocation(new java.awt.Point(14,85));
- jLabelCName = new JLabel();
- jLabelCName.setBounds(new java.awt.Rectangle(14,35,111,20));
- jLabelCName.setText("C Name");
- jLabelGuid = new JLabel();
- jLabelGuid.setBounds(new java.awt.Rectangle(15,60,112,20));
- jLabelGuid.setText("Guid Value");
- jLabelName = new JLabel();
- jLabelName.setBounds(new java.awt.Rectangle(15,10,113,20));
- jLabelName.setText("Name");
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(0, 35));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0, 60));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, 85));
- jStarLabel2.setVisible(true);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new Dimension(480, 375));
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jLabelCName, null);
- jContentPane.add(getJTextFieldCName(), null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonOk(), null);
-
- jContentPane.add(getJButtonGen(), null);
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJTextFieldName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(jLabelHelp, null);
- jContentPane.add(getJTextFieldHelp(), null);
- jContentPane.add(jLabelSupMod, null);
- jContentPane.add(jLabelSupArch, null);
- jContentPane.add(getJScrollPaneArch(), null);
- jContentPane.add(getJScrollPaneGuid(), null);
- jContentPane.add(getJScrollPaneModule(), null);
- jContentPane.add(jLabelGuidType, null);
- jContentPane.add(starLabel, null);
- }
- return jContentPane;
- }
-
- /**
- fill ComboBoxes with pre-defined contents
- **/
- protected void initFrame() {
-
- this.setTitle("GUID Declarations");
-
- boolean editable = true;
- if (getSfc().getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk) {
- this.save();
- this.dispose();
-
- }
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
-
- if (arg0.getSource() == jButtonAdd) {
-
- //ToDo: check before add
- String[] row = {"", "", "", "", "", "", ""};
- row[3] = jTextFieldHelp.getText();
- row[2] = jTextFieldGuid.getText();
- row[1] = jTextFieldCName.getText();
- row[0] = jTextFieldName.getText();
- row[4] = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
- if (row[4].length() == 0) {
- row[4] = null;
- }
- row[5] = vectorToString(iCheckBoxListMod.getAllCheckedItemsString());
- if (row[5].length() == 0) {
- row[5] = null;
- }
- row[6] = vectorToString(iCheckBoxListGuid.getAllCheckedItemsString());
- if (row[6].length() == 0) {
- row[6] = null;
- }
-
- if (!dataValidation(row)) {
- return;
- }
-
- if (addRow(row) == -1) {
- return;
- }
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
-
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- removeRow(rowSelected);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- clearAllRow();
- }
-
- if (arg0.getSource() == jButtonGen) {
- jTextFieldGuid.setText(Tools.generateUuidString());
- }
-
- if (arg0.getActionCommand().equals("GenGuidValue")) {
- jTextFieldGuid.setText(guidDialog.getGuid());
- }
-
- }
-
- protected boolean dataValidation(String[] row){
- if (!DataValidation.isUiNameType(row[0])) {
- JOptionPane.showMessageDialog(this, "Name must start with an alpha character.");
- return false;
- }
- if (!DataValidation.isGuid(row[2])) {
- JOptionPane.showMessageDialog(this, "Guid Value must be in registry format, 8-4-4-4-12.");
- return false;
- }
- if (!DataValidation.isC_NameType(row[1])) {
- JOptionPane.showMessageDialog(this, "C Name does not match C Name datatype.");
- return false;
- }
- if (row[3].length() == 0) {
- JOptionPane.showMessageDialog(this, "Help Text must be entered!");
- return false;
- }
- return true;
- }
-
- protected int addRow(String[] row) {
- Vector<String> vArch = iCheckBoxListArch.getAllCheckedItemsString();
- if (vArch.size() == 0) {
- vArch = null;
- }
- Vector<String> vModType = iCheckBoxListMod.getAllCheckedItemsString();
- if (vModType.size() == 0) {
- vModType = null;
- }
- Vector<String> vguidType = iCheckBoxListGuid.getAllCheckedItemsString();
- if (vguidType.size() == 0) {
- vguidType = null;
- }
- if (vguidType == null) {
- JOptionPane.showMessageDialog(this, "You must select at least one GUID type.");
- return -1;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.genSpdGuidDeclarations(row[0], row[1], row[2], row[3], vArch, vModType, vguidType);
- return 0;
- }
-
- protected void removeRow(int i){
- sfc.removeSpdGuidDeclaration(i);
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- protected void clearAllRow(){
- sfc.removeSpdGuidDeclaration();
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonGen() {
- if (jButtonGen == null) {
- jButtonGen = new JButton();
- jButtonGen.setBounds(new java.awt.Rectangle(485,58,92,21));
- jButtonGen.setText("Gen");
- jButtonGen.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonGen.addActionListener(this);
- }
- return jButtonGen;
- }
-
- /**
- * This method initializes jTextFieldName
- *
- * @return javax.swing.JTextField
- */
- protected JTextField getJTextFieldName() {
- if (jTextFieldName == null) {
- jTextFieldName = new JTextField();
- jTextFieldName.setBounds(new java.awt.Rectangle(138,10,337,20));
- jTextFieldName.setPreferredSize(new java.awt.Dimension(335,20));
- }
- return jTextFieldName;
- }
-
- /**
- * This method initializes jTextFieldCName
- *
- * @return javax.swing.JTextField
- */
- protected JTextField getJTextFieldCName() {
- if (jTextFieldCName == null) {
- jTextFieldCName = new JTextField();
- jTextFieldCName.setBounds(new java.awt.Rectangle(137,35,337,20));
- jTextFieldCName.setPreferredSize(new java.awt.Dimension(335,20));
- }
- return jTextFieldCName;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jTextFieldName, this.getWidth(), intPreferredWidth);
-
- Tools.resizeComponentWidth(this.jTextFieldCName, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
- Tools.relocateComponentX(this.jButtonGen, this.getWidth(), this.getPreferredSize().width, 40);
-
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldHelp() {
- if (jTextFieldHelp == null) {
- jTextFieldHelp = new JTextField();
- jTextFieldHelp.setBounds(new java.awt.Rectangle(136,85,337,20));
- jTextFieldHelp.setPreferredSize(new Dimension(335, 20));
- }
- return jTextFieldHelp;
- }
-
- private JScrollPane getJScrollPaneArch() {
- if (jScrollPaneArch == null) {
- jScrollPaneArch = new JScrollPane();
- jScrollPaneArch.setBounds(new java.awt.Rectangle(197,142,188,74));
- jScrollPaneArch.setPreferredSize(new java.awt.Dimension(188, 74));
- jScrollPaneArch.setViewportView(getICheckBoxListArch());
- }
- return jScrollPaneArch;
- }
- /**
- * This method initializes iCheckBoxList
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListArch() {
- if (iCheckBoxListArch == null) {
- iCheckBoxListArch = new ICheckBoxList();
- iCheckBoxListArch.setBounds(new java.awt.Rectangle(197,142,188,74));
- Vector<String> v = new Vector<String>();
- v.add("IA32");
- v.add("X64");
- v.add("IPF");
- v.add("EBC");
- v.add("ARM");
- v.add("PPC");
- iCheckBoxListArch.setAllItems(v);
- }
- return iCheckBoxListArch;
- }
-
- protected JScrollPane getJScrollPaneGuid() {
- if (jScrollPaneGuid== null) {
- jScrollPaneGuid = new JScrollPane();
- jScrollPaneGuid.setPreferredSize(new java.awt.Dimension(190,74));
- jScrollPaneGuid.setLocation(new java.awt.Point(400,142));
- jScrollPaneGuid.setSize(new java.awt.Dimension(260,74));
- jScrollPaneGuid.setViewportView(getICheckBoxListGuid());
- }
- return jScrollPaneGuid;
- }
- /**
- * This method initializes iCheckBoxList1
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListGuid() {
- if (iCheckBoxListGuid == null) {
- iCheckBoxListGuid = new ICheckBoxList();
- iCheckBoxListGuid.setBounds(new java.awt.Rectangle(400,142,177,74));
- Vector<String> v = new Vector<String>();
- v.add("DATA_HUB_RECORD");
- v.add("EFI_EVENT");
- v.add("EFI_SYSTEM_CONFIGURATION_TABLE");
- v.add("EFI_VARIABLE");
- v.add("GUID");
- v.add("HII_PACKAGE_LIST");
- v.add("HOB");
- v.add("TOKEN_SPACE_GUID");
-
- iCheckBoxListGuid.setAllItems(v);
- }
- return iCheckBoxListGuid;
- }
-
- private JScrollPane getJScrollPaneModule() {
- if (jScrollPaneModule == null) {
- jScrollPaneModule = new JScrollPane();
- jScrollPaneModule.setBounds(new java.awt.Rectangle(14,142,170,74));
- jScrollPaneModule.setPreferredSize(new java.awt.Dimension(170, 74));
- jScrollPaneModule.setViewportView(getICheckBoxListMod());
- }
- return jScrollPaneModule;
- }
- /**
- * This method initializes iCheckBoxList2
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListMod() {
- if (iCheckBoxListMod == null) {
- iCheckBoxListMod = new ICheckBoxList();
- iCheckBoxListMod.setBounds(new java.awt.Rectangle(14,142,170,74));
- Vector<String> v = new Vector<String>();
- v.add("BASE");
- v.add("SEC");
- v.add("PEI_CORE");
- v.add("PEIM");
- v.add("DXE_CORE");
- v.add("DXE_DRIVER");
- v.add("DXE_RUNTIME_DRIVER");
- v.add("DXE_SAL_DRIVER");
- v.add("DXE_SMM_DRIVER");
- v.add("UEFI_DRIVER");
- v.add("UEFI_APPLICATION");
- v.add("USER_DEFINED");
- iCheckBoxListMod.setAllItems(v);
- }
- return iCheckBoxListMod;
- }
-
- protected DefaultTableModel getModel() {
- return model;
- }
-
- protected void setModel(DefaultTableModel model) {
- this.model = model;
- }
-
- protected String vectorToString(Vector<String> v) {
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- protected Vector<String> stringToVector(String s){
- if (s == null) {
- return null;
- }
- String[] sArray = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- return v;
- }
-
- protected JLabel getJLabelGuidType() {
- return jLabelGuidType;
- }
-
- /**
- * @return Returns the sfc.
- */
- protected SpdFileContents getSfc() {
- return sfc;
- }
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java
deleted file mode 100644
index a8def0a86b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java
+++ /dev/null
@@ -1,816 +0,0 @@
-/** @file
-
- The file is used to create, update spdHeader of Spd file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import javax.swing.JCheckBox;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-/**
- The class is used to create, update spdHeader of Spd file
- It extends IInternalFrame
-
- @since PackageEditor 1.0
-
- **/
-public class SpdHeader extends IInternalFrame implements DocumentListener{
-
- private int dialogWidth = 560;
-
- private int labelColumn = 12;
-
- private int labelWidth = 155;
-
- private int buttonWidth = 60;
-
- private final int valueColumn = 168;
-
- private final int valueWidth = 320;
-
- private final int specWidth = 420;
-
- private int shortValueWidth = valueWidth - (buttonWidth + 5);
-
- private final int oneRowHeight = 20;
-
- private final int threeRowHeight = 60;
-
- private final int fourRowHeight = 80;
-
- private final int rowSep = 5;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + rowSep;
-
- private final int rowThree = rowTwo + oneRowHeight + rowSep;
-
- private final int rowFour = rowThree + oneRowHeight + rowSep;
-
- private final int rowFive = rowFour + threeRowHeight + rowSep;
-
- private final int rowSix = rowFive + fourRowHeight + rowSep;
-
- private final int rowSeven = rowSix + oneRowHeight + rowSep;
-
- private final int rowEight = rowSeven + oneRowHeight + rowSep;
-
- private final int rowNine = rowEight + fourRowHeight + rowSep;
-
- private final int rowTen = rowNine + oneRowHeight + rowSep;
-
- private int dialogHeight = rowTen + threeRowHeight;
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8152099582923006900L;
-
- //
- //Define class members
- //
- private IInternalFrame topFrame;
-
- private JPanel jContentPane = null;
-
- private JLabel jPackageNameLabel = null;
-
- private JTextField jPackageNameTextField = null;
-
- private JLabel jGuidLabel = null;
-
- private JTextField jGuidTextField = null;
-
- private JLabel jVersionLabel = null;
-
- private JTextField jVersionTextField = null;
-
- private JButton jGenerateGuidButton = null;
-
- private JLabel jLicenseLabel = null;
-
- private JTextArea jLicenseTextArea = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jDescriptionLabel = null;
-
- private JTextArea jDescriptionTextArea = null;
-
- private JTextField jSpecificationTextField = null;
-
- private JScrollPane jLicenseScrollPane = null;
-
- private JScrollPane jDescriptionScrollPane = null;
-
- private JScrollPane jCopyrightScrollPane = null;
-
- private JLabel jAbstractLabel = null;
-
- private JTextField jAbstractTextField = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel6 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private StarLabel jStarLabel9 = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private JTextArea jCopyrightTextArea = null;
-
- private JScrollPane topScrollPane = null;
-
- private JLabel jUrlLabel = null;
-
- private JTextField jUrlTextField = null;
-
- private JCheckBox jCheckBoxRdOnly = null;
-
- private JCheckBox jCheckBoxRePkg = null;
-
- /**
- This method initializes jPackageNameTextField
-
- @return javax.swing.JTextField jPackageNameTextField
-
- **/
- private JTextField getJPackageNameTextField() {
- if (jPackageNameTextField == null) {
- jPackageNameTextField = new JTextField();
- jPackageNameTextField.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
- jPackageNameTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jPackageNameTextField.getDocument().addDocumentListener(this);
- jPackageNameTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isUiNameType(jPackageNameTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Package Name must start with a letter.");
- return;
- }
- if (jPackageNameTextField.getText().equals(sfc.getSpdHdrPkgName())) {
- return;
- }
- sfc.setSpdHdrPkgName(jPackageNameTextField.getText());
- }
- });
- }
- return jPackageNameTextField;
- }
-
- /**
- This method initializes jGuidTextField
-
- @return javax.swing.JTextField jGuidTextField
-
- **/
- private JTextField getJGuidTextField() {
- if (jGuidTextField == null) {
- jGuidTextField = new JTextField();
- jGuidTextField.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));
- jGuidTextField.setPreferredSize(new java.awt.Dimension(shortValueWidth, oneRowHeight));
- jGuidTextField.getDocument().addDocumentListener(this);
- jGuidTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isGuid(jGuidTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Guid must be in registry (8-4-4-4-12) format.");
- return;
- }
- if (jGuidTextField.getText().equals(sfc.getSpdHdrGuidValue())) {
- return;
- }
- sfc.setSpdHdrGuidValue(jGuidTextField.getText());
- }
- });
- }
- return jGuidTextField;
- }
-
- /**
- This method initializes jVersionTextField
-
- @return javax.swing.JTextField jVersionTextField
-
- **/
- private JTextField getJVersionTextField() {
- if (jVersionTextField == null) {
- jVersionTextField = new JTextField();
- jVersionTextField.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));
- jVersionTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jVersionTextField.getDocument().addDocumentListener(this);
- jVersionTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isVersion(jVersionTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Version must start with a number.");
- return;
- }
- if (jVersionTextField.getText().equals(sfc.getSpdHdrVer())) {
- return;
- }
- sfc.setSpdHdrVer(jVersionTextField.getText());
- }
- });
- }
- return jVersionTextField;
- }
-
- /**
- This method initializes jGenerateGuidButton
-
- @return javax.swing.JButton jGenerateGuidButton
-
- **/
- private JButton getJGenerateGuidButton() {
- if (jGenerateGuidButton == null) {
- jGenerateGuidButton = new JButton();
- jGenerateGuidButton.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));
- jGenerateGuidButton.setText("GEN");
- jGenerateGuidButton.addActionListener(this);
- }
- return jGenerateGuidButton;
- }
-
- /**
- This method initializes jLicenseTextArea
-
- @return javax.swing.JTextArea jLicenseTextArea
-
- **/
- private JTextArea getJLicenseTextArea() {
- if (jLicenseTextArea == null) {
- jLicenseTextArea = new JTextArea();
- jLicenseTextArea.setLineWrap(true);
- jLicenseTextArea.getDocument().addDocumentListener(this);
- jLicenseTextArea.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (jLicenseTextArea.getText().length() == 0) {
- JOptionPane.showMessageDialog(topFrame, "License is a required field.");
- return;
- }
- if (jLicenseTextArea.getText().equals(sfc.getSpdHdrLicense())) {
- return;
- }
- sfc.setSpdHdrLicense(jLicenseTextArea.getText());
- }
- });
- }
- return jLicenseTextArea;
- }
-
- /**
- This method initializes jDescriptionTextArea
-
- @return javax.swing.JTextArea jDescriptionTextArea
-
- **/
- private JTextArea getJDescriptionTextArea() {
- if (jDescriptionTextArea == null) {
- jDescriptionTextArea = new JTextArea();
- jDescriptionTextArea.setLineWrap(true);
- jDescriptionTextArea.getDocument().addDocumentListener(this);
- jDescriptionTextArea.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (jDescriptionTextArea.getText().length() == 0) {
- JOptionPane
- .showMessageDialog(topFrame,
- "Description is a required field, and should reflect the contents of the package.");
- return;
- }
- if (jDescriptionTextArea.getText().equals(sfc.getSpdHdrDescription())) {
- return;
- }
- sfc.setSpdHdrDescription(jDescriptionTextArea.getText());
- }
- });
- }
- return jDescriptionTextArea;
- }
-
- /**
- This method initializes jSpecificationTextField
-
- @return javax.swing.JTextField jSpecificationTextField
-
- **/
- private JTextField getJSpecificationTextField() {
- if (jSpecificationTextField == null) {
- jSpecificationTextField = new JTextField();
- jSpecificationTextField.setBounds(new java.awt.Rectangle(labelColumn, dialogHeight - 40, specWidth, oneRowHeight));
- jSpecificationTextField.setEditable(false);
- jSpecificationTextField.setPreferredSize(new java.awt.Dimension(specWidth, oneRowHeight));
- jSpecificationTextField.setLocation(new java.awt.Point(2, dialogHeight - oneRowHeight));
- jSpecificationTextField.setBorder(null);
-
- // jSpecificationTextField.addFocusListener(new FocusAdapter(){
- // public void focusLost(FocusEvent e){
- // sfc.setSpdHdrSpec(jSpecificationTextField.getText());
- // }
- // });
- }
- return jSpecificationTextField;
- }
-
- /**
- This method initializes jLicenseScrollPane
-
- @return javax.swing.JScrollPane jLicenseScrollPane
-
- **/
- private JScrollPane getJLicenseScrollPane() {
- if (jLicenseScrollPane == null) {
- jLicenseScrollPane = new JScrollPane();
- jLicenseScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFive, valueWidth, fourRowHeight));
- jLicenseScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jLicenseScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
- jLicenseScrollPane.setViewportView(getJLicenseTextArea());
- }
- return jLicenseScrollPane;
- }
-
- /**
- This method initializes jDescriptionScrollPane
-
- @return javax.swing.JScrollPane jDescriptionScrollPane
-
- **/
- private JScrollPane getJDescriptionScrollPane() {
- if (jDescriptionScrollPane == null) {
- jDescriptionScrollPane = new JScrollPane();
- jDescriptionScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowEight, valueWidth, fourRowHeight));
- jDescriptionScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jDescriptionScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
- jDescriptionScrollPane.setViewportView(getJDescriptionTextArea());
- }
- return jDescriptionScrollPane;
- }
-
- /**
- This method initializes jAbstractTextField
-
- @return javax.swing.JTextField jAbstractTextField
-
- **/
- private JTextField getJAbstractTextField() {
- if (jAbstractTextField == null) {
- jAbstractTextField = new JTextField();
- jAbstractTextField.setBounds(new java.awt.Rectangle(valueColumn, rowSeven, valueWidth, oneRowHeight));
- jAbstractTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jAbstractTextField.getDocument().addDocumentListener(this);
- jAbstractTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isAbstract(jAbstractTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Abstract could NOT be empty.");
- return;
- }
- if (jAbstractTextField.getText().equals(sfc.getSpdHdrAbs())) {
- return;
- }
- sfc.setSpdHdrAbs(jAbstractTextField.getText());
- }
- });
- }
- return jAbstractTextField;
- }
-
- private JScrollPane getCopyrightScrollPane() {
- if (jCopyrightScrollPane == null) {
- jCopyrightScrollPane = new JScrollPane();
- jCopyrightScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFour, valueWidth, threeRowHeight));
- jCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jCopyrightScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
- jCopyrightScrollPane.setViewportView(getJCopyrightTextArea());
- }
- return jCopyrightScrollPane;
- }
- /**
- This method initializes jTextFieldCopyright
-
- @return javax.swing.JTextField jTextFieldCopyright
-
- **/
- private JTextArea getJCopyrightTextArea() {
- if (jCopyrightTextArea == null) {
- jCopyrightTextArea = new JTextArea();
- jCopyrightTextArea.setWrapStyleWord(true);
- jCopyrightTextArea.setLineWrap(true);
- jCopyrightTextArea.getDocument().addDocumentListener(this);
- jCopyrightTextArea.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Copyright must be entered.");
- return;
- }
- if (jCopyrightTextArea.getText().equals(sfc.getSpdHdrCopyright())) {
- return;
- }
- sfc.setSpdHdrCopyright(jCopyrightTextArea.getText());
- }
- });
- }
- return jCopyrightTextArea;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJUrlTextField() {
- if (jUrlTextField == null) {
- jUrlTextField = new JTextField();
- jUrlTextField.setBounds(new java.awt.Rectangle(valueColumn, rowSix, valueWidth, oneRowHeight));
- jUrlTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jUrlTextField.getDocument().addDocumentListener(this);
- jUrlTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (jUrlTextField.getText().length() == 0 && sfc.getSpdHdrUrl() == null) {
- return;
- }
- if (jUrlTextField.getText().equals(sfc.getSpdHdrUrl())) {
- return;
- }
- sfc.setSpdHdrLicense(jLicenseTextArea.getText());
- sfc.setSpdHdrUrl(jUrlTextField.getText());
- }
- });
- }
- return jUrlTextField;
- }
-
- /**
- * This method initializes jCheckBoxRdOnly
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxRdOnly() {
- if (jCheckBoxRdOnly == null) {
- jCheckBoxRdOnly = new JCheckBox();
- jCheckBoxRdOnly.setText("Read Only");
- jCheckBoxRdOnly.setLocation(new java.awt.Point(labelColumn, rowNine));
- jCheckBoxRdOnly.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
- jCheckBoxRdOnly.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected()+"");
- initFrame();
- }
- });
- }
- return jCheckBoxRdOnly;
- }
-
- /**
- * This method initializes jCheckBoxRePkg
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxRePkg() {
- if (jCheckBoxRePkg == null) {
- jCheckBoxRePkg = new JCheckBox();
- jCheckBoxRePkg.setLocation(new java.awt.Point(labelColumn, rowTen));
- jCheckBoxRePkg.setText("RePackagable");
- jCheckBoxRePkg.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
- jCheckBoxRePkg.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected()+"");
- }
- });
- }
- return jCheckBoxRePkg;
- }
-
- public static void main(String[] args) {
- new SpdHeader().setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public SpdHeader() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inspdHeader The input data of spdHeaderDocument.spdHeader
-
- **/
- public SpdHeader(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {
- this();
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdHeader(OpeningPackageType opt) {
- this(opt.getXmlSpd());
- docConsole = opt;
- initFrame();
- topFrame = this;
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setContentPane(getTopScrollPane());
- this.setTitle("Package Surface Area Header");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inspdHeader The input data of spdHeaderDocument.spdHeader
-
- **/
- private void init(SpdFileContents sfc) {
- if (sfc.getSpdHdrPkgName() != null) {
- jPackageNameTextField.setText(sfc.getSpdHdrPkgName());
- }
- if (sfc.getSpdHdrGuidValue() != null) {
- jGuidTextField.setText(sfc.getSpdHdrGuidValue());
- }
- if (sfc.getSpdHdrVer() != null) {
- jVersionTextField.setText(sfc.getSpdHdrVer());
- }
- if (sfc.getSpdHdrLicense() != null) {
- jLicenseTextArea.setText(sfc.getSpdHdrLicense());
- }
- if (sfc.getSpdHdrUrl() != null) {
- jUrlTextField.setText(sfc.getSpdHdrUrl());
- }
- if (sfc.getSpdHdrCopyright() != null) {
- jCopyrightTextArea.setText(sfc.getSpdHdrCopyright());
- }
- if (sfc.getSpdHdrAbs() != null) {
- jAbstractTextField.setText(sfc.getSpdHdrAbs());
- }
- if (sfc.getSpdHdrDescription() != null) {
- jDescriptionTextArea.setText(sfc.getSpdHdrDescription());
- }
- if (sfc.getSpdHdrSpec() != null) {
- jSpecificationTextField.setText(sfc.getSpdHdrSpec());
- }
- sfc.setSpdHdrSpec(jSpecificationTextField.getText());
-
- if (!sfc.getSpdPkgDefsRdOnly().equals("true")) {
- sfc.setSpdPkgDefsRdOnly("false");
- jCheckBoxRdOnly.setSelected(false);
- } else {
- jCheckBoxRdOnly.setSelected(true);
- }
- if (!sfc.getSpdPkgDefsRePkg().equals("true")) {
- sfc.setSpdPkgDefsRePkg("false");
- jCheckBoxRePkg.setSelected(false);
- } else {
- jCheckBoxRePkg.setSelected(true);
- }
-
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, rowOne));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, rowTwo));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, rowThree));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(2, rowFour));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(2, rowFive));
- jStarLabel6 = new StarLabel();
- jStarLabel6.setLocation(new java.awt.Point(2, rowSeven));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(2, rowEight));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(2, rowNine));
- jStarLabel8.setVisible(false);
- jStarLabel9 = new StarLabel();
- jStarLabel9.setLocation(new java.awt.Point(2, rowTen));
-
- jStarLabel9.setVisible(false);
- jPackageNameLabel = new JLabel();
- jPackageNameLabel.setText("Package Name");
- jPackageNameLabel.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jGuidLabel = new JLabel();
- jGuidLabel.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jGuidLabel.setText("Guid");
- jVersionLabel = new JLabel();
- jVersionLabel.setText("Version");
- jVersionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
- jLicenseLabel = new JLabel();
- jLicenseLabel.setText("License");
- jLicenseLabel.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
- jUrlLabel = new JLabel();
- jUrlLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
- jUrlLabel.setText("URL");
- jAbstractLabel = new JLabel();
- jAbstractLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSeven, labelWidth, oneRowHeight));
- jAbstractLabel.setText("Abstract");
- jDescriptionLabel = new JLabel();
- jDescriptionLabel.setText("Description");
- jDescriptionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowEight, labelWidth, oneRowHeight));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setLocation(new java.awt.Point(0, 0));
- jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 20, dialogHeight - 20));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel6, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(jStarLabel9, null);
-
- jContentPane.add(jPackageNameLabel, null);
- jContentPane.add(getJPackageNameTextField(), null);
- jContentPane.add(jGuidLabel, null);
- jContentPane.add(getJGuidTextField(), null);
- jContentPane.add(jVersionLabel, null);
- jContentPane.add(getJVersionTextField(), null);
- jContentPane.add(getJGenerateGuidButton(), null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(getCopyrightScrollPane(), null);
- jContentPane.add(jLicenseLabel, null);
- jContentPane.add(getJLicenseScrollPane(), null);
- jContentPane.add(jUrlLabel, null);
- jContentPane.add(getJUrlTextField(), null);
- jContentPane.add(jAbstractLabel, null);
- jContentPane.add(getJAbstractTextField(), null);
- jContentPane.add(jDescriptionLabel, null);
- jContentPane.add(getJDescriptionScrollPane(), null);
-
-// jContentPane.add(getJButtonOk(), null);
-// jContentPane.add(getJButtonCancel(), null);
-
- jContentPane.add(getJCheckBoxRdOnly(), null);
- jContentPane.add(getJCheckBoxRePkg(), null);
- jContentPane.add(getJSpecificationTextField(), null);
-
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jGenerateGuidButton) {
- //ToDo: invoke GuidValueEditor
- jGuidTextField.setText(Tools.generateUuidString());
- sfc.setSpdHdrGuidValue(jGuidTextField.getText());
- }
- }
-
- /**
- This method initializes Package type and Compontent type
-
- **/
- private void initFrame() {
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
- jPackageNameTextField.setEditable(editable);
- jGuidTextField.setEditable(editable);
- jGenerateGuidButton.setEnabled(editable);
- jVersionTextField.setEditable(editable);
- jCopyrightTextArea.setEditable(editable);
- jLicenseTextArea.setEditable(editable);
- jUrlTextField.setEditable(editable);
- jAbstractTextField.setEditable(editable);
- jDescriptionTextArea.setEditable(editable);
- jCheckBoxRePkg.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = dialogWidth;
- int intCurrentWidth = this.getJContentPane().getWidth();
-
-// Tools.resizeComponentWidth(this.jPackageNameTextField, intCurrentWidth, intPreferredWidth);
-// Tools.resizeComponentWidth(this.jGuidTextField, intCurrentWidth, intPreferredWidth);
-// Tools.resizeComponentWidth(this.jVersionTextField, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jUrlTextField, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jLicenseScrollPane, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jCopyrightTextArea, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jDescriptionScrollPane, intCurrentWidth, intPreferredWidth);
- // Tools.resizeComponentWidth(this.jSpecificationTextField, intCurrentWidth,intPreferredWidth);
- Tools.resizeComponentWidth(this.jAbstractTextField, intCurrentWidth, intPreferredWidth);
-// Tools.relocateComponentX(this.jGenerateGuidButton, intCurrentWidth, jGenerateGuidButton.getWidth(), 30);
- }
-
- private JScrollPane getTopScrollPane() {
- if (topScrollPane == null) {
- topScrollPane = new JScrollPane();
- topScrollPane.setViewportView(getJContentPane());
- }
- return topScrollPane;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
- */
- public void changedUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
- */
- public void insertUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
- */
- public void removeUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java
deleted file mode 100644
index 9aac2464c9..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java
+++ /dev/null
@@ -1,931 +0,0 @@
-/** @file
- Java class SpdLibClassDecls is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.io.File;
-import java.util.HashMap;
-//import java.util.Iterator;
-//import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-//import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
-//import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-//import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdLibClassDecls extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private JTable jTable = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JTextField jTextFieldAddClass = null;
-
- private JComboBox jComboBoxSelect = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonRemoveAll = null;
-
- private JLabel jLabelHdr = null;
-
- private JTextField jTextFieldHdr = null;
-
- private JButton jButtonBrowse = null;
-
- private StarLabel starLabel1 = null;
-
- private StarLabel starLabel3 = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private JLabel jLabel1ClassName = null;
-
- private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="10,53"
-
- private int selectedRow = -1;
-
- private StarLabel starLabel2 = null;
-
- private JLabel jLabel2HelpText = null;
-
- private JTextArea jTextAreaHelp = null;
-
- private JScrollPane jHelpTextScrollPane = null;
-
- private JLabel jLabel5SupArchList = null;
-
- private JLabel jLabel6SupModList = null;
-
- private JScrollPane jScrollPaneModules = null;
-
- private JScrollPane jScrollPane1Arch = null;
-
- private ICheckBoxList iCheckBoxListModules = null;
-
- private ICheckBoxList iCheckBoxListArch = null;
-
- private int cnClassName = 0;
- private int cnHdrFile = 1;
- private int cnHelpText = 2;
-// private int cnRecInstName = 3;
-// private int cnRecInstVer = 4;
- private int cnSupArch = 5;
- private int cnSupMod = 6;
-
- private final int classNameMinWidth = 200;
- private final int hdrFileMinWidth = 300;
- private final int helpTextMinWidth = 300;
- private final int supArchMinWidth = 200;
- private final int supModMinWidth = 200;
-
- private final int shortLabel = 90;
- private final int longLabel = 220;
- private final int labelCol = 12;
- private final int shortValueCol = labelCol + shortLabel + 6;
- private final int longValueCol = labelCol + longLabel + 6;
- private final int longValueWidth = 347;
- private final int shortWidth = 140;
- private final int medWidth = 240;
-
- private final int buttonWidth = 99;
-
- private final int addButtonCol = shortValueCol + 10;
- private final int removeButtonCol = addButtonCol + buttonWidth + 10;
- private final int removeAllButtonCol = removeButtonCol + buttonWidth + 10;
-
- private final int rowOne = 12;
- private final int rowTwo = rowOne + 25;
- private final int rowThree = rowTwo + 60 + 25;
- private final int rowFour = rowThree + 25;
- private final int rowFive = rowFour + 40 + 25;
- private final int rowSix = rowFive + 40 + 25;
- private final int rowSeven = rowSix;
- private final int rowEight = rowSeven + 30;
-
- HashMap<String, String> libNameGuidMap = new HashMap<String, String>();
-
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jTextFieldAddClass
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldAddClass() {
- if (jTextFieldAddClass == null) {
- jTextFieldAddClass = new JTextField();
- jTextFieldAddClass.setBounds(new java.awt.Rectangle(shortValueCol,rowOne,longValueWidth,20));
- jTextFieldAddClass.setPreferredSize(new java.awt.Dimension(longValueWidth,20));
- jTextFieldAddClass.setEnabled(true);
- }
- return jTextFieldAddClass;
- }
-
- /**
- This method initializes jComboBoxSelect
-
- @return javax.swing.JComboBox
- **/
- private JComboBox getJComboBoxSelect() {
- if (jComboBoxSelect == null) {
- jComboBoxSelect = new JComboBox();
- jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20));
- jComboBoxSelect.setPreferredSize(new java.awt.Dimension(260,22));
- jComboBoxSelect.setEnabled(true);
- jComboBoxSelect.setVisible(false);
- }
- return jComboBoxSelect;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
-
- Used for the Table of Library Classes that are provided by this package
-
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(labelCol,rowEight,400,253));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTable.setColumnSelectionAllowed(false);
- model.addColumn("Class Name");
- model.addColumn("Header");
- model.addColumn("Help Text");
- model.addColumn("Recommended Instance");
- model.addColumn("Version");
- model.addColumn("Supported Architectures");
- model.addColumn("Supported Module Types");
-
- jTable.getColumnModel().getColumn(cnHelpText).setCellEditor(new LongTextEditor(topFrame));
-
- jTable.removeColumn(jTable.getColumnModel().getColumn(3));
- jTable.removeColumn(jTable.getColumnModel().getColumn(3));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTable.getColumnModel().getColumn(cnSupArch - 2).setCellEditor(new ListEditor(vArch, topFrame));
-
- Vector<String> vModule = new Vector<String>();
- vModule.add("BASE");
- vModule.add("SEC");
- vModule.add("PEI_CORE");
- vModule.add("PEIM");
- vModule.add("DXE_CORE");
- vModule.add("DXE_DRIVER");
- vModule.add("DXE_RUNTIME_DRIVER");
- vModule.add("DXE_SAL_DRIVER");
- vModule.add("DXE_SMM_DRIVER");
- vModule.add("UEFI_DRIVER");
- vModule.add("UEFI_APPLICATION");
- vModule.add("USER_DEFINED");
-
- jTable.getColumnModel().getColumn(cnSupMod - 2).setCellEditor(new ListEditor(vModule, topFrame));
-
- TableColumn column = jTable.getColumnModel().getColumn(this.cnClassName);
- column.setMinWidth(this.classNameMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnHdrFile);
- column.setMinWidth(this.hdrFileMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnHelpText);
- column.setMinWidth(this.helpTextMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnSupArch - 2);
- column.setMinWidth(this.supArchMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnSupMod - 2);
- column.setMinWidth(this.supModMinWidth);
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
-
- }
- return jTable;
- }
-
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
-
- String lib = m.getValueAt(row, cnClassName) + "";
- String hdr = m.getValueAt(row, cnHdrFile) + "";
- String hlp = m.getValueAt(row, cnHelpText) + "";
- String name = null;
-// if (m.getValueAt(row, cnRecInstName) != null) {
-// name = m.getValueAt(row, cnRecInstName).toString();
-// }
-// String ver = null;
-// if (m.getValueAt(row, cnRecInstVer) != null){
-// ver = m.getValueAt(row, cnRecInstVer).toString();
-// }
- String arch = null;
- if (m.getValueAt(row, cnSupArch) != null) {
- arch = m.getValueAt(row, cnSupArch).toString();
- }
- String module = null;
- if (m.getValueAt(row, cnSupMod) != null) {
- module = m.getValueAt(row, cnSupMod).toString();
- }
- String[] rowData = {lib, hdr, hlp, name};
- if (!dataValidation(rowData)) {
- return;
- }
-
- String guid = null;
-// if (name != null && name.length() > 0) {
-// getLibInstances(lib);
-// guid = nameToGuid(name);
-// if (guid == null){
-// JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");
-// return;
-// }
-// }
-
- String[] sa = new String[7];
- sfc.getSpdLibClassDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
-// if (column == cnRecInstName) {
-// if (guid == null) {
-// if (sa[cnRecInstName] == null) {
-// return;
-// }
-// }
-// else {
-// if (guid.equals(sa[cnRecInstName])) {
-// return;
-// }
-// }
-// }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, null, arch, module);
- }
- }
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setText("Add");
- jButtonAdd.setSize(new java.awt.Dimension(buttonWidth,20));
- jButtonAdd.setBounds(new java.awt.Rectangle(addButtonCol,rowSeven,buttonWidth,20));
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setText("Delete");
- jButtonRemove.setSize(new java.awt.Dimension(buttonWidth,20));
- jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowSeven,buttonWidth,20));
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemoveAll() {
- if (jButtonRemoveAll == null) {
- jButtonRemoveAll = new JButton();
- jButtonRemoveAll.setText("Clear All");
- jButtonRemoveAll.setLocation(removeAllButtonCol,rowSeven);
- FontMetrics fm = jButtonRemoveAll.getFontMetrics(jButtonRemoveAll.getFont());
- jButtonRemoveAll.setSize(fm.stringWidth(jButtonRemoveAll.getText()) + 50, 20);
- jButtonRemoveAll.addActionListener(this);
- }
- return jButtonRemoveAll;
- }
-
- /**
- This is the default constructor
- **/
- public SpdLibClassDecls(JFrame frame) {
- super();
- topFrame = frame;
- initialize();
- init();
-
- }
-
- public SpdLibClassDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdLibClassDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
-
- this.setContentPane(getJContentPane());
- this.setTitle("Library Class Declarations");
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- }
-
- private void init(SpdFileContents sfc) {
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdLibClassDeclarationCount() == 0) {
- return ;
- }
- //
- // initialize table using SpdFileContents object
- //
- String[][] saa = new String[sfc.getSpdLibClassDeclarationCount()][7];
- sfc.getSpdLibClassDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
-// if (saa[i][3] != null && saa[i][3].length() > 0) {
-// getLibInstances(saa[i][0]);
-// saa[i][3] = guidToName(saa[i][3]);
-// }
-
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- private void initFrame() {
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonRemoveAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- private JScrollPane getJContentPane(){
- if (topScrollPane == null){
- topScrollPane = new JScrollPane();
- topScrollPane.setViewportView(getJContentPane1());
- }
- return topScrollPane;
- }
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- private JPanel getJContentPane1() {
- if (jContentPane == null) {
- // Library Class
- starLabel1 = new StarLabel();
- starLabel1.setLocation(new java.awt.Point(1,rowOne));
- jLabel1ClassName = new JLabel();
- jLabel1ClassName.setBounds(new java.awt.Rectangle(labelCol,rowOne,shortLabel,20));
- jLabel1ClassName.setText("Library Class");
-
- // Help Text
- starLabel2 = new StarLabel();
- starLabel2.setBounds(new java.awt.Rectangle(1,rowTwo,10,20));
- jLabel2HelpText = new JLabel();
- jLabel2HelpText.setBounds(new java.awt.Rectangle(labelCol,rowTwo,shortLabel,20));
- jLabel2HelpText.setText("Help Text");
-
- // Header File
- starLabel3 = new StarLabel();
- starLabel3.setLocation(new java.awt.Point(1,rowThree));
- jLabelHdr = new JLabel();
- jLabelHdr.setBounds(new java.awt.Rectangle(labelCol,rowThree,longLabel,20));
- jLabelHdr.setText("Include Header for Specified Class");
-
- jLabel6SupModList = new JLabel();
- jLabel6SupModList.setBounds(new java.awt.Rectangle(labelCol,rowFive,longLabel,20));
- jLabel6SupModList.setText("Supported Module Types");
- jLabel6SupModList.setEnabled(true);
-
- jLabel5SupArchList = new JLabel();
- jLabel5SupArchList.setBounds(new java.awt.Rectangle(labelCol,rowFour,longLabel,20));
- jLabel5SupArchList.setText("Supported Architectures");
- jLabel5SupArchList.setEnabled(true);
-
- jContentPane = new JPanel();
- jContentPane.setPreferredSize(new Dimension(680, 600));
- jContentPane.setLayout(null);
- jContentPane.add(jLabelHdr, null);
- jContentPane.add(starLabel1, null);
- jContentPane.add(starLabel3, null);
- jContentPane.add(getJTextFieldAddClass(), null);
- jContentPane.add(getJComboBoxSelect(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonRemoveAll(), null);
-
- jContentPane.add(getJTextFieldHdr(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(jLabel1ClassName, null);
- jContentPane.add(starLabel2, null);
- jContentPane.add(jLabel2HelpText, null);
- jContentPane.add(getJHelpTextScrollPane(), null);
-
- jContentPane.add(jLabel5SupArchList, null);
- jContentPane.add(jLabel6SupModList, null);
-
- jContentPane.add(getJScrollPaneModules(), null);
- jContentPane.add(getJScrollPane1Arch(), null);
-
- }
-
- return jContentPane;
- }
-
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonAdd) {
-
- //ToDo: check before add
- // LAH WAS String[] row = {null, null, null, jComboBox.getSelectedItem()+"", jTextField2RecInstVer.getText(), null, null};
- String[] row = {null, null, null, null, null, null, null};
- row[cnClassName] = jTextFieldAddClass.getText();
- row[cnHdrFile] = jTextFieldHdr.getText().replace('\\', '/');
- row[cnHelpText] = jTextAreaHelp.getText();
-// row[cnRecInstName] = jComboBox.getSelectedItem()+"";
-// row[cnRecInstVer] = jTextField2RecInstVer.getText();
- row[cnSupArch] = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
- if (row[cnSupArch].length() == 0) {
- row[cnSupArch] = null;
- }
- row[cnSupMod] = vectorToString(iCheckBoxListModules.getAllCheckedItemsString());
- if (row[cnSupMod].length() == 0){
- row[cnSupMod] = null;
- }
- if (!dataValidation(row)) {
- return;
- }
- //
- //convert to GUID before storing recommended lib instance.
- //
-// getLibInstances(row[cnClassName]);
-// String recommendGuid = nameToGuid(row[cnRecInstName]);
-// if (row[cnRecInstName].equals("null")) {
-// row[cnRecInstName] = null;
-// }
-// else{
-// if (recommendGuid == null) {
-// JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");
-// return;
-// }
-// }
-
- sfc.genSpdLibClassDeclarations(row[cnClassName], null, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, null, null, row[cnSupMod]);
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- docConsole.setSaved(false);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- docConsole.setSaved(false);
- sfc.removeSpdLibClass(rowSelected);
- }
- }
-
- if (arg0.getSource() == jButtonRemoveAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- docConsole.setSaved(false);
- model.setRowCount(0);
- sfc.removeSpdLibClass();
- }
- }
-
- private boolean dataValidation(String[] row) {
- if (!DataValidation.isKeywordType(row[cnClassName])) {
- JOptionPane.showMessageDialog(this, "Library Class name entered does not match KeyWord datatype.");
- return false;
- }
- if (!DataValidation.isPathAndFilename(row[cnHdrFile])) {
- JOptionPane.showMessageDialog(this, "Include Header does not match the PathAndFilename datatype.");
- return false;
- }
- if (row[cnHelpText].length() == 0) {
- JOptionPane.showMessageDialog(this, "Help Text must be entered!");
- return false;
- }
-// if (row[cnRecInstVer] != null && row[cnRecInstVer].length() > 0) {
-// if (row[cnRecInstName] == null || row[cnRecInstName].length() == 0) {
-// JOptionPane.showMessageDialog(frame, "Recommended Instance Version must associate with the Instance Name.");
-// return false;
-// }
-//
-// if (!DataValidation.isVersionDataType(row[cnRecInstVer])) {
-// JOptionPane.showMessageDialog(frame, "Recommended Instance Version does not match Version datatype.");
-// return false;
-// }
-// }
- return true;
- }
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jTextField
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldHdr() {
- if (jTextFieldHdr == null) {
- jTextFieldHdr = new JTextField();
- jTextFieldHdr.setPreferredSize(new java.awt.Dimension(shortWidth,20));
- jTextFieldHdr.setLocation(new java.awt.Point(longValueCol,rowThree));
- jTextFieldHdr.setSize(new java.awt.Dimension(shortWidth,20));
- }
- return jTextFieldHdr;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(longValueCol + shortWidth + 7,rowThree,90,20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(99,20));
- jButtonBrowse.addActionListener(new AbstractAction() {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- //
- // Select files from current pkg
- //
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(topFrame);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(topFrame, "You can only select files in current package directory structure!");
- return;
- }
-
-
- }
- else {
- return;
- }
-
- headerDest = theFile.getPath();
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());
- jTextFieldHdr.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
-
- }
-
- });
- }
- return jButtonBrowse;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jTextFieldAddClass, this.getWidth(), intPreferredWidth-28);
- Tools.resizeComponentWidth(this.jHelpTextScrollPane, this.getWidth(), intPreferredWidth-28);
- Tools.resizeComponentWidth(this.jScrollPaneTable, this.getWidth(), intPreferredWidth-10);
- Tools.resizeComponentWidth(this.jTextFieldHdr, this.getWidth(), intPreferredWidth - 7);
- Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), intPreferredWidth,
- DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
- }
-
- /**
- * This method initializes jHelpTextScrollPane
- *
- * @return javax.swing.JScrollPane jHelpTextScrollPane
- */
- private JScrollPane getJHelpTextScrollPane() {
- if (jHelpTextScrollPane == null) {
- jHelpTextScrollPane = new JScrollPane();
- jHelpTextScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jHelpTextScrollPane.setPreferredSize(new java.awt.Dimension(longValueWidth, 80));
- jHelpTextScrollPane.setSize(new java.awt.Dimension(longValueWidth, 80));
- jHelpTextScrollPane.setLocation(new java.awt.Point(shortValueCol,rowTwo));
- jHelpTextScrollPane.setViewportView(getJTextAreaHelp());
- }
- return jHelpTextScrollPane;
- }
-
- /**
- * This method initializes jTextAreaHelp
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaHelp() {
- if (jTextAreaHelp == null) {
- jTextAreaHelp = new JTextArea();
- jTextAreaHelp.setLineWrap(true);
- jTextAreaHelp.setWrapStyleWord(true);
- }
- return jTextAreaHelp;
- }
-
- private JScrollPane getJScrollPaneModules() {
- if (jScrollPaneModules == null) {
- jScrollPaneModules = new JScrollPane();
- jScrollPaneModules.setBounds(new java.awt.Rectangle(longValueCol,rowFive,medWidth,60));
- jScrollPaneModules.setPreferredSize(new java.awt.Dimension(medWidth, 60));
- jScrollPaneModules.setViewportView(getICheckBoxListSupportedModules());
- }
- return jScrollPaneModules;
- }
-
- private ICheckBoxList getICheckBoxListSupportedModules() {
- if (iCheckBoxListModules == null) {
- iCheckBoxListModules = new ICheckBoxList();
- iCheckBoxListModules.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));
- Vector<String> v = new Vector<String>();
- v.add("BASE");
- v.add("SEC");
- v.add("PEI_CORE");
- v.add("PEIM");
- v.add("DXE_CORE");
- v.add("DXE_DRIVER");
- v.add("DXE_RUNTIME_DRIVER");
- v.add("DXE_SAL_DRIVER");
- v.add("DXE_SMM_DRIVER");
- v.add("UEFI_DRIVER");
- v.add("UEFI_APPLICATION");
- v.add("USER_DEFINED");
- iCheckBoxListModules.setAllItems(v);
- }
- return iCheckBoxListModules;
- }
-
- private String vectorToString(Vector<String> v) {
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- private JScrollPane getJScrollPane1Arch() {
- if (jScrollPane1Arch == null) {
- jScrollPane1Arch = new JScrollPane();
- jScrollPane1Arch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));
- jScrollPane1Arch.setPreferredSize(new java.awt.Dimension(medWidth, 60));
- jScrollPane1Arch.setViewportView(getICheckBoxListArch());
- }
- return jScrollPane1Arch;
- }
- /**
- * This method initializes iCheckBoxList
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListArch() {
- if (iCheckBoxListArch == null) {
- iCheckBoxListArch = new ICheckBoxList();
- iCheckBoxListArch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));
- Vector<String> v = new Vector<String>();
- v.add("IA32");
- v.add("X64");
- v.add("IPF");
- v.add("EBC");
- v.add("ARM");
- v.add("PPC");
- iCheckBoxListArch.setAllItems(v);
- }
- return iCheckBoxListArch;
- }
-
-// private void getLibInstances(String libClass){
-// libNameGuidMap.clear();
-// try {
-// Iterator ismi = GlobalData.vModuleList.iterator();
-// while (ismi.hasNext()) {
-// ModuleIdentification mi = (ModuleIdentification) ismi.next();
-//
-// Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
-// for (int i = 0; i < classProduced.size(); ++i) {
-// if (classProduced.get(i).equals(libClass)) {
-// libNameGuidMap.put(mi.getName(), mi.getGuid());
-// }
-// }
-// }
-//
-// }
-// catch(Exception e){
-// JOptionPane.showMessageDialog(frame, "Search Instances Failed.");
-// }
-//
-// }
-
-// private String nameToGuid(String name) {
-// String s = null;
-// if (!libNameGuidMap.containsKey(name)) {
-// return s;
-// }
-//
-// s = libNameGuidMap.get(name);
-// return s;
-// }
-
-// private String guidToName(String guid){
-// String s = "";
-// if (!libNameGuidMap.containsValue(guid)) {
-// return s;
-// }
-// Set<String> key = libNameGuidMap.keySet();
-// Iterator<String> is = key.iterator();
-// while(is.hasNext()) {
-// s = is.next();
-// if (libNameGuidMap.get(s).equals(guid)) {
-// break;
-// }
-// }
-// return s;
-// }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java
deleted file mode 100644
index fb23e05659..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/** @file
- Java class SpdMsaFiles is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.io.File;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private JScrollPane jScrollPane = null; // @jve:decl-index=0:visual-constraint="10,95"
-
- private JTable jTable = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JScrollPane jScrollPaneMsa = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonOk = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextField = null;
-
- private JButton jButtonBrowse = null;
-
- private StarLabel jStarLabel2 = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private int selectedRow = -1;
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneMsa() {
- if (jScrollPaneMsa == null) {
- jScrollPaneMsa = new JScrollPane();
- jScrollPaneMsa.setBounds(new java.awt.Rectangle(13,177,461,421));
- jScrollPaneMsa.setViewportView(getJTable());
- }
- return jScrollPaneMsa;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- model.addColumn("MsaFile");
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(163,148,90,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(266,148,90,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(374,148,90,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setLocation(new java.awt.Point(390, 305));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jButton
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setSize(new java.awt.Dimension(90, 20));
- jButtonOk.setText("OK");
- jButtonOk.setLocation(new java.awt.Point(290, 305));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This is the default constructor
- **/
- public SpdMsaFiles(JFrame frame) {
- super();
- initialize();
- init();
- topFrame = frame;
- }
-
- public SpdMsaFiles(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdMsaFiles(OpeningPackageType opt, JFrame frame){
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setPreferredSize(new Dimension(490, 400));
- this.setContentPane(getJScrollPane());
- this.setTitle("Msa Files");
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- this.setVisible(true);
- }
-
- private void init(SpdFileContents sfc){
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdMsaFileCount() == 0) {
- return ;
- }
- //
- // initialize table using SpdFileContents object
- //
- String[][] saa = new String[sfc.getSpdMsaFileCount()][4];
- sfc.getSpdMsaFiles(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- private JScrollPane getJScrollPane(){
- if (jScrollPane == null){
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2,24));
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(17,24,111,22));
- jLabel.setText("Msa File ");
-
- jContentPane = new JPanel();
- jContentPane.setPreferredSize(new Dimension(480, 325));
- jContentPane.setLayout(null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(getJScrollPaneMsa(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonOk(), null);
-
- jContentPane.add(getJTextField(), null);
- jContentPane.add(getJButtonBrowse(), null);
- }
- return jContentPane;
- }
-
- /**
- fill ComboBoxes with pre-defined contents
- **/
- private void initFrame() {
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk) {
- this.save();
- this.dispose();
-
- }
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
-
- if (arg0.getSource() == jButtonAdd) {
- //ToDo: check before add
- String[] row = {jTextField.getText().replace('\\', '/')};
- if (jTextField.getText().length() == 0) {
- JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");
- return;
- }
-
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- if (!new File(dirPrefix + File.separator + jTextField.getText()).exists()) {
- JOptionPane.showMessageDialog(this, "File NOT Exists in Current Package.");
- return;
- }
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- sfc.genSpdMsaFiles(row[0], null, null, null);
- docConsole.setSaved(false);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- sfc.removeSpdMsaFile(rowSelected);
- docConsole.setSaved(false);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- sfc.removeSpdMsaFile();
- docConsole.setSaved(false);
- }
-
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- String[] sa = new String[1];
- sfc.getSpdMsaFile(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- String file = m.getValueAt(row, 0) + "";
- if (file.length() == 0) {
- JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdMsaFile(row, file, null, null, null);
- }
- }
-
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jTextField
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(14,51,346,21));
- jTextField.setPreferredSize(new java.awt.Dimension(345,20));
- }
- return jTextField;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(376,50,92,21));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(90,20));
- jButtonBrowse.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- //
- // Select files from current workspace
- //
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(SpdMsaFiles.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(SpdMsaFiles.this, "You can only select files in current package!");
- return;
- }
-
-
- }
- else {
- return;
- }
-
- headerDest = theFile.getPath();
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());
-
- jTextField.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
-
- }
- });
- }
- return jButtonBrowse;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jScrollPaneMsa, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);
- Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 25);
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java
deleted file mode 100644
index 1c1d13a245..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java
+++ /dev/null
@@ -1,579 +0,0 @@
-/** @file
- Java class SpdPackageHeaders is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.io.File;
-
-import javax.swing.DefaultCellEditor;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdPackageHeaders extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelSelect = null;
-
- private JComboBox jComboBoxSelect = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextField = null;
-
- private JButton jButtonBrowse = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPanePkgHdr = null;
-
- private int selectedRow = -1;
-
- private JTable jTable = null;
-
- private final int buttonWidth = 100;
- private final int buttonSep = 6;
- private final int addButtonCol = 148;
- private final int removeButtonCol = addButtonCol + buttonWidth + buttonSep;
- private final int removeAllButtonCol = removeButtonCol + buttonWidth + buttonSep;
- private final int labelCol = 12;
- private final int valueCol = 168;
- private final int rowOne = 12;
- private final int rowTwo = rowOne + 25;
- private final int rowThree = rowTwo + 25;
- private final int rowFour = rowThree + 30;
- private final int rowFive = rowFour + 30;
-
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jLabelSelect
-
- @return javax.swing.JLabel jLabelSelect
- **/
- private JLabel getJLabelSelect() {
- if (jLabelSelect == null) {
- jLabelSelect = new JLabel();
- jLabelSelect.setBounds(new java.awt.Rectangle(labelCol,rowOne,155,20));
- jLabelSelect.setText("Select ModuleType");
-
- }
- return jLabelSelect;
- }
-
- /**
- This method initializes jComboBoxSelect
-
- @return javax.swing.JComboBox
- **/
- private JComboBox getJComboBoxSelect() {
- if (jComboBoxSelect == null) {
- jComboBoxSelect = new JComboBox();
- jComboBoxSelect.setBounds(new java.awt.Rectangle(valueCol, rowOne, 260, 20));
- jComboBoxSelect.setPreferredSize(new java.awt.Dimension(260,20));
-
- jComboBoxSelect.setEnabled(true);
- }
- return jComboBoxSelect;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- *
- private JTable getJTable() {
- if (jTable == null) {
- model = new PackageHeaderTableModel();
- model.addColumn("ModuleType");
- model.addColumn("IncludeHeader");
-
-
- }
- return jTable;
- }*/
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(addButtonCol,rowFour,buttonWidth,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowFour,buttonWidth,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(removeAllButtonCol,rowFour,buttonWidth,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- /**
- This is the default constructor
- **/
- public SpdPackageHeaders(JFrame frame) {
- super();
- initialize();
- init();
- topFrame = frame;
- }
-
- public SpdPackageHeaders(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdPackageHeaders(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
-
- this.setContentPane(getJScrollPane());
- this.setTitle("Package Headers");
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- }
-
- private void init(SpdFileContents sfc){
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdPackageHeaderCount() == 0) {
- return ;
- }
- String[][] saa = new String[sfc.getSpdPackageHeaderCount()][2];
- sfc.getSpdPackageHeaders(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- private JScrollPane getJScrollPane(){
- if (jScrollPane == null){
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, rowOne));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0,rowTwo));
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(labelCol,rowTwo,320,22));
- jLabel.setText("Include Header for Module Type");
-
- jContentPane = new JPanel();
- jContentPane.setPreferredSize(new Dimension(480, 325));
- jContentPane.setLayout(null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(getJLabelSelect(), null);
- jContentPane.add(getJComboBoxSelect(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
-
- jContentPane.add(getJTextField(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(getJScrollPanePkgHdr(), null);
- }
- return jContentPane;
- }
-
- /**
- fill ComboBoxes with pre-defined contents
- **/
- private void initFrame() {
- jComboBoxSelect.addItem("BASE");
- jComboBoxSelect.addItem("SEC");
- jComboBoxSelect.addItem("PEI_CORE");
- jComboBoxSelect.addItem("PEIM");
- jComboBoxSelect.addItem("DXE_CORE");
- jComboBoxSelect.addItem("DXE_DRIVER");
- jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER");
- jComboBoxSelect.addItem("DXE_SAL_DRIVER");
- jComboBoxSelect.addItem("DXE_SMM_DRIVER");
- jComboBoxSelect.addItem("TOOL");
- jComboBoxSelect.addItem("UEFI_DRIVER");
- jComboBoxSelect.addItem("UEFI_APPLICATION");
- jComboBoxSelect.addItem("USER_DEFINED");
- jComboBoxSelect.setSelectedIndex(0);
-
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- docConsole.setSaved(false);
-
- if (arg0.getSource() == jButtonAdd) {
- String strLibClass = "";
-
- strLibClass = jComboBoxSelect.getSelectedItem().toString();
- //ToDo: check before add
- String[] row = {"", ""};
- row[0] = strLibClass;
- row[1] = jTextField.getText().replace('\\', '/');
- if (!dataValidation(row)) {
- return;
- }
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- sfc.genSpdModuleHeaders(row[0], row[1], null, null, null, null, null, null);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- sfc.removeSpdPkgHeader(rowSelected);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- sfc.removeSpdPkgHeader();
- }
-
- }
-
- private boolean dataValidation(String[] row) {
- if (!DataValidation.isPathAndFilename(row[1])) {
- JOptionPane.showMessageDialog(this, "Include header path is NOT PathAndFilename type.");
- return false;
- }
-
- return true;
- }
-
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jTextField
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(labelCol,rowThree,346,20));
- jTextField.setPreferredSize(new java.awt.Dimension(345,20));
- }
- return jTextField;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(374,rowThree,buttonWidth,20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(buttonWidth,20));
- jButtonBrowse.addActionListener(new javax.swing.AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- //
- // Select files from current workspace
- //
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(SpdPackageHeaders.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(SpdPackageHeaders.this, "You can only select files in current package!");
- return;
- }
-
-
- }
- else {
- return;
- }
-
- headerDest = theFile.getPath();
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());
-
- jTextField.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
-
- }
- });
- }
- return jButtonBrowse;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePkgHdr() {
- if (jScrollPanePkgHdr == null) {
- jScrollPanePkgHdr = new JScrollPane();
- jScrollPanePkgHdr.setBounds(new java.awt.Rectangle(labelCol,rowFive,453,258));
- jScrollPanePkgHdr.setViewportView(getJTable());
- }
- return jScrollPanePkgHdr;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- model.addColumn("ModuleType");
- model.addColumn("IncludeHeader");
- TableColumn typeColumn = jTable.getColumnModel().getColumn(0);
- JComboBox jComboBoxSelect = new JComboBox();
- jComboBoxSelect.addItem("BASE");
- jComboBoxSelect.addItem("SEC");
- jComboBoxSelect.addItem("PEI_CORE");
- jComboBoxSelect.addItem("PEIM");
- jComboBoxSelect.addItem("DXE_CORE");
- jComboBoxSelect.addItem("DXE_DRIVER");
- jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER");
- jComboBoxSelect.addItem("DXE_SAL_DRIVER");
- jComboBoxSelect.addItem("DXE_SMM_DRIVER");
- jComboBoxSelect.addItem("TOOL");
- jComboBoxSelect.addItem("UEFI_DRIVER");
- jComboBoxSelect.addItem("UEFI_APPLICATION");
- jComboBoxSelect.addItem("USER_DEFINED");
- typeColumn.setCellEditor(new DefaultCellEditor(jComboBoxSelect));
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- String[] sa = new String[2];
- sfc.getSpdModuleHeader(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- String pkg = m.getValueAt(row, 0) + "";
- String hdr = m.getValueAt(row, 1) + "";
- String[] rowData = {pkg, hdr};
- if (!dataValidation(rowData)) {
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdPkgHdr(row, pkg, hdr);
- }
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- // Tools.resizeComponentWidth(this.jComboBoxSelect, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPanePkgHdr, this.getWidth(), intPreferredWidth);
- Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 30);
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java
deleted file mode 100644
index 3886843072..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java
+++ /dev/null
@@ -1,1242 +0,0 @@
-/** @file
- Java class SpdPcdDefs is GUI for create PCD definition elements of spd file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-
-import javax.swing.DefaultCellEditor;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import javax.swing.JComboBox;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JCheckBox;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
-
-import java.awt.Rectangle;
-import java.util.Vector;
-
-/**
- GUI for create PCD definition elements of spd file
-
- @since PackageEditor 1.0
-**/
-public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelItemType = null;
-
- private JLabel jLabelC_Name = null;
-
- private JTextField jTextFieldC_Name = null;
-
- private JLabel jLabelToken = null;
-
- private JTextField jTextFieldToken = null;
-
- private JLabel jLabelDataType = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JComboBox jComboBoxDataType = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JLabel jLabelTokenSpace = null;
-
- private JComboBox jComboBoxTsGuid = null;
-
- private JLabel jLabelVarVal = null;
-
- private JTextField jTextFieldHelp = null;
-
- private JLabel jLabelDefVal = null;
-
- private JTextField jTextFieldDefaultValue = null;
-
- private JButton jButtonAdd = null;
-
- private CheckboxTableModel model = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTable jTable = null;
-
- private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="390,10"
-
- private int selectedRow = -1;
-
- private StarLabel starLabel = null;
-
- private JCheckBox jCheckBoxFeatureFlag = null;
-
- private JCheckBox jCheckBoxFixedAtBuild = null;
-
- private JCheckBox jCheckBoxPatchInMod = null;
-
- private JCheckBox jCheckBoxDyn = null;
-
- private JCheckBox jCheckBoxDynEx = null;
-
- private JScrollPane jScrollPaneArch = null;
-
- private ICheckBoxList iCheckBoxListArch = null;
-
- private JScrollPane jScrollPaneMod = null;
-
- private ICheckBoxList iCheckBoxListMod = null;
-
- private JLabel jLabelSupMod = null;
-
- private JLabel jLabelSupArch = null;
-
- private final int pcdCNameMinWidth = 200;
- private final int pcdTokenMinWidth = 100;
- private final int pcdTokenSpaceMinWidth = 200;
- private final int datumTypeMinWidth = 80;
- private final int defaultValueMinWidth = 100;
- private final int helpTextMinWidth = 200;
- private final int usageMinWidth = 60;
- private final int supArchMinWidth = 200;
- private final int supModMinWidth = 200;
-
-// private Object boolModifyLock = new Object();
-// private boolean exclusiveUsage = false;
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
- this.setTitle("PCD Declarations");
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- int xPos = jCheckBoxPatchInMod.getX() + jCheckBoxPatchInMod.getWidth();
- jCheckBoxFixedAtBuild.setLocation(xPos,133);
-
- xPos = jCheckBoxFeatureFlag.getX() + jCheckBoxFeatureFlag.getWidth();
- jCheckBoxDyn.setLocation(xPos,161);
-
- xPos = jCheckBoxDyn.getX() + jCheckBoxDyn.getWidth();
- jCheckBoxDynEx.setLocation(xPos,161);
-
- }
-
- /**
- This method initializes jTextFieldC_Name
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldC_Name() {
- if (jTextFieldC_Name == null) {
- jTextFieldC_Name = new JTextField();
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(156,9,317,20));
- jTextFieldC_Name.setPreferredSize(new java.awt.Dimension(315,20));
- }
- return jTextFieldC_Name;
- }
-
- /**
- This method initializes jTextFieldToken
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldToken() {
- if (jTextFieldToken == null) {
- jTextFieldToken = new JTextField();
- jTextFieldToken.setBounds(new java.awt.Rectangle(156,33,317,20));
- jTextFieldToken.setPreferredSize(new java.awt.Dimension(315,20));
- }
- return jTextFieldToken;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setText("OK");
- jButtonOk.setBounds(new java.awt.Rectangle(279,276,90,20));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setText("Cancel");
- jButtonCancel.setBounds(new java.awt.Rectangle(389,276,82,20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jComboBoxDataType
-
- @return javax.swing.JComboBox
- **/
- private JComboBox getJComboBoxDataType() {
- if (jComboBoxDataType == null) {
- jComboBoxDataType = new JComboBox();
- jComboBoxDataType.setBounds(new java.awt.Rectangle(156,84,110,20));
- }
- return jComboBoxDataType;
- }
-
- /**
- This is the default constructor
- **/
- public SpdPcdDefs(JFrame frame) {
- super();
- init();
- initialize();
- topFrame = frame;
- }
-
- public SpdPcdDefs(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) {
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdPcdDefs(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
- this.setSize(500, 650);
- this.setContentPane(getJContentPane());
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
-
- this.setVisible(true);
- }
-
- private void init(SpdFileContents sfc){
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdPcdDefinitionCount() == 0) {
- return ;
- }
- String[][] saa = new String[sfc.getSpdPcdDefinitionCount()][8];
- String[][] usage = new String[sfc.getSpdPcdDefinitionCount()][5];
- Object[] rowData = new Object[13];
- sfc.getSpdPcdDefinitions(saa, usage);
- int i = 0;
- while (i < saa.length) {
-
- for (int k = 0; k < 6; ++k) {
- rowData[k] = saa[i][k];
- }
- for (int m = 6; m < 11; ++m) {
- rowData[m] = new Boolean("false");
- }
- int j = 0;
- while (j < 5) {
- if (usage[i][j] == null || usage[i][j].length()==0){
- ++j;
- continue;
- }
- if (usage[i][j].equals("FEATURE_FLAG")){
- rowData[6] = new Boolean("true");
- }
- if (usage[i][j].equals("FIXED_AT_BUILD")){
- rowData[7] = new Boolean("true");
- }
- if (usage[i][j].equals("PATCHABLE_IN_MODULE")){
- rowData[8] = new Boolean("true");
- }
- if (usage[i][j].equals("DYNAMIC")){
- rowData[9] = new Boolean("true");
- }
- if (usage[i][j].equals("DYNAMIC_EX")){
- rowData[10] = new Boolean("true");
- }
-
- ++j;
- }
-
- rowData[11] = saa[i][6];
- rowData[12] = saa[i][7];
-
- model.addRow(rowData);
-
- i++;
- }
-
- }
-
- private JScrollPane getJContentPane(){
- if (topScrollPane == null){
- topScrollPane = new JScrollPane();
- topScrollPane.setSize(new java.awt.Dimension(482,451));
- topScrollPane.setViewportView(getJContentPane1());
- }
- return topScrollPane;
- }
- private JPanel getJContentPane1() {
- if (jContentPane == null) {
-
- jLabelSupArch = new JLabel();
- jLabelSupArch.setBounds(new java.awt.Rectangle(241,192,89,16));
- jLabelSupArch.setText("Supported Architectures");
- jLabelSupArch.setEnabled(true);
- FontMetrics fm = jLabelSupArch.getFontMetrics(jLabelSupArch.getFont());
- jLabelSupArch.setSize(fm.stringWidth(jLabelSupArch.getText()) + 10, 20);
- jLabelSupMod = new JLabel();
- jLabelSupMod.setBounds(new java.awt.Rectangle(15,193,103,16));
- jLabelSupMod.setText("Supported Module types");
- jLabelSupMod.setEnabled(true);
- fm = jLabelSupMod.getFontMetrics(jLabelSupMod.getFont());
- jLabelSupMod.setSize(fm.stringWidth(jLabelSupMod.getText()) + 10, 20);
- starLabel = new StarLabel();
- starLabel.setBounds(new java.awt.Rectangle(2,134,10,20));
- jLabelDefVal = new JLabel();
- jLabelDefVal.setBounds(new java.awt.Rectangle(277,84,80,20));
- jLabelDefVal.setText("Default Value");
- fm = jLabelDefVal.getFontMetrics(jLabelDefVal.getFont());
- jLabelDefVal.setSize(fm.stringWidth(jLabelDefVal.getText()) + 10, 20);
- jLabelVarVal = new JLabel();
- jLabelVarVal.setBounds(new java.awt.Rectangle(11,133,100,20));
- jLabelVarVal.setText("Valid Usage");
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(11,9,140,20));
- jLabelTokenSpace = new JLabel();
- jLabelTokenSpace.setBounds(new java.awt.Rectangle(11,58,140,20));
- jLabelTokenSpace.setText("Token Space");
- jLabelDataType = new JLabel();
- jLabelDataType.setText("Data Type");
- jLabelDataType.setBounds(new java.awt.Rectangle(11,83,140,20));
- jLabelToken = new JLabel();
- jLabelToken.setText("Token Number");
- jLabelToken.setBounds(new java.awt.Rectangle(11,33,140,20));
- jLabelItemType = new JLabel();
- jLabelItemType.setText("Help Text");
- jLabelItemType.setBounds(new java.awt.Rectangle(11,108,140,20));
-
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(479,375));
-
- jContentPane.add(jLabelItemType, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(jLabelTokenSpace, null);
- jContentPane.add(getJComboBoxTsGuid(), null);
- jContentPane.add(jLabelVarVal, null);
- jContentPane.add(getJTextFieldC_Name(), null);
- jContentPane.add(jLabelToken, null);
- jContentPane.add(getJTextFieldToken(), null);
- jContentPane.add(jLabelDataType, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJComboBoxDataType(), null);
-
- jStarLabel = new StarLabel();
- jStarLabel1 = new StarLabel();
- jStarLabel1.setBounds(new java.awt.Rectangle(2,8,10,20));
- jStarLabel2 = new StarLabel();
- jStarLabel3 = new StarLabel();
- jStarLabel4 = new StarLabel();
- jStarLabel.setLocation(new java.awt.Point(2,84));
- jStarLabel4.setLocation(new java.awt.Point(2, 109));
- jStarLabel2.setLocation(new java.awt.Point(2,33));
- jStarLabel3.setLocation(new java.awt.Point(2, 58));
- jStarLabel3.setSize(new java.awt.Dimension(8,20));
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel, null);
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(getJTextFieldHelp(), null);
- jContentPane.add(jLabelDefVal, null);
- jContentPane.add(getJTextFieldDefaultValue(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(starLabel, null);
- jContentPane.add(getJCheckBoxFeatureFlag(), null);
- jContentPane.add(getJCheckBoxFixedAtBuild(), null);
- jContentPane.add(getJCheckBoxPatchInMod(), null);
- jContentPane.add(getJCheckBoxDyn(), null);
- jContentPane.add(getJCheckBoxDynEx(), null);
- jContentPane.add(getJScrollPaneArch(), null);
- jContentPane.add(getJScrollPaneMod(), null);
- jContentPane.add(jLabelSupMod, null);
- jContentPane.add(jLabelSupArch, null);
- }
- return jContentPane;
- }
-
- /**
- This method initializes comboboxes
- jContentPane.add(jLabelTokenSpace, null);
-
- **/
- private void initFrame() {
-
- jComboBoxDataType.addItem("UINT8");
- jComboBoxDataType.addItem("UINT16");
- jComboBoxDataType.addItem("UINT32");
- jComboBoxDataType.addItem("UINT64");
- jComboBoxDataType.addItem("VOID*");
- jComboBoxDataType.addItem("BOOLEAN");
- jComboBoxDataType.setSelectedIndex(0);
-
- Vector<String> vGuidCName = new Vector<String>();
- sfc.getSpdGuidDeclWithType(vGuidCName, "TOKEN_SPACE_GUID");
- for (int i = 0; i < vGuidCName.size(); ++i) {
- jComboBoxTsGuid.addItem(vGuidCName.get(i));
- }
-
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- public void actionPerformed(ActionEvent arg0) {
-
-
- if (arg0.getSource() == jButtonOk) {
- this.save();
- this.dispose();
- }
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
-
- if (arg0.getSource() == jButtonAdd) {
- //ToDo: check before add
-
- boolean[] b = {jCheckBoxFeatureFlag.isSelected(), jCheckBoxFixedAtBuild.isSelected(), jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected()};
- if (!checkValidUsage(b)) {
- return;
- }
- String archList = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
- if (archList.length() == 0) {
- archList = null;
- }
- String modTypeList = vectorToString(iCheckBoxListMod.getAllCheckedItemsString());
- if (modTypeList.length() == 0) {
- modTypeList = null;
- }
- Object[] row = {jTextFieldC_Name.getText(), jTextFieldToken.getText(),
- jComboBoxTsGuid.getSelectedItem(), jComboBoxDataType.getSelectedItem(),
- jTextFieldDefaultValue.getText(), jTextFieldHelp.getText(),
- jCheckBoxFeatureFlag.isSelected(), jCheckBoxFixedAtBuild.isSelected(),
- jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected(),
- archList, modTypeList};
- try {
- if (!dataValidation(row)) {
- return;
- }
-
- if (tokenCNameExisted(jTextFieldToken.getText(), jTextFieldC_Name.getText())) {
- return;
- }
- } catch (Exception e) {
- JOptionPane.showMessageDialog(this, "Illegal Token:"+ e.getCause());
- return;
- }
-
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- String usage = getValidUsage(jCheckBoxFeatureFlag.isSelected(), jCheckBoxFixedAtBuild.isSelected(), jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected());
- if (usage.length() == 0) {
- usage = null;
- }
- sfc.genSpdPcdDefinitions(row[0]+"", row[1]+"", row[3]+"", usage, row[2]+"", row[4]+"", row[5]+"", archList, modTypeList);
- docConsole.setSaved(false);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- sfc.removeSpdPcdDefinition(rowSelected);
- docConsole.setSaved(false);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- sfc.removeSpdPcdDefinition();
- docConsole.setSaved(false);
- }
-
- }
-
- protected void save() {
-
- }
-
- /**
- * This method initializes jComboBoxTsGuid
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxTsGuid() {
- if (jComboBoxTsGuid == null) {
- jComboBoxTsGuid = new JComboBox();
- jComboBoxTsGuid.setBounds(new java.awt.Rectangle(156,58,315,20));
-
- }
- return jComboBoxTsGuid;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldHelp() {
- if (jTextFieldHelp == null) {
- jTextFieldHelp = new JTextField();
- jTextFieldHelp.setBounds(new java.awt.Rectangle(156,108,317,20));
- jTextFieldHelp.setPreferredSize(new java.awt.Dimension(315,20));
- }
- return jTextFieldHelp;
- }
-
- /**
- * This method initializes jTextFieldDefaultValue
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDefaultValue() {
- if (jTextFieldDefaultValue == null) {
- jTextFieldDefaultValue = new JTextField();
- int xPos = jLabelDefVal.getX() + jLabelDefVal.getWidth();
- jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(xPos,84,105,20));
- jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(104,20));
- }
- return jTextFieldDefaultValue;
- }
-
- /**
- * This method initializes jButtonAdd
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(195,277,71,20));
- jButtonAdd.setPreferredSize(new java.awt.Dimension(70,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
-
- }
-
- /**
- * This method initializes jButtonRemove
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(278,277,81,20));
- jButtonRemove.setPreferredSize(new java.awt.Dimension(70,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- * This method initializes jButtonClearAll
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(382,277,90,20));
- jButtonClearAll.setPreferredSize(new java.awt.Dimension(81,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jTextFieldC_Name, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldToken, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jComboBoxTsGuid, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldDefaultValue, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
-
- Tools.resizeComponentWidth(this.jTextFieldDefaultValue, this.getWidth(), intPreferredWidth);
-// relocateComponentX(this.jButtonClearAll, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
-// relocateComponentX(this.jButtonRemove, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
-// relocateComponentX(this.jButtonAdd, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(5,301,1473,259));
- jScrollPane.setViewportView(getJTable());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- model = new CheckboxTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
- jTable.setSize(new Dimension(1000, 300));
-
- model.addColumn("C_Name");
- model.addColumn("Token");
- model.addColumn("TokenSpace");
- model.addColumn("DatumType");
- model.addColumn("DefaultValue");
- model.addColumn("HelpText");
-
- model.addColumn("FeatureFlag");
- model.addColumn("FixedAtBuild");
- model.addColumn("PatchableInModule");
- model.addColumn("Dynamic");
- model.addColumn("DynamicEx");
- model.addColumn("SupportedArch");
- model.addColumn("SupportedModule");
-
- TableColumn column = jTable.getColumnModel().getColumn(0);
- column.setMinWidth(this.pcdCNameMinWidth);
- column = jTable.getColumnModel().getColumn(1);
- column.setMinWidth(this.pcdTokenMinWidth);
- column = jTable.getColumnModel().getColumn(2);
- column.setMinWidth(this.pcdTokenSpaceMinWidth);
- column = jTable.getColumnModel().getColumn(3);
- column.setMinWidth(this.datumTypeMinWidth);
- column = jTable.getColumnModel().getColumn(4);
- column.setMinWidth(this.defaultValueMinWidth);
- column = jTable.getColumnModel().getColumn(5);
- column.setMinWidth(this.helpTextMinWidth);
- column = jTable.getColumnModel().getColumn(6);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(7);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(8);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(9);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(10);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(11);
- column.setMinWidth(this.supArchMinWidth);
- column = jTable.getColumnModel().getColumn(12);
- column.setMinWidth(this.supModMinWidth);
-
- //ToDo: add a valid usage editor
-
- JComboBox jComboBoxDataType = new JComboBox();
- jComboBoxDataType.addItem("UINT8");
- jComboBoxDataType.addItem("UINT16");
- jComboBoxDataType.addItem("UINT32");
- jComboBoxDataType.addItem("UINT64");
- jComboBoxDataType.addItem("VOID*");
- jComboBoxDataType.addItem("BOOLEAN");
- TableColumn dataTypeColumn = jTable.getColumnModel().getColumn(3);
- dataTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxDataType));
-
- jTable.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(topFrame));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTable.getColumnModel().getColumn(11).setCellEditor(new ListEditor(vArch, topFrame));
-
- Vector<String> vModule = new Vector<String>();
- vModule.add("BASE");
- vModule.add("SEC");
- vModule.add("PEI_CORE");
- vModule.add("PEIM");
- vModule.add("DXE_CORE");
- vModule.add("DXE_DRIVER");
- vModule.add("DXE_RUNTIME_DRIVER");
- vModule.add("DXE_SAL_DRIVER");
- vModule.add("DXE_SMM_DRIVER");
- vModule.add("UEFI_DRIVER");
- vModule.add("UEFI_APPLICATION");
- vModule.add("USER_DEFINED");
- jTable.getColumnModel().getColumn(12).setCellEditor(new ListEditor(vModule, topFrame));
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- String[] sa = new String[9];
- sfc.getSpdPcdDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (column < 6) {
-
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- }
-
- String usage = getValidUsage(new Boolean(m.getValueAt(row, 6)+""), new Boolean(m.getValueAt(row, 7)+""), new Boolean(m.getValueAt(row, 8)+""), new Boolean(m.getValueAt(row, 9)+""), new Boolean(m.getValueAt(row, 10)+""));
- if (usage.length() == 0) {
- JOptionPane.showMessageDialog(this, "You must choose at least one usage for PCD entry.");
- return;
- }
-
- if (column <= 10 && column >= 6) {
- Vector<String> v = stringToVector(usage);
- if (compareTwoVectors(v, stringToVector(sa[6]))) {
- return;
- }
- if (v.contains("FEATURE_FLAG")/* && v.size() > 1 && !exclusiveUsage*/) {
- if (v.size() > 1) {
- JOptionPane.showMessageDialog(this, "Usage Feature Flag can NOT co-exist with others.");
- return;
- }
-// synchronized (boolModifyLock){
-// exclusiveUsage = true;
-// }
-// m.setValueAt(false, row, 7);
-// m.setValueAt(false, row, 8);
-// m.setValueAt(false, row, 9);
-// m.setValueAt(false, row, 10);
- else {
- m.setValueAt("BOOLEAN", row, 3);
- }
-
- }
- }
-
- if (column == 11) {
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[7])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[7] == null) {
- return;
- }
- }
-
- if (column == 12) {
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[8])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[8] == null) {
- return;
- }
- }
- String cName = m.getValueAt(row, 0) + "";
- String token = m.getValueAt(row, 1) + "";
- String ts = m.getValueAt(row, 2) + "";
- String dataType = m.getValueAt(row, 3) + "";
- String defaultVal = m.getValueAt(row, 4) + "";
- String help = m.getValueAt(row, 5) + "";
-
-
- String archList = null;
- if (m.getValueAt(row, 11) != null){
- archList = m.getValueAt(row, 11).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 12) != null) {
- modTypeList = m.getValueAt(row, 12).toString();
- }
-
- Object[] o = {cName, token, ts, dataType, defaultVal, help};
- try {
- if (!dataValidation(o)){
- return;
- }
- }
- catch (Exception e) {
- JOptionPane.showMessageDialog(this, "Illegal Token:" + e.getCause());
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdPcdDefinition(row, cName, token, dataType, usage, ts, defaultVal, help, archList, modTypeList);
- }
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFeatureFlag() {
- if (jCheckBoxFeatureFlag == null) {
- jCheckBoxFeatureFlag = new JCheckBox();
- jCheckBoxFeatureFlag.setBounds(new java.awt.Rectangle(156,161,100,21));
- jCheckBoxFeatureFlag.setText("Feature Flag");
- FontMetrics fm = jCheckBoxFeatureFlag.getFontMetrics(jCheckBoxFeatureFlag.getFont());
- jCheckBoxFeatureFlag.setSize(fm.stringWidth(jCheckBoxFeatureFlag.getText()) + 30, 20);
- jCheckBoxFeatureFlag.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxFeatureFlag.isSelected()) {
- jCheckBoxPatchInMod.setSelected(false);
- jCheckBoxFixedAtBuild.setSelected(false);
- jCheckBoxDyn.setSelected(false);
- jCheckBoxDynEx.setSelected(false);
- jComboBoxDataType.setSelectedItem("BOOLEAN");
- }
- }
- });
- }
- return jCheckBoxFeatureFlag;
- }
-
- /**
- * This method initializes jCheckBox1
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFixedAtBuild() {
- if (jCheckBoxFixedAtBuild == null) {
- jCheckBoxFixedAtBuild = new JCheckBox();
-
- jCheckBoxFixedAtBuild.setText("Fixed at Build");
- FontMetrics fm = jCheckBoxFixedAtBuild.getFontMetrics(jCheckBoxFixedAtBuild.getFont());
- jCheckBoxFixedAtBuild.setSize(fm.stringWidth(jCheckBoxFixedAtBuild.getText()) + 30, 20);
- jCheckBoxFixedAtBuild.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxFixedAtBuild.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxFixedAtBuild;
- }
-
- /**
- * This method initializes jCheckBox2
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPatchInMod() {
- if (jCheckBoxPatchInMod == null) {
- jCheckBoxPatchInMod = new JCheckBox();
-
- jCheckBoxPatchInMod.setBounds(new java.awt.Rectangle(156,133,154,20));
- jCheckBoxPatchInMod.setText("Patchable in Module");
- FontMetrics fm = jCheckBoxPatchInMod.getFontMetrics(jCheckBoxPatchInMod.getFont());
- jCheckBoxPatchInMod.setSize(fm.stringWidth(jCheckBoxPatchInMod.getText()) + 30, 20);
- jCheckBoxPatchInMod.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxPatchInMod.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxPatchInMod;
- }
-
- /**
- * This method initializes jCheckBox3
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxDyn() {
- if (jCheckBoxDyn == null) {
- jCheckBoxDyn = new JCheckBox();
-
- jCheckBoxDyn.setText("Dynamic");
- FontMetrics fm = jCheckBoxDyn.getFontMetrics(jCheckBoxDyn.getFont());
- jCheckBoxDyn.setSize(fm.stringWidth(jCheckBoxDyn.getText()) + 30, 20);
- jCheckBoxDyn.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxDyn.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxDyn;
- }
-
- /**
- * This method initializes jCheckBox4
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxDynEx() {
- if (jCheckBoxDynEx == null) {
- jCheckBoxDynEx = new JCheckBox();
-
- jCheckBoxDynEx.setText("DynamicEx");
- FontMetrics fm = jCheckBoxDynEx.getFontMetrics(jCheckBoxDynEx.getFont());
- jCheckBoxDynEx.setSize(fm.stringWidth(jCheckBoxDynEx.getText()) + 30, 20);
- jCheckBoxDynEx.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxDynEx.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxDynEx;
- }
-
- private String getValidUsage(boolean ff, boolean fab, boolean pim, boolean d, boolean de) {
- String usage = "";
- if (ff){
- usage += "FEATURE_FLAG ";
- }
- if (fab){
- usage += "FIXED_AT_BUILD ";
- }
- if (pim){
- usage += "PATCHABLE_IN_MODULE ";
- }
- if (d){
- usage += "DYNAMIC ";
- }
- if (de){
- usage += "DYNAMIC_EX ";
- }
-
- return usage.trim();
- }
-
- private boolean tokenCNameExisted(String token, String cName) throws Exception{
- Long inputToken = Long.decode(token);
-
- for (int i = 0; i < model.getRowCount(); ++i) {
- if (model.getValueAt(i, 0).equals(cName)) {
- JOptionPane.showMessageDialog(this, "C_Name already existed in table.");
- return true;
- }
- if (model.getValueAt(i, 1).equals(token)) {
- JOptionPane.showMessageDialog(this, "Token already existed in table.");
- return true;
- }
- Long tokenValue = Long.decode(model.getValueAt(i, 1)+"");
- if (tokenValue.equals(inputToken)) {
- JOptionPane.showMessageDialog(this, "Same token value already existed in table.");
- return true;
- }
-
- }
- return false;
- }
-
- private boolean checkValidUsage(boolean[] b) {
- if (!(b[0] || b[1] || b[2] || b[3] || b[4])){
- JOptionPane.showMessageDialog(this, "You must specify at least one usage.");
- return false;
- }
- return true;
- }
- private boolean dataValidation(Object[] row) throws Exception{
-
- if (!DataValidation.isC_NameType(row[0].toString())) {
- JOptionPane.showMessageDialog(this, "C_Name is NOT C_NameType.");
- return false;
- }
- if (!DataValidation.isHexDoubleWordDataType(row[1].toString()) &&
- !DataValidation.isLongInt(row[1].toString(), 1, Long.MAX_VALUE)) {
- JOptionPane.showMessageDialog(this, "Token is NOT correct.");
- return false;
- }
- if (!DataValidation.isC_NameType(row[2].toString())) {
- JOptionPane.showMessageDialog(this, "Token Space is NOT C_NameType");
- return false;
- }
- if (row[5].toString().length() == 0) {
- JOptionPane.showMessageDialog(this, "HelpText could NOT be empty.");
- return false;
- }
- return true;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneArch() {
- if (jScrollPaneArch == null) {
- jScrollPaneArch = new JScrollPane();
- jScrollPaneArch.setBounds(new java.awt.Rectangle(242,213,188,54));
- jScrollPaneArch.setViewportView(getICheckBoxListArch());
- jScrollPaneArch.setPreferredSize(new Dimension(188, 74));
- }
- return jScrollPaneArch;
- }
-
- /**
- * This method initializes iCheckBoxList
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListArch() {
- if (iCheckBoxListArch == null) {
- iCheckBoxListArch = new ICheckBoxList();
- iCheckBoxListArch.setBounds(new Rectangle(197, 142, 188, 74));
- Vector<String> v = new Vector<String>();
- v.add("IA32");
- v.add("X64");
- v.add("IPF");
- v.add("EBC");
- v.add("ARM");
- v.add("PPC");
- iCheckBoxListArch.setAllItems(v);
- }
- return iCheckBoxListArch;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneMod() {
- if (jScrollPaneMod == null) {
- jScrollPaneMod = new JScrollPane();
- jScrollPaneMod.setBounds(new java.awt.Rectangle(15,213,199,55));
- jScrollPaneMod.setViewportView(getICheckBoxListMod());
- jScrollPaneMod.setPreferredSize(new Dimension(170, 74));
- }
- return jScrollPaneMod;
- }
-
- /**
- * This method initializes iCheckBoxList1
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListMod() {
- if (iCheckBoxListMod == null) {
- iCheckBoxListMod = new ICheckBoxList();
- iCheckBoxListMod.setBounds(new Rectangle(14, 142, 170, 74));
- Vector<String> v = new Vector<String>();
- v.add("BASE");
- v.add("SEC");
- v.add("PEI_CORE");
- v.add("PEIM");
- v.add("DXE_CORE");
- v.add("DXE_DRIVER");
- v.add("DXE_RUNTIME_DRIVER");
- v.add("DXE_SAL_DRIVER");
- v.add("DXE_SMM_DRIVER");
- v.add("UEFI_DRIVER");
- v.add("UEFI_APPLICATION");
- v.add("USER_DEFINED");
- iCheckBoxListMod.setAllItems(v);
- }
- return iCheckBoxListMod;
- }
-
- protected String vectorToString(Vector<String> v) {
- if (v == null) {
- return null;
- }
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- protected Vector<String> stringToVector(String s){
- Vector<String> v = new Vector<String>();
- if (s == null) {
- return v;
- }
- String[] sArray = s.split(" ");
-
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- return v;
- }
-
- private boolean compareTwoVectors(Vector v1, Vector v2) {
- if (v1.size() != v2.size()) {
- return false;
- }
- for (int i = 0; i < v1.size(); ++i) {
- if (!v2.contains(v1.get(i))) {
- return false;
- }
- }
- return true;
- }
-} // @jve:decl-index=0:visual-constraint="22,11"
-
-class CheckboxTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public Class<?> getColumnClass (int c) {
- if (getValueAt(0, c) != null){
- return getValueAt(0, c).getClass();
- }
- return String.class;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java
deleted file mode 100644
index e0b96319a7..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/** @file
- Java class SpdProtocolDecls is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-
-/**
-GUI for create library definition elements of spd file.
-
-@since PackageEditor 1.0
-**/
-public class SpdPpiDecls extends SpdGuidDecls {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private SpdFileContents sfc = null;
- private OpeningPackageType docConsole = null;
-// private JFrame topFrame = null;
-
- public SpdPpiDecls(JFrame frame) {
- super(frame);
- // TODO Auto-generated constructor stub
- }
-
- public SpdPpiDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) {
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdPpiDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
- }
-
- protected void initFrame() {
- super.initFrame();
- this.setTitle("PPI Declarations");
- starLabel.setVisible(false);
- ((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
- }
-
- protected void init(SpdFileContents sfc){
- //
- // initialize table using SpdFileContents object
- //
- DefaultTableModel model = getModel();
- if (sfc.getSpdPpiDeclarationCount() == 0) {
- return ;
- }
- saa = new String[sfc.getSpdPpiDeclarationCount()][7];
- sfc.getSpdPpiDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- protected void updateRow(int row, int column, TableModel m){
- String[] sa = new String[7];
- sfc.getSpdPpiDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
-
- String name = m.getValueAt(row, 0) + "";
- String cName = m.getValueAt(row, 1) + "";
- String guid = m.getValueAt(row, 2) + "";
- String help = m.getValueAt(row, 3) + "";
- String archList = null;
- if (m.getValueAt(row, 4) != null) {
- archList = m.getValueAt(row, 4).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 5) != null) {
- modTypeList = m.getValueAt(row, 5).toString();
- }
- String guidTypeList = null;
- if (m.getValueAt(row, 6) != null) {
- guidTypeList = m.getValueAt(row, 6).toString();
- }
- String[] rowData = {name, cName, guid, help};
- if (!dataValidation(rowData)){
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdPpiDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
- }
-
- protected int addRow(String[] row) {
-
- if (!dataValidation(row)){
- return -1;
- }
- docConsole.setSaved(false);
- sfc.genSpdPpiDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]), stringToVector(row[6]));
- return 0;
- }
-
- protected void removeRow(int i){
- sfc.removeSpdPpiDeclaration(i);
- docConsole.setSaved(false);
- }
-
- protected void clearAllRow(){
- sfc.removeSpdPpiDeclaration();
- docConsole.setSaved(false);
- }
-
- /**
- * @return Returns the sfc.
- */
- protected SpdFileContents getSfc() {
- return sfc;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java
deleted file mode 100644
index 1c4c0cf269..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/** @file
- Java class SpdProtocolDecls is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-
-/**
-GUI for create library definition elements of spd file.
-
-@since PackageEditor 1.0
-**/
-public class SpdProtocolDecls extends SpdGuidDecls {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private SpdFileContents sfc = null;
- private OpeningPackageType docConsole = null;
-
- public SpdProtocolDecls(JFrame frame) {
- super(frame);
- // TODO Auto-generated constructor stub
- }
-
- public SpdProtocolDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) {
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdProtocolDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
- }
-
- protected void initFrame() {
- super.initFrame();
- this.setTitle("Protocol Declarations");
- starLabel.setVisible(false);
- ((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
- }
-
- protected void init(SpdFileContents sfc){
- //
- // initialize table using SpdFileContents object
- //
- DefaultTableModel model = getModel();
- if (sfc.getSpdProtocolDeclarationCount() == 0) {
- return ;
- }
- saa = new String[sfc.getSpdProtocolDeclarationCount()][7];
- sfc.getSpdProtocolDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- protected void updateRow(int row, int column, TableModel m){
- String[] sa = new String[7];
- sfc.getSpdProtocolDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
-
- String name = m.getValueAt(row, 0) + "";
- String cName = m.getValueAt(row, 1) + "";
- String guid = m.getValueAt(row, 2) + "";
- String help = m.getValueAt(row, 3) + "";
- String archList = null;
- if (m.getValueAt(row, 4) != null) {
- archList = m.getValueAt(row, 4).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 5) != null) {
- modTypeList = m.getValueAt(row, 5).toString();
- }
- String guidTypeList = null;
- if (m.getValueAt(row, 6) != null) {
- guidTypeList = m.getValueAt(row, 6).toString();
- }
- String[] rowData = {name, cName, guid, help};
- if (!dataValidation(rowData)){
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdProtocolDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
- }
-
- protected int addRow(String[] row) {
- if (!dataValidation(row)){
- return -1;
- }
- docConsole.setSaved(false);
- sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]), stringToVector(row[6]));
- return 0;
- }
-
- protected void removeRow(int i){
- sfc.removeSpdProtocolDeclaration(i);
- docConsole.setSaved(false);
- }
-
- protected void clearAllRow(){
- sfc.removeSpdProtocolDeclaration();
- docConsole.setSaved(false);
- }
-
- /**
- * @return Returns the sfc.
- */
- protected SpdFileContents getSfc() {
- return sfc;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java
deleted file mode 100644
index bc0b3d2bed..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/** @file
-
- The file is used to save basic information of platform
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.platform;
-
-
-import java.io.File;
-
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class PlatformIdentification extends Identification{
-
- public PlatformIdentification(String name, String guid, String version, String path){
- super(name, guid, version, path);
- }
-
- public PlatformIdentification(Identification id){
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- }
-
- public File getFpdFile(){
- File fpdFile = new File(this.getPath());
- return fpdFile;
- }
-
- public String toString() {
- return getName() + " " + getVersion() + " [" + Tools.getRelativePath(getFpdFile().getPath(), Workspace.getCurrentWorkspace()) + "]";
- }
-
- public boolean equals(String platformGuid, String platformVersion) {
- boolean b = false;
- if (this.getGuid().equals(platformGuid)) {
- b = true;
- //
- // Check Version
- //
- if (platformVersion != null) {
- if (!Tools.isEmpty(platformVersion)) {
- if (!platformVersion.equals(this.getVersion())) {
- b = false;
- }
- }
- }
- }
- return b;
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java
deleted file mode 100644
index d47352bb3e..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
-
- The file is used to create tree view sections
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-import java.awt.GridLayout;
-
-import javax.swing.JPanel;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-
-
-public class DynamicTree extends JPanel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- protected DefaultMutableTreeNode rootNode;
- protected DefaultTreeModel treeModel;
- protected JTree tree;
-
- public DynamicTree() {
- super(new GridLayout(1,0));
-
-
- }
-
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java
deleted file mode 100644
index feddaeeb71..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java
+++ /dev/null
@@ -1,2242 +0,0 @@
-/** @file
-
- The file is used to create, update BuildOptions of Fpd file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import java.awt.FlowLayout;
-import javax.swing.AbstractAction;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentEvent;
-
-import javax.swing.DefaultCellEditor;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JComboBox;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import java.util.Vector;
-import java.awt.Dimension;
-import javax.swing.JSplitPane;
-import java.awt.GridLayout;
-
-public class FpdBuildOptions extends IInternalFrame {
-
- private final int oneRowHeight = 20;
-
- private final int twoRowHeight = 40;
-
- private final int sepHeight = 6;
-
- private final int sepWidth = 10;
-
- private final int buttonWidth = 90;
-
- private final int rowOne = 12;
-
- private final int dialogWidth = 600;
-
- private final int rowTwo = rowOne + oneRowHeight + sepHeight;
-
- private final int rowThree = rowTwo + oneRowHeight + sepHeight;
-
- private final int rowFour = rowThree + oneRowHeight + sepHeight;
-
- private final int rowFive = rowFour + oneRowHeight + sepHeight;
-
- private final int rowSix = rowFive + oneRowHeight + sepHeight;
-
- private final int rowSeven = rowSix + oneRowHeight + sepHeight;
-
- private final int buttonRow = rowSeven + oneRowHeight + sepHeight + sepHeight;
-
- private final int dialogHeight = buttonRow + twoRowHeight + twoRowHeight;
-
- private final int lastButtonXLoc = dialogWidth - buttonWidth - sepWidth;
-
- private final int next2LastButtonLoc = lastButtonXLoc - buttonWidth - sepWidth;
-
- private final int firstButtonLoc = next2LastButtonLoc - buttonWidth - sepWidth;
-
- private final int labelColumn = 12;
-
- private final int fieldColumn = 168;
-
- private final int labelWidth = 155;
-
- private final int fieldWidth = 320;
-
- private static final long serialVersionUID = 1L;
-
- private JPanel jContentPane = null;
-
- // private JPanel jPanelContentSouth = null;
-
- // private JPanel jPanelContentNorth = null;
-
- // private JPanel jPanelContentWest = null;
-
- // private JPanel jPanelContentEast = null;
-
- private JTabbedPane jTabbedPane = null;
-
- private JPanel jPanelUserDef = null;
-
- private JPanel jPanelUserDefNorth = null;
-
- private JPanel jPanelUserDefCenter = null;
-
- private JTextField jTextFieldAntTaskFile = null;
-
- private JLabel jLabelAntTaskId = null;
-
- private JTextField jTextFieldAntTaskId = null;
-
- private JButton jButtonAntTaskAdd = null;
-
- private JButton jButtonAntTaskDel = null;
-
- private JTextField jTextFieldAntCmdOpts = null;
-
- private JScrollPane jScrollPaneAntTasks = null;
-
- private JTable jTableAntTasks = null;
-
- private DefaultTableModel ffsTableModel = null;
-
- private DefaultTableModel sectionsTableModel = null;
-
- private DefaultTableModel sectionTableModel = null;
-
- private DefaultTableModel subsectionsTableModel = null;
-
- private DefaultTableModel antTaskTableModel = null;
-
- private DefaultTableModel ffsAttributesTableModel = null;
-
- private DefaultTableModel optionsTableModel = null;
-
- private JPanel jPanelFfsTab = null;
-
- private JPanel jPanelFfsTabCenter = null;
-
- private JPanel jPanelFfsTabCenterN = null;
-
- private JPanel jPanelFfsTabCenterS = null;
-
- private JButton jButtonFfsAdd = null;
-
- private JButton jButtonFfsDel = null;
-
- private JScrollPane jScrollPaneFfsAttribs = null;
-
- private JTable jTableFfsAttribs = null;
-
- private JPanel jPanelOptionsTab = null;
-
- private JLabel jLabelOptionContents = null;
-
- private JTextField jTextFieldOptionContents = null;
-
- private JLabel jLabelToolChainFamily = null;
-
- private JLabel jLabelSupArch = null;
-
- private JLabel jLabelToolCmd = null;
-
- private JTextField jTextFieldToolCmd = null;
-
- private JScrollPane jScrollPaneOptions = null;
-
- private JTable jTableOptions = null;
-
- private JButton jButtonOptionsAdd = null;
-
- private JButton jButtonOptionsDel = null;
-
- private JButton jButtonFfsAttribNew = null;
-
- private JButton jButtonFfsAttribRemove = null;
-
- private FpdFileContents ffc = null;
-
- private OpeningPlatformType docConsole = null;
-
- private JPanel jArchitectureSelections = null;
-
- private JCheckBox jCheckBoxIA32 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxEBC = null;
-
- private JCheckBox jCheckBoxARM = null;
-
- private JCheckBox jCheckBoxPPC = null;
-
- private JLabel jLabelBuildTargets = null;
-
- private JTextField jTextFieldBuildTargets = null;
-
- private JTextField jTextFieldTagName = null;
-
- private JLabel jLabelTagName = null;
-
- private int selectedRow = -1;
-
- private JLabel jLabelAntTaskFile = null;
-
- private JLabel jLabelAntCmdOpts = null;
-
- private JScrollPane jScrollPaneFfs = null;
-
- private JTable jTableFfs = null;
-
- private JLabel jLabelFfsSection = null;
-
- private JScrollPane jScrollPaneFfsSection = null;
-
- private JTable jTableFfsSection = null;
-
- private JLabel jLabelFfsSubSections = null;
-
- private JScrollPane jScrollPaneFfsSubSection = null;
-
- private JTable jTableFfsSubSection = null;
-
- private JLabel jLabelEncapType = null;
-
- private JTextField jTextFieldEncapType = null;
-
- private JPanel jPanelFfsAttribButtonGroup = null;
-
- private JLabel jLabelFfsAttribs = null;
-
- private JButton jButtonFfsSectionNew = null;
-
- private JButton jButtonFfsSectionRemove = null;
-
- private JButton jButtonFfsSubSectionNew = null;
-
- private JButton jButtonFfsSubSectionRemove = null;
-
- private JLabel jLabelFfsSections = null;
-
- private JButton jButtonFfsSectionsNew = null;
-
- private JButton jButtonFfsSectionsRemove = null;
-
- private JScrollPane jScrollPaneFfsSections = null;
-
- private JTable jTableFfsSections = null;
-
- private JButton jButtonAntTaskFileBrowse = null;
-
- private JTextField jTextFieldToolChainFamily = null;
-
- private JSplitPane jSplitPaneFfsC = null;
-
- private JPanel jPanelFfsCTop = null;
-
- private JSplitPane jSplitPaneFfsCBottom = null;
-
- private JPanel jPanelFfsCBottomTop = null;
-
- private JPanel jPanelFfsCBottomBottom = null;
-
- private JPanel jPanelSectionN = null;
-
- private JPanel jPanelSectionsN = null;
-
- private JPanel jPanelSubSectionN = null;
-
- private JPanel jPanelOptionsContainer = null;
-
- private JPanel jPanelUserDefCenterN = null;
-
- private JPanel jPanelTableOptionsContainer = null;
-
- private JLabel jLabelTableOptionsTitle = null;
-
- private final int buildTargetWidth = 150;
- private final int toolChainFamilyWidth = 150;
- private final int supportArchWidth = 150;
- private final int toolCmdCodeWidth = 200;
- private final int tagNameWidth = 150;
- private final int argWidth = 400;
-
- private boolean ffsSelection = false;
- private int selectedFfsTableRow = -1;
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentSouth() {
- if (jPanelContentSouth == null) {
- jPanelContentSouth = new JPanel();
- }
- return jPanelContentSouth;
- }
- */
-
- /**
- * This method initializes jPanel1
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentNorth() {
- if (jPanelContentNorth == null) {
- jPanelContentNorth = new JPanel();
- }
- return jPanelContentNorth;
- }
- */
-
- /**
- * This method initializes jPanel2
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentWest() {
- if (jPanelContentWest == null) {
- jPanelContentWest = new JPanel();
- }
- return jPanelContentWest;
- }
- */
-
- /**
- * This method initializes jPanel3
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- jPanelContentEast = new JPanel();
- }
- return jPanelContentEast;
- }
- */
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("Flash Filesystem Options", null, getJPanelFfsTab(), null);
- jTabbedPane.addTab("Customize Tool Chain Configurations", null, getJPanelOptionsTab(), null);
- jTabbedPane.addTab("User Defined ANT Tasks", null, getJPanelUserDef(), null);
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(722, 577);
- this.setTitle("Platform Build Options");
- this.setContentPane(getJContentPane());
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- // jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
- // jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
- // jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
- // jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jPanelTableOptionsContainer
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelTableOptionsContainer() {
- if (jPanelTableOptionsContainer == null) {
- jLabelTableOptionsTitle = new JLabel();
- jLabelTableOptionsTitle.setText(" Current Argument Lines");
- jPanelTableOptionsContainer = new JPanel();
- jPanelTableOptionsContainer.setLayout(new BorderLayout());
- jPanelTableOptionsContainer.add(jLabelTableOptionsTitle, java.awt.BorderLayout.NORTH);
- jPanelTableOptionsContainer.add(getJScrollPaneOptions(), java.awt.BorderLayout.CENTER);
- }
- return jPanelTableOptionsContainer;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- new FpdBuildOptions().setVisible(true);
- }
-
- /**
- * This is the default constructor
- */
- public FpdBuildOptions() {
- super();
- initialize();
- this.setVisible(true);
- }
-
- public FpdBuildOptions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this();
- ffc = new FpdFileContents(fpd);
- init(ffc);
- }
-
- public FpdBuildOptions(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- }
-
- private void init(FpdFileContents ffc) {
- initOptionTable();
- initAntTaskTable();
- initFfsTable();
- this.addInternalFrameListener(new InternalFrameAdapter() {
- public void internalFrameDeactivated(InternalFrameEvent e) {
- if (jTableAntTasks.isEditing()) {
- jTableAntTasks.getCellEditor().stopCellEditing();
- }
- if (jTableOptions.isEditing()) {
- jTableOptions.getCellEditor().stopCellEditing();
- }
- stopEditingInTables ();
- }
- });
- }
-
- private void stopEditingInTables () {
- if (jTableFfs.isEditing()) {
- jTableFfs.getCellEditor().stopCellEditing();
- }
- if (jTableFfsSection.isEditing()) {
- jTableFfsSection.getCellEditor().stopCellEditing();
- }
- if (jTableFfsSections.isEditing()) {
- jTableFfsSections.getCellEditor().stopCellEditing();
- }
- if (jTableFfsSubSection.isEditing()) {
- jTableFfsSubSection.getCellEditor().stopCellEditing();
- }
- if (jTableFfsAttribs.isEditing()) {
- jTableFfsAttribs.getCellEditor().stopCellEditing();
- }
- }
-
- /**
- * This method initializes jPanel13
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTab() {
- if (jPanelFfsTab == null) {
- jPanelFfsTab = new JPanel();
- jPanelFfsTab.setLayout(new BorderLayout());
- jPanelFfsTab.add(getJPanelFfsTabCenter(), java.awt.BorderLayout.CENTER);
- jPanelFfsTab.add(getJScrollPaneFfs(), java.awt.BorderLayout.WEST);
- }
- return jPanelFfsTab;
- }
-
- /**
- * This method initializes jPanel18
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTabCenter() {
- if (jPanelFfsTabCenter == null) {
- jPanelFfsTabCenter = new JPanel();
- jPanelFfsTabCenter.setLayout(new BorderLayout());
- jPanelFfsTabCenter.add(getJPanelFfsTabCenterN(), java.awt.BorderLayout.NORTH);
- jPanelFfsTabCenter.add(getJPanelFfsTabCenterS(), java.awt.BorderLayout.SOUTH);
- jPanelFfsTabCenter.add(getJSplitPaneFfsC(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsTabCenter;
- }
-
- /**
- * This method initializes jPanel15
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTabCenterN() {
- if (jPanelFfsTabCenterN == null) {
- jLabelEncapType = new JLabel();
- jLabelEncapType.setText("Encapsulation Type");
- FlowLayout flowLayout5 = new FlowLayout();
- flowLayout5.setAlignment(java.awt.FlowLayout.RIGHT);
-
- jPanelFfsTabCenterN = new JPanel();
- jPanelFfsTabCenterN.setLayout(flowLayout5);
-
-
- jPanelFfsTabCenterN.add(jLabelEncapType, null);
- jPanelFfsTabCenterN.add(getJTextFieldEncapType(), null);
- jPanelFfsTabCenterN.add(getJButtonFfsAdd(), null);
- jPanelFfsTabCenterN.add(getJButtonFfsDel(), null);
- }
- return jPanelFfsTabCenterN;
- }
-
- /**
- * This method initializes jPanel16
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTabCenterS() {
- if (jPanelFfsTabCenterS == null) {
- jLabelFfsAttribs = new JLabel();
- jLabelFfsAttribs.setText("Attributes");
- jPanelFfsTabCenterS = new JPanel();
- jPanelFfsTabCenterS.setPreferredSize(new java.awt.Dimension(491, 130));
- jPanelFfsTabCenterS.setLayout(new BorderLayout());
- jPanelFfsTabCenterS.add(jLabelFfsAttribs, java.awt.BorderLayout.WEST);
- jPanelFfsTabCenterS.add(getJScrollPaneFfsAttribs(), java.awt.BorderLayout.CENTER);
- jPanelFfsTabCenterS.add(getJPanelFfsAttribButtonGroup(), java.awt.BorderLayout.EAST);
- }
- return jPanelFfsTabCenterS;
- }
-
- /**
- * This method initializes jTextField6
- *
- * @return javax.swing.JTextField
- */
-
-
- /**
- * This method initializes jButton8
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsAdd() {
- if (jButtonFfsAdd == null) {
- jButtonFfsAdd = new JButton();
- jButtonFfsAdd.setPreferredSize(new java.awt.Dimension(70, 20));
- jButtonFfsAdd.setText("New");
- jButtonFfsAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = -2923720717273384221L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
-
- String[] row = { "" };
- ffsTableModel.addRow(row);
- docConsole.setSaved(false);
- ffc.genBuildOptionsFfs("", "");
- jTableFfs.changeSelection(ffsTableModel.getRowCount()-1, 0, false, false);
-
- }
- });
- }
- return jButtonFfsAdd;
- }
-
- /**
- * This method initializes jButton9
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsDel() {
- if (jButtonFfsDel == null) {
- jButtonFfsDel = new JButton();
- jButtonFfsDel.setPreferredSize(new java.awt.Dimension(70, 20));
- jButtonFfsDel.setText("Delete");
- jButtonFfsDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = -4002678939178194476L;
-
- public void actionPerformed(ActionEvent arg0) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- ffc.removeBuildOptionsFfs(jTableFfs.getSelectedRow());
- ffsTableModel.removeRow(jTableFfs.getSelectedRow());
- sectionTableModel.setRowCount(0);
- sectionsTableModel.setRowCount(0);
- subsectionsTableModel.setRowCount(0);
- ffsAttributesTableModel.setRowCount(0);
- }
- });
- }
- return jButtonFfsDel;
- }
-
- /**
- * This method initializes jScrollPane5
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfsAttribs() {
- if (jScrollPaneFfsAttribs == null) {
- jScrollPaneFfsAttribs = new JScrollPane();
-// jScrollPaneFfsAttribs.setPreferredSize(new java.awt.Dimension(350, 100));
- jScrollPaneFfsAttribs.setViewportView(getJTableFfsAttribs());
-
- }
- return jScrollPaneFfsAttribs;
- }
-
- /**
- * This method initializes jTable4
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsAttribs() {
- if (jTableFfsAttribs == null) {
- ffsAttributesTableModel = new DefaultTableModel();
- jTableFfsAttribs = new JTable(ffsAttributesTableModel);
-// jTableFfsAttribs.setPreferredSize(new java.awt.Dimension(400, 80));
- jTableFfsAttribs.setRowHeight(20);
- ffsAttributesTableModel.addColumn("Name");
- ffsAttributesTableModel.addColumn("Value");
-
- jTableFfsAttribs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFfsAttribs.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String name = m.getValueAt(row, 0) + "";
- String value = m.getValueAt(row, 1) + "";
-
- if (name.length() == 0) {
- return;
- }
- if (value.length() == 0) {
- return;
- }
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), row, name, value);
- }
- }
- });
- }
- return jTableFfsAttribs;
- }
-
- private void initFfsTable() {
- int ffsCount = ffc.getBuildOptionsFfsCount();
- if (ffsCount < 0) {
- return;
- }
- String[][] saa = new String[ffsCount][1];
- ffc.getBuildOptionsFfsKey(saa);
- for (int i = 0; i < saa.length; ++i) {
- ffsTableModel.addRow(saa[i]);
- }
- jTableFfs.changeSelection(0, 0, false, false);
- }
-
- /**
- * This method initializes jButton17
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsAttribNew() {
- if (jButtonFfsAttribNew == null) {
- jButtonFfsAttribNew = new JButton();
- jButtonFfsAttribNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsAttribNew.setText("New");
- jButtonFfsAttribNew.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- Object[] o = { "", "" };
- ffsAttributesTableModel.addRow(o);
- docConsole.setSaved(false);
- ffc.genBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), "", "");
- }
- });
- }
- return jButtonFfsAttribNew;
- }
-
- /**
- * This method initializes jButton18
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsAttribRemove() {
- if (jButtonFfsAttribRemove == null) {
- jButtonFfsAttribRemove = new JButton();
- jButtonFfsAttribRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsAttribRemove.setText("Remove");
- jButtonFfsAttribRemove.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- if (jTableFfsAttribs.getSelectedRow() >= 0) {
- docConsole.setSaved(false);
- ffsAttributesTableModel.removeRow(jTableFfsAttribs.getSelectedRow());
- ffc.removeBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(),
- jTableFfsAttribs.getSelectedRow());
- }
- }
- });
- }
- return jButtonFfsAttribRemove;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfs() {
- if (jScrollPaneFfs == null) {
- jScrollPaneFfs = new JScrollPane();
- jScrollPaneFfs.setPreferredSize(new java.awt.Dimension(200,419));
- jScrollPaneFfs.setViewportView(getJTableFfs());
- }
- return jScrollPaneFfs;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfs() {
- if (jTableFfs == null) {
- ffsTableModel = new DefaultTableModel();
- ffsTableModel.addColumn("FFS Type");
- jTableFfs = new JTable(ffsTableModel);
- jTableFfs.setShowGrid(false);
- jTableFfs.setRowHeight(20);
-
- jTableFfs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFfs.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
-
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- int row = lsm.getMinSelectionIndex();
- sectionTableModel.setRowCount(0);
- sectionsTableModel.setRowCount(0);
- subsectionsTableModel.setRowCount(0);
- ffsAttributesTableModel.setRowCount(0);
- String[] sArray = { "", "" };
- LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
- ArrayList<String> alSections = new ArrayList<String>();
- ArrayList<String> alSection = new ArrayList<String>();
- ffc.getBuildOptionsFfs(row, sArray, lhm, alSections, alSection);
- ffsSelection = true;
- jTextFieldEncapType.setText(sArray[1]);
- ffsSelection = false;
- for (int i = 0; i < alSection.size(); ++i) {
- String[] sectionRow = { alSection.get(i) };
- sectionTableModel.addRow(sectionRow);
- }
- for (int j = 0; j < alSections.size(); ++j) {
- String[] sectionsRow = { alSections.get(j) };
- sectionsTableModel.addRow(sectionsRow);
- }
- if (lhm.size() <= 0) {
- return;
- }
- Set<String> keySet = lhm.keySet();
- Iterator<String> is = keySet.iterator();
- while (is.hasNext()) {
- String key = is.next();
- String[] attribRow = { key, lhm.get(key) };
- ffsAttributesTableModel.addRow(attribRow);
- }
- selectedFfsTableRow = row;
- }
- }
- });
-
- jTableFfs.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String id = m.getValueAt(row, 0) + "";
-
- if (id.length() == 0) {
- return;
- }
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsKey(row, id);
- }
- }
- });
- }
- return jTableFfs;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfsSection() {
- if (jScrollPaneFfsSection == null) {
- jScrollPaneFfsSection = new JScrollPane();
-// jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80));
- jScrollPaneFfsSection.setViewportView(getJTableFfsSection());
- }
- return jScrollPaneFfsSection;
- }
-
- /**
- * This method initializes jTable1
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsSection() {
- if (jTableFfsSection == null) {
- sectionTableModel = new DefaultTableModel();
- sectionTableModel.addColumn("SectionType");
-
- jTableFfsSection = new JTable(sectionTableModel);
- jTableFfsSection.setRowHeight(20);
- JComboBox cb = new JComboBox();
- cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
- cb.addItem("EFI_SECTION_VERSION");
- cb.addItem("EFI_SECTION_USER_INTERFACE");
- cb.addItem("EFI_SECTION_DXE_DEPEX");
- cb.addItem("EFI_SECTION_PEI_DEPEX");
- cb.addItem("EFI_SECTION_PE32");
- cb.addItem("EFI_SECTION_PIC");
- cb.addItem("EFI_SECTION_TE");
- cb.addItem("EFI_SECTION_RAW");
- cb.addItem("EFI_SECTION_COMPRESSION");
- cb.addItem("EFI_SECTION_GUID_DEFINED");
- cb.addItem("EFI_SECTION_COMPATIBILITY16");
- cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
- jTableFfsSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
-
- jTableFfsSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTableFfsSection.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String type = m.getValueAt(row, 0) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row, type);
- }
- }
- });
- }
- return jTableFfsSection;
- }
-
- /**
- * This method initializes jScrollPane3
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfsSubSection() {
- if (jScrollPaneFfsSubSection == null) {
- jScrollPaneFfsSubSection = new JScrollPane();
-// jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90));
- jScrollPaneFfsSubSection.setViewportView(getJTableFfsSubSection());
- }
- return jScrollPaneFfsSubSection;
- }
-
- /**
- * This method initializes jTable3
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsSubSection() {
- if (jTableFfsSubSection == null) {
- subsectionsTableModel = new DefaultTableModel();
- subsectionsTableModel.addColumn("SectionType");
- jTableFfsSubSection = new JTable(subsectionsTableModel);
- jTableFfsSubSection.setRowHeight(20);
- JComboBox cb = new JComboBox();
- cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
- cb.addItem("EFI_SECTION_VERSION");
- cb.addItem("EFI_SECTION_USER_INTERFACE");
- cb.addItem("EFI_SECTION_DXE_DEPEX");
- cb.addItem("EFI_SECTION_PEI_DEPEX");
- cb.addItem("EFI_SECTION_PE32");
- cb.addItem("EFI_SECTION_PIC");
- cb.addItem("EFI_SECTION_TE");
- cb.addItem("EFI_SECTION_RAW");
- cb.addItem("EFI_SECTION_COMPRESSION");
- cb.addItem("EFI_SECTION_GUID_DEFINED");
- cb.addItem("EFI_SECTION_COMPATIBILITY16");
- cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
- jTableFfsSubSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
- jTableFfsSubSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTableFfsSubSection.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
- return;
- }
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String type = m.getValueAt(row, 0) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
- jTableFfsSections.getSelectedRow(), row, type);
- }
- }
- });
- }
- return jTableFfsSubSection;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldEncapType() {
- if (jTextFieldEncapType == null) {
- jTextFieldEncapType = new JTextField();
- jTextFieldEncapType.setPreferredSize(new java.awt.Dimension(200,20));
- jTextFieldEncapType.getDocument().addDocumentListener(new DocumentListener() {
-
- public void insertUpdate(DocumentEvent arg0) {
- if (ffsSelection) {
-// ffsSelection = false;
- return;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- public void removeUpdate(DocumentEvent arg0) {
- if (ffsSelection) {
-// ffsSelection = false;
- return;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- public void changedUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- });
- jTextFieldEncapType.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- if (selectedFfsTableRow < 0) {
- return;
- }
- ffc.updateBuildOptionsFfsSectionsType(selectedFfsTableRow, jTextFieldEncapType.getText());
-
- }
- });
- }
- return jTextFieldEncapType;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsAttribButtonGroup() {
- if (jPanelFfsAttribButtonGroup == null) {
- jPanelFfsAttribButtonGroup = new JPanel();
- jPanelFfsAttribButtonGroup.setPreferredSize(new java.awt.Dimension(100, 100));
- jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribNew(), null);
- jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribRemove(), null);
- }
- return jPanelFfsAttribButtonGroup;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionNew() {
- if (jButtonFfsSectionNew == null) {
- jButtonFfsSectionNew = new JButton();
- jButtonFfsSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionNew.setText("New");
- jButtonFfsSectionNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- String[] row = { "EFI_SECTION_RAW" };
- sectionTableModel.addRow(row);
- ffc.genBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row[0]);
- }
- });
- }
- return jButtonFfsSectionNew;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionRemove() {
- if (jButtonFfsSectionRemove == null) {
- jButtonFfsSectionRemove = new JButton();
- jButtonFfsSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionRemove.setText("Remove");
-
- jButtonFfsSectionRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSection.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- sectionTableModel.removeRow(jTableFfsSection.getSelectedRow());
- ffc.removeBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(),
- jTableFfsSection.getSelectedRow());
- }
- });
- }
- return jButtonFfsSectionRemove;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSubSectionNew() {
- if (jButtonFfsSubSectionNew == null) {
- jButtonFfsSubSectionNew = new JButton();
- jButtonFfsSubSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSubSectionNew.setText("New");
- jButtonFfsSubSectionNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- String[] row = { "EFI_SECTION_RAW" };
- subsectionsTableModel.addRow(row);
- ffc.genBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
- jTableFfsSections.getSelectedRow(), row[0]);
-
- }
- });
- }
- return jButtonFfsSubSectionNew;
- }
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSubSectionRemove() {
- if (jButtonFfsSubSectionRemove == null) {
- jButtonFfsSubSectionRemove = new JButton();
- jButtonFfsSubSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSubSectionRemove.setText("Remove");
- jButtonFfsSubSectionRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedFfsRow = jTableFfs.getSelectedRow();
- int selectedSectionsRow = jTableFfsSections.getSelectedRow();
- int selectedSubSectionRow = jTableFfsSubSection.getSelectedRow();
- if (selectedFfsRow < 0 || selectedSectionsRow < 0
- || selectedSubSectionRow < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- subsectionsTableModel.removeRow(selectedSubSectionRow);
- ffc.removeBuildOptionsFfsSectionsSectionsSection(selectedFfsRow,
- selectedSectionsRow,
- selectedSubSectionRow);
- if (subsectionsTableModel.getRowCount() == 0) {
- sectionsTableModel.removeRow(selectedSectionsRow);
- }
- }
- });
- }
- return jButtonFfsSubSectionRemove;
- }
-
- /**
- * This method initializes jButton6
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionsNew() {
- if (jButtonFfsSectionsNew == null) {
- jButtonFfsSectionsNew = new JButton();
- jButtonFfsSectionsNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionsNew.setText("New");
- jButtonFfsSectionsNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- String[] row = { "Compress" };
- sectionsTableModel.addRow(row);
- ffc.genBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), "");
- JOptionPane.showMessageDialog(FpdBuildOptions.this, "Add Default Section Type EFI_SECTION_PE32 into the New Sections Entry.");
- jTableFfsSections.changeSelection(sectionsTableModel.getRowCount()-1, 0, false, false);
- }
- });
- }
- return jButtonFfsSectionsNew;
- }
-
- /**
- * This method initializes jButton7
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionsRemove() {
- if (jButtonFfsSectionsRemove == null) {
- jButtonFfsSectionsRemove = new JButton();
- jButtonFfsSectionsRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionsRemove.setText("Remove");
- jButtonFfsSectionsRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- sectionsTableModel.removeRow(jTableFfsSections.getSelectedRow());
- ffc.removeBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(),
- jTableFfsSections.getSelectedRow());
- subsectionsTableModel.setRowCount(0);
- }
- });
- }
- return jButtonFfsSectionsRemove;
- }
-
- private JScrollPane getJScrollPaneFfsSections() {
- if (jScrollPaneFfsSections == null) {
- jScrollPaneFfsSections = new JScrollPane();
-// jScrollPaneFfsSections.setPreferredSize(new java.awt.Dimension(500, 80));
- jScrollPaneFfsSections.setViewportView(getJTableFfsSections());
- }
- return jScrollPaneFfsSections;
- }
-
- /**
- * This method initializes jTable6
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsSections() {
- if (jTableFfsSections == null) {
- sectionsTableModel = new DefaultTableModel();
- sectionsTableModel.addColumn("EncapsulationType");
- jTableFfsSections = new JTable(sectionsTableModel);
- jTableFfsSections.setRowHeight(20);
- jTableFfsSections.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFfsSections.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- int sectionsRow = lsm.getMinSelectionIndex();
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- subsectionsTableModel.setRowCount(0);
- ArrayList<String> al = new ArrayList<String>();
- ffc.getBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), sectionsRow, al);
- for (int i = 0; i < al.size(); ++i) {
- String[] subsectionRow = { al.get(i) };
- subsectionsTableModel.addRow(subsectionRow);
- }
- }
- }
- });
-
- jTableFfsSections.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String encapType = m.getValueAt(row, 0) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), row, encapType);
- }
- }
- });
- }
- return jTableFfsSections;
- }
-
- /**
- * This method initializes jSplitPaneFfsC
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPaneFfsC() {
- if (jSplitPaneFfsC == null) {
- jSplitPaneFfsC = new JSplitPane();
- jSplitPaneFfsC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- jSplitPaneFfsC.setDividerLocation(130);
- jSplitPaneFfsC.setTopComponent(getJPanelFfsCTop());
- jSplitPaneFfsC.setBottomComponent(getJSplitPaneFfsCBottom());
- jSplitPaneFfsC.setDividerSize(5);
- }
- return jSplitPaneFfsC;
- }
-
- /**
- * This method initializes jPanelFfsCTop
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsCTop() {
- if (jPanelFfsCTop == null) {
- jPanelFfsCTop = new JPanel();
- jPanelFfsCTop.setLayout(new BorderLayout());
- jPanelFfsCTop.add(getJPanelSectionN(), java.awt.BorderLayout.NORTH);
- jPanelFfsCTop.add(getJScrollPaneFfsSection(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsCTop;
- }
-
- /**
- * This method initializes jSplitPaneFfsCBottom
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPaneFfsCBottom() {
- if (jSplitPaneFfsCBottom == null) {
- jSplitPaneFfsCBottom = new JSplitPane();
- jSplitPaneFfsCBottom.setDividerSize(5);
- jSplitPaneFfsCBottom.setDividerLocation(130);
- jSplitPaneFfsCBottom.setTopComponent(getJPanelFfsCBottomTop());
- jSplitPaneFfsCBottom.setBottomComponent(getJPanelFfsCBottomBottom());
- jSplitPaneFfsCBottom.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- }
- return jSplitPaneFfsCBottom;
- }
-
- /**
- * This method initializes jPanelFfsCBottomTop
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsCBottomTop() {
- if (jPanelFfsCBottomTop == null) {
- jPanelFfsCBottomTop = new JPanel();
- jPanelFfsCBottomTop.setLayout(new BorderLayout());
- jPanelFfsCBottomTop.add(getJPanelSectionsN(), java.awt.BorderLayout.NORTH);
- jPanelFfsCBottomTop.add(getJScrollPaneFfsSections(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsCBottomTop;
- }
-
- /**
- * This method initializes jPanelFfsCBottomBottom
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsCBottomBottom() {
- if (jPanelFfsCBottomBottom == null) {
- jPanelFfsCBottomBottom = new JPanel();
- jPanelFfsCBottomBottom.setLayout(new BorderLayout());
- jPanelFfsCBottomBottom.add(getJPanelSubSectionN(), java.awt.BorderLayout.NORTH);
- jPanelFfsCBottomBottom.add(getJScrollPaneFfsSubSection(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsCBottomBottom;
- }
-
- /**
- * This method initializes jPanelSectionN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSectionN() {
- if (jPanelSectionN == null) {
- jPanelSectionN = new JPanel();
- jLabelFfsSection = new JLabel();
- jLabelFfsSection.setText("Section");
- jPanelSectionN.add(jLabelFfsSection, null);
- jPanelSectionN.add(getJButtonFfsSectionNew(), null);
- jPanelSectionN.add(getJButtonFfsSectionRemove(), null);
- }
- return jPanelSectionN;
- }
-
- /**
- * This method initializes jPanelSectionsN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSectionsN() {
- if (jPanelSectionsN == null) {
- jPanelSectionsN = new JPanel();
- jLabelFfsSections = new JLabel();
- jLabelFfsSections.setText("Sections");
- jPanelSectionsN.add(jLabelFfsSections, null);
- jPanelSectionsN.add(getJButtonFfsSectionsNew(), null);
- jPanelSectionsN.add(getJButtonFfsSectionsRemove(), null);
- }
- return jPanelSectionsN;
- }
-
- /**
- * This method initializes jPanelSubSectionN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSubSectionN() {
- if (jPanelSubSectionN == null) {
- jPanelSubSectionN = new JPanel();
- jLabelFfsSubSections = new JLabel();
- jLabelFfsSubSections.setText("Sub-Sections");
- jPanelSubSectionN.add(jLabelFfsSubSections, null);
- jPanelSubSectionN.add(getJButtonFfsSubSectionNew(), null);
- jPanelSubSectionN.add(getJButtonFfsSubSectionRemove(), null);
- }
- return jPanelSubSectionN;
- }
-
- /**
- * The following section contains all Build Options content
- */
-
- /**
- * This method initializes jPanelOptionsTab
- *
- * This is the main Options screen
- *
- * @return javax.swing.JPanel jPanelOptionsTab
- */
- private JPanel getJPanelOptionsTab() {
- if (jPanelOptionsTab == null) {
- // This container holds the Options Tab content
-
- // FlowLayout flowLayout9 = new FlowLayout();
- // flowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(2);
- jPanelOptionsTab = new JPanel();
- jPanelOptionsTab.setLayout(gridLayout);
- jPanelOptionsTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));
- jPanelOptionsTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));
- jPanelOptionsTab.setAutoscrolls(true);
- jPanelOptionsTab.setLocation(0, 0);
- jPanelOptionsTab.add(getJPanelOptionsContainer(), null);
-// jPanelOptionsTab.add(getJScrollPaneOptions(), null);
- jPanelOptionsTab.add(getJPanelTableOptionsContainer(), null);
- }
- return jPanelOptionsTab;
- }
-
- /**
- * This method initializes jPanelOptionsContainer
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelOptionsContainer() {
- if (jPanelOptionsContainer == null) {
- jLabelTagName = new JLabel();
- jLabelTagName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jLabelTagName.setLocation(new java.awt.Point(labelColumn, rowOne));
- jLabelTagName.setText("Tag Name");
- jLabelBuildTargets = new JLabel();
- jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jLabelBuildTargets.setLocation(new java.awt.Point(labelColumn, rowTwo));
- jLabelBuildTargets.setText("Build Targets");
- jLabelToolCmd = new JLabel();
- jLabelToolCmd.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
- jLabelToolCmd.setLocation(new java.awt.Point(labelColumn, rowThree));
- jLabelToolCmd.setText("Tool Command");
- jLabelSupArch = new JLabel();
- jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
- jLabelSupArch.setLocation(new java.awt.Point(labelColumn, rowFour));
- jLabelSupArch.setText("Supported Architectures");
- jLabelToolChainFamily = new JLabel();
- jLabelToolChainFamily.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
- jLabelToolChainFamily.setLocation(new java.awt.Point(labelColumn, rowFive));
- jLabelToolChainFamily.setText("Tool Chain Family");
-
- jLabelOptionContents = new JLabel();
- jLabelOptionContents.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
- jLabelOptionContents.setLocation(new java.awt.Point(labelColumn, rowSix));
- jLabelOptionContents.setText("Argument Strings");
-
- jPanelOptionsContainer = new JPanel();
-
- jPanelOptionsContainer.setLayout(null);
-
- jPanelOptionsContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
- /*
- jPanelOptionsContainer
- .setBorder(javax.swing.BorderFactory
- .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-*/
- jPanelOptionsContainer.add(jLabelTagName, null);
- jPanelOptionsContainer.add(getJTextFieldTagName(), null);
-
- jPanelOptionsContainer.add(jLabelBuildTargets, null);
- jPanelOptionsContainer.add(getJTextFieldBuildTargets(), null);
-
- jPanelOptionsContainer.add(jLabelToolChainFamily, null);
- jPanelOptionsContainer.add(getJTextFieldToolChainFamily(), null);
-
- jPanelOptionsContainer.add(jLabelToolCmd, null);
- jPanelOptionsContainer.add(getJTextFieldToolCmd(), null);
-
- jPanelOptionsContainer.add(jLabelSupArch, null);
- jPanelOptionsContainer.add(getArchitectureSelections(), null);
-
- jPanelOptionsContainer.add(jLabelOptionContents, null);
- jPanelOptionsContainer.add(getJTextFieldOptionContents(), null);
-
- jPanelOptionsContainer.add(getJButtonOptionsAdd(), null);
- jPanelOptionsContainer.add(getJButtonOptionsDel(), null);
- }
- return jPanelOptionsContainer;
- }
-
- /**
- * This method initializes jTextFieldOptionTagName Row 1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldTagName() {
- if (jTextFieldTagName == null) {
- jTextFieldTagName = new JTextField();
- jTextFieldTagName.setBounds(new java.awt.Rectangle(fieldColumn, rowOne, fieldWidth, oneRowHeight));
- jTextFieldTagName.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldTagName.setLocation(new java.awt.Point(fieldColumn, rowOne));
- }
- return jTextFieldTagName;
- }
-
- /**
- * This method initializes jTextFieldBuildTargets Row 2
- *
- * @return javax.swing.JTextField jTextFieldBuildTargets
- */
- private JTextField getJTextFieldBuildTargets() {
- if (jTextFieldBuildTargets == null) {
- jTextFieldBuildTargets = new JTextField();
- jTextFieldBuildTargets.setBounds(new java.awt.Rectangle(fieldColumn, rowTwo, fieldWidth, oneRowHeight));
- jTextFieldBuildTargets.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldBuildTargets.setLocation(new java.awt.Point(fieldColumn, rowTwo));
- }
- return jTextFieldBuildTargets;
- }
-
- /**
- * This method initializes jTextFieldToolCmd Row 3
- *
- * This should be a dropdown box of command codes from tools_def.txt
- *
- * @return javax.swing.JTextField jTextFieldToolCmd
- */
- private JTextField getJTextFieldToolCmd() {
- if (jTextFieldToolCmd == null) {
- jTextFieldToolCmd = new JTextField();
- jTextFieldToolCmd.setBounds(new java.awt.Rectangle(fieldColumn, rowThree, fieldWidth, oneRowHeight));
- jTextFieldToolCmd.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldToolCmd.setLocation(new java.awt.Point(fieldColumn, rowThree));
- }
- return jTextFieldToolCmd;
- }
-
- /**
- * This method initializes jArchitectureSelections Row 4
- *
- * @return jArchitectureSelections
- */
- private JPanel getArchitectureSelections() {
- if (jArchitectureSelections == null) {
- jArchitectureSelections = new JPanel();
- jArchitectureSelections.setLayout(null);
- jArchitectureSelections.add(getJCheckBoxIA32(), null);
- jArchitectureSelections.add(getJCheckBoxX64(), null);
- jArchitectureSelections.add(getJCheckBoxIpf(), null);
- jArchitectureSelections.add(getJCheckBoxEBC(), null);
- jArchitectureSelections.add(getJCheckBoxARM(), null);
- jArchitectureSelections.add(getJCheckBoxPPC(), null);
- jArchitectureSelections.setBounds(new java.awt.Rectangle(fieldColumn, rowFour, fieldWidth, oneRowHeight));
- jArchitectureSelections.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jArchitectureSelections.setLocation(new java.awt.Point(fieldColumn, rowFour));
- }
- return jArchitectureSelections;
- }
-
- /**
- * This method initializes jCheckBoxIA32
- *
- * @return javax.swing.JCheckBox jCheckBoxIA32
- */
- private JCheckBox getJCheckBoxIA32() {
- if (jCheckBoxIA32 == null) {
- jCheckBoxIA32 = new JCheckBox();
- jCheckBoxIA32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
- jCheckBoxIA32.setText("IA32");
- }
- return jCheckBoxIA32;
- }
-
- /**
- * This method initializes jCheckBoxX64
- *
- * @return javax.swing.JCheckBox jCheckBoxX64
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBoxIpf
- *
- * @return javax.swing.JCheckBox jCheckBoxIpf
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
- jCheckBoxIpf.setText("IPF");
- }
- return jCheckBoxIpf;
- }
-
-
- /**
- * This method initializes jCheckBoxEBC
- *
- * @return javax.swing.JCheckBox jCheckBoxEBC
- */
- private JCheckBox getJCheckBoxEBC() {
- if (jCheckBoxEBC == null) {
- jCheckBoxEBC = new JCheckBox();
- jCheckBoxEBC.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
- jCheckBoxEBC.setText("EBC");
- }
- return jCheckBoxEBC;
- }
-
- /**
- * This method initializes jCheckBoxARM
- *
- * @return javax.swing.JCheckBox jCheckBoxARM
- */
- private JCheckBox getJCheckBoxARM() {
- if (jCheckBoxARM == null) {
- jCheckBoxARM = new JCheckBox();
- jCheckBoxARM.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
- jCheckBoxARM.setText("ARM");
- }
- return jCheckBoxARM;
- }
-
- /**
- * This method initializes jCheckBoxPPC
- *
- * @return javax.swing.JCheckBox jCheckBoxPPC
- */
- private JCheckBox getJCheckBoxPPC() {
- if (jCheckBoxPPC == null) {
- jCheckBoxPPC = new JCheckBox();
- jCheckBoxPPC.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
- jCheckBoxPPC.setText("PPC");
- }
- return jCheckBoxPPC;
- }
-
- /**
- * This method initializes jTextFieldToolChainFamily Row 5
- *
- * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolChainFamily() {
- if (jTextFieldToolChainFamily == null) {
- jTextFieldToolChainFamily = new JTextField();
- jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(fieldColumn, rowFive, fieldWidth, oneRowHeight));
- jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldToolChainFamily.setLocation(new java.awt.Point(fieldColumn, rowFive));
- }
- return jTextFieldToolChainFamily;
- }
-
- /**
- * This method initializes jTextFieldOptionContents Row 6
- *
- * This is where we should put the checkbox & entry data for the command arguments
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldOptionContents() {
- if (jTextFieldOptionContents == null) {
- jTextFieldOptionContents = new JTextField();
- jTextFieldOptionContents.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldOptionContents.setBounds(fieldColumn, rowSix, fieldWidth, oneRowHeight);
- jTextFieldOptionContents.setLocation(new java.awt.Point(fieldColumn, rowSix));
- }
- return jTextFieldOptionContents;
- }
-
- /**
- * This method initializes jButtonOptionsAdd
- *
- * Add entry from the top screen to the table
- *
- * @return javax.swing.JButton jButtonOptionsAdd
- */
- private JButton getJButtonOptionsAdd() {
- if (jButtonOptionsAdd == null) {
- jButtonOptionsAdd = new JButton();
- jButtonOptionsAdd.setText("Add");
-
- jButtonOptionsAdd.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
- jButtonOptionsAdd.setBounds(new java.awt.Rectangle(firstButtonLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonOptionsAdd.setLocation(new java.awt.Point(firstButtonLoc, buttonRow));
- jButtonOptionsAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- boolean[] boolArray = { jCheckBoxIA32.isSelected(), jCheckBoxIpf.isSelected(),
- jCheckBoxX64.isSelected(), jCheckBoxEBC.isSelected(),
- jCheckBoxARM.isSelected(), jCheckBoxPPC.isSelected() };
- String s = boolToList(boolArray);
- Object[] o = { jTextFieldBuildTargets.getText(), jTextFieldToolChainFamily.getText(), s,
- jTextFieldToolCmd.getText(), jTextFieldTagName.getText(),
- jTextFieldOptionContents.getText() };
- optionsTableModel.addRow(o);
- docConsole.setSaved(false);
- ffc.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets.getText().trim()),
- jTextFieldToolChainFamily.getText(), jTextFieldTagName.getText(),
- jTextFieldToolCmd.getText(), stringToVector(s.trim()),
- jTextFieldOptionContents.getText());
- }
- });
- }
- return jButtonOptionsAdd;
- }
-
- /**
- * This method initializes jButtonOptionsDel
- *
- * Remove a line from the table below
- *
- * @return javax.swing.JButton jButtonOptionsDel
- */
- private JButton getJButtonOptionsDel() {
- if (jButtonOptionsDel == null) {
- jButtonOptionsDel = new JButton();
- jButtonOptionsDel.setText("Delete");
- jButtonOptionsDel.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
- jButtonOptionsDel.setBounds(new java.awt.Rectangle(next2LastButtonLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonOptionsDel.setLocation(new java.awt.Point(next2LastButtonLoc, buttonRow));
- jButtonOptionsDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (selectedRow >= 0) {
- optionsTableModel.removeRow(selectedRow);
- docConsole.setSaved(false);
- ffc.removeBuildOptionsOpt(selectedRow);
- }
- }
- });
- }
- return jButtonOptionsDel;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jScrollPaneOptions, this.getWidth(), intPreferredWidth);
-
- }
- /**
- * This method initializes jScrollPaneOptions
- * Contains the Table and is located below the data entry section
- * @return javax.swing.JScrollPane jScrollPaneOptoins
- */
- private JScrollPane getJScrollPaneOptions() {
- if (jScrollPaneOptions == null) {
- jScrollPaneOptions = new JScrollPane();
- jScrollPaneOptions.setViewportView(getJTableOptions());
- }
- return jScrollPaneOptions;
- }
-
- /**
- * This method initializes jTableOptions
- *
- * @return javax.swing.JTable jTableOptions
- */
- private JTable getJTableOptions() {
- if (jTableOptions == null) {
-
- optionsTableModel = new DefaultTableModel();
- jTableOptions = new JTable(optionsTableModel);
- jTableOptions.setRowHeight(20);
- optionsTableModel.addColumn("Build Targets");
- optionsTableModel.addColumn("Tool Chain Family");
- optionsTableModel.addColumn("Supported Architectures");
- optionsTableModel.addColumn("Tool Command Code");
- optionsTableModel.addColumn("TagName");
- optionsTableModel.addColumn("Arguments");
-
- jTableOptions.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth);
- jTableOptions.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth);
- jTableOptions.getColumnModel().getColumn(2).setMinWidth(supportArchWidth);
- jTableOptions.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth);
- jTableOptions.getColumnModel().getColumn(4).setMinWidth(tagNameWidth);
- jTableOptions.getColumnModel().getColumn(5).setMinWidth(argWidth);
-
-// javax.swing.table.TableColumn toolFamilyCol = jTableOptions.getColumnModel().getColumn(1);
-// JComboBox cb = new JComboBox();
-// cb.addItem("MSFT");
-// cb.addItem("GCC");
-// cb.addItem("CYGWIN");
-// cb.addItem("INTEL");
-// cb.addItem("USER_DEFINED");
-// toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch, FrameworkWizardUI.getInstance()));
-
- jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI.getInstance()));
-
- jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- selectedRow = -1;
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTableOptions.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String targets = m.getValueAt(row, 0) + "";
- Vector<Object> targetName = new Vector<Object>();
- String[] sArray = targets.split("( )+");
- for (int i = 0; i < sArray.length; ++i) {
- targetName.add(sArray[i]);
- }
- String toolChain = m.getValueAt(row, 1) + "";
- String archs = m.getValueAt(row, 2) + "";
- Vector<Object> supArch = null;
- if (archs.length() > 0) {
- supArch = new Vector<Object>();
- String[] sArray1 = archs.split("( )+");
- for (int i = 0; i < sArray1.length; ++i) {
- supArch.add(sArray1[i]);
- }
- }
-
- String toolCmd = m.getValueAt(row, 3) + "";
- String tagName = m.getValueAt(row, 4) + "";
- String contents = m.getValueAt(row, 5) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsOpt(row, targetName, toolChain, tagName, toolCmd, supArch, contents);
- }
- }
- });
- }
- return jTableOptions;
- }
-
- private Vector<Object> stringToVector(String s) {
- String[] sArray = s.split(" ");
- Vector<Object> v = null;
- if (s.length() > 0 && !s.trim().equalsIgnoreCase("")) {
- v = new Vector<Object>();
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- }
- return v;
- }
-
- private String boolToList(boolean[] bool) {
- String s = " ";
- if (bool[0]) {
- s += "IA32 ";
- }
- if (bool[1]) {
- s += "IPF ";
- }
- if (bool[2]) {
- s += "X64 ";
- }
- if (bool[3]) {
- s += "EBC ";
- }
- if (bool[4]) {
- s += "ARM ";
- }
- if (bool[5]) {
- s += "PPC ";
- }
-
- return s.trim();
- }
-
- private void initOptionTable() {
- if (ffc.getBuildOptionsOptCount() == 0) {
- //ToDo get default options from *.txt file
- return;
- }
- String[][] saa = new String[ffc.getBuildOptionsOptCount()][6];
- ffc.getBuildOptionsOpts(saa);
- for (int i = 0; i < saa.length; ++i) {
- optionsTableModel.addRow(saa[i]);
- }
- }
-
-
- /**
- * Everything below should pertain to the ANT Task Tab
- */
-
- /**
- * This method initializes jButton12
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAntTaskFileBrowse() {
- if (jButtonAntTaskFileBrowse == null) {
- jButtonAntTaskFileBrowse = new JButton();
- jButtonAntTaskFileBrowse.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonAntTaskFileBrowse.setText("Browse");
- jButtonAntTaskFileBrowse.addActionListener(new AbstractAction() {
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- //
- // Select files from current workspace
- //
- String dirPrefix = Workspace.getCurrentWorkspace();
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
- int retval = chooser.showOpenDialog(FpdBuildOptions.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(FpdBuildOptions.this, "You can only select files in current package!");
- return;
- }
- } else {
- return;
- }
-
- headerDest = theFile.getPath();
- jTextFieldAntTaskFile.setText(headerDest.substring(dirPrefix.length()).replace('\\', '/'));
-
- }
-
- });
- }
- return jButtonAntTaskFileBrowse;
- }
-
- /**
- * This method initializes jPanelUserDefCenterN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDefCenterN() {
- if (jPanelUserDefCenterN == null) {
- jPanelUserDefCenterN = new JPanel();
- jPanelUserDefCenterN.add(jLabelAntCmdOpts, null);
- jPanelUserDefCenterN.add(getJTextFieldAntCmdOpts(), null);
- jPanelUserDefCenterN.add(getJButtonAntTaskAdd(), null);
- jPanelUserDefCenterN.add(getJButtonAntTaskDel(), null);
- }
- return jPanelUserDefCenterN;
- }
-
- /**
- * This method initializes jPanel8
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDef() {
- if (jPanelUserDef == null) {
- jPanelUserDef = new JPanel();
- jPanelUserDef.setLayout(new BorderLayout());
- jPanelUserDef.add(getJPanelUserDefNorth(), java.awt.BorderLayout.NORTH);
- jPanelUserDef.add(getJPanelUserDefCenter(), java.awt.BorderLayout.CENTER);
-
- }
- return jPanelUserDef;
- }
-
- /**
- * This method initializes jPanel9
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDefNorth() {
- if (jPanelUserDefNorth == null) {
- jLabelAntTaskFile = new JLabel();
- jLabelAntTaskFile.setText("ANT Task File");
- jLabelAntTaskFile.setPreferredSize(new java.awt.Dimension(80, 20));
- FlowLayout flowLayout8 = new FlowLayout();
- flowLayout8.setAlignment(java.awt.FlowLayout.CENTER);
- jLabelAntTaskId = new JLabel();
- jLabelAntTaskId.setText("ID");
- jPanelUserDefNorth = new JPanel();
- jPanelUserDefNorth.setLayout(flowLayout8);
- jPanelUserDefNorth.add(jLabelAntTaskFile, null);
- jPanelUserDefNorth.add(getJTextFieldAntTaskFile(), null);
- jPanelUserDefNorth.add(getJButtonAntTaskFileBrowse(), null);
- jPanelUserDefNorth.add(jLabelAntTaskId, null);
- jPanelUserDefNorth.add(getJTextFieldAntTaskId(), null);
- }
- return jPanelUserDefNorth;
- }
-
- /**
- * This method initializes jPanel11
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDefCenter() {
- if (jPanelUserDefCenter == null) {
- jLabelAntCmdOpts = new JLabel();
- jLabelAntCmdOpts.setText("ANT Command Options");
- jLabelAntCmdOpts.setPreferredSize(new java.awt.Dimension(131, 20));
- jPanelUserDefCenter = new JPanel();
- jPanelUserDefCenter.setLayout(new BorderLayout());
-
- jPanelUserDefCenter.add(getJPanelUserDefCenterN(), java.awt.BorderLayout.NORTH);
- jPanelUserDefCenter.add(getJScrollPaneAntTasks(), java.awt.BorderLayout.CENTER);
- }
- return jPanelUserDefCenter;
- }
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldAntTaskFile() {
- if (jTextFieldAntTaskFile == null) {
- jTextFieldAntTaskFile = new JTextField();
- jTextFieldAntTaskFile.setPreferredSize(new java.awt.Dimension(200, 20));
- }
- return jTextFieldAntTaskFile;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldAntTaskId() {
- if (jTextFieldAntTaskId == null) {
- jTextFieldAntTaskId = new JTextField();
- jTextFieldAntTaskId.setPreferredSize(new java.awt.Dimension(100, 20));
- }
- return jTextFieldAntTaskId;
- }
-
- /**
- * This method initializes jButton4
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAntTaskAdd() {
- if (jButtonAntTaskAdd == null) {
- jButtonAntTaskAdd = new JButton();
- jButtonAntTaskAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonAntTaskAdd.setText("Add");
- jButtonAntTaskAdd.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (!DataValidation.isInt(jTextFieldAntTaskId.getText())
- || jTextFieldAntTaskId.getText().length() != 8) {
- JOptionPane.showMessageDialog(FpdBuildOptions.this, "ID must be an 8-digit integer.");
- return;
- }
- Object[] o = { jTextFieldAntTaskId.getText(), null, null };
- o[1] = jTextFieldAntTaskFile.getText();
- o[2] = jTextFieldAntCmdOpts.getText();
- ffc.genBuildOptionsUserDefAntTask(o[0] + "", o[1] + "", o[2] + "");
- antTaskTableModel.addRow(o);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonAntTaskAdd;
- }
-
- /**
- * This method initializes jButton5
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAntTaskDel() {
- if (jButtonAntTaskDel == null) {
- jButtonAntTaskDel = new JButton();
- jButtonAntTaskDel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonAntTaskDel.setText("Delete");
- jButtonAntTaskDel.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (selectedRow >= 0) {
- docConsole.setSaved(false);
- antTaskTableModel.removeRow(selectedRow);
- ffc.removeBuildOptionsUserDefAntTask(selectedRow);
- }
- }
- });
- }
- return jButtonAntTaskDel;
- }
-
- /**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldAntCmdOpts() {
- if (jTextFieldAntCmdOpts == null) {
- jTextFieldAntCmdOpts = new JTextField();
- jTextFieldAntCmdOpts.setPreferredSize(new java.awt.Dimension(270, 20));
- jTextFieldAntCmdOpts.setEnabled(true);
- }
- return jTextFieldAntCmdOpts;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneAntTasks() {
- if (jScrollPaneAntTasks == null) {
- jScrollPaneAntTasks = new JScrollPane();
- jScrollPaneAntTasks.setPreferredSize(new java.awt.Dimension(600, 400));
- jScrollPaneAntTasks.setViewportView(getJTableAntTasks());
- }
- return jScrollPaneAntTasks;
- }
-
- /**
- * This method initializes jTable2
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableAntTasks() {
- if (jTableAntTasks == null) {
- antTaskTableModel = new DefaultTableModel();
- jTableAntTasks = new JTable(antTaskTableModel);
- jTableAntTasks.setRowHeight(20);
- antTaskTableModel.addColumn("ID");
- antTaskTableModel.addColumn("Filename");
- antTaskTableModel.addColumn("ANT Command Options");
-
- jTableAntTasks.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableAntTasks.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- selectedRow = -1;
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTableAntTasks.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String id = m.getValueAt(row, 0) + "";
- String file = m.getValueAt(row, 1) + "";
- String execOrder = m.getValueAt(row, 2) + "";
- if (id.length() == 0) {
- return;
- }
- if (file.length() == 0 && execOrder.length() == 0) {
- return;
- }
- if (file.length() == 0) {
- file = null;
- }
- if (execOrder.length() == 0) {
- execOrder = null;
- }
- ffc.updateBuildOptionsUserDefAntTask(row, id, file, execOrder);
-
- }
- }
- });
- }
- return jTableAntTasks;
- }
-
- private void initAntTaskTable() {
- if (ffc.getBuildOptionsUserDefAntTaskCount() == 0) {
- return;
- }
- String[][] saa = new String[ffc.getBuildOptionsUserDefAntTaskCount()][3];
- ffc.getBuildOptionsUserDefAntTasks(saa);
- for (int i = 0; i < saa.length; ++i) {
- antTaskTableModel.addRow(saa[i]);
- }
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java
deleted file mode 100644
index c7a455ed91..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java
+++ /dev/null
@@ -1,774 +0,0 @@
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import javax.swing.JCheckBox;
-import javax.swing.JRadioButton;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import java.awt.GridLayout;
-import java.util.ArrayList;
-
-public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JPanel jContentPane = null;
- private JScrollPane jScrollPaneDynPcd = null;
- private JTable jTableDynPcd = null;
- private DynPcdTableModel modelPcd = null;
- private DynPcdTableModel modelSku = null;
- private FpdFileContents ffc = null;
- private OpeningPlatformType docConsole = null;
- private JPanel jPanelSkuInfo = null;
- private JCheckBox jCheckBoxSkuEnable = null;
- private JPanel jPanelDynPcdValue = null;
- private JRadioButton jRadioButtonHii = null;
- private JRadioButton jRadioButtonVpd = null;
- private JScrollPane jScrollPaneSkuInfo = null;
- private JTable jTableSkuInfo = null;
- private JButton jButtonSkuInfoUpdate = null;
- private JLabel jLabelVarName = null;
- private JTextField jTextFieldVarName = null;
- private JLabel jLabelVarGuid = null;
- private JTextField jTextFieldVarGuid = null;
- private JLabel jLabelPad = null;
- private JLabel jLabelVarOffset = null;
- private JTextField jTextFieldVarOffset = null;
- private JLabel jLabelHiiDefaultValue = null;
- private JTextField jTextFieldHiiDefaultValue = null;
- private JTextField jTextFieldVpdOffset = null;
- private JLabel jLabelVpdOffset = null;
- private JTextField jTextFieldDefaultValue = null;
- private JRadioButton jRadioButtonDefaultValue = null;
- private ButtonGroup bg = new ButtonGroup();
- private JLabel jLabelPadd = null;
- private JLabel jLabelPad1 = null;
- private JScrollPane jScrollPane = null;
- /**
- * This is the default constructor
- */
- public FpdDynamicPcdBuildDefinitions() {
- super();
- initialize();
- }
-
- public FpdDynamicPcdBuildDefinitions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){
- this();
- init(fpd);
- }
-
- public FpdDynamicPcdBuildDefinitions(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- }
-
- public void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- if (ffc == null) {
- ffc = new FpdFileContents(fpd);
- ffc.initDynPcdMap();
- }
- String[][] saa = new String[ffc.getDynamicPcdBuildDataCount()][5];
- ffc.getDynamicPcdBuildData(saa);
- for (int i = 0; i < saa.length; ++i) {
- modelPcd.addRow(saa[i]);
- }
-
- saa = new String[ffc.getPlatformDefsSkuInfoCount()][2];
- ffc.getPlatformDefsSkuInfos(saa);
- for (int i = 0; i < saa.length; ++i) {
- modelSku.addRow(saa[i]);
- }
-
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(661, 558);
- this.setTitle("Dynamic PCD Build Definitions");
- this.setContentPane(getJContentPane());
- this.setVisible(true);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJScrollPaneDynPcd(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJPanelSkuInfo(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneDynPcd() {
- if (jScrollPaneDynPcd == null) {
- jScrollPaneDynPcd = new JScrollPane();
- jScrollPaneDynPcd.setPreferredSize(new java.awt.Dimension(100,250));
- jScrollPaneDynPcd.setViewportView(getJTableDynPcd());
- }
- return jScrollPaneDynPcd;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableDynPcd() {
- if (jTableDynPcd == null) {
- modelPcd = new DynPcdTableModel();
- modelPcd.addColumn("CName");
- modelPcd.addColumn("Token");
- modelPcd.addColumn("TokenSpaceGuid");
- modelPcd.addColumn("MaxDatumSize");
- modelPcd.addColumn("DatumType");
- jTableDynPcd = new JTable(modelPcd);
- jTableDynPcd.setRowHeight(20);
- TableColumn tokenColumn = jTableDynPcd.getColumnModel().getColumn(1);
- jTableDynPcd.removeColumn(tokenColumn);
- jTableDynPcd.getColumnModel().getColumn(0).setMinWidth(250);
-
- jTableDynPcd.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableDynPcd.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow = lsm.getMinSelectionIndex();
- jTextFieldDefaultValue.setText("");
- jTextFieldVpdOffset.setText("");
- jTextFieldVarName.setText("");
- jTextFieldVarGuid.setText("");
- jTextFieldVarOffset.setText("");
- jTextFieldHiiDefaultValue.setText("");
- displayDetails(selectedRow);
- }
- }
- });
- }
- return jTableDynPcd;
- }
- //
- // should display default sku info here, as no selection event of table1 will be triggered when change selection of rows in table.
- //
- private void displayDetails(int i) {
- int defaultSkuRow = getDefaultSkuInfoRow();
- jTableSkuInfo.changeSelection(defaultSkuRow, 0, false, false);
-
- int skuCount = ffc.getDynamicPcdSkuInfoCount(i);
- String defaultVal = ffc.getDynamicPcdBuildDataValue(i);
- if (defaultVal != null) {
- jRadioButtonDefaultValue.setSelected(true);
- jTextFieldDefaultValue.setText(defaultVal);
- if ( skuCount == 1) {
- jCheckBoxSkuEnable.setSelected(false);
- }
- else{
- jCheckBoxSkuEnable.setSelected(true);
- }
- }
-
- else if (ffc.getDynamicPcdBuildDataVpdOffset(i) != null) {
- jRadioButtonVpd.setSelected(true);
- jTextFieldVpdOffset.setText(ffc.getDynamicPcdBuildDataVpdOffset(i));
- if (skuCount ==1) {
- jCheckBoxSkuEnable.setSelected(false);
-
- }
- else{
- jCheckBoxSkuEnable.setSelected(true);
- }
- }
- else {
- jRadioButtonHii.setSelected(true);
- String[][] saa = new String[ffc.getDynamicPcdSkuInfoCount(i)][7];
- ffc.getDynamicPcdSkuInfos(i, saa);
-
- String varDisplayName = Tools.convertUnicodeHexStringToString(saa[0][1]);
- jTextFieldVarName.setText(varDisplayName);
-
- jTextFieldVarGuid.setText(saa[0][2]);
- jTextFieldVarOffset.setText(saa[0][3]);
- jTextFieldHiiDefaultValue.setText(saa[0][4]);
- if (skuCount ==1) {
- jCheckBoxSkuEnable.setSelected(false);
- }
- else{
- jCheckBoxSkuEnable.setSelected(true);
- }
- }
-
- }
-
- private void displaySkuInfoDetails(String id) {
- int pcdSelected = jTableDynPcd.getSelectedRow();
- if (pcdSelected < 0) {
- return;
- }
-
- int skuInfoCount = ffc.getDynamicPcdSkuInfoCount(pcdSelected);
- String[][] saa = new String[skuInfoCount][7];
- ffc.getDynamicPcdSkuInfos(pcdSelected, saa);
- int i = 0;
- while (i < skuInfoCount) {
- if (id.equals(saa[i][0])) {
- if (saa[i][5] != null){
- jRadioButtonVpd.setSelected(true);
- jTextFieldVpdOffset.setText(saa[i][5]);
- }
-
- else if (saa[i][1] != null) {
- jRadioButtonHii.setSelected(true);
- String varDisplayName = Tools.convertUnicodeHexStringToString(saa[i][1]);
- jTextFieldVarName.setText(varDisplayName);
- jTextFieldVarGuid.setText(saa[i][2]);
- jTextFieldVarOffset.setText(saa[i][3]);
- jTextFieldHiiDefaultValue.setText(saa[i][4]);
- }
-
- else{
- jRadioButtonDefaultValue.setSelected(true);
- jTextFieldDefaultValue.setText(saa[i][6]);
- }
- return;
- }
- ++i;
- }
- }
-
- private int getDefaultSkuInfoRow () {
- for (int i = 0; i < modelSku.getRowCount(); ++i) {
- if (modelSku.getValueAt(i, 0).equals("0")) {
- return i;
- }
- }
- return 0;
- }
-
- /**
- * This method initializes jPanel3
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSkuInfo() {
- if (jPanelSkuInfo == null) {
- jPanelSkuInfo = new JPanel();
- jPanelSkuInfo.setLayout(new BorderLayout());
- jPanelSkuInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
- jPanelSkuInfo.setPreferredSize(new java.awt.Dimension(600,120));
-
-// jPanelSkuInfo.add(getJPanelSkuInfoN(), java.awt.BorderLayout.NORTH);
- jPanelSkuInfo.add(getJScrollPane(), java.awt.BorderLayout.NORTH);
- jPanelSkuInfo.add(getJScrollPaneSkuInfo(), java.awt.BorderLayout.CENTER);
-
-
-// jPanelSkuInfo.add(getJPanelDynPcdValue(), java.awt.BorderLayout.SOUTH);
- }
- return jPanelSkuInfo;
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxSkuEnable() {
- if (jCheckBoxSkuEnable == null) {
- jCheckBoxSkuEnable = new JCheckBox();
- jCheckBoxSkuEnable.setText("SKU Enable");
- jCheckBoxSkuEnable.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (!jCheckBoxSkuEnable.isSelected()) {
- int defaultSkuRow = getDefaultSkuInfoRow();
- jTableSkuInfo.changeSelection(defaultSkuRow, 0, false, false);
- }
- jTableSkuInfo.setEnabled(jCheckBoxSkuEnable.isSelected());
- }
- });
- }
- return jCheckBoxSkuEnable;
- }
-
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelDynPcdValue() {
- if (jPanelDynPcdValue == null) {
- jLabelPad1 = new JLabel();
- jLabelPad1.setText(" ");
- GridLayout gridLayout = new GridLayout();
- gridLayout.setColumns(5);
- gridLayout.setRows(4);
- gridLayout.setHgap(20);
- gridLayout.setVgap(20);
-
- jLabelVpdOffset = new JLabel();
- jLabelVpdOffset.setPreferredSize(new java.awt.Dimension(80,20));
- jLabelVpdOffset.setText("VPD Offset");
- jLabelHiiDefaultValue = new JLabel();
- jLabelHiiDefaultValue.setPreferredSize(new java.awt.Dimension(100,20));
- jLabelHiiDefaultValue.setText("HII Default Value");
- jLabelVarOffset = new JLabel();
- jLabelVarOffset.setText("Variable Offset");
- jLabelVarOffset.setPreferredSize(new java.awt.Dimension(90,20));
- jLabelPad = new JLabel();
- jLabelPad.setText(" ");
- jLabelVarGuid = new JLabel();
- jLabelVarGuid.setText("Variable GUID");
- jLabelVarGuid.setPreferredSize(new java.awt.Dimension(100,20));
- jLabelVarName = new JLabel();
- jLabelVarName.setText("Variable Name");
- jLabelVarName.setToolTipText("");
- jLabelVarName.setPreferredSize(new java.awt.Dimension(90,20));
- jPanelDynPcdValue = new JPanel();
- jPanelDynPcdValue.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
- jPanelDynPcdValue.setPreferredSize(new java.awt.Dimension(1000,150));
- jPanelDynPcdValue.setLayout(gridLayout);
- jPanelDynPcdValue.add(getJRadioButtonHii(), null);
- jPanelDynPcdValue.add(jLabelVarName, null);
- jPanelDynPcdValue.add(getJTextFieldVarName(), null);
- jPanelDynPcdValue.add(jLabelVarGuid, null);
- jPanelDynPcdValue.add(getJTextFieldVarGuid(), null);
- jPanelDynPcdValue.add(jLabelPad, null);
- jPanelDynPcdValue.add(jLabelVarOffset, null);
- jPanelDynPcdValue.add(getJTextFieldVarOffset(), null);
- jPanelDynPcdValue.add(jLabelHiiDefaultValue, null);
- jPanelDynPcdValue.add(getJTextFieldHiiDefaultValue(), null);
- jPanelDynPcdValue.add(getJRadioButtonVpd(), null);
- jPanelDynPcdValue.add(jLabelVpdOffset, null);
- jLabelPadd = new JLabel();
- jLabelPadd.setText(" ");
- jPanelDynPcdValue.add(getJTextFieldVpdOffset(), null);
- jLabelVarName.setEnabled(false);
- jLabelVarGuid.setEnabled(false);
- jLabelHiiDefaultValue.setEnabled(false);
- jLabelVarOffset.setEnabled(false);
- jLabelVpdOffset.setEnabled(false);
- jPanelDynPcdValue.add(jLabelPadd, null);
- jPanelDynPcdValue.add(jLabelPad1, null);
- jPanelDynPcdValue.add(getJRadioButtonDefaultValue(), null);
- jPanelDynPcdValue.add(getJTextFieldDefaultValue(), null);
- jPanelDynPcdValue.add(getJCheckBoxSkuEnable(), null);
- jPanelDynPcdValue.add(getJButtonSkuInfoUpdate(), null);
- bg.add(jRadioButtonHii);
- bg.add(jRadioButtonVpd);
- }
-
- return jPanelDynPcdValue;
- }
-
- /**
- * This method initializes jRadioButton
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonHii() {
- if (jRadioButtonHii == null) {
- jRadioButtonHii = new JRadioButton();
- jRadioButtonHii.setText("HII Enable");
- jRadioButtonHii.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- boolean selected = jRadioButtonHii.isSelected();
- jLabelVarName.setEnabled(selected);
- jLabelVarGuid.setEnabled(selected);
- jLabelPad.setEnabled(selected);
- jLabelVarOffset.setEnabled(selected);
- jLabelHiiDefaultValue.setEnabled(selected);
- jTextFieldVarName.setEnabled(selected);
- jTextFieldVarGuid.setEnabled(selected);
- jTextFieldVarOffset.setEnabled(selected);
- jTextFieldHiiDefaultValue.setEnabled(selected);
- }
- });
- }
- return jRadioButtonHii;
- }
-
- /**
- * This method initializes jRadioButton1
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonVpd() {
- if (jRadioButtonVpd == null) {
- jRadioButtonVpd = new JRadioButton();
- jRadioButtonVpd.setText("VPD Enable");
- jRadioButtonVpd.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- boolean selected = jRadioButtonVpd.isSelected();
- jTextFieldVpdOffset.setEnabled(selected);
- jLabelVpdOffset.setEnabled(selected);
- }
- });
- }
- return jRadioButtonVpd;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneSkuInfo() {
- if (jScrollPaneSkuInfo == null) {
- jScrollPaneSkuInfo = new JScrollPane();
- jScrollPaneSkuInfo.setPreferredSize(new java.awt.Dimension(300,50));
- jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());
- }
- return jScrollPaneSkuInfo;
- }
-
- /**
- * This method initializes jTable1
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableSkuInfo() {
- if (jTableSkuInfo == null) {
- modelSku = new DynPcdTableModel();
- jTableSkuInfo = new JTable(modelSku);
- modelSku.addColumn("SKU ID");
- modelSku.addColumn("SKU Name");
- jTableSkuInfo.setEnabled(false);
- jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableSkuInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (jTableDynPcd.getSelectedRow() < 0) {
- return;
- }
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- jTextFieldDefaultValue.setText("");
- jTextFieldVpdOffset.setText("");
- jTextFieldVarName.setText("");
- jTextFieldVarGuid.setText("");
- jTextFieldVarOffset.setText("");
- jTextFieldHiiDefaultValue.setText("");
- int selected = lsm.getMinSelectionIndex();
- String skuId = modelSku.getValueAt(selected, 0)+"";
- displaySkuInfoDetails(skuId);
- }
- }
- });
- }
- return jTableSkuInfo;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonSkuInfoUpdate() {
- if (jButtonSkuInfoUpdate == null) {
- jButtonSkuInfoUpdate = new JButton();
- jButtonSkuInfoUpdate.setPreferredSize(new java.awt.Dimension(180,20));
- jButtonSkuInfoUpdate.setText("Update SKU Value");
- FontMetrics fm = jButtonSkuInfoUpdate.getFontMetrics(jButtonSkuInfoUpdate.getFont());
- jButtonSkuInfoUpdate.setPreferredSize(new Dimension (fm.stringWidth(jButtonSkuInfoUpdate.getText()) + 40, 20));
- jButtonSkuInfoUpdate.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int pcdSelected = jTableDynPcd.getSelectedRow();
- if (pcdSelected < 0) {
- return;
- }
- docConsole.setSaved(false);
- updateSkuInfo(pcdSelected);
-
- }
- });
- }
- return jButtonSkuInfoUpdate;
- }
-
- private void updateSkuInfo (int pcdSelected) {
- int skuCount = ffc.getDynamicPcdSkuInfoCount(pcdSelected);
- String cName = modelPcd.getValueAt(pcdSelected, 0)+"";
- String tsGuid = modelPcd.getValueAt(pcdSelected, 2)+"";
-
- String varName = null;
- String varGuid = null;
- String varOffset = null;
- String hiiDefault = null;
- String value = null;
- String vpdOffset = null;
- if (jRadioButtonHii.isSelected()) {
- varName = Tools.convertStringToUnicodeHexString(jTextFieldVarName.getText());
- if (varName.length() == 0) {
- JOptionPane.showMessageDialog(this, "Variable Name is Empty.");
- return;
- }
- varGuid = jTextFieldVarGuid.getText();
- if (varGuid.length() == 0) {
- JOptionPane.showMessageDialog(this, "Variable GUID is Empty.");
- return;
- }
- varOffset = jTextFieldVarOffset.getText();
- if (!DataValidation.isHex64BitDataType(varOffset)) {
- JOptionPane.showMessageDialog(this, "Variable Offset is NOT Hex64BitDataType.");
- return;
- }
- hiiDefault = jTextFieldHiiDefaultValue.getText();
- if (!DataValidation.isDefaultValueType(hiiDefault)) {
- JOptionPane.showMessageDialog(this, "Default Value is NOT DefaultValueType.");
- return;
- }
- }
- if (jRadioButtonVpd.isSelected()) {
- vpdOffset = jTextFieldVpdOffset.getText();
- if (!DataValidation.isHex64BitDataType(vpdOffset)) {
- JOptionPane.showMessageDialog(this, "VPD Offset is NOT Hex64BitDataType.");
- return;
- }
- }
- if (jRadioButtonDefaultValue.isSelected()) {
- value = jTextFieldDefaultValue.getText();
- if (!DataValidation.isDefaultValueType(value)) {
- JOptionPane.showMessageDialog(this, "Value is NOT DefaultValueType.");
- return;
- }
- }
- //
- // SKU disabled. only modify data for default SKU.
- //
- if (!jCheckBoxSkuEnable.isSelected()) {
- if (true) {
- ffc.removeDynamicPcdBuildDataSkuInfo(pcdSelected);
- if (jRadioButtonHii.isSelected()) {
- ffc.genDynamicPcdBuildDataSkuInfo("0", varName, varGuid, varOffset, hiiDefault, null, null, pcdSelected);
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- if (al == null) {
- return;
- }
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- ffc.updatePcdData(mKey, cName, tsGuid, null, null, hiiDefault);
- }
- }
- else if (jRadioButtonVpd.isSelected()){
- ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, vpdOffset, null, pcdSelected);
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- if (al == null) {
- return;
- }
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- ffc.updatePcdData(mKey, cName, tsGuid, null, null, vpdOffset);
- }
- }
- else{
- ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, null, value, pcdSelected);
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- if (al == null) {
- return;
- }
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- ffc.updatePcdData(mKey, cName, tsGuid, null, null, value);
- }
- }
- }
- }
- //
- // SKU Enabled, need add data to all SKUs.
- //
- if (jCheckBoxSkuEnable.isSelected()) {
- if (skuCount == 1) {
-
- for (int i = 1; i < jTableSkuInfo.getRowCount(); ++i) {
- ffc.genDynamicPcdBuildDataSkuInfo(modelSku.getValueAt(i, 0)+"", varName, varGuid, varOffset, hiiDefault, vpdOffset, value, pcdSelected);
- }
- }
- else {
- int row = jTableSkuInfo.getSelectedRow();
- if (row < 0) {
- return;
- }
- ffc.updateDynamicPcdBuildDataSkuInfo(modelSku.getValueAt(row, 0)+"", varName, varGuid, varOffset, hiiDefault, vpdOffset, value, pcdSelected);
- }
- }
- }
-
- private String moduleInfo (String pcdInfo) {
-
- return pcdInfo.substring(0, pcdInfo.lastIndexOf(" "));
- }
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVarName() {
- if (jTextFieldVarName == null) {
- jTextFieldVarName = new JTextField();
- jTextFieldVarName.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVarName.setEnabled(false);
- }
- return jTextFieldVarName;
- }
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVarGuid() {
- if (jTextFieldVarGuid == null) {
- jTextFieldVarGuid = new JTextField();
- jTextFieldVarGuid.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVarGuid.setEnabled(false);
- }
- return jTextFieldVarGuid;
- }
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVarOffset() {
- if (jTextFieldVarOffset == null) {
- jTextFieldVarOffset = new JTextField();
- jTextFieldVarOffset.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVarOffset.setEnabled(false);
- }
- return jTextFieldVarOffset;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldHiiDefaultValue() {
- if (jTextFieldHiiDefaultValue == null) {
- jTextFieldHiiDefaultValue = new JTextField();
- jTextFieldHiiDefaultValue.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldHiiDefaultValue.setEnabled(false);
- }
- return jTextFieldHiiDefaultValue;
- }
-
- /**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVpdOffset() {
- if (jTextFieldVpdOffset == null) {
- jTextFieldVpdOffset = new JTextField();
- jTextFieldVpdOffset.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVpdOffset.setEnabled(false);
- }
- return jTextFieldVpdOffset;
- }
-
- /**
- * This method initializes jTextField5
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDefaultValue() {
- if (jTextFieldDefaultValue == null) {
- jTextFieldDefaultValue = new JTextField();
- jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(150,20));
- }
- return jTextFieldDefaultValue;
- }
-
- /**
- * This method initializes jRadioButton2
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonDefaultValue() {
- if (jRadioButtonDefaultValue == null) {
- jRadioButtonDefaultValue = new JRadioButton();
- jRadioButtonDefaultValue.setText("Default PCD Value");
- jRadioButtonDefaultValue.setSelected(true);
- jRadioButtonDefaultValue.setPreferredSize(new java.awt.Dimension(175,20));
- jRadioButtonDefaultValue.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- jTextFieldDefaultValue.setEnabled(jRadioButtonDefaultValue.isSelected());
- }
- });
- bg.add(jRadioButtonDefaultValue);
- }
- return jRadioButtonDefaultValue;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(1003,180));
- jScrollPane.setViewportView(getJPanelDynPcdValue());
- }
- return jScrollPane;
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class DynPcdTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
-
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
deleted file mode 100644
index c5f854a7e8..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
+++ /dev/null
@@ -1,3818 +0,0 @@
-/** @file
- Java class FpdFileContents is used to parse fpd xml file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.io.File;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.tianocore.AntTaskDocument;
-import org.tianocore.BuildOptionsDocument;
-import org.tianocore.DynamicPcdBuildDefinitionsDocument;
-import org.tianocore.EfiSectionType;
-import org.tianocore.FlashDefinitionFileDocument;
-import org.tianocore.FlashDocument;
-import org.tianocore.FrameworkModulesDocument;
-import org.tianocore.IntermediateOutputType;
-import org.tianocore.LibrariesDocument;
-import org.tianocore.ModuleSADocument;
-import org.tianocore.ModuleSaBuildOptionsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.OptionDocument;
-import org.tianocore.OptionsDocument;
-import org.tianocore.PcdBuildDefinitionDocument;
-import org.tianocore.PcdCodedDocument;
-import org.tianocore.PcdDataTypes;
-import org.tianocore.PcdDeclarationsDocument;
-import org.tianocore.PcdItemTypes;
-import org.tianocore.PlatformDefinitionsDocument;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.FvImageTypes;
-import org.tianocore.FvImagesDocument;
-import org.tianocore.LicenseDocument;
-import org.tianocore.PlatformHeaderDocument;
-import org.tianocore.SkuInfoDocument;
-import org.tianocore.UserDefinedAntTasksDocument;
-import org.tianocore.UserExtensionsDocument;
-import org.tianocore.LibrariesDocument.Libraries.Instance;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-/**
- This class processes fpd file contents such as add remove xml elements.
- @since PackageEditor 1.0
-**/
-public class FpdFileContents {
-
- static final String xmlNs = "http://www.TianoCore.org/2006/Edk2.0";
- static final String regExpNewLineAndSpaces = "((\n)|(\r\n)|(\r)|(\u0085)|(\u2028)|(\u2029))(\\s)*";
-
- private PlatformSurfaceAreaDocument fpdd = null;
-
- private PlatformSurfaceAreaDocument.PlatformSurfaceArea fpdRoot = null;
-
- private PlatformHeaderDocument.PlatformHeader fpdHdr = null;
-
- private PlatformDefinitionsDocument.PlatformDefinitions fpdPlatformDefs = null;
-
- private FlashDocument.Flash fpdFlash = null;
-
- private BuildOptionsDocument.BuildOptions fpdBuildOpts = null;
-
- private FrameworkModulesDocument.FrameworkModules fpdFrameworkModules = null;
-
- private DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions fpdDynPcdBuildDefs = null;
-
- private HashMap<String, ArrayList<String>> dynPcdMap = null;
-
- private HashMap<String, String> defaultPcdValue = new HashMap<String, String>();
-
- private String itemType (String pcdInfo) {
-
- return pcdInfo.substring(pcdInfo.lastIndexOf(" ") + 1);
- }
-
- /**
- * look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.
- */
- public void initDynPcdMap() {
- if (dynPcdMap == null) {
- dynPcdMap = new HashMap<String, ArrayList<String>>();
- List<ModuleSADocument.ModuleSA> l = getfpdFrameworkModules().getModuleSAList();
- if (l == null) {
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
- ListIterator<ModuleSADocument.ModuleSA> li = l.listIterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- if (moduleSa.getPcdBuildDefinition() == null || moduleSa.getPcdBuildDefinition().getPcdDataList() == null) {
- continue;
- }
- String ModuleInfo = moduleSa.getModuleGuid().toLowerCase() + " " + moduleSa.getModuleVersion() +
- " " + moduleSa.getPackageGuid().toLowerCase() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
- List<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lp = moduleSa.getPcdBuildDefinition().getPcdDataList();
- ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lpi = lp.listIterator();
- while (lpi.hasNext()) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = lpi.next();
- String pcdKey = pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName();
- if (dynPcdMap.get(pcdKey) == null) {
- ArrayList<String> al = new ArrayList<String>();
- al.add(ModuleInfo + " " + pcdData.getItemType().toString());
- dynPcdMap.put(pcdKey, al);
- }
- else{
- dynPcdMap.get(pcdKey).add(ModuleInfo + " " + pcdData.getItemType().toString());
- }
- }
- }
- }
- }
-
- public ArrayList<String> getDynPcdMapValue(String key) {
- return dynPcdMap.get(key);
- }
- /**
- Constructor to create a new spd file
- **/
- public FpdFileContents() {
-
- fpdd = PlatformSurfaceAreaDocument.Factory.newInstance();
- fpdRoot = fpdd.addNewPlatformSurfaceArea();
-
- }
-
- /**
- Constructor for existing document object
- @param psa
- **/
- public FpdFileContents(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- fpdRoot = fpd;
- fpdHdr = fpdRoot.getPlatformHeader();
- fpdPlatformDefs = fpdRoot.getPlatformDefinitions();
- fpdBuildOpts = fpdRoot.getBuildOptions();
- fpdFrameworkModules = fpdRoot.getFrameworkModules();
- fpdDynPcdBuildDefs = fpdRoot.getDynamicPcdBuildDefinitions();
- fpdFlash = fpdRoot.getFlash();
- }
-
- /**
- Constructor based on an existing spd file
-
- @param f Existing spd file
- **/
- public FpdFileContents(File f) {
- try {
- fpdd = PlatformSurfaceAreaDocument.Factory.parse(f);
- fpdRoot = fpdd.getPlatformSurfaceArea();
- } catch (Exception e) {
- System.out.println(e.toString());
- }
- }
-
- public DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions getfpdDynPcdBuildDefs() {
- if (fpdDynPcdBuildDefs == null){
- fpdDynPcdBuildDefs = fpdRoot.addNewDynamicPcdBuildDefinitions();
- }
- return fpdDynPcdBuildDefs;
- }
-
- public FrameworkModulesDocument.FrameworkModules getfpdFrameworkModules() {
- if (fpdFrameworkModules == null){
- fpdFrameworkModules = fpdRoot.addNewFrameworkModules();
- }
- return fpdFrameworkModules;
- }
-
- public void getFrameworkModuleSAByFvBinding (String fvName, Vector<String[]> vGuid) {
- if (getFrameworkModulesCount() == 0){
- return;
- }
-
- ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
- while(li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();
- if (moduleSa.getModuleSaBuildOptions() == null) {
- continue;
- }
- String fvBinding = moduleSa.getModuleSaBuildOptions().getFvBinding();
- if (fvBinding == null) {
- continue;
- }
-
- String[] fvNames = fvBinding.split(" ");
- for (int i = 0; i < fvNames.length; ++i) {
- //
- // BugBug : underscore "_" should not be replaced!!!
- // But Fv name FVMAIN from fdf file not consist with FV_MAIN in fpd file.
- //
- if (fvNames[i].equals(fvName) || fvNames[i].replaceAll("_", "").equals(fvName)) {
- String[] sa = new String[] {moduleSa.getModuleGuid(), moduleSa.getModuleVersion(),
- moduleSa.getPackageGuid(), moduleSa.getPackageVersion(),
- listToString(moduleSa.getSupArchList())};
- vGuid.add(sa);
- break;
- }
- }
- }
- }
-
- public int getFrameworkModulesCount() {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return 0;
- }
- return getfpdFrameworkModules().getModuleSAList().size();
- }
-
- public void getFrameworkModulesInfo(String[][] saa) {
- if (getFrameworkModulesCount() == 0){
- return;
- }
-
- ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
- int i = 0;
- while(li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();
- saa[i][0] = moduleSa.getModuleGuid();
- saa[i][1] = moduleSa.getModuleVersion();
-
- saa[i][2] = moduleSa.getPackageGuid();
- saa[i][3] = moduleSa.getPackageVersion();
- saa[i][4] = listToString(moduleSa.getSupArchList());
- ++i;
- }
- }
-
- public void getFrameworkModuleInfo(int i, String[] sa) {
- ModuleSADocument.ModuleSA msa = getModuleSA(i);
- if (msa == null) {
- return;
- }
- sa[0] = msa.getModuleGuid();
- sa[1] = msa.getModuleVersion();
- sa[2] = msa.getPackageGuid();
- sa[3] = msa.getPackageVersion();
- sa[4] = listToString(msa.getSupArchList());
- }
-
- public ModuleSADocument.ModuleSA getModuleSA(String key) {
-
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) {
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return null;
- }
- String[] s = key.split(" ");
- String archsInKey = "";
- if (s.length > 4) {
- for (int i = 4; i < s.length; ++i) {
- archsInKey += s[i];
- archsInKey += " ";
- }
- archsInKey = archsInKey.trim();
- }
-
- ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
- while(li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();
- if (moduleSa.getModuleGuid().equalsIgnoreCase(s[0]) && moduleSa.getPackageGuid().equalsIgnoreCase(s[2])) {
- if (moduleSa.getModuleVersion() != null) {
- if (!moduleSa.getModuleVersion().equals(s[1])) {
- continue;
- }
- }
- if (moduleSa.getPackageVersion() != null) {
- if (!moduleSa.getPackageVersion().equals(s[3])) {
- continue;
- }
- }
- //ToDo add arch check .
- if (moduleSa.getSupArchList() != null) {
- if (listToString(moduleSa.getSupArchList()).equals(archsInKey)) {
- return moduleSa;
- }
- }
- else {
- if (archsInKey.length() == 0) {
- return moduleSa;
- }
- }
- }
- }
- return null;
- }
-
- private ModuleSADocument.ModuleSA getModuleSA(int i) {
- ModuleSADocument.ModuleSA moduleSa = null;
- if (fpdRoot.getFrameworkModules() == null) {
- return null;
- }
- XmlCursor cursor = fpdRoot.getFrameworkModules().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();
- }
- cursor.dispose();
- return moduleSa;
- }
-
- public void removeModuleSA(int i) {
- XmlObject o = fpdRoot.getFrameworkModules();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- //
- // remove pcd from dynPcdMap, if DynamicPcdBuildData exists, remove them too.
- //
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();
- String moduleInfo = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() + " " +
- moduleSa.getPackageGuid()+ " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
- PcdBuildDefinitionDocument.PcdBuildDefinition pcdBuildDef = moduleSa.getPcdBuildDefinition();
- if (pcdBuildDef != null && pcdBuildDef.getPcdDataList() != null) {
- ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> li = pcdBuildDef.getPcdDataList().listIterator();
- while(li.hasNext()) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();
- maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleInfo);
- }
- }
-
- cursor.push();
- while (cursor.hasPrevToken()) {
- cursor.toPrevToken();
- if (!cursor.isText()) {
- break;
- }
- if (cursor.getObject() == null) {
- break;
- }
- String s = cursor.getTextValue();
- if (s.matches(regExpNewLineAndSpaces)) {
- continue;
- }
- }
-
- if (cursor.isComment()) {
- cursor.removeXml();
- }
-
- cursor.pop();
- cursor.removeXml();
- if (getFrameworkModulesCount() == 0) {
- cursor.dispose();
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
- }
- cursor.dispose();
- }
-
- public boolean adjustPcd (String seqModuleSa, Vector<String> vExceptions) throws Exception {
- boolean dataModified = false;
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa);
- int pcdCount = getPcdDataCount(seqModuleSa);
- String[][] saaModuleSaPcd = new String[pcdCount][7];
- getPcdData(seqModuleSa, saaModuleSaPcd);
- String mg = moduleSa.getModuleGuid().toLowerCase();
- String mv = moduleSa.getModuleVersion();
- String pg = moduleSa.getPackageGuid().toLowerCase();
- String pv = moduleSa.getPackageVersion();
- String arch = listToString(moduleSa.getSupArchList());
- //
- // delete pcd in ModuleSA but not in MSA files any longer.
- //
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- int libCount = getLibraryInstancesCount(moduleKey);
- String[][] saaLib = new String[libCount][5];
- getLibraryInstances(moduleKey, saaLib);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- if (mi == null) {
- vExceptions.add("Module " + mg + " does NOT exist in workspace.");
- throw new Exception ("Module does NOT exist in workspace.");
- }
- Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();
- //
- // create vector for module & library instance MIs.
- //
- vMi.add(mi);
- for (int j = 0; j < saaLib.length; ++j) {
- String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);
- if (libMi != null) {
- vMi.add(libMi);
- }
- }
-
- nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {
-
- for (int j = 0; j < vMi.size(); ++j) {
- ModuleIdentification nextMi = vMi.get(j);
- if (nextMi == null) {
- continue;
- }
- if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], arch, nextMi)) {
- continue nextPcd;
- }
- }
- removePcdData(seqModuleSa, saaModuleSaPcd[i][0], saaModuleSaPcd[i][1]);
- dataModified = true;
- }
- //
- // add new Pcd from MSA file to ModuleSA.
- //
- for (int i = 0; i < vMi.size(); ++i) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
- .getModuleXmlObject(vMi
- .get(i));
- if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {
- continue;
- }
- ListIterator li = msa.getPcdCoded().getPcdEntryList().listIterator();
- msaPcdIter:while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();
- ArrayList<String> al = getDynPcdMapValue(msaPcd.getCName() + " " + msaPcd.getTokenSpaceGuidCName());
- if (al != null) {
- for (int j = 0; j < al.size(); ++j) {
- if (al.get(j).startsWith(moduleKey)) {
- continue msaPcdIter;
- }
- }
- }
- // Check sup arch conformance for the new PCD
- if (msaPcd.getSupArchList() != null) {
- String newPcdArch = msaPcd.getSupArchList().toString();
- if (!newPcdArch.toLowerCase().contains(arch.toLowerCase())) {
- continue;
- }
- }
-
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, vMi.get(i));
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
- if (spdPcd == null) {
- //
- // ToDo Error
- //
- String errorMessage = "No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "
- + mi.getName();
- if (i != 0) {
- errorMessage += " Library Instance " + vMi.get(i).getName();
- }
- vExceptions.add(errorMessage);
- throw new PcdDeclNotFound(errorMessage);
- }
- //
- // AddItem to ModuleSA PcdBuildDefinitions
- //
- String defaultVal = msaPcd.getDefaultValue() == null ? spdPcd.getDefaultValue()
- : msaPcd.getDefaultValue();
-
- genPcdData(msaPcd.getCName(), spdPcd.getToken(), msaPcd.getTokenSpaceGuidCName(),
- msaPcd.getPcdItemType().toString(), spdPcd.getDatumType() + "", defaultVal, moduleSa, spdPcd);
- dataModified = true;
- }
-
- }
-
- return dataModified;
- }
-
- private synchronized void maintainDynPcdMap(String pcdKey, String moduleInfo) {
-
- ArrayList<String> al = dynPcdMap.get(pcdKey);
- if (al == null) {
- return;
- }
- String[] s = moduleInfo.split(" ");
- for(int i = 0; i < al.size(); ++i){
- String consumer = al.get(i);
- if (consumer.contains(s[0].toLowerCase()) && consumer.contains(s[2].toLowerCase())){
- String[] consumerPart = consumer.split(" ");
- if (!consumerPart[4].equals(s[4])) {
- continue;
- }
- al.remove(consumer);
- break;
- }
- }
-
- if (al.size() == 0) {
- defaultPcdValue.remove(pcdKey);
- dynPcdMap.remove(pcdKey);
- String[] s1 = pcdKey.split(" ");
- removeDynamicPcdBuildData(s1[0], s1[1]);
- }
-
- }
- //
- // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"
- //
- public int getPcdDataCount (String key){
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
-
- if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){
- return 0;
- }
- return msa.getPcdBuildDefinition().getPcdDataList().size();
-
- }
-
- public void getPcdData (String key, String[][] saa) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
-
- if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){
- return;
- }
- ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData>li = msa.getPcdBuildDefinition().getPcdDataList().listIterator();
- for (int k = 0; k < saa.length; ++k) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();
- saa[k][0] = pcdData.getCName();
- saa[k][1] = pcdData.getTokenSpaceGuidCName();
- saa[k][2] = pcdData.getItemType()+"";
- saa[k][3] = pcdData.getToken().toString();
- saa[k][4] = pcdData.getMaxDatumSize()+"";
- saa[k][5] = pcdData.getDatumType()+"";
- saa[k][6] = pcdData.getValue();
-
- }
- }
-
- public void removePcdData (String key, String cName, String tsGuid) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(key);
- if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){
- return;
- }
-
- String mg = moduleSa.getModuleGuid();
- String mv = moduleSa.getModuleVersion();
- String pg = moduleSa.getPackageGuid();
- String pv = moduleSa.getPackageVersion();
- String arch = listToString(moduleSa.getSupArchList());
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
-
- XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();
- if (cursor.toFirstChild()){
-
- do {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
- if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {
- maintainDynPcdMap(cName + " " + tsGuid, moduleKey);
- if (getPcdDataCount(key) == 1) {
- cursor.toParent();
- }
- cursor.removeXml();
- break;
- }
- }
- while(cursor.toNextSibling());
-
- }
- cursor.dispose();
- }
-
- public void updatePcdData (String key, String cName, String tsGuid, String itemType, String maxSize, String value){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(key);
- if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){
- return;
- }
-
- XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();
- if (cursor.toFirstChild()){
- do {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
- if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {
- //
- // change item type while not updating dynPcdData????
- //
- if (itemType != null) {
- pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));
- }
-
- if(pcdData.getDatumType().equals("VOID*") && maxSize != null) {
- pcdData.setMaxDatumSize(new Integer(maxSize));
- }
- //
- // if value input is null, keep old value untouched.
- //
- if (value != null) {
- pcdData.setValue(value);
- defaultPcdValue.put(cName + " " + tsGuid, value);
- }
-
- break;
- }
- }
- while(cursor.toNextSibling());
- }
- cursor.dispose();
- }
-
- /**Get original Pcd info from MSA & SPD files.
- * @param mi ModuleIdentification from which MSA & SPD come
- * @param cName PCD cName
- * @param sa Results: HelpText, Original item type.
- * @return
- */
- public boolean getPcdBuildDataInfo(ModuleIdentification mi, String cName, String tsGuid, String[] sa, Vector<String> validPcdTypes) throws Exception{
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
- .getModuleXmlObject(mi);
- if (msa.getPcdCoded() == null) {
- return false;
- }
-
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
- //
- // First look through MSA pcd entries.
- //
- List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();
- if (!msaPcd.getCName().equals(cName)) {
- continue;
- }
- if (!msaPcd.getTokenSpaceGuidCName().equals(tsGuid)) {
- continue;
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
- if (spdPcd == null || spdPcd.getValidUsage() == null) {
- //
- // ToDo Error
- //
- throw new PcdDeclNotFound(mi.getName() + " " + msaPcd.getCName());
- }
- //
- // Get Pcd help text and original item type.
- //
- sa[0] = spdPcd.getHelpText() + msaPcd.getHelpText();
- sa[1] = msaPcd.getPcdItemType() + "";
- sa[2] = msa.getModuleDefinitions().getBinaryModule() + "";
- ListIterator iter = spdPcd.getValidUsage().listIterator();
- while (iter.hasNext()) {
- String usage = iter.next().toString();
- validPcdTypes.add(usage);
- }
- return true;
- }
-
- return false;
- }
-
- private boolean multiSourcePcd (String cName, String tsGuidCName, String moduleKey) {
- int libCount = getLibraryInstancesCount(moduleKey);
- String[][] saaLib = new String[libCount][5];
- getLibraryInstances(moduleKey, saaLib);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();
- //
- // create vector for module & library instance MIs.
- //
- vMi.add(mi);
- for (int j = 0; j < saaLib.length; ++j) {
- String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);
- vMi.add(libMi);
- }
-
- int pcdSourceCount = 0;
- for (int i = 0; i < vMi.size(); ++i) {
- if (WorkspaceProfile.pcdInMsa(cName, tsGuidCName, null, vMi.get(i))) {
- pcdSourceCount++;
- }
- }
-
- if (pcdSourceCount < 2) {
- return false;
- }
- else {
- return true;
- }
-
- }
-
- /**Remove PCDBuildDefinition entries from ModuleSA
- * @param moduleKey identifier of ModuleSA.
- * @param consumer where these entries come from.
- */
- public void removePcdData(String moduleKey, ModuleIdentification consumer) {
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(consumer);
- if (msa.getPcdCoded() == null) {
- return;
- }
-
- List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();
- ListIterator li = l.listIterator();
-
- while(li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();
- ModuleSADocument.ModuleSA moduleSA = getModuleSA(moduleKey);
- if (moduleSA.getPcdBuildDefinition() != null) {
- XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();
- cursor.push();
- if (cursor.toFirstChild()) {
- do {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor
- .getObject();
- String cName = msaPcd.getCName();
- String tsGuidCName = msaPcd.getTokenSpaceGuidCName();
- if (cName.equals(pcdData.getCName())
- && tsGuidCName.equals(pcdData.getTokenSpaceGuidCName()) && !multiSourcePcd(cName, tsGuidCName, moduleKey)) {
-
- maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(),
- moduleKey);
- cursor.removeXml();
- break;
- }
- } while (cursor.toNextSibling());
- }
-
- cursor.pop();
- if (moduleSA.getPcdBuildDefinition().getPcdDataList().size() == 0) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
- }
-
- }
- //
- // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"
- //
- public int getLibraryInstancesCount(String key) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null || msa.getLibraries() == null || msa.getLibraries().getInstanceList() == null){
- return 0;
- }
- return msa.getLibraries().getInstanceList().size();
- }
-
- public void getLibraryInstances(String key, String[][] saa){
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null || msa.getLibraries() == null || msa.getLibraries().getInstanceList() == null){
- return ;
- }
-
- ListIterator<LibrariesDocument.Libraries.Instance> li = msa.getLibraries().getInstanceList().listIterator();
- for (int i = 0; i < saa.length; ++i) {
- LibrariesDocument.Libraries.Instance instance = li.next();
- saa[i][1] = instance.getModuleGuid();
- saa[i][2] = instance.getModuleVersion();
- saa[i][3] = instance.getPackageGuid();
- saa[i][4] = instance.getPackageVersion();
- }
- }
-
- public boolean instanceExistsInModuleSA (String key, String mg, String mv, String pg, String pv) {
- int count = 0;
- if ((count = getLibraryInstancesCount(key)) > 0) {
- String[][] saa = new String[count][5];
- getLibraryInstances (key, saa);
- for (int i = 0; i < count; ++i) {
- if (mg.equalsIgnoreCase(saa[i][1]) && pg.equalsIgnoreCase(saa[i][3])) {
- boolean modVerMatch = false;
- boolean pkgVerMatch = false;
- if ((mv.equals("null") || saa[i][2] == null)) {
- modVerMatch = true;
- }
- if (pv.equals("null") || saa[i][4] == null) {
- pkgVerMatch = true;
- }
- if (modVerMatch && pkgVerMatch) {
- return true;
- }
- else {
- if (mv.equals(saa[i][2]) && pv.equals(saa[i][4])) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- public void removeLibraryInstance(String key, String instanceKey) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null || msa.getLibraries() == null){
- return ;
- }
-
- String[] instanceInfo = instanceKey.split(" ");
- XmlCursor cursor = msa.getLibraries().newCursor();
- if (cursor.toFirstChild()) {
- do {
- Instance libIns = (Instance)cursor.getObject();
- if (libIns.getModuleGuid().equalsIgnoreCase(instanceInfo[0]) && libIns.getPackageGuid().equalsIgnoreCase(instanceInfo[2])) {
- break;
- }
- }while (cursor.toNextSibling());
- cursor.push();
- while (cursor.hasPrevToken()) {
- cursor.toPrevToken();
- if (!cursor.isText()) {
- break;
- }
- String s = cursor.getTextValue();
- if (s.matches(regExpNewLineAndSpaces)) {
- continue;
- }
- }
-
- if (cursor.isComment()) {
- cursor.removeXml();
- }
- cursor.pop();
- cursor.removeXml();
- if (getLibraryInstancesCount(key) == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
-
- cursor.dispose();
- }
-
- public void genLibraryInstance(ModuleIdentification libMi, String key) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null){
- msa = getfpdFrameworkModules().addNewModuleSA();
- }
- LibrariesDocument.Libraries libs = msa.getLibraries();
- if(libs == null){
- libs = msa.addNewLibraries();
- }
-
- String mn = libMi.getName();
- String mg = libMi.getGuid();
- String mv = libMi.getVersion();
- String pn = libMi.getPackageId().getName();
- String pg = libMi.getPackageId().getGuid();
- String pv = libMi.getPackageId().getVersion();
- LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();
- XmlCursor cursor = instance.newCursor();
- try{
- String comment = "Pkg: " + pn + " Mod: " + mn
- + " Path: " + libMi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- cursor.insertComment(comment);
- }
- catch (Exception e){
- e.printStackTrace();
- }
- finally {
- cursor.dispose();
- }
-
- instance.setModuleGuid(mg);
- instance.setModuleVersion(mv);
- instance.setPackageGuid(pg);
- instance.setPackageVersion(pv);
-
- }
-
- public String getFvBinding(String moduleKey){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- return getFvBinding (moduleSa);
- }
-
- public String getFvBinding (ModuleSADocument.ModuleSA moduleSa) {
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null) {
- return null;
- }
- return moduleSa.getModuleSaBuildOptions().getFvBinding();
- }
-
- public void setFvBinding(ModuleSADocument.ModuleSA moduleSa, String fvBinding) {
- if (moduleSa == null ) {
- return;
- }
- if (fvBinding == null || fvBinding.length() == 0) {
- if(moduleSa.getModuleSaBuildOptions() != null){
- moduleSa.getModuleSaBuildOptions().unsetFvBinding();
- }
- }
- else {
- if(moduleSa.getModuleSaBuildOptions() == null){
- moduleSa.addNewModuleSaBuildOptions().setFvBinding(fvBinding);
- return;
- }
- moduleSa.getModuleSaBuildOptions().setFvBinding(fvBinding);
- }
- }
-
- public void setFvBinding(String moduleKey, String fvBinding){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- setFvBinding (moduleSa, fvBinding);
- }
-
- private int fvBindingForModuleSA (ModuleSADocument.ModuleSA moduleSa, String fvName) {
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {
- return -1;
- }
-
- String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();
- String[] fvNamesArray = fvNameList.split(" ");
- int occursAt = -1;
- for (int i = 0; i < fvNamesArray.length; ++i) {
- if (fvNamesArray[i].equals(fvName)) {
- occursAt = i;
- break;
- }
- }
- return occursAt;
- }
-
- public void removeFvBinding (ModuleSADocument.ModuleSA moduleSa, String fvName) {
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {
- return;
- }
-
- String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();
- String[] fvNamesArray = fvNameList.split(" ");
- int occursAt = -1;
- for (int i = 0; i < fvNamesArray.length; ++i) {
- if (fvNamesArray[i].equals(fvName)) {
- occursAt = i;
- break;
- }
- }
- // jump over where the input fvName occurs in the original Fv list.
- if (occursAt != -1) {
- String newFvNameList = " ";
- for (int i = 0; i < fvNamesArray.length; ++i) {
- if (i == occursAt) {
- continue;
- }
- newFvNameList += fvNamesArray[i];
- }
- setFvBinding (moduleSa, newFvNameList.trim());
- }
-
- }
-
- /**
- * @param fvName The FV name that to be removed from FvBinding List.
- */
- public void removeFvBindingAll (String fvName) {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
-
- Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- removeFvBinding (moduleSa, fvName);
- }
- }
-
- public void appendFvBindingAll (String fvName) {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
-
- Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- appendFvBinding (moduleSa, fvName);
- }
- }
-
- public void appendFvBindingFor (String oldFvName, String newFvName) {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
-
- Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- String fvBinding = getFvBinding (moduleSa);
- if (fvBinding != null && fvBindingForModuleSA (moduleSa, oldFvName) >= 0) {
- appendFvBinding (moduleSa, newFvName);
- }
- }
- }
-
- public void appendFvBinding (String moduleKey, String fvName) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- appendFvBinding (moduleSa, fvName);
- }
-
- public void appendFvBinding (ModuleSADocument.ModuleSA moduleSa, String fvName) {
- if (moduleSa == null) {
- return;
- }
-
- if (moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {
- setFvBinding(moduleSa, fvName);
- return;
- }
-
- String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();
- String newFvNameList = fvNameList + " " + fvName;
- setFvBinding (moduleSa, newFvNameList.trim());
- }
-
- public void updateFvBindingInModuleSA (String moduleKey, String fvName) {
-
- appendFvBinding (moduleKey, fvName);
- }
-
- public String getFfsFileNameGuid(String moduleKey){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null) {
- return null;
- }
- return moduleSa.getModuleSaBuildOptions().getFfsFileNameGuid();
- }
-
- public void setFfsFileNameGuid(String moduleKey, String fileGuid){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null ) {
- return;
- }
- if(msa.getModuleSaBuildOptions() == null){
- msa.addNewModuleSaBuildOptions();
-
- }
- ModuleSaBuildOptionsDocument.ModuleSaBuildOptions msaBuildOpts= msa.getModuleSaBuildOptions();
- if (fileGuid != null) {
- msaBuildOpts.setFfsFileNameGuid(fileGuid);
- }
- else{
- XmlCursor cursor = msaBuildOpts.newCursor();
- if (cursor.toChild(xmlNs, "FfsFileNameGuid")) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- }
-
- public String getFfsFormatKey(String moduleKey){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null || msa.getModuleSaBuildOptions() == null) {
- return null;
- }
- return msa.getModuleSaBuildOptions().getFfsFormatKey();
- }
-
- public void setFfsFormatKey(String moduleKey, String ffsKey){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null ) {
- return;
- }
- if(msa.getModuleSaBuildOptions() == null){
- msa.addNewModuleSaBuildOptions().setFfsFormatKey(ffsKey);
- return;
- }
- msa.getModuleSaBuildOptions().setFfsFormatKey(ffsKey);
- }
-
- public void setModuleSAForceDebug(int i, boolean dbgEnable) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(i);
- moduleSa.setForceDebug(dbgEnable);
- }
-
- public boolean getModuleSAForceDebug (int i) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(i);
- if (moduleSa.getForceDebug() == true) {
- return true;
- }
- return false;
- }
-
- public void getModuleSAOptions(String moduleKey, String[][] saa) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
- || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
- return ;
- }
-
- List<OptionDocument.Option> lOpt = msa.getModuleSaBuildOptions().getOptions().getOptionList();
- ListIterator li = lOpt.listIterator();
- int i = 0;
- while(li.hasNext()) {
- OptionDocument.Option opt = (OptionDocument.Option)li.next();
- if (opt.getBuildTargets() != null) {
- saa[i][0] = listToString(opt.getBuildTargets());
- }
- saa[i][1] = opt.getToolChainFamily();
- saa[i][2] = opt.getTagName();
- saa[i][3] = opt.getToolCode();
-
- if (opt.getSupArchList() != null){
- saa[i][4] = listToString(opt.getSupArchList());
- }
- else {
- saa[i][4] = "";
- }
-
- saa[i][5] = opt.getStringValue();
-
- ++i;
- }
- }
-
- public int getModuleSAOptionsCount(String moduleKey){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
- || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
- return 0;
- }
- return msa.getModuleSaBuildOptions().getOptions().getOptionList().size();
- }
-
- public void genModuleSAOptionsOpt(String moduleKey, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa.getModuleSaBuildOptions() == null) {
- msa.addNewModuleSaBuildOptions();
- }
- if (msa.getModuleSaBuildOptions().getOptions() == null){
- msa.getModuleSaBuildOptions().addNewOptions();
- }
- OptionDocument.Option opt = msa.getModuleSaBuildOptions().getOptions().addNewOption();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
-
- public void removeModuleSAOptionsOpt(String moduleKey, int i) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) {
- return ;
- }
- OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions();
- XmlCursor cursor = opts.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j){
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getModuleSAOptionsCount(moduleKey) == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateModuleSAOptionsOpt(String moduleKey, int i, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) {
- return ;
- }
- OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions();
- XmlCursor cursor = opts.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j){
- cursor.toNextSibling();
- }
- OptionDocument.Option opt = (OptionDocument.Option)cursor.getObject();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
- cursor.dispose();
- }
-
- /**add pcd information of module mi to a ModuleSA.
- * @param mi
- * @param moduleSa if null, generate a new ModuleSA.
- */
- public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, String arch, ModuleSADocument.ModuleSA moduleSa) throws Exception {
- //ToDo add Arch filter
-
- if (moduleSa == null) {
- moduleSa = genModuleSA(mi, arch);
- }
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
- .getModuleXmlObject(mi);
- if (msa.getPcdCoded() == null) {
- return;
- }
-
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
- //
- // Implementing InitializePlatformPcdBuildDefinitions
- //
- List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();
- if (msaPcd.getSupArchList() != null) {
- if (!msaPcd.getSupArchList().toString().toLowerCase().contains(arch.toLowerCase())) {
- continue;
- }
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
- if (spdPcd == null) {
- //
- // ToDo Error
- //
- throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + "\n used by Module "
- + mi.getName() + " or its Library Instances.");
- }
- //
- // AddItem to ModuleSA PcdBuildDefinitions
- //
- String defaultVal = msaPcd.getDefaultValue() == null ? spdPcd.getDefaultValue() : msaPcd.getDefaultValue();
-
- genPcdData(msaPcd.getCName(), spdPcd.getToken(), msaPcd.getTokenSpaceGuidCName(), msaPcd.getPcdItemType()
- .toString(),
- spdPcd.getDatumType() + "", defaultVal, moduleSa, spdPcd);
- }
-
- }
-
- private PcdDeclarationsDocument.PcdDeclarations.PcdEntry LookupPcdDeclaration (PcdCodedDocument.PcdCoded.PcdEntry msaPcd, PackageIdentification[] depPkgs) {
-
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null;
- for (int i = 0; i < depPkgs.length; ++i) {
-
- XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations(depPkgs[i]);
- if (xo == null) {
- continue;
- }
- for (int j = 0; j < xo.length; ++j) {
- spdPcd = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)xo[j];
- if (msaPcd.getTokenSpaceGuidCName() == null) {
- if (spdPcd.getCName().equals(msaPcd.getCName())) {
- return spdPcd;
- }
- }
- else{
- if (spdPcd.getCName().equals(msaPcd.getCName()) && spdPcd.getTokenSpaceGuidCName().equals(msaPcd.getTokenSpaceGuidCName())) {
- return spdPcd;
- }
- }
-
- }
-
- }
- return null;
- }
-
- private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {
- PackageIdentification pi = WorkspaceProfile.getPackageForModule(mi);
- ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();
- XmlCursor cursor = msa.newCursor();
- try{
- String comment = "Mod: " + mi.getName() + " Type: " + SurfaceAreaQuery.getModuleType(mi) + " Path: "
- + mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- cursor.insertComment(comment);
- }
- catch(Exception e){
- e.printStackTrace();
- }
- finally {
- cursor.dispose();
- }
- msa.setModuleGuid(mi.getGuid());
- msa.setModuleVersion(mi.getVersion());
- msa.setPackageGuid(pi.getGuid());
- msa.setPackageVersion(pi.getVersion());
- if (arch != null) {
- Vector<String> v = new Vector<String>();
- v.add(arch);
- msa.setSupArchList(v);
- }
-
- return msa;
- }
-
- private String chooseDefaultPcdType (List validPcdTypes) {
- String choosedType = "";
- if (validPcdTypes.contains("FIXED_AT_BUILD")) {
- choosedType = "FIXED_AT_BUILD";
- }
- else if (validPcdTypes.contains("DYNAMIC")) {
- choosedType = "DYNAMIC";
- }
- else if (validPcdTypes.contains("PATCHABLE_IN_MODULE")) {
- choosedType = "PATCHABLE_IN_MODULE";
- }
- else if (validPcdTypes.contains("DYNAMIC_EX")) {
- choosedType = "DYNAMIC_EX";
- }
- return choosedType;
- }
-
- private synchronized void genPcdData (String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal,
- ModuleSADocument.ModuleSA moduleSa, PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd)
- throws PcdItemTypeConflictException, PcdValueMalFormed{
- if (moduleSa.getPcdBuildDefinition() == null){
- moduleSa.addNewPcdBuildDefinition();
- }
- //
- // constructe pcd to modulesa mapping first.
- // Attention : for any error condition, remove from map this pcd.
- //
- ArrayList<String> pcdConsumer = LookupPlatformPcdData(cName + " " + tsGuid);
- if (pcdConsumer == null) {
- pcdConsumer = new ArrayList<String>();
- }
- //
- // Check whether this PCD has already added to ModuleSA, if so, just return.
- //
- String moduleInfo = moduleSa.getModuleGuid().toLowerCase() + " " + moduleSa.getModuleVersion()
- + " " + moduleSa.getPackageGuid().toLowerCase() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
- for (int i = 0; i < pcdConsumer.size(); ++i) {
- String pcdInfo = pcdConsumer.get(i);
- if (moduleInfo.equals(pcdInfo.substring(0, pcdInfo.lastIndexOf(" ")))){
- return;
- }
- }
- // if pcd type from MSA file is Dynamic
- // we must choose one default type from SPD file for it.
- //
- List validPcdTypes = spdPcd.getValidUsage();
- //
- // Using existing Pcd type, if this pcd already exists in other ModuleSA
- //
- if (pcdConsumer.size() > 0) {
- //
- // platform should only contain one type for each pcd.
- //
- String existingItemType = itemType (pcdConsumer.get(0));
- for (int i = 1; i < pcdConsumer.size(); ++i) {
- if (!existingItemType.equals(itemType(pcdConsumer.get(i)))) {
- throw new PcdItemTypeConflictException (cName, pcdConsumer.get(0), pcdConsumer.get(i));
- }
- }
-
- if (itemType.equals("DYNAMIC")) {
- if (!validPcdTypes.contains(existingItemType)) {
- throw new PcdItemTypeConflictException(cName, pcdConsumer.get(0));
- }
- itemType = existingItemType;
- }
- else {
- if (!itemType.equals(existingItemType)) {
- throw new PcdItemTypeConflictException(cName, pcdConsumer.get(0));
- }
- }
- }
- //
- // if this is the first occurence of this pcd.
- //
- else {
- if (itemType.equals("DYNAMIC")) {
- itemType = chooseDefaultPcdType (validPcdTypes);
- }
- }
- String listValue = moduleInfo + " " + itemType;
- pcdConsumer.add(listValue);
- dynPcdMap.put(cName + " " + tsGuid, pcdConsumer);
-
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData fpdPcd = moduleSa.getPcdBuildDefinition().addNewPcdData();
- fpdPcd.setCName(cName);
- fpdPcd.setToken(token);
- fpdPcd.setTokenSpaceGuidCName(tsGuid);
- fpdPcd.setDatumType(PcdDataTypes.Enum.forString(dataType));
- fpdPcd.setItemType(PcdItemTypes.Enum.forString(itemType));
-
- if (defaultVal != null && defaultVal.length() > 0){
- fpdPcd.setValue(defaultVal);
- }
- else {
- if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {
- fpdPcd.setValue("0");
- }
- if (dataType.equals("BOOLEAN")){
- fpdPcd.setValue("FALSE");
- }
- if (dataType.equals("VOID*")) {
- fpdPcd.setValue("L\"\"");
- }
- }
- //
- // Using existing pcd value, if this pcd already exists in other moduleSa.
- //
- if (defaultPcdValue.get(cName + " " + tsGuid) == null) {
- defaultPcdValue.put(cName + " " + tsGuid, fpdPcd.getValue());
- }
- else {
- fpdPcd.setValue(defaultPcdValue.get(cName + " " + tsGuid));
- }
-
- if (dataType.equals("UINT8")){
- fpdPcd.setMaxDatumSize(1);
- }
- if (dataType.equals("UINT16")) {
- fpdPcd.setMaxDatumSize(2);
- }
- if (dataType.equals("UINT32")) {
- fpdPcd.setMaxDatumSize(4);
- }
- if (dataType.equals("UINT64")){
- fpdPcd.setMaxDatumSize(8);
- }
- if (dataType.equals("BOOLEAN")){
- fpdPcd.setMaxDatumSize(1);
- }
- if (dataType.equals("VOID*")) {
- int maxSize = setMaxSizeForPointer(fpdPcd.getValue());
- fpdPcd.setMaxDatumSize(maxSize);
- }
-
-
- if (itemType.equals("DYNAMIC") || itemType.equals("DYNAMIC_EX")) {
- ArrayList<String> al = LookupDynamicPcdBuildDefinition(cName + " " + tsGuid);
- //
- // if only one module mapped to this pcd, then the one is myself. so no other module mapped.
- // so need to add one dyn pcd.
- //
- if (al.size() == 1) {
- addDynamicPcdBuildData(cName, token, tsGuid, itemType, dataType, defaultVal);
- }
- }
-
- }
-
- public int setMaxSizeForPointer(String datum) throws PcdValueMalFormed{
- if (datum == null) {
- return 0;
- }
- char ch = datum.charAt(0);
- int start, end;
- String strValue;
- //
- // For void* type PCD, only three datum is support:
- // 1) Unicode: string with start char is "L"
- // 2) Ansci: String is ""
- // 3) byte array: String start char "{"
- //
- if (ch == 'L') {
- start = datum.indexOf('\"');
- end = datum.lastIndexOf('\"');
- if ((start > end) ||
- (end > datum.length())||
- ((start == end) && (datum.length() > 0))) {
- //ToDo Error handling here
- throw new PcdValueMalFormed (datum);
- }
-
- strValue = datum.substring(start + 1, end);
- return strValue.length() * 2;
- } else if (ch == '\"'){
- start = datum.indexOf('\"');
- end = datum.lastIndexOf('\"');
- if ((start > end) ||
- (end > datum.length())||
- ((start == end) && (datum.length() > 0))) {
- throw new PcdValueMalFormed (datum);
- }
- strValue = datum.substring(start + 1, end);
- return strValue.length();
- } else if (ch =='{') {
- String[] strValueArray;
-
- start = datum.indexOf('{');
- end = datum.lastIndexOf('}');
- strValue = datum.substring(start + 1, end);
- strValue = strValue.trim();
- if (strValue.length() == 0) {
- return 0;
- }
- strValueArray = strValue.split(",");
- for (int index = 0; index < strValueArray.length; index ++) {
- Integer value = Integer.decode(strValueArray[index].trim());
-
- if (value > 0xFF) {
-// "[FPD file error] The datum type of PCD %s in %s is VOID*, "+
-// "it must be a byte array. But the element of %s exceed the byte range",
- throw new PcdValueMalFormed (datum);
- }
- }
- return strValueArray.length;
-
-
- } else {
-// "[FPD file error] The datum type of PCD %s in %s is VOID*. For VOID* type, you have three format choise:\n "+
-// "1) UNICODE string: like L\"xxxx\";\r\n"+
-// "2) ANSIC string: like \"xxx\";\r\n"+
-// "3) Byte array: like {0x2, 0x45, 0x23}\r\n"+
-// "but the datum in seems does not following above format!",
- throw new PcdValueMalFormed (datum);
-
- }
- }
-
- private ArrayList<String> LookupDynamicPcdBuildDefinition(String dynPcdKey) {
- ArrayList<String> al = dynPcdMap.get(dynPcdKey);
-
- return al;
- }
-
- private ArrayList<String> LookupPlatformPcdData(String pcdKey) {
-
- return dynPcdMap.get(pcdKey);
- }
-
- public int getDynamicPcdBuildDataCount() {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return 0;
- }
- return getfpdDynPcdBuildDefs().getPcdBuildDataList().size();
- }
-
- public void getDynamicPcdBuildData(String[][] saa) {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return ;
- }
- List<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> l = getfpdDynPcdBuildDefs().getPcdBuildDataList();
- ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData dynPcd = li.next();
- saa[i][0] = dynPcd.getCName();
- saa[i][1] = dynPcd.getToken().toString();
- saa[i][2] = dynPcd.getTokenSpaceGuidCName();
- saa[i][3] = dynPcd.getMaxDatumSize()+"";
- saa[i][4] = dynPcd.getDatumType()+"";
-
- ++i;
- }
- }
-
- public void addDynamicPcdBuildData(String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal)
- throws PcdValueMalFormed{
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData dynPcdData = getfpdDynPcdBuildDefs().addNewPcdBuildData();
- dynPcdData.setItemType(PcdItemTypes.Enum.forString(itemType));
- dynPcdData.setCName(cName);
- dynPcdData.setToken(token);
- dynPcdData.setTokenSpaceGuidCName(tsGuid);
- dynPcdData.setDatumType(PcdDataTypes.Enum.forString(dataType));
-
- BigInteger bigInt = new BigInteger("0");
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = dynPcdData.addNewSkuInfo();
- skuInfo.setSkuId(bigInt);
- if (defaultVal != null){
- skuInfo.setValue(defaultVal);
- }
- else {
- if (dataType.equals("UINT8")){
- skuInfo.setValue("0");
- }
- if (dataType.equals("UINT16")) {
- skuInfo.setValue("0");
- }
- if (dataType.equals("UINT32")) {
- skuInfo.setValue("0");
- }
- if (dataType.equals("UINT64")){
- skuInfo.setValue("0");
- }
- if (dataType.equals("BOOLEAN")){
- skuInfo.setValue("false");
- }
- if (dataType.equals("VOID*")) {
- skuInfo.setValue("");
- }
- }
- if (dataType.equals("UINT8")){
- dynPcdData.setMaxDatumSize(1);
- }
- if (dataType.equals("UINT16")) {
- dynPcdData.setMaxDatumSize(2);
- }
- if (dataType.equals("UINT32")) {
- dynPcdData.setMaxDatumSize(4);
- }
- if (dataType.equals("UINT64")){
- dynPcdData.setMaxDatumSize(8);
- }
- if (dataType.equals("BOOLEAN")){
- dynPcdData.setMaxDatumSize(1);
- }
- if (dataType.equals("VOID*")) {
- int maxSize = setMaxSizeForPointer(defaultVal);
- dynPcdData.setMaxDatumSize(maxSize);
- }
- }
-
- public void removeDynamicPcdBuildData(String cName, String tsGuid) {
- XmlObject o = fpdRoot.getDynamicPcdBuildDefinitions();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- do {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData =
- (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdBuildData.getCName().equals(cName) && pcdBuildData.getTokenSpaceGuidCName().equals(tsGuid)) {
-
- if (getDynamicPcdBuildDataCount() == 1) {
- cursor.dispose();
- removeElement(o);
- fpdDynPcdBuildDefs = null;
- return;
- }
- cursor.removeXml();
- cursor.dispose();
- return;
- }
- }
- while (cursor.toNextSibling());
- }
- cursor.dispose();
- }
- //
- // Get the Sku Info count of ith dyn pcd element.
- //
- public int getDynamicPcdSkuInfoCount(int i){
- if (fpdRoot.getDynamicPcdBuildDefinitions() == null || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList() == null
- || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return 0;
- }
-
- int skuInfoCount = 0;
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- skuInfoCount = 0;
- }
- else {
- skuInfoCount = pcdData.getSkuInfoList().size();
- }
- }
- cursor.dispose();
- return skuInfoCount;
- }
-
- public void getDynamicPcdSkuInfos(int i, String[][] saa){
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- cursor.dispose();
- return;
- }
- else {
- ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> li = pcdData.getSkuInfoList().listIterator();
- int k = 0;
- while (li.hasNext()) {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = li.next();
- saa[k][0] = skuInfo.getSkuId()+"";
- saa[k][1] = skuInfo.getVariableName();
- saa[k][2] = skuInfo.getVariableGuid();
- saa[k][3] = skuInfo.getVariableOffset();
- saa[k][4] = skuInfo.getHiiDefaultValue();
- saa[k][5] = skuInfo.getVpdOffset();
- saa[k][6] = skuInfo.getValue();
- ++k;
- }
-
- }
- }
- cursor.dispose();
-
- }
-
- public String getDynamicPcdBuildDataValue(int i){
- String value = null;
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return value;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- value = null;
- }
- else {
- value = pcdData.getSkuInfoArray(0).getValue();
- }
- }
- cursor.dispose();
- return value;
- }
-
- public String getDynamicPcdBuildDataVpdOffset(int i){
- String vpdOffset = null;
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return vpdOffset;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- vpdOffset = null;
- }
- else {
- vpdOffset = pcdData.getSkuInfoArray(0).getVpdOffset();
- }
- }
- cursor.dispose();
- return vpdOffset;
- }
-
- public void removeDynamicPcdBuildDataSkuInfo(int i) {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- cursor.dispose();
- return;
- }
- else {
- pcdData.getSkuInfoList().clear();
-// QName qSkuInfo = new QName(xmlNs, "SkuInfo");
-// cursor.toChild(qSkuInfo);
-// cursor.removeXml();
- }
- }
- cursor.dispose();
- }
- //
- // generate sku info for ith dyn pcd build data.
- //
- public void genDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
- String hiiDefault, String vpdOffset, String value, int i) {
-// if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
-// return;
-// }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = pcdData.addNewSkuInfo();
- skuInfo.setSkuId(new BigInteger(id));
- if (varName != null){
- skuInfo.setVariableName(varName);
- skuInfo.setVariableGuid(varGuid);
- skuInfo.setVariableOffset(varOffset);
- skuInfo.setHiiDefaultValue(hiiDefault);
- }
- else if (vpdOffset != null){
- skuInfo.setVpdOffset(vpdOffset);
- }
- else{
- skuInfo.setValue(value);
- }
- }
- }
-
- public void updateDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
- String hiiDefault, String vpdOffset, String value, int i){
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> li = pcdData.getSkuInfoList().listIterator();
- while (li.hasNext()) {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = li.next();
- if (skuInfo.getSkuId().toString().equals(id)){
- if (varName != null){
- skuInfo.setVariableName(varName);
- skuInfo.setVariableGuid(varGuid);
- skuInfo.setVariableOffset(varOffset);
- skuInfo.setHiiDefaultValue(hiiDefault);
- }
- else if (vpdOffset != null){
- skuInfo.setVpdOffset(vpdOffset);
- }
- else{
- skuInfo.setValue(value);
- }
- break;
- }
- }
- }
- }
-
- public BuildOptionsDocument.BuildOptions getfpdBuildOpts() {
- if (fpdBuildOpts == null) {
- fpdBuildOpts = fpdRoot.addNewBuildOptions();
- }
- return fpdBuildOpts;
- }
-
- public void genBuildOptionsUserExtensions(String fvName, String userId, String id, String outputFileName, Vector<String[]> includeModules) {
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName elementInfFileName = new QName(xmlNs, "InfFileName");
- QName elementModule = new QName(xmlNs, "Module");
-
- UserExtensionsDocument.UserExtensions userExts = getfpdBuildOpts().addNewUserExtensions();
- userExts.setUserID(userId);
- userExts.setIdentifier(id);
- XmlCursor cursor = userExts.newCursor();
- cursor.toEndToken();
-
- cursor.beginElement(elementFvName);
- cursor.insertChars(fvName);
- cursor.toNextToken();
-
- cursor.beginElement(elementInfFileName);
- cursor.insertChars(outputFileName);
- cursor.toNextToken();
-
- cursor.beginElement(elementIncludeModules);
- for (int i = 0; i < includeModules.size(); ++i) {
- cursor.beginElement(elementModule);
- cursor.insertAttributeWithValue("ModuleGuid", includeModules.get(i)[0]);
- if (!includeModules.get(i)[1].equals("null") && includeModules.get(i)[1].length() != 0) {
- cursor.insertAttributeWithValue("ModuleVersion", includeModules.get(i)[1]);
- }
- cursor.insertAttributeWithValue("PackageGuid", includeModules.get(i)[2]);
- if (!includeModules.get(i)[3].equals("null") && includeModules.get(i)[3].length() != 0) {
- cursor.insertAttributeWithValue("PackageVersion", includeModules.get(i)[3]);
- }
-
- cursor.insertAttributeWithValue("Arch", includeModules.get(i)[4]);
- cursor.toEndToken();
- cursor.toNextToken();
- }
- cursor.dispose();
- }
-
- public int getUserExtsIncModCount (String fvName, String userId, String id) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return -1;
- }
-
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals(userId)) {
- continue;
- }
- if (ues.getIdentifier() == null || !ues.getIdentifier().equals(id)) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
- int i = 1;
- for (i = 1; cursor.toNextSibling(); ++i);
- cursor.dispose();
- return i;
- }
- cursor.dispose();
- return 0;
- }
- cursor.dispose();
- }
- return -1;
- }
-
- public void getUserExtsIncMods(String fvName, String userId, String id, String[][] saa) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return;
- }
-
- XmlCursor cursor = getfpdBuildOpts().newCursor();
- QName elementUserExts = new QName (xmlNs, "UserExtensions");
- QName attribUserId = new QName ("UserID");
- QName attribId = new QName ("Identifier");
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName attribModuleGuid = new QName("ModuleGuid");
- QName attribModuleVersion = new QName("ModuleVersion");
- QName attribPackageGuid = new QName("PackageGuid");
- QName attribPackageVersion = new QName("PackageVersion");
- QName attribArch = new QName("Arch");
-
- if (cursor.toChild(elementUserExts)) {
- do {
- cursor.push();
- if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id)) {
- cursor.toChild(elementFvName);
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
- int i = 0;
- do {
- saa[i][0] = cursor.getAttributeText(attribModuleGuid);
- saa[i][1] = cursor.getAttributeText(attribModuleVersion);
- saa[i][2] = cursor.getAttributeText(attribPackageGuid);
- saa[i][3] = cursor.getAttributeText(attribPackageVersion);
- saa[i][4] = cursor.getAttributeText(attribArch);
- ++i;
- }while (cursor.toNextSibling());
- }
- break;
- }
- }
- cursor.pop();
- }while (cursor.toNextSibling(elementUserExts));
- }
- cursor.dispose();
-
- }
-
- public void updateBuildOptionsUserExtensions (String oldFvName, String newFvName) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return;
- }
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals("IMAGES")) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(oldFvName)) {
- cursor.setTextValue(newFvName);
- }
- cursor.dispose();
- }
-
- }
-
- public void removeBuildOptionsUserExtensions (String fvName, String userId, String id) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return;
- }
-
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals(userId)) {
- continue;
- }
- if (ues.getIdentifier()== null || !ues.getIdentifier().equals(id)) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toParent();
- cursor.removeXml();
- cursor.dispose();
- return;
- }
- cursor.dispose();
- }
-
- }
-
- private boolean versionEqual (String v1, String v2) {
-
- if ((v1 == null || v1.length() == 0 || v1.equalsIgnoreCase("null"))
- && (v2 == null || v2.length() == 0 || v2.equalsIgnoreCase("null"))) {
- return true;
- }
-
- if (v1 != null && v1.equals(v2)) {
- return true;
- }
-
- return false;
- }
-
- public boolean moduleInBuildOptionsUserExtensions (String fvName, String userId, String id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
- boolean inList = false;
- if (getUserExtsIncModCount(fvName, userId, id) > 0) {
- XmlCursor cursor = getfpdBuildOpts().newCursor();
- QName elementUserExts = new QName (xmlNs, "UserExtensions");
- QName attribUserId = new QName ("UserID");
- QName attribId = new QName ("Identifier");
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName attribModuleGuid = new QName("ModuleGuid");
- QName attribModuleVersion = new QName("ModuleVersion");
- QName attribPackageGuid = new QName("PackageGuid");
- QName attribPackageVersion = new QName("PackageVersion");
- QName attribArch = new QName("Arch");
-
- if (cursor.toChild(elementUserExts)) {
- do {
- cursor.push();
- if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id)) {
- cursor.toChild(elementFvName);
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
-
- do {
- String mg = cursor.getAttributeText(attribModuleGuid);
- String mv = cursor.getAttributeText(attribModuleVersion);
- String pg = cursor.getAttributeText(attribPackageGuid);
- String pv = cursor.getAttributeText(attribPackageVersion);
- String ar = cursor.getAttributeText(attribArch);
- if (!moduleGuid.equalsIgnoreCase(mg)) {
- continue;
- }
- if (!packageGuid.equalsIgnoreCase(pg)) {
- continue;
- }
- if (!arch.equalsIgnoreCase(ar)) {
- continue;
- }
- if (!versionEqual(moduleVersion, mv)) {
- continue;
- }
- if (!versionEqual(packageVersion, pv)) {
- continue;
- }
- inList = true;
- break;
- }while (cursor.toNextSibling());
- }
- break;
- }
- }
- cursor.pop();
- }while (cursor.toNextSibling(elementUserExts));
- }
- cursor.dispose();
- }
- return inList;
- }
-
- public void removeModuleInBuildOptionsUserExtensions (String fvName, String userId, String id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
- //
- // if there is only one module before remove operation, the whole user extension should be removed.
- //
- int moduleAmount = getUserExtsIncModCount(fvName, userId, id);
- if (moduleAmount == 1) {
- removeBuildOptionsUserExtensions(fvName, userId, id);
- return;
- }
-
- if (moduleAmount > 1) {
- XmlCursor cursor = getfpdBuildOpts().newCursor();
- QName elementUserExts = new QName (xmlNs, "UserExtensions");
- QName attribUserId = new QName ("UserID");
- QName attribId = new QName ("Identifier");
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName attribModuleGuid = new QName("ModuleGuid");
- QName attribModuleVersion = new QName("ModuleVersion");
- QName attribPackageGuid = new QName("PackageGuid");
- QName attribPackageVersion = new QName("PackageVersion");
- QName attribArch = new QName("Arch");
-
- if (cursor.toChild(elementUserExts)) {
- do {
- cursor.push();
- if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id)) {
- cursor.toChild(elementFvName);
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
-
- do {
- String mg = cursor.getAttributeText(attribModuleGuid);
- String mv = cursor.getAttributeText(attribModuleVersion);
- String pg = cursor.getAttributeText(attribPackageGuid);
- String pv = cursor.getAttributeText(attribPackageVersion);
- String ar = cursor.getAttributeText(attribArch);
- if (!moduleGuid.equalsIgnoreCase(mg)) {
- continue;
- }
- if (!packageGuid.equalsIgnoreCase(pg)) {
- continue;
- }
- if (!arch.equalsIgnoreCase(ar)) {
- continue;
- }
- if (!versionEqual(moduleVersion, mv)) {
- continue;
- }
- if (!versionEqual(packageVersion, pv)) {
- continue;
- }
- cursor.removeXml();
- }while (cursor.toNextSibling());
- }
- break;
- }
- }
- cursor.pop();
- }while (cursor.toNextSibling(elementUserExts));
- }
- cursor.dispose();
- }
- }
-
- public void addModuleIntoBuildOptionsUserExtensions (String fvName, String userId, String id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
- if (moduleInBuildOptionsUserExtensions (fvName, userId, id, moduleGuid, moduleVersion, packageGuid, packageVersion, arch)) {
- return;
- }
-
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName elementModule = new QName(xmlNs, "Module");
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals(userId)) {
- continue;
- }
- if (ues.getIdentifier() == null || !ues.getIdentifier().equals(id)) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- cursor.toLastChild();
- cursor.toEndToken();
- cursor.toNextToken();
- cursor.beginElement(elementModule);
- cursor.insertAttributeWithValue("ModuleGuid", moduleGuid);
- if (!moduleVersion.equals("null") && moduleVersion.length() != 0) {
- cursor.insertAttributeWithValue("ModuleVersion", moduleVersion);
- }
- cursor.insertAttributeWithValue("PackageGuid", packageGuid);
- if (!packageVersion.equals("null") && packageVersion.length() != 0) {
- cursor.insertAttributeWithValue("PackageVersion", packageVersion);
- }
-
- cursor.insertAttributeWithValue("Arch", arch);
- cursor.dispose();
- return;
- }
- cursor.dispose();
- }
-
- }
-
- public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) {
- UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();
- if (udats == null) {
- udats = getfpdBuildOpts().addNewUserDefinedAntTasks();
- }
-
- AntTaskDocument.AntTask at = udats.addNewAntTask();
- setBuildOptionsUserDefAntTask(id, fileName, execOrder, at);
- }
-
- private void setBuildOptionsUserDefAntTask(String id, String fileName, String execOrder, AntTaskDocument.AntTask at) {
- at.setId(new Integer(id));
- XmlCursor cursor = at.newCursor();
- if (fileName != null){
- at.setFilename(fileName);
- }
- else if (cursor.toChild(xmlNs, "Filename")) {
- cursor.removeXml();
- }
- if (execOrder != null) {
- at.setAntCmdOptions(execOrder);
- }
- else if (cursor.toChild(xmlNs, "AntCmdOptions")) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void removeBuildOptionsUserDefAntTask(int i) {
- XmlObject o = getfpdBuildOpts().getUserDefinedAntTasks();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getBuildOptionsUserDefAntTaskCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsUserDefAntTask(int i, String id, String fileName, String execOrder){
- XmlObject o = getfpdBuildOpts().getUserDefinedAntTasks();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- AntTaskDocument.AntTask at = (AntTaskDocument.AntTask)cursor.getObject();
- setBuildOptionsUserDefAntTask(id, fileName, execOrder, at);
- }
- cursor.dispose();
- }
-
- public int getBuildOptionsUserDefAntTaskCount() {
- UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();
- if (udats == null || udats.getAntTaskList() == null) {
- return 0;
- }
-
- return udats.getAntTaskList().size();
- }
-
- public void getBuildOptionsUserDefAntTasks(String[][] saa) {
- UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();
- if (udats == null || udats.getAntTaskList() == null) {
- return ;
- }
-
- List<AntTaskDocument.AntTask> l = udats.getAntTaskList();
- ListIterator li = l.listIterator();
- int i = 0;
- while (li.hasNext()) {
- AntTaskDocument.AntTask at = (AntTaskDocument.AntTask)li.next();
- saa[i][0] = at.getId() + "";
- saa[i][1] = saa[i][2] = "";
- if (at.getFilename() != null){
- saa[i][1] = at.getFilename();
- }
- if (at.getAntCmdOptions() != null) {
- saa[i][2] = at.getAntCmdOptions();
- }
- ++i;
- }
- }
- public void genBuildOptionsOpt(Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- OptionsDocument.Options opts = getfpdBuildOpts().getOptions();
- if (opts == null) {
- opts = getfpdBuildOpts().addNewOptions();
- }
- OptionDocument.Option opt = opts.addNewOption();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
-
- private void setBuildOptionsOpt(Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents, OptionDocument.Option opt){
- opt.setStringValue(contents);
- if (buildTargets != null) {
- opt.setBuildTargets(buildTargets);
- }
- else {
- if (opt.isSetBuildTargets()) {
- opt.unsetBuildTargets();
- }
- }
-
- if (toolChain != null && toolChain.length() > 0) {
- opt.setToolChainFamily(toolChain);
- }
- else {
- if (opt.isSetToolChainFamily()) {
- opt.unsetToolChainFamily();
- }
- }
-
- if (tagName != null && tagName.length() > 0) {
- opt.setTagName(tagName);
- }
- else {
- if (opt.isSetTagName()) {
- opt.unsetTagName();
- }
- }
-
- if (toolCmd != null && toolCmd.length() > 0) {
- opt.setToolCode(toolCmd);
- }
- else {
- if (opt.isSetToolCode()) {
- opt.unsetToolCode();
- }
- }
-
-
- if (archList != null) {
- opt.setSupArchList(archList);
- }
- else {
- if (opt.isSetSupArchList()) {
- opt.unsetSupArchList();
- }
- }
- }
-
- public void removeBuildOptionsOpt(int i){
-
- XmlObject o = getfpdBuildOpts().getOptions();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getBuildOptionsOptCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsOpt(int i, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- XmlObject o = getfpdBuildOpts().getOptions();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- OptionDocument.Option opt = (OptionDocument.Option)cursor.getObject();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
- cursor.dispose();
- }
-
- public int getBuildOptionsOptCount(){
- if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {
- return 0;
- }
- return getfpdBuildOpts().getOptions().getOptionList().size();
- }
-
- public void getBuildOptionsOpts(String[][] saa) {
- if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {
- return ;
- }
-
- List<OptionDocument.Option> lOpt = getfpdBuildOpts().getOptions().getOptionList();
- ListIterator li = lOpt.listIterator();
- int i = 0;
- while(li.hasNext()) {
- OptionDocument.Option opt = (OptionDocument.Option)li.next();
- if (opt.getBuildTargets() != null) {
- saa[i][0] = listToString(opt.getBuildTargets());
- }
- saa[i][1] = opt.getToolChainFamily();
- if (opt.getSupArchList() != null){
- saa[i][2] = listToString(opt.getSupArchList());
-
- }
- saa[i][3] = opt.getToolCode();
- saa[i][4] = opt.getTagName();
- saa[i][5] = opt.getStringValue();
-
- ++i;
- }
- }
-
- public void genBuildOptionsFfs(String ffsKey, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getfpdBuildOpts().addNewFfs();
- ffs.setFfsKey(ffsKey);
- if (type != null) {
- ffs.addNewSections().setEncapsulationType(type);
- }
- }
-
- public void updateBuildOptionsFfsSectionsType(int i, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- ffs.getSections().setEncapsulationType(type);
- }
-
- public void genBuildOptionsFfsAttribute(int i, String name, String value) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = ffs.addNewAttribute();
- attrib.setName(name);
- attrib.setValue(value);
- }
-
- /**update jth attribute of ith ffs.
- * @param i
- * @param j
- */
- public void updateBuildOptionsFfsAttribute(int i, int j, String name, String value){
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- XmlCursor cursor = ffs.newCursor();
- QName qAttrib = new QName(xmlNs, "Attribute");
- if (cursor.toChild(qAttrib)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qAttrib);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = (BuildOptionsDocument.BuildOptions.Ffs.Attribute)cursor.getObject();
- attrib.setName(name);
- attrib.setValue(value);
- }
- cursor.dispose();
- }
-
- public void removeBuildOptionsFfsAttribute(int i, int j){
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- XmlCursor cursor = ffs.newCursor();
- QName qAttrib = new QName(xmlNs, "Attribute");
- if (cursor.toChild(qAttrib)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qAttrib);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void genBuildOptionsFfsSectionsSection(int i, String sectionType) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
-
- if (sections == null){
- sections = ffs.addNewSections();
- }
- sections.addNewSection().setSectionType(EfiSectionType.Enum.forString(sectionType));
- }
-
- public void removeBuildOptionsFfsSectionsSection(int i, int j) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSection = new QName(xmlNs, "Section");
- if (cursor.toChild(qSection)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSection);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsFfsSectionsSection(int i, int j, String type){
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSection = new QName(xmlNs, "Section");
- if (cursor.toChild(qSection)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSection);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Section)cursor.getObject();
- section.setSectionType(EfiSectionType.Enum.forString(type));
- }
- cursor.dispose();
- }
-
- public void genBuildOptionsFfsSectionsSections(int i, String encapType) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
-
- if (sections == null){
- sections = ffs.addNewSections();
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = sections.addNewSections();
- sections2.setEncapsulationType(encapType);
- sections2.addNewSection().setSectionType(EfiSectionType.Enum.forString("EFI_SECTION_PE32"));
- }
-
- public void removeBuildOptionsFfsSectionsSections(int i, int j) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsFfsSectionsSections(int i, int j, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();
- sections2.setEncapsulationType(type);
- }
- cursor.dispose();
- }
-
- public void genBuildOptionsFfsSectionsSectionsSection(int i, int j, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)){
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();
- sections2.addNewSection().setSectionType(EfiSectionType.Enum.forString(type));
- }
- cursor.dispose();
- }
-
- public void removeBuildOptionsFfsSectionsSectionsSection(int i, int j, int k) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int l = 0; l < j; ++l) {
- cursor.toNextSibling(qSections);
- }
- if (cursor.toFirstChild()) {
- int m = 0;
- for (; m < k; ++m) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (m == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsFfsSectionsSectionsSection(int i, int j, int k, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int l = 0; l < j; ++l) {
- cursor.toNextSibling(qSections);
- }
- if (cursor.toFirstChild()) {
- for (int m = 0; m < k; ++m) {
- cursor.toNextSibling();
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section)cursor.getObject();
- section.setSectionType(EfiSectionType.Enum.forString(type));
- }
- }
- cursor.dispose();
- }
-
- public void getBuildOptionsFfsSectionsSectionsSection(int i, int j, ArrayList<String> al) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)){
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();
- if (sections2.getSectionList() == null){
- cursor.dispose();
- return;
- }
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section> li = sections2.getSectionList().listIterator();
- while(li.hasNext()) {
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = li.next();
-// if (section.isSetSectionType()) {
- al.add(section.getSectionType()+"");
-// }
-
- }
- }
- cursor.dispose();
-
- }
-
- public int getBuildOptionsFfsCount(){
- if (getfpdBuildOpts().getFfsList() == null) {
- return 0;
- }
- return getfpdBuildOpts().getFfsList().size();
- }
-
- public void getBuildOptionsFfsKey(String[][] saa) {
- if (getfpdBuildOpts().getFfsList() == null) {
- return;
- }
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs> li = getfpdBuildOpts().getFfsList().listIterator();
- int i = 0;
- while(li.hasNext()){
- BuildOptionsDocument.BuildOptions.Ffs ffs = li.next();
- saa[i][0] = ffs.getFfsKey();
- ++i;
- }
- }
-
- public void updateBuildOptionsFfsKey(int i, String key) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- ffs.setFfsKey(key);
- }
-
- /**Get ith FFS key and contents.
- * @param saa
- */
- public void getBuildOptionsFfs(int i, String[] sa, LinkedHashMap<String, String> ffsAttribMap, ArrayList<String> firstLevelSections, ArrayList<String> firstLevelSection) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
-
- if (ffs != null) {
-
- sa[0] = ffs.getFfsKey();
- if (ffs.getSections() != null) {
- if(ffs.getSections().getEncapsulationType() != null){
- sa[1] = ffs.getSections().getEncapsulationType();
- }
- if (ffs.getSections().getSectionList() != null){
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Section> li = ffs.getSections().getSectionList().listIterator();
- while (li.hasNext()) {
- firstLevelSection.add(li.next().getSectionType()+"");
- }
- }
- if (ffs.getSections().getSectionsList() != null) {
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2> li = ffs.getSections().getSectionsList().listIterator();
- while(li.hasNext()) {
- firstLevelSections.add(li.next().getEncapsulationType());
- }
- }
- }
- if (ffs.getAttributeList() != null) {
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Attribute> li = ffs.getAttributeList().listIterator();
- while(li.hasNext()) {
- BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = li.next();
- ffsAttribMap.put(attrib.getName(), attrib.getValue());
- }
-
- }
- }
-
-
- }
-
- private BuildOptionsDocument.BuildOptions.Ffs getFfs(int i) {
- XmlObject o = getfpdBuildOpts();
- BuildOptionsDocument.BuildOptions.Ffs ffs = null;
-
- XmlCursor cursor = o.newCursor();
- QName qFfs = new QName(xmlNs, "Ffs");
- if (cursor.toChild(qFfs)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFfs);
- }
- ffs = (BuildOptionsDocument.BuildOptions.Ffs)cursor.getObject();
- }
- cursor.dispose();
- return ffs;
- }
-
- public void removeBuildOptionsFfs(int i) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null){
- return;
- }
-
- XmlCursor cursor = ffs.newCursor();
- cursor.removeXml();
- cursor.dispose();
- }
-
-
-
- public PlatformDefinitionsDocument.PlatformDefinitions getfpdPlatformDefs(){
- if (fpdPlatformDefs == null){
- fpdPlatformDefs = fpdRoot.addNewPlatformDefinitions();
- }
- return fpdPlatformDefs;
- }
-
- public void getPlatformDefsSupportedArchs(Vector<Object> archs){
- if (getfpdPlatformDefs().getSupportedArchitectures() == null) {
- return;
- }
- ListIterator li = getfpdPlatformDefs().getSupportedArchitectures().listIterator();
- while(li.hasNext()) {
- archs.add(li.next());
- }
- }
-
- public void setPlatformDefsSupportedArchs(Vector<Object> archs) {
- if (archs != null) {
- getfpdPlatformDefs().setSupportedArchitectures(archs);
- }
-// else {
-// XmlCursor cursor = getfpdPlatformDefs().newCursor();
-// if (cursor.toChild(xmlNs, "SupportedArchitectures")) {
-// cursor.removeXml();
-// }
-// cursor.dispose();
-// }
- }
-
- public void getPlatformDefsBuildTargets(Vector<Object> targets) {
- if (getfpdPlatformDefs().getBuildTargets() == null) {
- return;
- }
- ListIterator li = getfpdPlatformDefs().getBuildTargets().listIterator();
- while(li.hasNext()) {
- targets.add(li.next());
- }
- }
-
- public void setPlatformDefsBuildTargets(Vector<Object> targets) {
- getfpdPlatformDefs().setBuildTargets(targets);
- }
-
- public void genPlatformDefsSkuInfo(String id, String name) {
- SkuInfoDocument.SkuInfo skuInfo = null;
- if (getfpdPlatformDefs().getSkuInfo() == null) {
- skuInfo = getfpdPlatformDefs().addNewSkuInfo();
- }
- skuInfo = getfpdPlatformDefs().getSkuInfo();
- if (skuInfo.getUiSkuNameList() == null || skuInfo.getUiSkuNameList().size() == 0) {
- SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName();
- skuName.setSkuID(new BigInteger("0"));
- skuName.setStringValue("DEFAULT");
- }
- if (id.equals("0")) {
- return;
- }
- SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName();
- skuName.setSkuID(new BigInteger(id));
- skuName.setStringValue(name);
- }
-
- public int getPlatformDefsSkuInfoCount(){
- if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {
- return 0;
- }
- return getfpdPlatformDefs().getSkuInfo().getUiSkuNameList().size();
- }
-
- public void getPlatformDefsSkuInfos(String[][] saa){
- if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- }
- return ;
- }
-
- List<SkuInfoDocument.SkuInfo.UiSkuName> l = getfpdPlatformDefs().getSkuInfo().getUiSkuNameList();
- ListIterator<SkuInfoDocument.SkuInfo.UiSkuName> li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- SkuInfoDocument.SkuInfo.UiSkuName sku = li.next();
- saa[i][0] = sku.getSkuID()+"";
- saa[i][1] = sku.getStringValue();
- ++i;
- }
- }
-
- public void removePlatformDefsSkuInfo(int i) {
- SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo();
- if (skuInfo == null || i == 0) {
- return ;
- }
-
- XmlCursor cursor = skuInfo.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updatePlatformDefsSkuInfo(int i, String id, String name) {
- SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo();
- if (skuInfo == null || i == 0) {
- return ;
- }
-
- XmlCursor cursor = skuInfo.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- SkuInfoDocument.SkuInfo.UiSkuName sku = (SkuInfoDocument.SkuInfo.UiSkuName)cursor.getObject();
- sku.setSkuID(new BigInteger(id));
- sku.setStringValue(name);
- }
- cursor.dispose();
- }
-
- public String getPlatformDefsInterDir(){
- if (getfpdPlatformDefs().getIntermediateDirectories() == null) {
- return null;
- }
- return getfpdPlatformDefs().getIntermediateDirectories().toString();
- }
-
- public void setPlatformDefsInterDir(String interDir){
- getfpdPlatformDefs().setIntermediateDirectories(IntermediateOutputType.Enum.forString(interDir));
- }
-
- public String getPlatformDefsOutputDir() {
- return getfpdPlatformDefs().getOutputDirectory();
- }
-
- public void setPlatformDefsOutputDir(String outputDir) {
- if (outputDir != null && outputDir.length() > 0) {
- getfpdPlatformDefs().setOutputDirectory(outputDir);
- }
- else{
- XmlCursor cursor = getfpdPlatformDefs().newCursor();
- if (cursor.toChild(new QName(xmlNs, "OutputDirectory"))) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
- }
-
- public FlashDocument.Flash getfpdFlash() {
- if (fpdFlash == null) {
- fpdFlash = fpdRoot.addNewFlash();
- }
- return fpdFlash;
- }
-
- public void genFlashDefinitionFile(String file) {
- FlashDefinitionFileDocument.FlashDefinitionFile fdf = getfpdFlash().getFlashDefinitionFile();
- if (fdf == null) {
- fdf = getfpdFlash().addNewFlashDefinitionFile();
- }
-
- fdf.setStringValue(file);
- }
-
- public String getFlashDefinitionFile() {
- FlashDefinitionFileDocument.FlashDefinitionFile fdf = getfpdFlash().getFlashDefinitionFile();
- if (fdf == null) {
- return "";
- }
-
- return fdf.getStringValue();
- }
-
- public void genFvImagesNameValue(String name, String value) {
-
- FvImagesDocument.FvImages fi = getfpdFlash().getFvImages();
- if (fi == null) {
- fi = getfpdFlash().addNewFvImages();
- }
-
- FvImagesDocument.FvImages.NameValue nv = fi.addNewNameValue();
- nv.setName(name);
- nv.setValue(value);
- }
-
- public void removeFvImagesNameValue(int i){
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
-
- QName qNameValue = new QName(xmlNs, "NameValue");
- XmlCursor cursor = o.newCursor();
- if (cursor.toChild(qNameValue)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qNameValue);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updateFvImagesNameValue(int i, String name, String value){
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
-
- QName qNameValue = new QName(xmlNs, "NameValue");
- XmlCursor cursor = o.newCursor();
- if (cursor.toChild(qNameValue)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qNameValue);
- }
- FvImagesDocument.FvImages.NameValue nv = (FvImagesDocument.FvImages.NameValue)cursor.getObject();
- nv.setName(name);
- nv.setValue(value);
- }
- cursor.dispose();
- }
-
- public int getFvImagesNameValueCount() {
-
- FvImagesDocument.FvImages fi = null;
- if ((fi = getfpdFlash().getFvImages()) == null || fi.getNameValueList() == null) {
- return 0;
- }
- return fi.getNameValueList().size();
- }
-
- public void getFvImagesNameValues(String[][] nv) {
-
- FvImagesDocument.FvImages fi = getfpdFlash().getFvImages();
- if (fi == null){
- return;
- }
- List<FvImagesDocument.FvImages.NameValue> l = fi.getNameValueList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.NameValue e = (FvImagesDocument.FvImages.NameValue) li
- .next();
- nv[i][0] = e.getName();
- nv[i][1] = e.getValue();
-
- i++;
- }
- }
-
- public void getFvImagesFvImageFvImageNames (Vector<String> vImageNames) {
- FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();
- if (fis == null || fis.getFvImageList() == null) {
- return;
- }
-
- ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = li.next();
- if (fi.getType().toString().equals("ImageName")) {
- vImageNames.addAll(fi.getFvImageNamesList());
- return;
- }
- }
- }
-
- public void addFvImageFvImageNames (String[] fvNames) {
- FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();
- if (fis == null || fis.getFvImageList() == null) {
- genFvImagesFvImage (fvNames, "ImageName", null);
- return;
- }
-
- ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = li.next();
- if (fi.getType().toString().equals("ImageName")) {
- addFvImageNamesInFvImage (fi, fvNames);
- return;
- }
- }
- genFvImagesFvImage (fvNames, "ImageName", null);
- }
-
- public void addFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String[] fvNames) {
-
- for (int i = 0; i < fvNames.length; ++i) {
- fi.addFvImageNames(fvNames[i]);
- }
- }
-
- public void addFvImageNamesInFvImage (int i, String[] fvNames) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- addFvImageNamesInFvImage(fi, fvNames);
- }
- cursor.dispose();
- }
-
- public void genFvImagesFvImage(String[] names, String types, Map<String, String> options) {
-
- FvImagesDocument.FvImages fis = null;
- if ((fis = getfpdFlash().getFvImages()) == null) {
- fis = getfpdFlash().addNewFvImages();
- }
-
- //
- //gen FvImage with FvImageNames array
- //
- FvImagesDocument.FvImages.FvImage fi = fis.addNewFvImage();
- for (int i = 0; i < names.length; ++i) {
- fi.addFvImageNames(names[i]);
- }
- fi.setType(FvImageTypes.Enum.forString(types));
- if (options != null){
- setFvImagesFvImageFvImageOptions(options, fi);
- }
- }
-
- private void setFvImagesFvImageFvImageOptions(Map<String, String> options, FvImagesDocument.FvImages.FvImage fi){
- FvImagesDocument.FvImages.FvImage.FvImageOptions fio = fi.getFvImageOptions();
- if (fio == null){
- fio = fi.addNewFvImageOptions();
- }
-
- Set<String> key = options.keySet();
- Iterator<String> i = key.iterator();
- while (i.hasNext()) {
-
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fio.addNewNameValue();
- String k = (String)i.next();
-
- nv.setName(k);
- nv.setValue((String)options.get(k));
-
- }
-
- }
-
-
- public void removeFvImagesFvImage(int i) {
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
-
- QName qFvImage = new QName(xmlNs, "FvImage");
- XmlCursor cursor = o.newCursor();
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- /**
- * @param oldFvName
- * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
- */
- public void updateFvImageNameAll (String oldFvName, String newFvName) {
- if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
- return;
- }
- ListIterator<FvImagesDocument.FvImages.FvImage> li = getfpdFlash().getFvImages().getFvImageList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = li.next();
- updateFvImageNamesInFvImage (fi, oldFvName, newFvName);
- if (fi.getFvImageNamesList().size() == 0) {
- li.remove();
- }
- }
- }
-
- public void updateFvImageNamesInFvImage (int i, String oldFvName, String newFvName) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- updateFvImageNamesInFvImage (fi, oldFvName, newFvName);
- }
- cursor.dispose();
- }
- /**
- * @param fi
- * @param oldFvName The FV Name to be replaced.
- * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
- */
- public void updateFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String oldFvName, String newFvName) {
- QName qFvImageNames = new QName(xmlNs, "FvImageNames");
- XmlCursor cursor = fi.newCursor();
-
- if (cursor.toChild(qFvImageNames)) {
- do {
- String xmlValue = cursor.getTextValue();
- if (xmlValue.equals(oldFvName)){
- if (newFvName != null) {
- cursor.setTextValue(newFvName);
- }
- else {
- cursor.removeXml();
- }
- }
- }while (cursor.toNextSibling(qFvImageNames));
- }
-
- cursor.dispose();
- }
-
- /**update the Type attribute of ith FvImage with new type.
- * @param i
- * @param type
- */
- public void updateFvImagesFvImageType (int i, String type) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- fi.setType(FvImageTypes.Enum.forString(type));
- }
- cursor.dispose();
- }
-
- public void updateFvImagesFvImage(int i, String[] names, String types, Map<String, String> options){
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- fi.setType(FvImageTypes.Enum.forString(types));
-
- //
- // remove old FvImageNames before adding new ones
- //
- QName qFvImageNames = new QName(xmlNs, "FvImageNames");
- cursor.toChild(qFvImageNames);
- cursor.removeXml();
- while (cursor.toNextSibling(qFvImageNames)) {
- cursor.removeXml();
- }
-
- for (int k = 0; k < names.length; ++k) {
- fi.addFvImageNames(names[k]);
- }
- //
- // remove old FvImageOptions before adding new options
- //
- QName qFvImageOptions = new QName(xmlNs, "FvImageOptions");
- cursor.toNextSibling(qFvImageOptions);
- cursor.removeXml();
-
- setFvImagesFvImageFvImageOptions(options, fi);
- }
- cursor.dispose();
- }
-
- public int getFvImagesFvImageCount(String type) {
-
- if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
- return 0;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- ListIterator li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
-
- ++i;
- }
-
- return i;
- }
-
- public Vector<FvImagesDocument.FvImages.FvImage> getFvImagesFvImageWithName (String fvName, String type) {
- Vector<FvImagesDocument.FvImages.FvImage> vFvImage = new Vector<FvImagesDocument.FvImages.FvImage>();
- if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
- return vFvImage;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- if (fi.getFvImageNamesList().contains(fvName)) {
- vFvImage.add(fi);
- }
- }
-
- return vFvImage;
- }
- /**
- * @param saa
- * @param type "ALL" means all FvImage types: ImageName, Options, Attributes, Components.
- */
- public void getFvImagesFvImages(String[][] saa, String type) {
-
- if (getfpdFlash().getFvImages() == null) {
- return;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- if (l == null) {
- return;
- }
- ListIterator li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- //
- // get FvImageNames array, space separated
- //
- List<String> lfn = fi.getFvImageNamesList();
- ListIterator lfni = lfn.listIterator();
- saa[i][0] = " ";
- while (lfni.hasNext()) {
- saa[i][0] += (String)lfni.next();
- saa[i][0] += " ";
- }
- saa[i][0] = saa[i][0].trim();
-
- saa[i][1] = fi.getType()+"";
-
- ++i;
- }
- }
-
- public void removeFvImageNameValue (int i, String attributeName) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- removeFvImageNameValue (fi, attributeName);
- }
- cursor.dispose();
- }
- /**Remove from fi the attribute pair with attributeName in FvImageOptions.
- * @param fi
- * @param attributeName
- */
- public void removeFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String attributeName) {
- if (fi.getFvImageOptions() != null && fi.getFvImageOptions().getNameValueList() != null) {
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
- if (nv.getName().equals(attributeName)) {
- li.remove();
- }
- }
- }
- }
-
- public void removeTypedNamedFvImageNameValue (String fvName, String type, String optName) {
- Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName(fvName, type);
- for (int i = 0; i < vFvImage.size(); ++i) {
- FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);
- removeFvImageNameValue (fi, optName);
- }
- }
-
- /**Add name-value pair to FvImage element with type.
- * @param fvName FV name to add name-value pair.
- * @param type FvImage attribute.
- * @param name
- * @param value
- */
- public void setTypedNamedFvImageNameValue (String fvName, String type, String name, String value, String newName) {
- boolean fvImageExists = false;
- if (getfpdFlash().getFvImages() != null) {
-
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- if (l != null) {
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage) li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- if (!fi.getFvImageNamesList().contains(fvName)) {
- continue;
- }
- fvImageExists = true;
- setFvImagesFvImageNameValue(fi, name, value, newName);
- }
- }
- }
-
- if (!fvImageExists) {
- HashMap<String, String> map = new HashMap<String, String>();
- map.put(name, value);
- genFvImagesFvImage(new String[] { fvName }, type, map);
- }
- }
-
- /**Add to all FvImage elements with type, the name-value pair.
- * @param type
- * @param name
- * @param value
- */
- public void setTypedFvImageNameValue (String type, String name, String value) {
- if (getfpdFlash().getFvImages() == null) {
- return;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- if (l == null) {
- return;
- }
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- setFvImagesFvImageNameValue (fi, name, value, null);
- }
-
- }
-
- public void setFvImagesFvImageNameValue (int i, String name, String value) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- setFvImagesFvImageNameValue (fi, name, value, null);
- }
- cursor.dispose();
- }
-
- /**Add to FvImage the name-value pair, or replace old name with newName, or generate new name-value pair if not exists before.
- * @param fi
- * @param name
- * @param value
- * @param newName
- */
- public void setFvImagesFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String name, String value, String newName) {
- if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.addNewFvImageOptions().addNewNameValue();
- nv.setName(name);
- nv.setValue(value);
- if (newName != null && !newName.equals(name)) {
- nv.setName(newName);
- }
- return;
- }
-
- XmlCursor cursor = fi.getFvImageOptions().newCursor();
- if (cursor.toFirstChild()) {
- do {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue)cursor.getObject();
- if (nv.getName().equals(name)) {
- nv.setValue(value);
- if (newName != null && !newName.equals(name)) {
- nv.setName(newName);
- }
- cursor.dispose();
- return;
- }
- }while (cursor.toNextSibling());
- }
-
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.getFvImageOptions().addNewNameValue();
- nv.setName(name);
- nv.setValue(value);
- if (newName != null && !newName.equals(name)) {
- nv.setName(newName);
- }
- cursor.dispose();
- }
-
- public void getFvImagesFvImageOptions (String fvName, Map<String, String> m) {
- Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName (fvName, "Options");
- for (int i = 0; i < vFvImage.size(); ++i) {
- FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);
- if (fi == null || fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
- continue;
- }
-
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions()
- .getNameValueList()
- .listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
- m.put(nv.getName(), nv.getValue());
- }
- }
- }
-
- public int getFvImagePosInFvImages (String fvNameList, String type) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return -1;
- }
-
- int pos = -1;
- String[] fvNameArray = fvNameList.trim().split(" ");
- Vector<String> vFvNames = new Vector<String>();
-
-
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- do {
- pos++;
- vFvNames.removeAllElements();
- for (int i = 0; i < fvNameArray.length; ++i) {
- vFvNames.add(fvNameArray[i]);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- if (!fi.getType().toString().equals(type)) {
- continue;
- }
- if (fi.getFvImageNamesList() == null || fi.getFvImageNamesList().size() != vFvNames.size()) {
- continue;
- }
- ListIterator<String> li = fi.getFvImageNamesList().listIterator();
- while (li.hasNext()) {
- String name = li.next();
- vFvNames.remove(name);
- }
- if (vFvNames.size() == 0) {
- cursor.dispose();
- return pos;
- }
-
- }while (cursor.toNextSibling(qFvImage));
-
- }
- cursor.dispose();
- return -1;
- }
- /**Get FvImage Options for FvImage i
- * @param i the ith FvImage
- */
- public void getFvImagesFvImageOptions(int i, Map<String, String> m) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null){
- cursor.dispose();
- return;
- }
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();
- while(li.hasNext()){
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
- m.put(nv.getName(), nv.getValue());
- }
- }
- cursor.dispose();
- }
-
- /**
- Get platform header element
- @return PlatformHeaderDocument.PlatformHeader
- **/
- public PlatformHeaderDocument.PlatformHeader getFpdHdr() {
- if (fpdHdr == null) {
- fpdHdr = fpdRoot.addNewPlatformHeader();
- }
-
- return fpdHdr;
- }
-
- public String getFpdHdrPlatformName() {
- return getFpdHdr().getPlatformName();
- }
-
- public String getFpdHdrGuidValue() {
- return getFpdHdr().getGuidValue();
- }
-
- public String getFpdHdrVer() {
- return getFpdHdr().getVersion();
- }
-
- public String getFpdHdrAbs() {
- return getFpdHdr().getAbstract();
- }
-
- public String getFpdHdrDescription() {
- return getFpdHdr().getDescription();
- }
-
- public String getFpdHdrCopyright() {
- return getFpdHdr().getCopyright();
- }
-
- public String getFpdHdrLicense() {
- LicenseDocument.License l = getFpdHdr().getLicense();
- if (l == null) {
- return null;
- }
- return l.getStringValue();
- }
-
- public String getFpdHdrUrl() {
- LicenseDocument.License l = getFpdHdr().getLicense();
- if (l == null) {
- return null;
- }
- return l.getURL();
- }
-
- public String getFpdHdrSpec() {
-
- return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
-// return getFpdHdr().getSpecification();
- }
-
- public void setFpdHdrPlatformName(String name){
- getFpdHdr().setPlatformName(name);
- }
-
- public void setFpdHdrGuidValue(String guid){
- getFpdHdr().setGuidValue(guid);
- }
-
- public void setFpdHdrVer(String v){
- getFpdHdr().setVersion(v);
- }
-
- public void setFpdHdrAbs(String abs) {
- getFpdHdr().setAbstract(abs);
- }
-
- public void setFpdHdrDescription(String desc){
- getFpdHdr().setDescription(desc);
- }
-
- public void setFpdHdrCopyright(String cr) {
- getFpdHdr().setCopyright(cr);
- }
-
- public void setFpdHdrLicense(String license){
- LicenseDocument.License l = getFpdHdr().getLicense();
- if (l == null) {
- getFpdHdr().addNewLicense().setStringValue(license);
- }
- else {
- l.setStringValue(license);
- }
- }
-
- public void setFpdHdrUrl(String url){
- LicenseDocument.License l = getFpdHdr().getLicense();
-
- l.setURL(url);
-
- }
-
- public void setFpdHdrSpec(String s){
- s = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
- getFpdHdr().setSpecification(s);
- }
- /**
- Save the processed xml contents to file
-
- @param fpdFile The file to save xml contents
- @throws IOException Exceptions during file operation
- **/
- public void saveAs(File fpdFile) throws IOException {
-
- XmlOptions options = new XmlOptions();
-
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- try {
- fpdd.save(fpdFile, options);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- private String listToString(List l) {
- if (l == null) {
- return null;
- }
- String s = " ";
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- s += li.next();
- s += " ";
- }
- return s.trim();
- }
-
- private void removeElement(XmlObject o) {
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- cursor.dispose();
- }
-}
-
-class PcdItemTypeConflictException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String details = null;
-
- PcdItemTypeConflictException (String pcdName, String info) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(info);
- if (mi != null) {
- details = pcdName + " ItemType Conflicts with " + mi.getName() + "\n in Pkg " + mi.getPackageId().getName();
- }
- else {
- details = pcdName + " ItemType Conflicts with \n" + info;
- }
- }
-
- PcdItemTypeConflictException (String pcdName, String info1, String info2) {
- ModuleIdentification mi1 = WorkspaceProfile.getModuleId(info1);
- ModuleIdentification mi2 = WorkspaceProfile.getModuleId(info2);
- String moduleInfo1 = "";
- String moduleInfo2 = "";
- if (mi1 != null) {
- moduleInfo1 = mi1.getName() + " in Pkg " + mi1.getPackageId().getName();
- }
- else {
- moduleInfo1 = info1;
- }
-
- if (mi2 != null) {
- moduleInfo2 = mi2.getName() + " in Pkg " + mi2.getPackageId().getName();
- }
- else {
- moduleInfo2 = info2;
- }
-
- details = pcdName + " ItemType Conflicts in \n" + moduleInfo1 + "\n and " + moduleInfo2;
- }
-
- public String getMessage() {
- return details;
- }
-}
-
-class PcdDeclNotFound extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String details = null;
-
- PcdDeclNotFound(String info) {
- details = "PcdDeclNotFound: " + info;
- }
-
- public String getMessage() {
- return details;
- }
-}
-
-class PcdValueMalFormed extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String details = null;
-
- PcdValueMalFormed(String info) {
- details = "PcdValueMalFormed: " + info;
- }
-
- public String getMessage() {
- return details;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java
deleted file mode 100644
index 29a6219e51..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java
+++ /dev/null
@@ -1,3239 +0,0 @@
-/** @file
- Java class FpdFlash is GUI for Flash element operation in SPD file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import javax.swing.JPanel;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JCheckBox;
-import javax.swing.JTextField;
-import java.awt.GridLayout;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import javax.swing.JComboBox;
-import java.awt.Dimension;
-import javax.swing.JSplitPane;
-
-public class FpdFlash extends IInternalFrame {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private final int startIndexOfDynamicTab = 2;
- private JPanel jContentPane = null;
- private JPanel jPanelContentEast = null;
- private JPanel jPanelContentSouth = null;
- private JPanel jPanelContentWest = null;
- private JPanel jPanelContentNorth = null;
- private JTabbedPane jTabbedPane = null;
- private JPanel jPanelFvImages = null;
- private JPanel jPanelFvImageS = null;
- private JPanel jPanelFvImageN = null;
- private JCheckBox jCheckBoxFvProperty = null;
- private JLabel jLabelFvPropName = null;
- private JTextField jTextFieldFvPropName = null;
- private JLabel jLabelFvPropValue = null;
- private JTextField jTextFieldFvPropValue = null;
- private JButton jButtonFvPropAdd = null;
- private JScrollPane jScrollPaneFvProp = null;
- private JTable jTableFvProp = null;
- private JPanel jPanelFvPropButtonGroup = null;
- private JButton jButtonFvPropDel = null;
- private DefaultTableModel fvPropertyTableModel = null;
- private DefaultTableModel fvImageNameTableModel = null;
- private ImageParaTableModel fvImageParaTableModel = null;
- private DefaultTableModel fvOptionTableModel = null;
- private JPanel jPanelFvImageC = null;
- private JLabel jLabelFvParaType = null;
- private JComboBox jComboBoxFvParaType = null;
- private JLabel jLabelFvImageNames = null;
- private JLabel jLabelFvParaName = null;
- private JTextField jTextFieldFvParaName = null;
- private JButton jButtonFvNameAdd = null;
- private JScrollPane jScrollPaneFvImageNames = null;
- private JTable jTableFvImageNames = null;
- private JButton jButtonFvNameDel = null;
- private JPanel jPanelFvImageOpts = null;
- private JButton jButtonAddFvImage = null;
- private JScrollPane jScrollPaneFvInfo = null;
- private JTable jTableFvInfo = null;
- private JButton jButtonDelFvImage = null;
- private JPanel jPanelFvImagePara = null;
- private OpeningPlatformType docConsole = null;
- private FpdFileContents ffc = null;
- private JPanel jPanelFdf = null;
- private JCheckBox jCheckBoxFdf = null;
- private JTextField jTextFieldFdf = null;
- private JButton jButtonFdfBrowse = null;
- private JLabel jLabelFvImageOptName = null;
- private JTextField jTextFieldFvImageOptName = null;
- private JLabel jLabelFvImageOptValue = null;
- private JTextField jTextFieldFvImageOptValue = null;
- private JPanel jPanelFvImageOptsButtonGroup = null;
- private JButton jButtonFvImageOptAdd = null;
- private JButton jButtonFvImageOptDel = null;
- private JScrollPane jScrollPane = null;
- private JTable jTableFvImageOpts = null;
- private JButton jButtonUpdateFvImage = null;
- private JPanel jPanelFdfN = null;
- private JPanel jPanelFdfS = null;
- private JSplitPane jSplitPaneFdfC = null;
- private JPanel jPanelFdfCTop = null;
- private JPanel jPanelFdfCBottom = null;
- private JPanel jPanelFdfCTopN = null;
- private JPanel jPanelFdfCTopS = null;
-// private JPanel jPanelFdfCTopC = null;
- private JPanel jPanelFdfCBottomN = null;
-// private JPanel jPanelFdfCBottomC = null;
- private JLabel jLabelFvInFdf = null;
- private JLabel jLabelFvAdditional = null;
- private JScrollPane jScrollPaneFvInFdf = null;
- private JTable jTableFvInFdf = null;
- private IDefaultTableModel fvInFdfTableModel = null; // @jve:decl-index=0:visual-constraint=""
- private JButton jButtonFvInFdfOptions = null;
- private JScrollPane jScrollPaneFvAdditional = null;
- private JTable jTableFvAdditional = null;
- private DefaultTableModel fvAdditionalTableModel = null; // @jve:decl-index=0:visual-constraint=""
- private JButton jButtonAddFv = null;
- private JButton jButtonDelFv = null;
- private JButton jButtonAddFvOptions = null;
- private int tabIndexForFv = -1;
- private int selectedRowInFvAdditionalTable = -1;
- private String oldFvName = null;
- private Vector<String> vBlockSize = new Vector<String>();
- private String determinedFvBlockSize = null;
- private final String defaultBlkSize = "0x10000";
- private String erasePolarity = "";
- boolean memModified = false;
- private FvOptsTableModel fvInFdfOptTableModel = null;
- private FvOptsTableModel fvAdditionalOptTableModel = null;
- private boolean sizeFromOptionDlg = false;
- private boolean fileFromOptionDlg = false;
- private JLabel jLabelOptions = null;
- private JPanel jPanelBgFvName = null;
- private JPanel jPanelBgFvImage = null;
- private JPanel jPanelW = null;
- private JPanel jPanelFvImageParaN = null;
- private JPanel jPanelFvImageParaS = null;
-// private JPanel jPanelFvImageParaC = null;
- private JPanel jPanelFvImageOptsN = null;
- private JPanel jPanelFvImageOptsS = null;
-// private JPanel jPanelFvImageOptsC = null;
- private JPanel jPanelFvImageParaE = null;
- private JPanel jPanelFvImageOptsE = null;
- private JPanel jPanelFvImageSN = null;
- private JPanel jPanelFvImageSE = null;
- private JPanel jPanelFvImageSS = null;
-
- public FpdFlash() {
- super();
- // TODO Auto-generated constructor stub
-
- initialize();
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- }
-
- public FpdFlash(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){
- this();
- ffc = new FpdFileContents(fpd);
- init(ffc);
- }
-
- public FpdFlash(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- if (memModified) {
- docConsole.setSaved(false);
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Platform Synced with FDF file.");
- memModified = false;
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- FlowLayout flowLayout7 = new FlowLayout();
- flowLayout7.setVgap(50);
- jPanelContentEast = new JPanel();
- jPanelContentEast.setLayout(flowLayout7);
- }
- return jPanelContentEast;
- }
-
- /**
- * This method initializes jPanel1
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentSouth() {
- if (jPanelContentSouth == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- flowLayout.setHgap(15);
- jPanelContentSouth = new JPanel();
- jPanelContentSouth.setLayout(flowLayout);
- jPanelContentSouth.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
- }
- return jPanelContentSouth;
- }
-
- /**
- * This method initializes jPanel2
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentWest() {
- if (jPanelContentWest == null) {
- jPanelContentWest = new JPanel();
- }
- return jPanelContentWest;
- }
-
- /**
- * This method initializes jPanel3
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentNorth() {
- if (jPanelContentNorth == null) {
- jPanelContentNorth = new JPanel();
- }
- return jPanelContentNorth;
- }
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("General", null, getJPanelFdf(), null);
- jTabbedPane.addTab("Advanced", null, getJPanelFvImages(), null);
-
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes jPanelFvImages
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImages() {
- if (jPanelFvImages == null) {
- jPanelFvImages = new JPanel();
- jPanelFvImages.setLayout(new BorderLayout());
- jPanelFvImages.add(getJPanelFvImageN(), java.awt.BorderLayout.NORTH);
- jPanelFvImages.add(getJPanelFvImageS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImages.add(getJPanelFvImageC(), java.awt.BorderLayout.CENTER);
- jPanelFvImages.add(getJPanelW(), java.awt.BorderLayout.EAST);
- jPanelFvImages.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
-// fvImageParaTableModel.setRowCount(0);
-// fvPropertyTableModel.setRowCount(0);
-
-
- }
- });
-
- }
- return jPanelFvImages;
- }
-
- /**
- * This method initializes jPanelFvImageN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageS() {
- if (jPanelFvImageS == null) {
- jLabelFvPropValue = new JLabel();
- jLabelFvPropValue.setText("Value");
- jLabelFvPropValue.setEnabled(false);
- jLabelFvPropValue.setPreferredSize(new java.awt.Dimension(38,20));
- jLabelFvPropName = new JLabel();
- jLabelFvPropName.setText("Name");
- jLabelFvPropName.setEnabled(false);
- jLabelFvPropName.setPreferredSize(new java.awt.Dimension(38,20));
- jPanelFvImageS = new JPanel();
- jPanelFvImageS.setPreferredSize(new java.awt.Dimension(576,130));
- jPanelFvImageS.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
- jPanelFvImageS.setLayout(new BorderLayout());
- jPanelFvImageS.add(getJPanelFvImageSN(), java.awt.BorderLayout.NORTH);
- jPanelFvImageS.add(getJPanelFvImageSE(), java.awt.BorderLayout.EAST);
- jPanelFvImageS.add(getJPanelFvImageSS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImageS.add(getJScrollPaneFvProp(), java.awt.BorderLayout.CENTER);
-
- }
- return jPanelFvImageS;
- }
-
- /**
- * This method initializes jPanelFvImageS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageN() {
- if (jPanelFvImageN == null) {
- GridLayout gridLayout2 = new GridLayout();
- gridLayout2.setRows(1);
- jPanelFvImageN = new JPanel();
- jPanelFvImageN.setPreferredSize(new java.awt.Dimension(480,150));
- jPanelFvImageN.setLayout(gridLayout2);
- jPanelFvImageN.add(getJScrollPaneFvInfo(), null);
- }
- return jPanelFvImageN;
- }
-
-
- /**
- * This method initializes jCheckBox1
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFvProperty() {
- if (jCheckBoxFvProperty == null) {
- jCheckBoxFvProperty = new JCheckBox();
- jCheckBoxFvProperty.setText("Global FV Variables");
- jCheckBoxFvProperty.addItemListener(new ItemListener(){
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO Auto-generated method stub
- boolean seleted = jCheckBoxFvProperty.isSelected();
-
- jLabelFvPropName.setEnabled(seleted);
- jTextFieldFvPropName.setEnabled(seleted);
- jLabelFvPropValue.setEnabled(seleted);
- jTextFieldFvPropValue.setEnabled(seleted);
- jTableFvProp.setEnabled(seleted);
- jButtonFvPropAdd.setEnabled(seleted);
- jButtonFvPropDel.setEnabled(seleted);
-
-
- }
-
- });
- }
- return jCheckBoxFvProperty;
- }
-
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvPropName() {
- if (jTextFieldFvPropName == null) {
- jTextFieldFvPropName = new JTextField();
- jTextFieldFvPropName.setPreferredSize(new java.awt.Dimension(100,20));
- jTextFieldFvPropName.setEnabled(false);
- }
- return jTextFieldFvPropName;
- }
-
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvPropValue() {
- if (jTextFieldFvPropValue == null) {
- jTextFieldFvPropValue = new JTextField();
- jTextFieldFvPropValue.setPreferredSize(new java.awt.Dimension(100,20));
- jTextFieldFvPropValue.setEnabled(false);
- }
- return jTextFieldFvPropValue;
- }
-
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvPropAdd() {
- if (jButtonFvPropAdd == null) {
- jButtonFvPropAdd = new JButton();
- jButtonFvPropAdd.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonFvPropAdd.setEnabled(false);
- jButtonFvPropAdd.setText("Add");
- jButtonFvPropAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTextFieldFvPropName.getText().length() > 0 && jTextFieldFvPropValue.getText().length() > 0){
- String[] row = {jTextFieldFvPropName.getText(), jTextFieldFvPropValue.getText()};
- fvPropertyTableModel.addRow(row);
- docConsole.setSaved(false);
- ffc.genFvImagesNameValue(row[0], row[1]);
- }
- }
- });
- }
- return jButtonFvPropAdd;
- }
-
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvProp() {
- if (jScrollPaneFvProp == null) {
- jScrollPaneFvProp = new JScrollPane();
- jScrollPaneFvProp.setPreferredSize(new java.awt.Dimension(350,100));
- jScrollPaneFvProp.setViewportView(getJTableFvProp());
- }
- return jScrollPaneFvProp;
- }
-
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvProp() {
- if (jTableFvProp == null) {
- fvPropertyTableModel = new DefaultTableModel();
- jTableFvProp = new JTable(fvPropertyTableModel);
- fvPropertyTableModel.addColumn("Name");
- fvPropertyTableModel.addColumn("Value");
- jTableFvProp.setRowHeight(20);
- jTableFvProp.setEnabled(false);
-
- jTableFvProp.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFvProp.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
-// selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTableFvProp.getModel().addTableModelListener(new TableModelListener(){
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
-
- String name = m.getValueAt(row, 0) + "";
- String value = m.getValueAt(row, 1) + "";
- docConsole.setSaved(false);
- ffc.updateFvImagesNameValue(row, name, value);
- }
- }
- });
- }
- return jTableFvProp;
- }
-
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvPropButtonGroup() {
- if (jPanelFvPropButtonGroup == null) {
- jPanelFvPropButtonGroup = new JPanel();
- jPanelFvPropButtonGroup.setPreferredSize(new java.awt.Dimension(80,55));
-
- jPanelFvPropButtonGroup.add(getJButtonFvPropAdd(), null);
- jPanelFvPropButtonGroup.add(getJButtonFvPropDel(), null);
- }
- return jPanelFvPropButtonGroup;
- }
-
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvPropDel() {
- if (jButtonFvPropDel == null) {
- jButtonFvPropDel = new JButton();
- jButtonFvPropDel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonFvPropDel.setEnabled(false);
- jButtonFvPropDel.setText("Delete");
- jButtonFvPropDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTableFvProp.getSelectedRow() >= 0){
- fvPropertyTableModel.removeRow(jTableFvProp.getSelectedRow());
- docConsole.setSaved(false);
- ffc.removeFvImagesNameValue(jTableFvProp.getSelectedRow());
- }
- }
- });
- }
- return jButtonFvPropDel;
- }
-
-
- /**
- * This method initializes jPanelFvImageC
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageC() {
- if (jPanelFvImageC == null) {
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(2);
- jLabelFvParaName = new JLabel();
- jLabelFvParaName.setPreferredSize(new Dimension(38, 20));
- jLabelFvParaName.setText("Name");
- jLabelFvImageNames = new JLabel();
- jLabelFvImageNames.setText("FV Image Names");
- jLabelFvImageNames.setPreferredSize(new java.awt.Dimension(150,20));
- jLabelFvParaType = new JLabel();
- jLabelFvParaType.setText("Type");
- jLabelFvParaType.setPreferredSize(new java.awt.Dimension(70,20));
- jPanelFvImageC = new JPanel();
- jPanelFvImageC.setLayout(gridLayout);
- jPanelFvImageC.add(getJPanelFvImagePara(), null);
- jPanelFvImageC.add(getJPanelFvImageOpts(), null);
-
-
- }
- return jPanelFvImageC;
- }
-
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxFvParaType() {
- if (jComboBoxFvParaType == null) {
- jComboBoxFvParaType = new JComboBox();
- jComboBoxFvParaType.addItem("Attributes");
- jComboBoxFvParaType.addItem("Components");
- jComboBoxFvParaType.setSelectedIndex(0);
- jComboBoxFvParaType.setPreferredSize(new java.awt.Dimension(180,20));
- jComboBoxFvParaType.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO disable attribute settings when ValidImageNames selected.
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String oldType = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, oldType);
- if (fvImagePos < 0) {
- return;
- }
-
- String type = jComboBoxFvParaType.getSelectedItem()+"";
- ffc.updateFvImagesFvImageType(fvImagePos, type);
- jTableFvInfo.setValueAt(type, selectedRow, 1);
- docConsole.setSaved(false);
- }
-
- });
- }
- return jComboBoxFvParaType;
- }
-
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvParaName() {
- if (jTextFieldFvParaName == null) {
- jTextFieldFvParaName = new JTextField();
- jTextFieldFvParaName.setPreferredSize(new java.awt.Dimension(140,20));
- }
- return jTextFieldFvParaName;
- }
-
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvNameAdd() {
- if (jButtonFvNameAdd == null) {
- jButtonFvNameAdd = new JButton();
- jButtonFvNameAdd.setPreferredSize(new Dimension(80, 20));
- jButtonFvNameAdd.setEnabled(true);
- jButtonFvNameAdd.setText("Add");
- jButtonFvNameAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTextFieldFvParaName.getText().length() > 0){
- String[] row = {jTextFieldFvParaName.getText()};
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
-
- if (fvImagePos < 0) {
- // new FvImage.
- ffc.genFvImagesFvImage(row, jComboBoxFvParaType.getSelectedItem()+"", null);
- }
- else {
- //append Fv name.
- ffc.addFvImageNamesInFvImage(fvImagePos, row);
- }
- docConsole.setSaved(false);
- fvImageNameTableModel.addRow(row);
- fvNameList += " ";
- fvNameList += row[0];
- jTableFvInfo.setValueAt(fvNameList.trim(), selectedRow, 0);
- jTableFvImageNames.changeSelection(jTableFvImageNames.getRowCount() - 1, 0, false, false);
- }
- }
- });
- }
- return jButtonFvNameAdd;
- }
-
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvImageNames() {
- if (jScrollPaneFvImageNames == null) {
- jScrollPaneFvImageNames = new JScrollPane();
- jScrollPaneFvImageNames.setPreferredSize(new java.awt.Dimension(350,80));
- jScrollPaneFvImageNames.setViewportView(getJTableFvImageNames());
- }
- return jScrollPaneFvImageNames;
- }
-
-
- /**
- * This method initializes jTable1
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvImageNames() {
- if (jTableFvImageNames == null) {
- fvImageNameTableModel = new IDefaultTableModel();
- jTableFvImageNames = new JTable(fvImageNameTableModel);
- jTableFvImageNames.setRowHeight(20);
- fvImageNameTableModel.addColumn("FV Image Name");
-
- }
- return jTableFvImageNames;
- }
-
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvNameDel() {
- if (jButtonFvNameDel == null) {
- jButtonFvNameDel = new JButton();
- jButtonFvNameDel.setPreferredSize(new Dimension(80, 20));
- jButtonFvNameDel.setEnabled(true);
- jButtonFvNameDel.setText("Delete");
- jButtonFvNameDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFvImageNames.getSelectedRow() >= 0){
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String selectedFvName = jTableFvImageNames.getValueAt(jTableFvImageNames.getSelectedRow(), 0)+"";
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
-
- if (fvImagePos < 0) {
- return;
- }
- else {
- //delete Fv name.
- ffc.updateFvImageNamesInFvImage(fvImagePos, selectedFvName, null);
- }
- docConsole.setSaved(false);
- String newList = removeFvNameFromList(fvNameList, selectedFvName);
- jTableFvInfo.setValueAt(newList, selectedRow, 0);
- fvImageNameTableModel.removeRow(jTableFvImageNames.getSelectedRow());
- }
- }
- });
- }
- return jButtonFvNameDel;
- }
-
- private String removeFvNameFromList (String list, String name) {
- String[] nameArray = list.split(" ");
- int occursAt = -1;
- for (int i = 0; i < nameArray.length; ++i) {
- if (nameArray[i].equals(name)) {
- occursAt = i;
- break;
- }
- }
-
- if (occursAt == -1) {
- return list;
- }
-
- String newList = " ";
- for (int j = 0; j < nameArray.length; ++j) {
- if (j != occursAt) {
- newList += nameArray[j];
- newList += " ";
- }
- }
-
- return newList.trim();
- }
-
-
- private JPanel getJPanelFvImageOpts() {
-
-
- if (jPanelFvImageOpts == null) {
- //ToDo add ButtonGroup for RadioButtons
- jLabelOptions = new JLabel();
- jLabelOptions.setText("Attribute");
- jLabelFvImageOptValue = new JLabel();
- jLabelFvImageOptValue.setEnabled(true);
- jLabelFvImageOptValue.setText("Value");
- jLabelFvImageOptValue.setPreferredSize(new Dimension(38, 20));
- jLabelFvImageOptName = new JLabel();
- jLabelFvImageOptName.setEnabled(true);
- jLabelFvImageOptName.setText("Name");
- jLabelFvImageOptName.setPreferredSize(new Dimension(38, 20));
- jPanelFvImageOpts = new JPanel();
- jPanelFvImageOpts.setLayout(new BorderLayout());
- jPanelFvImageOpts.setPreferredSize(new java.awt.Dimension(450,130));
-
-
- jPanelFvImageOpts.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
-
- jPanelFvImageOpts.add(getJPanelFvImageOptsN(), java.awt.BorderLayout.NORTH);
- jPanelFvImageOpts.add(getJPanelFvImageOptsS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImageOpts.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
-
- jPanelFvImageOpts.add(getJPanelFvImageOptsE(), java.awt.BorderLayout.EAST);
- }
- return jPanelFvImageOpts;
- }
-
-
- /**
- * This method initializes jButton4
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddFvImage() {
- if (jButtonAddFvImage == null) {
- jButtonAddFvImage = new JButton();
- jButtonAddFvImage.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonAddFvImage.setText("New FV Attributes");
- jButtonAddFvImage.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
-
-// String imageName = " ";
-// for (int i = 0; i < jTableFvImageNames.getRowCount(); ++i){
-// imageName += (String)jTableFvImageNames.getValueAt(i, 0);
-// imageName += " ";
-// }
-// imageName = imageName.trim();
-
-// LinkedHashMap<String, String> m = null;
-// m = new LinkedHashMap<String, String>();
-// getOptionNameValue(m);
-// ffc.genFvImagesFvImage(imageName.split(" "), jComboBoxFvParaType.getSelectedItem()+"", m);
-// docConsole.setSaved(false);
- fvImageNameTableModel.setRowCount(0);
- fvOptionTableModel.setRowCount(0);
- Object[] row = {"", jComboBoxFvParaType.getSelectedItem()};
- fvImageParaTableModel.addRow(row);
- jTableFvInfo.changeSelection(jTableFvInfo.getRowCount() - 1, 0, false, false);
- }
- });
- }
- return jButtonAddFvImage;
- }
-
-
- /**
- * This method initializes jScrollPane3
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvInfo() {
- if (jScrollPaneFvInfo == null) {
- jScrollPaneFvInfo = new JScrollPane();
- jScrollPaneFvInfo.setPreferredSize(new java.awt.Dimension(480,150));
- jScrollPaneFvInfo.setViewportView(getJTableFvInfo());
- }
- return jScrollPaneFvInfo;
- }
-
-
- /**
- * This method initializes jTable2
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvInfo() {
- if (jTableFvInfo == null) {
- fvImageParaTableModel = new ImageParaTableModel();
- jTableFvInfo = new JTable(fvImageParaTableModel);
- fvImageParaTableModel.addColumn("FvImageNames");
- fvImageParaTableModel.addColumn("Type");
-
- jTableFvInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFvInfo.setRowHeight(20);
- jTableFvInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow = lsm.getMinSelectionIndex();
- String fvNameList = fvImageParaTableModel.getValueAt(selectedRow, 0)+"";
- String type = fvImageParaTableModel.getValueAt(selectedRow, 1)+"";
- jComboBoxFvParaType.setSelectedItem(type);
- String[] fvNames = fvNameList.split(" ");
- fvImageNameTableModel.setRowCount(0);
- fvOptionTableModel.setRowCount(0);
- for (int i = 0; i < fvNames.length; ++i) {
- String[] row = { fvNames[i] };
- if (row[0].length() > 0) {
- fvImageNameTableModel.addRow(row);
- }
- }
-
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
- if (fvImagePos < 0) {
- return;
- }
- LinkedHashMap<String, String> optionMap = new LinkedHashMap<String, String>();
- ffc.getFvImagesFvImageOptions(fvImagePos, optionMap);
- if (optionMap.size() > 0){
- Set<String> key = optionMap.keySet();
- Iterator<String> i = key.iterator();
- while (i.hasNext()) {
- String k = (String)i.next();
- String[] row = {k, optionMap.get(k)};
- fvOptionTableModel.addRow(row);
- }
- }
- }
- }
- });
-
-
- }
- return jTableFvInfo;
- }
-
-
- /**
- * This method initializes jButton6
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDelFvImage() {
- if (jButtonDelFvImage == null) {
- jButtonDelFvImage = new JButton();
- jButtonDelFvImage.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonDelFvImage.setText("Delete FV Attributes");
- jButtonDelFvImage.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (jTableFvInfo.getSelectedRow() >= 0 ) {
- String fvNameList = fvImageParaTableModel.getValueAt(jTableFvInfo.getSelectedRow(), 0)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, jComboBoxFvParaType.getSelectedItem()+"");
-
- ffc.removeFvImagesFvImage(fvImagePos);
- fvImageParaTableModel.removeRow(jTableFvInfo.getSelectedRow());
- docConsole.setSaved(false);
-
- fvImageNameTableModel.setRowCount(0);
- fvOptionTableModel.setRowCount(0);
- }
- }
-
- });
- }
- return jButtonDelFvImage;
- }
-
-
- /**
- * This method initializes jPanel6
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImagePara() {
- if (jPanelFvImagePara == null) {
- StarLabel starLabel = new StarLabel();
- starLabel.setVisible(false);
- jPanelFvImagePara = new JPanel();
- jPanelFvImagePara.setLayout(new BorderLayout());
- jPanelFvImagePara.setPreferredSize(new java.awt.Dimension(450,140));
- jPanelFvImagePara.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-
- jPanelFvImagePara.add(getJPanelFvImageParaN(), java.awt.BorderLayout.NORTH);
- jPanelFvImagePara.add(getJPanelFvImageParaS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImagePara.add(getJScrollPaneFvImageNames(), java.awt.BorderLayout.CENTER);
-
- jPanelFvImagePara.add(getJPanelFvImageParaE(), java.awt.BorderLayout.EAST);
-//
-//
-//
- }
- return jPanelFvImagePara;
- }
-
- /**
- * This method initializes jPanel7
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdf() {
- if (jPanelFdf == null) {
- jPanelFdf = new JPanel();
- jPanelFdf.setLayout(new BorderLayout());
-
- jPanelFdf.add(getJPanelFdfN(), java.awt.BorderLayout.NORTH);
- jPanelFdf.add(getJPanelFdfS(), java.awt.BorderLayout.SOUTH);
- jPanelFdf.add(getJSplitPaneFdfC(), java.awt.BorderLayout.CENTER);
- jPanelFdf.addComponentListener(new ComponentAdapter(){
- public void componentShown(ComponentEvent e) {
-// if (ffc.getFlashDefinitionFile() != null) {
-// jTextFieldFdf.setText(ffc.getFlashDefinitionFile());
-// initFvInFdfTable(Workspace.getCurrenetWorkspace() + File.separator + jTextFieldFdf.getText());
-//
-// }
- }
- public void componentHidden(ComponentEvent e) {
- if (jCheckBoxFdf.isSelected()) {
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
- }
- }
- });
- }
- return jPanelFdf;
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFdf() {
- if (jCheckBoxFdf == null) {
- jCheckBoxFdf = new JCheckBox();
- jCheckBoxFdf.setText("Flash Definition File");
- jCheckBoxFdf.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO Auto-generated method stub
- if (jCheckBoxFdf.isSelected()){
- jTextFieldFdf.setEnabled(true);
- jButtonFdfBrowse.setEnabled(true);
- }
- else {
- getFvInFdfTableModel().setRowCount(0);
- jTextFieldFdf.setEnabled(false);
- jTextFieldFdf.setText("");
- jButtonFdfBrowse.setEnabled(false);
- ffc.genFlashDefinitionFile("");
- docConsole.setSaved(false);
- int selectedBackup = selectedRowInFvAdditionalTable;
- selectedRowInFvAdditionalTable = -1;
- initFvAdditionalTable();
- selectedRowInFvAdditionalTable = selectedBackup;
- }
- }
- });
- }
- return jCheckBoxFdf;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFdf() {
- if (jTextFieldFdf == null) {
- jTextFieldFdf = new JTextField();
- jTextFieldFdf.setEnabled(false);
- jTextFieldFdf.setEditable(false);
- jTextFieldFdf.setPreferredSize(new Dimension(300, 20));
- jTextFieldFdf.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
- }
- });
- }
- return jTextFieldFdf;
- }
-
- /**
- * This method initializes jButton5
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFdfBrowse() {
- if (jButtonFdfBrowse == null) {
- jButtonFdfBrowse = new JButton();
- jButtonFdfBrowse.setEnabled(false);
- jButtonFdfBrowse.setText("Browse");
- jButtonFdfBrowse.setPreferredSize(new Dimension(78, 20));
- jButtonFdfBrowse.addActionListener(new AbstractAction(){
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- String wsDir = Workspace.getCurrentWorkspace();
- JFileChooser chooser = new JFileChooser(wsDir);
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(FpdFlash.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- File theFile = chooser.getSelectedFile();
- String filePath = theFile.getPath();
- if (!filePath.startsWith(wsDir)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "You can only select files in current WORKSPACE.");
- return;
- }
- jTextFieldFdf.setText(filePath.substring(wsDir.length() + 1).replace('\\', '/'));
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
- docConsole.setSaved(false);
- initFvInFdfTable(filePath);
- }
- }
-
- });
- }
- return jButtonFdfBrowse;
- }
-
- private void initFvAttributes () {
- if (ffc.getFvImagesFvImageCount("Attributes") == 0 && ffc.getFvImagesFvImageCount("Components") == 0) {
- return;
- }
- String[][] saa = new String[ffc.getFvImagesFvImageCount("Attributes")][2];
- ffc.getFvImagesFvImages(saa, "Attributes");
-
- int i = 0;
- while (i < saa.length) {
- fvImageParaTableModel.addRow(saa[i]);
- ++i;
- }
-
- saa = new String[ffc.getFvImagesFvImageCount("Components")][2];
- ffc.getFvImagesFvImages(saa, "Components");
- i = 0;
- while (i < saa.length) {
- fvImageParaTableModel.addRow(saa[i]);
- ++i;
- }
-
- saa = new String[ffc.getFvImagesNameValueCount()][2];
- ffc.getFvImagesNameValues(saa);
- for (int m = 0; m < saa.length; ++m) {
- fvPropertyTableModel.addRow(saa[m]);
- }
- }
-
- private void initFvAdditionalTable() {
- Vector<String> vFvNames = new Vector<String>();
- ffc.getFvImagesFvImageFvImageNames(vFvNames);
- for (int i = 0; i < vFvNames.size(); ++i) {
- String fvName = vFvNames.get(i);
- if (fvNameExists(fvName)) {
- continue;
- }
- fvAdditionalTableModel.addRow(getBasicFvInfo(fvName));
- addTabForFv(new FvInfoFromFdf(fvName, "", ""));
- }
- }
-
- private void initFvInFdfTable(String fdfPath){
- Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();
- getFvInfoFromFdf(fdfPath, vFvInfo);
- getFlashInfoFromFdf (fdfPath);
- if (!erasePolarity.equals("1") && !erasePolarity.equals("0")) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "FDF file does NOT contain valid Erase Polarity.");
- }
- else {
- ffc.setTypedFvImageNameValue("Attributes", "EFI_ERASE_POLARITY", erasePolarity);
- }
-
- // BugBug: assume all blocks have same size;
-
- String blkSize = defaultBlkSize;
- if (vBlockSize.size() > 0) {
- blkSize = vBlockSize.get(0);
- if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "FDF file does NOT contain valid FV block size. Default size 0x10000 will be used.");
- blkSize = defaultBlkSize;
- }
- }
- determinedFvBlockSize = blkSize;
-
- getFvInFdfTableModel().setRowCount(0);
- Vector<String> vExistingFvNameInFpd = new Vector<String>();
- ffc.getFvImagesFvImageFvImageNames(vExistingFvNameInFpd);
- for (int j = 0; j < vFvInfo.size(); ++j) {
- FvInfoFromFdf fvInfo = vFvInfo.get(j);
- String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};
-
- if (row[0].length() > 0 && !vExistingFvNameInFpd.contains(row[0])) {
- ffc.addFvImageFvImageNames(new String[]{row[0]});
- }
-
- // if FV addtional table contains the same FV from fdf file, remove that row.
- for (int k = 0; k < jTableFvAdditional.getRowCount(); ++k) {
- if (fvAdditionalTableModel.getValueAt(k, 0).equals(row[0])) {
- fvAdditionalTableModel.removeRow(k);
- }
- }
- getFvInFdfTableModel().addRow(row);
- try {
- int blockSize = Integer.decode(blkSize);
- int fvSize = Integer.decode(row[1]);
- int numBlocks = fvSize/blockSize;
- HashMap<String, String> mOptions = new HashMap<String, String>();
- // if no options for this FV before, generate a new options entry for this FV.
- if (ffc.getFvImagesFvImageWithName(row[0], "Options") == null) {
-
- mOptions.put("EFI_BLOCK_SIZE", blkSize);
- mOptions.put("EFI_NUM_BLOCKS", numBlocks+"");
- mOptions.put("EFI_FILE_NAME", row[2]);
- ffc.genFvImagesFvImage(new String[]{row[0]}, "Options", mOptions);
- memModified = true;
- }
- else {
- ffc.getFvImagesFvImageOptions(row[0], mOptions);
- if (mOptions.get("EFI_BLOCK_SIZE") == null || !mOptions.get("EFI_BLOCK_SIZE").equalsIgnoreCase(blkSize)) {
- ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_BLOCK_SIZE", blkSize, null);
- memModified = true;
- }
- if (mOptions.get("EFI_NUM_BLOCKS") == null || Integer.decode(mOptions.get("EFI_NUM_BLOCKS")) != numBlocks) {
- ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_NUM_BLOCKS", numBlocks + "", null);
- memModified = true;
- }
- if (mOptions.get("EFI_FILE_NAME") == null || !mOptions.get("EFI_FILE_NAME").equals(row[2])) {
- ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_FILE_NAME", row[2], null);
- memModified = true;
- }
-
- }
- }
- catch (NumberFormatException e){
- JOptionPane.showMessageDialog(FpdFlash.this, e.getMessage());
- }
- }
-
- for (int k = 0; k < vFvInfo.size(); ++k) {
- FvInfoFromFdf fvInfo = vFvInfo.get(k);
- addTabForFv(fvInfo);
- }
-
- }
-
- private void addTabForFv (FvInfoFromFdf fvInfo) {
- String fvName = fvInfo.getFvName();
- String outputFile = fvInfo.getEfiFileName();
- int index = jTabbedPane.indexOfTab(fvName);
- if (index >= startIndexOfDynamicTab) {
- return;
- }
- ModuleOrderPane pane = new ModuleOrderPane(fvName, outputFile, ffc, this);
- pane.showModulesInFv(fvName);
- pane.showAllModulesInPlatform();
- jTabbedPane.addTab(fvName, null, pane, null);
- }
- /**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvImageOptName() {
- if (jTextFieldFvImageOptName == null) {
- jTextFieldFvImageOptName = new JTextField();
- jTextFieldFvImageOptName.setEnabled(true);
- jTextFieldFvImageOptName.setPreferredSize(new Dimension(100, 20));
- }
- return jTextFieldFvImageOptName;
- }
-
- /**
- * This method initializes jTextField5
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvImageOptValue() {
- if (jTextFieldFvImageOptValue == null) {
- jTextFieldFvImageOptValue = new JTextField();
- jTextFieldFvImageOptValue.setEnabled(true);
- jTextFieldFvImageOptValue.setPreferredSize(new Dimension(100, 20));
- }
- return jTextFieldFvImageOptValue;
- }
-
- /**
- * This method initializes jPanel8
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsButtonGroup() {
- if (jPanelFvImageOptsButtonGroup == null) {
- jPanelFvImageOptsButtonGroup = new JPanel();
- jPanelFvImageOptsButtonGroup.setPreferredSize(new Dimension(80, 55));
- jPanelFvImageOptsButtonGroup.add(getJButtonFvImageOptAdd(), null);
- jPanelFvImageOptsButtonGroup.add(getJButtonFvImageOptDel(), null);
- }
- return jPanelFvImageOptsButtonGroup;
- }
-
- /**
- * This method initializes jButton7
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvImageOptAdd() {
- if (jButtonFvImageOptAdd == null) {
- jButtonFvImageOptAdd = new JButton();
- jButtonFvImageOptAdd.setEnabled(true);
- jButtonFvImageOptAdd.setText("Add");
- jButtonFvImageOptAdd.setPreferredSize(new Dimension(80, 20));
- jButtonFvImageOptAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTextFieldFvImageOptName.getText().length() > 0 && jTextFieldFvImageOptValue.getText().length() > 0){
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
- String[] row = {jTextFieldFvImageOptName.getText(), jTextFieldFvImageOptValue.getText()};
-
- if (fvImagePos < 0) {
- return;
- }
- else {
- //append options to FvImage.
- ffc.setFvImagesFvImageNameValue(fvImagePos, row[0], row[1]);
- }
- docConsole.setSaved(false);
- fvOptionTableModel.addRow(row);
- jTableFvImageOpts.changeSelection(jTableFvImageOpts.getRowCount() - 1, 0, false, false);
- }
- }
- });
- }
- return jButtonFvImageOptAdd;
- }
-
- /**
- * This method initializes jButton8
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvImageOptDel() {
- if (jButtonFvImageOptDel == null) {
- jButtonFvImageOptDel = new JButton();
- jButtonFvImageOptDel.setEnabled(true);
- jButtonFvImageOptDel.setText("Delete");
- jButtonFvImageOptDel.setPreferredSize(new Dimension(80, 20));
- jButtonFvImageOptDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTableFvImageOpts.getSelectedRow() >= 0){
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
- if (fvImagePos < 0) {
- return;
- }
-
- String optName = fvOptionTableModel.getValueAt(jTableFvImageOpts.getSelectedRow(), 0)+"";
- ffc.removeFvImageNameValue(fvImagePos, optName);
- docConsole.setSaved(false);
- fvOptionTableModel.removeRow(jTableFvImageOpts.getSelectedRow());
- }
- }
- });
- }
- return jButtonFvImageOptDel;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(350,100));
- jScrollPane.setViewportView(getJTableFvImageOpts());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable3
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvImageOpts() {
- if (jTableFvImageOpts == null) {
- fvOptionTableModel = new IDefaultTableModel();
- fvOptionTableModel.addColumn("Name");
- fvOptionTableModel.addColumn("Value");
- jTableFvImageOpts = new JTable(fvOptionTableModel);
-
- jTableFvImageOpts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFvImageOpts.setRowHeight(20);
-
- }
- return jTableFvImageOpts;
- }
-
- /**
- * This method initializes jButton9
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonUpdateFvImage() {
- if (jButtonUpdateFvImage == null) {
- jButtonUpdateFvImage = new JButton();
- jButtonUpdateFvImage.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonUpdateFvImage.setActionCommand("Update");
- jButtonUpdateFvImage.setText("Update FV Attributes");
- jButtonUpdateFvImage.setVisible(false);
- jButtonUpdateFvImage.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTableFvInfo.getSelectedRow();
- if (jTableFvInfo.isEditing()) {
- jTableFvInfo.getCellEditor().stopCellEditing();
- }
- if (jTableFvImageOpts.isEditing()) {
- jTableFvImageOpts.getCellEditor().stopCellEditing();
- }
-
- //ToDo Check data validity before update
- String name = fvImageParaTableModel.getValueAt(row, 0) + "";
- String type = fvImageParaTableModel.getValueAt(row, 1) + "";
-
- LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
- getOptionNameValue(lhm);
-
- docConsole.setSaved(false);
- ffc.updateFvImagesFvImage(row, name.split(" "), type, lhm);
-
- }
- });
- }
- return jButtonUpdateFvImage;
- }
-
- /**
- * This method initializes jPanelFdfN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfN() {
- if (jPanelFdfN == null) {
- jPanelFdfN = new JPanel();
- jPanelFdfN.add(getJCheckBoxFdf(), null);
- jPanelFdfN.add(getJTextFieldFdf(), null);
- jPanelFdfN.add(getJButtonFdfBrowse(), null);
- }
- return jPanelFdfN;
- }
-
- /**
- * This method initializes jPanelFdfS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfS() {
- if (jPanelFdfS == null) {
- FlowLayout flowLayout4 = new FlowLayout();
- flowLayout4.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelFdfS = new JPanel();
- jPanelFdfS.setLayout(flowLayout4);
- jPanelFdfS.add(getJButtonAddFv(), null);
- jPanelFdfS.add(getJButtonDelFv(), null);
- jPanelFdfS.add(getJButtonAddFvOptions(), null);
- }
- return jPanelFdfS;
- }
-
- /**
- * This method initializes jSplitPaneFdfC
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPaneFdfC() {
- if (jSplitPaneFdfC == null) {
- jSplitPaneFdfC = new JSplitPane();
- jSplitPaneFdfC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- jSplitPaneFdfC.setDividerSize(5);
- jSplitPaneFdfC.setTopComponent(getJPanelFdfCTop());
- jSplitPaneFdfC.setBottomComponent(getJPanelFdfCBottom());
- jSplitPaneFdfC.setDividerLocation(280);
- }
- return jSplitPaneFdfC;
- }
-
- /**
- * This method initializes jPanelFdfCTop
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCTop() {
- if (jPanelFdfCTop == null) {
- jPanelFdfCTop = new JPanel();
- jPanelFdfCTop.setLayout(new BorderLayout());
- jPanelFdfCTop.add(getJPanelFdfCTopN(), java.awt.BorderLayout.NORTH);
- jPanelFdfCTop.add(getJPanelFdfCTopS(), java.awt.BorderLayout.SOUTH);
- jPanelFdfCTop.add(getJScrollPaneFvInFdf(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFdfCTop;
- }
-
- /**
- * This method initializes jPanelFdfCBottom
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCBottom() {
- if (jPanelFdfCBottom == null) {
- jPanelFdfCBottom = new JPanel();
- jPanelFdfCBottom.setLayout(new BorderLayout());
- jPanelFdfCBottom.add(getJPanelFdfCBottomN(), java.awt.BorderLayout.NORTH);
- jPanelFdfCBottom.add(getJScrollPaneFvAdditional(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFdfCBottom;
- }
-
- /**
- * This method initializes jPanelFdfCTopN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCTopN() {
- if (jPanelFdfCTopN == null) {
- jLabelFvInFdf = new JLabel();
- jLabelFvInFdf.setText("FVs in Flash Definition File");
- jPanelFdfCTopN = new JPanel();
- jPanelFdfCTopN.add(jLabelFvInFdf, null);
- }
- return jPanelFdfCTopN;
- }
-
- /**
- * This method initializes jPanelFdfCTopS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCTopS() {
- if (jPanelFdfCTopS == null) {
- FlowLayout flowLayout1 = new FlowLayout();
- flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelFdfCTopS = new JPanel();
- jPanelFdfCTopS.setLayout(flowLayout1);
- jPanelFdfCTopS.add(getJButtonFvInFdfOptions(), null);
- }
- return jPanelFdfCTopS;
- }
-
- /**
- * This method initializes jPanelFdfCTopC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFdfCTopC() {
-// if (jPanelFdfCTopC == null) {
-// jPanelFdfCTopC = new JPanel();
-// jPanelFdfCTopC.add(getJScrollPaneFvInFdf(), null);
-// }
-// return jPanelFdfCTopC;
-// }
-
- /**
- * This method initializes jPanelFdfCBottomN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCBottomN() {
- if (jPanelFdfCBottomN == null) {
- jLabelFvAdditional = new JLabel();
- jLabelFvAdditional.setText("Additional FVs");
- jPanelFdfCBottomN = new JPanel();
- jPanelFdfCBottomN.add(jLabelFvAdditional, null);
- }
- return jPanelFdfCBottomN;
- }
-
- /**
- * This method initializes jPanelFdfCBottomC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFdfCBottomC() {
-// if (jPanelFdfCBottomC == null) {
-// jPanelFdfCBottomC = new JPanel();
-// jPanelFdfCBottomC.add(getJScrollPaneFvAdditional(), null);
-// }
-// return jPanelFdfCBottomC;
-// }
-
- /**
- * This method initializes jScrollPaneFvInFdf
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvInFdf() {
- if (jScrollPaneFvInFdf == null) {
- jScrollPaneFvInFdf = new JScrollPane();
- jScrollPaneFvInFdf.setPreferredSize(new java.awt.Dimension(653,200));
- jScrollPaneFvInFdf.setViewportView(getJTableFvInFdf());
- }
- return jScrollPaneFvInFdf;
- }
-
- /**
- * This method initializes jTableFvInFdf
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvInFdf() {
- if (jTableFvInFdf == null) {
- jTableFvInFdf = new JTable();
- jTableFvInFdf.setRowHeight(20);
- jTableFvInFdf.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
- jTableFvInFdf.setModel(getFvInFdfTableModel());
- }
- return jTableFvInFdf;
- }
-
- /**
- * This method initializes fvInFdfTableModel
- *
- * @return org.tianocore.frameworkwizard.platform.ui.NonEditableTableModel
- */
- private IDefaultTableModel getFvInFdfTableModel() {
- if (fvInFdfTableModel == null) {
- fvInFdfTableModel = new IDefaultTableModel();
- fvInFdfTableModel.addColumn("FV Name");
- fvInFdfTableModel.addColumn("Size");
- fvInFdfTableModel.addColumn("Corresponding File Name");
- }
- return fvInFdfTableModel;
- }
-
- /**
- * This method initializes jButtonFvInFdfOptions
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvInFdfOptions() {
- if (jButtonFvInFdfOptions == null) {
- jButtonFvInFdfOptions = new JButton();
- jButtonFvInFdfOptions.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonFvInFdfOptions.setEnabled(true);
- jButtonFvInFdfOptions.setText("Options");
- jButtonFvInFdfOptions.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFvInFdf.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvName = jTableFvInFdf.getValueAt(selectedRow, 0)+"";
- if (fvName.length() == 0) {
- return;
- }
- DefaultTableModel dtm = getFvInFdfOptTableModel();
- new FpdFvOptions(fvName, dtm, ffc, docConsole);
- }
- });
- }
- return jButtonFvInFdfOptions;
- }
-
- private DefaultTableModel getFvInFdfOptTableModel() {
- if (fvInFdfOptTableModel == null) {
- fvInFdfOptTableModel = new FvOptsTableModel();
- fvInFdfOptTableModel.addColumn("Name");
- fvInFdfOptTableModel.addColumn("Value");
- Vector<Object> v = new Vector<Object>();
- v.add("EFI_BLOCK_SIZE");
- v.add("EFI_NUM_BLOCKS");
- v.add("EFI_FILE_NAME");
- fvInFdfOptTableModel.setVKeyWords(v);
- fvInFdfOptTableModel.setVNonEditableName(v);
- }
- return fvInFdfOptTableModel;
- }
-
- private DefaultTableModel getFvAdditionalOptTableModel() {
- if (fvAdditionalOptTableModel == null) {
- fvAdditionalOptTableModel = new FvOptsTableModel();
- fvAdditionalOptTableModel.addColumn("Name");
- fvAdditionalOptTableModel.addColumn("Value");
- Vector<Object> v = new Vector<Object>();
- v.add("EFI_BLOCK_SIZE");
- v.add("EFI_NUM_BLOCKS");
- v.add("EFI_FILE_NAME");
- fvAdditionalOptTableModel.setVNonEditableName(v);
- }
- return fvAdditionalOptTableModel;
- }
-
- /**
- * This method initializes jScrollPaneFvAdditional
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvAdditional() {
- if (jScrollPaneFvAdditional == null) {
- jScrollPaneFvAdditional = new JScrollPane();
- jScrollPaneFvAdditional.setPreferredSize(new java.awt.Dimension(653,200));
- jScrollPaneFvAdditional.setViewportView(getJTableFvAdditional());
- }
- return jScrollPaneFvAdditional;
- }
-
- /**
- * This method initializes jTableFvAdditional
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvAdditional() {
- if (jTableFvAdditional == null) {
- jTableFvAdditional = new JTable();
- jTableFvAdditional.setRowHeight(20);
- jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
- jTableFvAdditional.setModel(getFvAdditionalTableModel());
-
- jTableFvAdditional.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRowInFvAdditionalTable = lsm.getMinSelectionIndex();
- oldFvName = jTableFvAdditional.getValueAt(selectedRowInFvAdditionalTable, 0)+"";
- }
- }
- });
-
- jTableFvAdditional.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int col = arg0.getColumn();
- TableModel m = (TableModel) arg0.getSource();
-
- if (arg0.getType() == TableModelEvent.UPDATE) {
- if (col == 0) {
- String newFvName = m.getValueAt(row, 0) + "";
- if (newFvName.equals(oldFvName)) {
- return;
- }
- if (fvNameExists(newFvName)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "This FV already exists. Please choose another FV name.");
- m.setValueAt(oldFvName, row, 0);
- return;
- }
-
- tabIndexForFv = jTabbedPane.indexOfTab(oldFvName);
- if (tabIndexForFv >= startIndexOfDynamicTab) {
- jTabbedPane.setTitleAt(tabIndexForFv, newFvName);
- // change FvName in UserExtensions
- ffc.updateBuildOptionsUserExtensions(oldFvName, newFvName);
- // change FvBinding in ModuleSA
- ffc.appendFvBindingFor(oldFvName, newFvName);
- ffc.removeFvBindingAll(oldFvName);
- // change FvImageNames in Flash
- ffc.updateFvImageNameAll(oldFvName, newFvName);
-
- } else {
- ModuleOrderPane pane = new ModuleOrderPane(newFvName, "", ffc, FpdFlash.this);
- pane.showModulesInFv(newFvName);
- pane.showAllModulesInPlatform();
- jTabbedPane.addTab(newFvName, pane);
- // Add FvImageNames in Flash
- String[] fvNames = {newFvName};
- ffc.addFvImageFvImageNames(fvNames);
- }
- docConsole.setSaved(false);
- oldFvName = newFvName;
- }
-
- if (col == 1 && !sizeFromOptionDlg) {
- String fvSize = m.getValueAt(row, col) + "";
- if (!DataValidation.isInt(fvSize) && !DataValidation.isHexDoubleWordDataType(fvSize)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "FV size should be Integer or Hex format.");
- return;
- }
- HashMap<String, String> mFvOpts = new HashMap<String, String>();
- ffc.getFvImagesFvImageOptions(oldFvName, mFvOpts);
- String blkSize = mFvOpts.get("EFI_BLOCK_SIZE");
- if (blkSize == null) {
- if (determinedFvBlockSize != null) {
- blkSize = determinedFvBlockSize;
- }
- else {
- blkSize = defaultBlkSize;
- }
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", blkSize, null);
- int fs = Integer.decode(fvSize);
- int bs = Integer.decode(blkSize);
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
- docConsole.setSaved(false);
- }
- else {
- if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {
- int retVal = JOptionPane.showConfirmDialog(FpdFlash.this, "Confirm", "FPD file contains error block size format. Would you like to replace it with a default value?", JOptionPane.YES_NO_OPTION);
- if (retVal == JOptionPane.YES_OPTION) {
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", defaultBlkSize, null);
- int fs = Integer.decode(fvSize);
- int bs = Integer.decode(defaultBlkSize);
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
- docConsole.setSaved(false);
- return;
- }
- else {
- return;
- }
-
- }
- int fs = Integer.decode(fvSize);
- int bs = Integer.decode(blkSize);
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
- docConsole.setSaved(false);
- }
- }
-
- if (col == 2 && !fileFromOptionDlg) {
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_FILE_NAME", m.getValueAt(row, col)+"", null);
- docConsole.setSaved(false);
- }
-
- }
- }
- });
- }
- return jTableFvAdditional;
- }
-
- private boolean fvNameExistsInFvInFdfTable (String fvName) {
- for (int i = 0; i < jTableFvInFdf.getRowCount(); ++i) {
- if (fvInFdfTableModel.getValueAt(i, 0).equals(fvName)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean fvNameExists (String fvName) {
- if (fvNameExistsInFvInFdfTable(fvName)) {
- return true;
- }
-
- for (int j = 0; j < jTableFvAdditional.getRowCount(); ++j) {
- if (fvAdditionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * This method initializes fvAdditionalTableModel
- *
- * @return javax.swing.table.DefaultTableModel
- */
- private DefaultTableModel getFvAdditionalTableModel() {
- if (fvAdditionalTableModel == null) {
- fvAdditionalTableModel = new DefaultTableModel();
- fvAdditionalTableModel.addColumn("FV Name");
- fvAdditionalTableModel.addColumn("Size");
- fvAdditionalTableModel.addColumn("Corresponding File Name");
- }
- return fvAdditionalTableModel;
- }
-
- /**
- * This method initializes jButtonAddFv
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddFv() {
- if (jButtonAddFv == null) {
- jButtonAddFv = new JButton();
- jButtonAddFv.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonAddFv.setEnabled(true);
- jButtonAddFv.setText("New");
- jButtonAddFv.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFvAdditional.isEditing()) {
- jTableFvAdditional.getCellEditor().stopCellEditing();
- }
- String[] row = {"", "", ""};
- fvAdditionalTableModel.addRow(row);
- }
- });
- }
- return jButtonAddFv;
- }
-
- /**
- * This method initializes jButtonDelFv
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDelFv() {
- if (jButtonDelFv == null) {
- jButtonDelFv = new JButton();
- jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDelFv.setEnabled(true);
- jButtonDelFv.setText("Delete");
- jButtonDelFv.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- //delete row in FvAdditional table.
- int selectedRow = jTableFvAdditional.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvName = fvAdditionalTableModel.getValueAt(selectedRow, 0) + "";
- fvAdditionalTableModel.removeRow(selectedRow);
- //
- //delete tab with selected FV name.
- //
- jTabbedPane.removeTabAt(jTabbedPane.indexOfTab(fvName));
- //delete FV Name from FvImages element.
- ffc.updateFvImageNameAll(fvName, null);
- //delete FvBinding from ModuleSA.
- ffc.removeFvBindingAll(fvName);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonDelFv;
- }
-
- /**
- * This method initializes jButtonAddFvOptions
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddFvOptions() {
- if (jButtonAddFvOptions == null) {
- jButtonAddFvOptions = new JButton();
- jButtonAddFvOptions.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonAddFvOptions.setEnabled(true);
- jButtonAddFvOptions.setText("Options");
- jButtonAddFvOptions.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFvAdditional.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvName = jTableFvAdditional.getValueAt(selectedRow, 0)+"";
- String oldFvSize = jTableFvAdditional.getValueAt(selectedRow, 1)+"";
- String oldFileName = jTableFvAdditional.getValueAt(selectedRow, 2)+"";
- if (fvName.length() == 0) {
- return;
- }
- DefaultTableModel dtm = getFvAdditionalOptTableModel();
- new FpdFvOptions(fvName, dtm, ffc, docConsole);
-
- String[] updatedFvInfo = getBasicFvInfo (fvName);
- if (!oldFvSize.equalsIgnoreCase(updatedFvInfo[1])) {
- sizeFromOptionDlg = true;
- jTableFvAdditional.setValueAt(updatedFvInfo[1], selectedRow, 1);
- sizeFromOptionDlg = false;
- }
- if (!oldFileName.equals(updatedFvInfo[2])) {
- fileFromOptionDlg = true;
- jTableFvAdditional.setValueAt(updatedFvInfo[2], selectedRow, 2);
- fileFromOptionDlg = false;
- }
- }
- });
- }
- return jButtonAddFvOptions;
- }
-
- private String[] getBasicFvInfo (String fvName) {
- HashMap<String, String> mFvOpts = new HashMap<String, String>();
- ffc.getFvImagesFvImageOptions(fvName, mFvOpts);
- String bSize = "";
- String numBlks = "";
- String fvSize = "";
- String fvFile = "";
- if (mFvOpts.get("EFI_FILE_NAME") != null) {
- fvFile = mFvOpts.get("EFI_FILE_NAME");
- }
- if (mFvOpts.get("EFI_BLOCK_SIZE") != null && mFvOpts.get("EFI_NUM_BLOCKS") != null) {
- bSize = mFvOpts.get("EFI_BLOCK_SIZE");
- numBlks = mFvOpts.get("EFI_NUM_BLOCKS");
- boolean blockSizeWellFormat = true;
- boolean numOfBlockWellFormat = true;
- if (!DataValidation.isHexDoubleWordDataType(bSize) && !DataValidation.isInt(bSize)) {
- blockSizeWellFormat = false;
- JOptionPane.showMessageDialog(FpdFlash.this, fvName + " block size bad format.");
- }
- if (!DataValidation.isHexDoubleWordDataType(numBlks) && !DataValidation.isInt(numBlks)) {
- numOfBlockWellFormat = false;
- JOptionPane.showMessageDialog(FpdFlash.this, fvName + " number of blocks bad format.");
- }
- if (blockSizeWellFormat && numOfBlockWellFormat) {
- int size = Integer.decode(bSize);
- int num = Integer.decode(numBlks);
- fvSize = "0x" + Integer.toHexString(size*num);
- }
- }
-
- return new String[]{fvName, fvSize, fvFile};
-
- }
-
- /**
- * This method initializes jPanelBgFvName
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelBgFvName() {
- if (jPanelBgFvName == null) {
- jPanelBgFvName = new JPanel();
- jPanelBgFvName.setPreferredSize(new java.awt.Dimension(80,55));
- jPanelBgFvName.add(getJButtonFvNameAdd(), null);
- jPanelBgFvName.add(getJButtonFvNameDel(), null);
- }
- return jPanelBgFvName;
- }
-
- /**
- * This method initializes jPanelBgFvImage
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelBgFvImage() {
- if (jPanelBgFvImage == null) {
- jPanelBgFvImage = new JPanel();
- jPanelBgFvImage.setPreferredSize(new java.awt.Dimension(150,100));
- jPanelBgFvImage.add(getJButtonAddFvImage(), null);
- jPanelBgFvImage.add(getJButtonDelFvImage(), null);
- jPanelBgFvImage.add(getJButtonUpdateFvImage(), null);
- }
- return jPanelBgFvImage;
- }
-
- /**
- * This method initializes jPanelW
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelW() {
- if (jPanelW == null) {
- jPanelW = new JPanel();
- jPanelW.add(getJPanelBgFvImage(), null);
- }
- return jPanelW;
- }
-
- /**
- * This method initializes jPanelFvImageParaN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageParaN() {
- if (jPanelFvImageParaN == null) {
- FlowLayout flowLayout3 = new FlowLayout();
- flowLayout3.setAlignment(java.awt.FlowLayout.CENTER);
- jPanelFvImageParaN = new JPanel();
- jPanelFvImageParaN.setLayout(flowLayout3);
- jPanelFvImageParaN.add(new StarLabel(), null);
- jPanelFvImageParaN.add(jLabelFvImageNames, null);
- jPanelFvImageParaN.add(jLabelFvParaName, null);
- jPanelFvImageParaN.add(getJTextFieldFvParaName(), null);
- }
- return jPanelFvImageParaN;
- }
-
- /**
- * This method initializes jPanelFvImageParaS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageParaS() {
- if (jPanelFvImageParaS == null) {
- FlowLayout flowLayout6 = new FlowLayout();
- flowLayout6.setAlignment(java.awt.FlowLayout.CENTER);
- jPanelFvImageParaS = new JPanel();
- jPanelFvImageParaS.setLayout(flowLayout6);
- jPanelFvImageParaS.add(jLabelFvParaType, null);
- jPanelFvImageParaS.add(getJComboBoxFvParaType(), null);
- }
- return jPanelFvImageParaS;
- }
-
- /**
- * This method initializes jPanelFvImageParaC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFvImageParaC() {
-// if (jPanelFvImageParaC == null) {
-// jPanelFvImageParaC = new JPanel();
-// jPanelFvImageParaC.add(getJScrollPaneFvImageNames(), null);
-// }
-// return jPanelFvImageParaC;
-// }
-
- /**
- * This method initializes jPanelFvImageOptsN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsN() {
- if (jPanelFvImageOptsN == null) {
- jPanelFvImageOptsN = new JPanel();
- jPanelFvImageOptsN.add(jLabelOptions, null);
- jPanelFvImageOptsN.add(jLabelFvImageOptName, null);
- jPanelFvImageOptsN.add(getJTextFieldFvImageOptName(), null);
- jPanelFvImageOptsN.add(jLabelFvImageOptValue, null);
- jPanelFvImageOptsN.add(getJTextFieldFvImageOptValue(), null);
- }
- return jPanelFvImageOptsN;
- }
-
- /**
- * This method initializes jPanelFvImageOptsS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsS() {
- if (jPanelFvImageOptsS == null) {
- jPanelFvImageOptsS = new JPanel();
- }
- return jPanelFvImageOptsS;
- }
-
- /**
- * This method initializes jPanelFvImageOptsC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFvImageOptsC() {
-// if (jPanelFvImageOptsC == null) {
-// jPanelFvImageOptsC = new JPanel();
-// jPanelFvImageOptsC.add(getJScrollPane(), null);
-// }
-// return jPanelFvImageOptsC;
-// }
-
- /**
- * This method initializes jPanelFvImageParaE
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageParaE() {
- if (jPanelFvImageParaE == null) {
- jPanelFvImageParaE = new JPanel();
- jPanelFvImageParaE.add(getJPanelBgFvName(), null);
- }
- return jPanelFvImageParaE;
- }
-
- /**
- * This method initializes jPanelFvImageOptsE
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsE() {
- if (jPanelFvImageOptsE == null) {
- jPanelFvImageOptsE = new JPanel();
- jPanelFvImageOptsE.add(getJPanelFvImageOptsButtonGroup(), null);
- }
- return jPanelFvImageOptsE;
- }
-
- /**
- * This method initializes jPanelFvImageSN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageSN() {
- if (jPanelFvImageSN == null) {
- jPanelFvImageSN = new JPanel();
- jPanelFvImageSN.add(getJCheckBoxFvProperty(), null);
- jPanelFvImageSN.add(jLabelFvPropName, null);
- jPanelFvImageSN.add(getJTextFieldFvPropName(), null);
- jPanelFvImageSN.add(jLabelFvPropValue, null);
- jPanelFvImageSN.add(getJTextFieldFvPropValue(), null);
- }
- return jPanelFvImageSN;
- }
-
- /**
- * This method initializes jPanelFvImageSE
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageSE() {
- if (jPanelFvImageSE == null) {
- jPanelFvImageSE = new JPanel();
- jPanelFvImageSE.add(getJPanelFvPropButtonGroup(), null);
- }
- return jPanelFvImageSE;
- }
-
- /**
- * This method initializes jPanelFvImageSS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageSS() {
- if (jPanelFvImageSS == null) {
- jPanelFvImageSS = new JPanel();
- }
- return jPanelFvImageSS;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- new FpdFlash().setVisible(true);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(660, 650);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setContentPane(getJContentPane());
- this.setTitle("FPD Flash Definitions");
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTableFvProp.isEditing()) {
- jTableFvProp.getCellEditor().stopCellEditing();
- }
- if (jTableFvImageNames.isEditing()) {
- jTableFvImageNames.getCellEditor().stopCellEditing();
- }
- if (jTableFvInfo.isEditing()) {
- jTableFvInfo.getCellEditor().stopCellEditing();
- }
- if (jTableFvAdditional.isEditing()) {
- jTableFvAdditional.getCellEditor().stopCellEditing();
- }
- }
- });
- }
-
- private void init(FpdFileContents ffc) {
- initFvAttributes();
-
- jTextFieldFdf.setText("");
- String fdfFile = ffc.getFlashDefinitionFile();
- if (fdfFile != null && fdfFile.length() > 0) {
- jCheckBoxFdf.setSelected(true);
- jTextFieldFdf.setText(fdfFile);
- String fdfPath = Workspace.getCurrentWorkspace() + File.separator + fdfFile;
- initFvInFdfTable(fdfPath);
- }
-
- initFvAdditionalTable();
- }
-
- private void getOptionNameValue(Map<String, String> m){
- for (int i = 0; i < jTableFvImageOpts.getRowCount(); ++i) {
- m.put(fvOptionTableModel.getValueAt(i, 0)+"", fvOptionTableModel.getValueAt(i, 1)+"");
- }
- }
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
- jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
- jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- private void getFlashInfoFromFdf (String fdfPath) {
- File fdf = new File(fdfPath);
- if (!fdf.exists()) {
- return;
- }
- int lines = 0;
-
- try {
- FileReader reader = new FileReader(fdf);
- BufferedReader in = new BufferedReader(reader);
- String str;
-
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
- //
- // ErasePolarity
- //
- if (str.startsWith("ErasePolarity")) {
- erasePolarity = str.substring(str.indexOf("=") + 1, str.lastIndexOf(",")).trim();
- }
- //
- // dig into Block section.
- //
- if (str.startsWith("Block") && str.endsWith("}")) {
- String[] blockSec = str.split(",");
- String nv = blockSec[1].trim();
- String[] sizeSec = nv.split("=");
- vBlockSize.add(sizeSec[1].trim());
- }
-
- }
-
- reader.close();
- in.close();
- }
- catch (Exception e) {
-
- }
- }
-
- private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) {
- File fdf = new File(fdfPath);
- if (!fdf.exists()) {
- return;
- }
- int lines = 0;
-
- try {
- FileReader reader = new FileReader(fdf);
- BufferedReader in = new BufferedReader(reader);
- String str;
-
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
- //
- // dig into Region {} section, create FvInfoFromFdf object for it.
- //
- if (str.startsWith("Region") && str.endsWith("{")) {
- FvInfoFromFdf fvInfo = new FvInfoFromFdf();
- boolean nameFound = false;
- boolean sizeFound = false;
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
-
- if (str.startsWith("Name")) {
- int firstQuote = str.indexOf("\"");
- int lastQuote = str.lastIndexOf("\"");
- fvInfo.setFvName(str.substring(firstQuote + 1, lastQuote));
- nameFound = true;
- }
-
- if (str.startsWith("Size")) {
- int equalIndex = str.indexOf("=");
- int commaIndex = str.indexOf(",");
- fvInfo.setSize(str.substring(equalIndex + 1, commaIndex).trim());
- sizeFound = true;
- }
-
- if (nameFound && sizeFound) {
- break;
- }
- }
-
- vFvInfo.add(fvInfo);
- }
- //
- // dig into File {} section, supply file name information to existing FvInfoFromFdf object.
- //
- if (str.startsWith("File")) {
- boolean fileNameFound = false;
- boolean fvFound = false;
- String fileName = "";
- String fvName = "";
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
-
- if (str.startsWith("Name")) {
- int firstQuote = str.indexOf("\"");
- int lastQuote = str.lastIndexOf("\"");
- fileName = str.substring(firstQuote + 1, lastQuote);
- fileNameFound = true;
- }
-
- if (str.startsWith("Region")) {
- int firstQuote = str.indexOf("\"");
- int lastQuote = str.lastIndexOf("\"");
- fvName = str.substring(firstQuote + 1, lastQuote);
- fvFound = true;
- }
-
- if (fileNameFound && fvFound) {
- break;
- }
- }
-
- for (int i = 0; i <vFvInfo.size(); ++i) {
- if (vFvInfo.get(i).getFvName().equals(fvName)) {
- vFvInfo.get(i).setEfiFileName(fileName);
- }
- }
- }
-
- }
-
- reader.close();
- in.close();
- }
- catch (Exception e) {
-
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.tianocore.frameworkwizard.common.ui.IInternalFrame#actionPerformed(java.awt.event.ActionEvent)
- */
- @Override
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
- docConsole.setSaved(false);
- jTabbedPane.setSelectedIndex(0);
- }
- else if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) {
- jTabbedPane.setSelectedIndex(0);
- }
- else {
- return;
- }
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class ModuleOrderPane extends JPanel implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JPanel jPanelModOrderN = null;
- private JPanel jPanelModOrderS = null;
- private JPanel jPanelModOrderC = null;
- private JScrollPane jScrollPaneModInFv = null;
- private JTable jTableModInFv = null;
- private JPanel jPanelController = null;
- private JScrollPane jScrollPaneFpdModules = null;
- private JTable jTableFpdModules = null;
- private JButton jButtonUp = null;
- private JButton jButtonInsert = null;
- private JButton jButtonRemove = null;
- private JButton jButtonDown = null;
- private JButton jButtonOk = null;
- private JButton jButtonCancel = null;
- private IDefaultTableModel modInFvTableModel = null;
- private IDefaultTableModel fpdModTableModel = null;
- private FpdFileContents ffc = null;
- private String title = null;
- private String outputFileName = null;
-
- public ModuleOrderPane(String tabTitle, String file, FpdFileContents inputFfc, ActionListener action) {
- super(new BorderLayout());
- title = tabTitle;
- outputFileName = file;
- ffc = inputFfc;
- add(getJPanelModOrderN(), java.awt.BorderLayout.NORTH);
- add(getJPanelModOrderS(), java.awt.BorderLayout.SOUTH);
- add(getJPanelModOrderC(), java.awt.BorderLayout.CENTER);
- jButtonOk.addActionListener(action);
- jButtonCancel.addActionListener(action);
-
- }
-
- public void showModulesInFv(String fvName) {
-
- if (modInFvTableModel == null) {
- return;
- }
- int size = ffc.getUserExtsIncModCount(fvName, "IMAGES", "1");
-
- if (size != -1) {
- String[][] saa = new String[size][5];
- ffc.getUserExtsIncMods(fvName, "IMAGES", "1", saa);
-
- for (int i = 0; i < size; ++i) {
- String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
-
- String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
- modInFvTableModel.addRow(row);
- }
- }
- //
- // From ModuleSAs, get module guids with FvBinding = fvName.
- //
- Vector<String[]> vModuleSA = new Vector<String[]>();
- ffc.getFrameworkModuleSAByFvBinding(fvName, vModuleSA);
- //
- // If BuildOptions->UserExtensions already contain these module info,
- // no need to add them into table again.
- //
- Iterator<String[]> iter = vModuleSA.iterator();
- while (iter.hasNext()){
- String[] sa = iter.next();
- if (!moduleInfoInTable (sa, modInFvTableModel)) {
- String moduleKey = sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
- String[] row = { name, sa[0] , sa[1], sa[2] , sa[3], sa[4] };
- modInFvTableModel.addRow(row);
- }
- }
-
- }
-
- public void showAllModulesInPlatform() {
-
- if (modInFvTableModel == null || fpdModTableModel == null) {
- return;
- }
- int size = ffc.getFrameworkModulesCount();
- String[][] saa = new String[size][5];
- ffc.getFrameworkModulesInfo(saa);
-
- for (int i = 0; i < size; ++i) {
- if (moduleInfoInTable(saa[i], modInFvTableModel) || moduleInfoInTable(saa[i], fpdModTableModel)) {
- continue;
- }
- String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
- String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
- fpdModTableModel.addRow(row);
- }
-
- TableSorter sorter = (TableSorter)jTableFpdModules.getModel();
- sorter.setSortState(0, TableSorter.ASCENDING);
- }
-
-
- protected boolean moduleInfoInTable (String[] moduleInfo, DefaultTableModel model) {
- boolean matched = false;
- int size = model.getDataVector().size();
- for (int i = 0; i < size; ++i) {
- Vector rowData = (Vector)model.getDataVector().elementAt(i);
- for (int j = 1; j < rowData.size(); ++j) {
- if (rowData.elementAt(j) == null && moduleInfo[j-1] == null) {
- matched = true;
- }
- else if (rowData.elementAt(j).equals("null") && moduleInfo[j-1] == null) {
- matched = true;
- }
- else if (rowData.elementAt(j) == null && moduleInfo[j-1].equals("null")) {
- matched = true;
- }
- else if (rowData.elementAt(j) != null && rowData.elementAt(j).toString().equalsIgnoreCase(moduleInfo[j-1])) {
- matched = true;
- }
- else {
- matched = false;
- break;
- }
- }
-
- if (matched) {
- return true;
- }
-
- }
- return false;
- }
-
-
-
- /**
- * This method initializes jPanelModOrderN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModOrderN() {
- if (jPanelModOrderN == null) {
- jPanelModOrderN = new JPanel();
- }
- return jPanelModOrderN;
- }
-
- /**
- * This method initializes jPanelModOrderS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModOrderS() {
- if (jPanelModOrderS == null) {
- FlowLayout flowLayout6 = new FlowLayout();
- flowLayout6.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelModOrderS = new JPanel();
- jPanelModOrderS.setLayout(flowLayout6);
- jPanelModOrderS.add(getJButtonOk(), null);
- jPanelModOrderS.add(getJButtonCancel(), null);
- }
- return jPanelModOrderS;
- }
-
- /**
- * This method initializes jPanelModOrderC
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModOrderC() {
- if (jPanelModOrderC == null) {
- jPanelModOrderC = new JPanel();
- jPanelModOrderC.add(getJScrollPaneModInFv(), null);
- jPanelModOrderC.add(getJPanelController(), null);
- jPanelModOrderC.add(getJScrollPaneFpdModules(), null);
- }
- return jPanelModOrderC;
- }
-
- /**
- * This method initializes jScrollPaneModInFv
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneModInFv() {
- if (jScrollPaneModInFv == null) {
- jScrollPaneModInFv = new JScrollPane();
- jScrollPaneModInFv.setPreferredSize(new java.awt.Dimension(200,500));
- jScrollPaneModInFv.setViewportView(getJTableModInFv());
- }
- return jScrollPaneModInFv;
- }
-
- /**
- * This method initializes jTableModInFv
- *
- * @return javax.swing.JTable
- */
- protected JTable getJTableModInFv() {
- if (jTableModInFv == null) {
- modInFvTableModel = new IDefaultTableModel();
-
- jTableModInFv = new JTable(modInFvTableModel){
- /**
- *
- */
- private static final long serialVersionUID = 4903583933542581721L;
-
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
-// int colIndex = columnAtPoint(p);
-// int realColumnIndex = convertColumnIndexToModel(colIndex);
-
- TableModel model = getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- String arch = (String) model.getValueAt(rowIndex, 5);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- if (mi != null) {
- tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";";
- }
- else {
- tip = "No Module Path Information.";
- }
-
- return tip;
- }
-
- };
- modInFvTableModel.addColumn("Module Orders in FV");
- modInFvTableModel.addColumn("mg");
- modInFvTableModel.addColumn("mv");
- modInFvTableModel.addColumn("pg");
- modInFvTableModel.addColumn("pv");
- modInFvTableModel.addColumn("arch");
-
- for (int i = 1; i < 6; ++i) {
- jTableModInFv.removeColumn(jTableModInFv.getColumnModel().getColumn(jTableModInFv.getColumnCount()-1));
- }
-
- jTableModInFv.setRowHeight(20);
- jTableModInFv.setShowGrid(false);
- jTableModInFv.setAutoCreateColumnsFromModel(false);
- jTableModInFv.addMouseListener(new MouseAdapter() {
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
- */
- @Override
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getButton() == MouseEvent.BUTTON3) {
- java.awt.Point p = arg0.getPoint();
- int rowIndex = jTableModInFv.rowAtPoint(p);
- TableModel model = jTableModInFv.getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- if (mi != null) {
- details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- }
- JOptionPane.showMessageDialog(ModuleOrderPane.this, details);
- }
- }
-
- });
- }
- return jTableModInFv;
- }
-
- /**
- * This method initializes jPanelController
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelController() {
- if (jPanelController == null) {
- FlowLayout flowLayout5 = new FlowLayout();
- flowLayout5.setVgap(50);
- flowLayout5.setHgap(50);
- jPanelController = new JPanel();
- jPanelController.setLayout(flowLayout5);
- jPanelController.setPreferredSize(new java.awt.Dimension(150,500));
- jPanelController.add(getJButtonUp(), null);
- jPanelController.add(getJButtonInsert(), null);
- jPanelController.add(getJButtonRemove(), null);
- jPanelController.add(getJButtonDown(), null);
- }
- return jPanelController;
- }
-
- /**
- * This method initializes jScrollPaneFpdModules
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFpdModules() {
- if (jScrollPaneFpdModules == null) {
- jScrollPaneFpdModules = new JScrollPane();
- jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(200,500));
- jScrollPaneFpdModules.setViewportView(getJTableFpdModules());
- }
- return jScrollPaneFpdModules;
- }
-
- /**
- * This method initializes jTableFpdModules
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFpdModules() {
- if (jTableFpdModules == null) {
- fpdModTableModel = new IDefaultTableModel();
- TableSorter sorter = new TableSorter(fpdModTableModel);
- jTableFpdModules = new JTable(sorter){
- /**
- *
- */
- private static final long serialVersionUID = -4666296888377637808L;
-
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
-// int colIndex = columnAtPoint(p);
-// int realColumnIndex = convertColumnIndexToModel(colIndex);
-
- TableModel model = getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- String arch = (String) model.getValueAt(rowIndex, 5);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- if (mi != null) {
- tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";";
- }
- else {
- tip = "No Module Path Information.";
- }
-
- return tip;
- }
-
- };
-
- fpdModTableModel.addColumn("Modules in Platform");
- fpdModTableModel.addColumn("mg");
- fpdModTableModel.addColumn("mv");
- fpdModTableModel.addColumn("pg");
- fpdModTableModel.addColumn("pv");
- fpdModTableModel.addColumn("arch");
-
- for (int i = 1; i < 6; ++i) {
- jTableFpdModules.removeColumn(jTableFpdModules.getColumnModel().getColumn(jTableFpdModules.getColumnCount()-1));
- }
- jTableFpdModules.setRowHeight(20);
- jTableFpdModules.setShowGrid(false);
- jTableFpdModules.setAutoCreateColumnsFromModel(false);
- jTableFpdModules.addMouseListener(new MouseAdapter() {
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
- */
- @Override
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getButton() == MouseEvent.BUTTON3) {
- java.awt.Point p = arg0.getPoint();
- int rowIndex = jTableFpdModules.rowAtPoint(p);
- TableModel model = jTableFpdModules.getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- if (mi != null) {
- details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- }
- JOptionPane.showMessageDialog(ModuleOrderPane.this, details);
- }
- }
-
- });
-
- }
- return jTableFpdModules;
- }
-
- /**
- * This method initializes jButtonUp
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonUp() {
- if (jButtonUp == null) {
- jButtonUp = new JButton();
- jButtonUp.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonUp.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
- jButtonUp.setText("^");
- jButtonUp.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableModInFv.getSelectedRow();
- if (selectedRow <= 0) {
- return;
- }
- modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow - 1);
- jTableModInFv.changeSelection(selectedRow - 1, 0, false, false);
- }
- });
- }
- return jButtonUp;
- }
-
- /**
- * This method initializes jButtonInsert
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonInsert() {
- if (jButtonInsert == null) {
- jButtonInsert = new JButton();
- jButtonInsert.setText("<");
- jButtonInsert.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonInsert.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRowRight = jTableFpdModules.getSelectedRow();
- if (selectedRowRight < 0) {
- return;
- }
-
- int rowInModel = ((TableSorter)jTableFpdModules.getModel()).getModelRowIndex(selectedRowRight);
- String name = fpdModTableModel.getValueAt(rowInModel, 0)+"";
- String mg = fpdModTableModel.getValueAt(rowInModel, 1)+"";
- String mv = fpdModTableModel.getValueAt(rowInModel, 2)+"";
- String pg = fpdModTableModel.getValueAt(rowInModel, 3)+"";
- String pv = fpdModTableModel.getValueAt(rowInModel, 4)+"";
- String arch = fpdModTableModel.getValueAt(rowInModel, 5)+"";
- String[] row = {name, mg, mv, pg, pv, arch};
- if (name.length() == 0 || name.equals("N/A")) {
- return;
- }
-
- int selectedRowLeft = jTableModInFv.getSelectedRow();
- if (selectedRowLeft < 0) {
- modInFvTableModel.addRow(row);
- jTableModInFv.changeSelection(jTableModInFv.getRowCount() - 1, 0, false, false);
- }
- else {
- modInFvTableModel.insertRow(selectedRowLeft, row);
- jTableModInFv.changeSelection(selectedRowLeft, 0, false, false);
- }
- fpdModTableModel.removeRow(rowInModel);
- }
- });
- }
- return jButtonInsert;
- }
-
- /**
- * This method initializes jButtonRemove
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonRemove.setText(">");
- jButtonRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRowLeft = jTableModInFv.getSelectedRow();
- if (selectedRowLeft < 0) {
- return;
- }
-
- String name = modInFvTableModel.getValueAt(selectedRowLeft, 0)+"";
- String mg = modInFvTableModel.getValueAt(selectedRowLeft, 1)+"";
- String mv = modInFvTableModel.getValueAt(selectedRowLeft, 2)+"";
- String pg = modInFvTableModel.getValueAt(selectedRowLeft, 3)+"";
- String pv = modInFvTableModel.getValueAt(selectedRowLeft, 4)+"";
- String arch = modInFvTableModel.getValueAt(selectedRowLeft, 5)+"";
- String[] row = {name, mg, mv, pg, pv, arch};
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- if (name.length() == 0 || name.equals("N/A") || ffc.getModuleSA(moduleKey) == null) {
- JOptionPane.showMessageDialog(ModuleOrderPane.this, "Module " + name + " not exists in platform. If you want to add back this module, please first add it into current platform. " + moduleKey );
- modInFvTableModel.removeRow(selectedRowLeft);
- return;
- }
-
- fpdModTableModel.addRow(row);
- int viewIndex = ((TableSorter) jTableFpdModules.getModel()).getViewIndexArray()[jTableFpdModules
- .getRowCount() - 1];
- jTableFpdModules.changeSelection(viewIndex, 0, false, false);
- modInFvTableModel.removeRow(selectedRowLeft);
- }
- });
- }
- return jButtonRemove;
- }
-
- /**
- * This method initializes jButtonDown
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDown() {
- if (jButtonDown == null) {
- jButtonDown = new JButton();
- jButtonDown.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonDown.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
- jButtonDown.setText("v");
- jButtonDown.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableModInFv.getSelectedRow();
- if (selectedRow >= jTableModInFv.getRowCount() - 1) {
- return;
- }
- modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow + 1);
- jTableModInFv.changeSelection(selectedRow + 1, 0, false, false);
- }
- });
- }
- return jButtonDown;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- */
- protected JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("ModuleOrderPaneOk");
- jButtonOk.addActionListener(this);
-
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- protected JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setActionCommand("ModuleOrderPaneCancel");
-
- }
- return jButtonCancel;
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- // need reset FvBindings in ModuleSA.
- ffc.removeFvBindingAll(title);
- //
- // collect module order information to store them into <BuildOptions> -> <UserExtensions>.
- // also update the FvBinding info in <ModuleSA>.
- //
- Vector<String[]> vModInFv = new Vector<String[]>();
- for (int i = 0; i < jTableModInFv.getRowCount(); ++i) {
- String moduleName = modInFvTableModel.getValueAt(i, 0)+"";
- if (moduleName.length() == 0 || moduleName.equals("N/A")) {
- continue;
- }
-
- String mg = modInFvTableModel.getValueAt(i, 1)+"";
- String mv = modInFvTableModel.getValueAt(i, 2)+"";
- String pg = modInFvTableModel.getValueAt(i, 3)+"";
- String pv = modInFvTableModel.getValueAt(i, 4)+"";
- String arch = modInFvTableModel.getValueAt(i, 5)+"";
-
- String moduleInfo = mg + " " + mv + " " + pg + " " + pv + " " + arch;
-
- String[] sa = { mg, mv, pg, pv, arch};
- vModInFv.add(sa);
- ffc.updateFvBindingInModuleSA(moduleInfo, title);
-
- }
- ffc.removeBuildOptionsUserExtensions(title, "IMAGES", "1");
- ffc.genBuildOptionsUserExtensions(title, "IMAGES", "1", outputFileName, vModInFv);
-
- }
- }
-
- /**
- * @return Returns the fpdModTableModel.
- */
- protected IDefaultTableModel getFpdModTableModel() {
- return fpdModTableModel;
- }
-
- /**
- * @return Returns the modInFvTableModel.
- */
- protected IDefaultTableModel getModInFvTableModel() {
- return modInFvTableModel;
- }
-}
-
-
-class FvOptsTableModel extends DefaultTableModel {
-
- private static final long serialVersionUID = 1L;
-
- private Vector<Object> vNonEditableName = new Vector<Object>();
- private Vector<Object> vKeyWords = new Vector<Object>();
-
- public boolean isCellEditable(int row, int col) {
-
- if (vNonEditableName.size() > 0 || vKeyWords.size() > 0) {
- if (vKeyWords.contains(getValueAt(row, 0))) {
- return false;
- }
- if (vNonEditableName.contains(getValueAt(row, 0)) && col == 0) {
- return false;
- }
- }
-
- if (col == 0 && getValueAt(row, 0) != null && getValueAt(row, 0).toString().length() > 0) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @return Returns the vKeyWords.
- */
- protected Vector<Object> getVKeyWords() {
- return vKeyWords;
- }
-
- /**
- * @param keyWords The vKeyWords to set.
- */
- protected void setVKeyWords(Vector<Object> keyWords) {
- vKeyWords.removeAllElements();
- vKeyWords.addAll(keyWords);
- }
-
- /**
- * @return Returns the vNonEditableName.
- */
- protected Vector<Object> getVNonEditableName() {
- return vNonEditableName;
- }
-
- /**
- * @param nonEditableName The vNonEditableName to set.
- */
- protected void setVNonEditableName(Vector<Object> nonEditableName) {
- vNonEditableName.removeAllElements();
- vNonEditableName.addAll(nonEditableName);
- }
-
-}
-class ImageParaTableModel extends DefaultTableModel {
-
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
-// if (getValueAt(row, 1).equals("ImageName") && col >=1) {
-// return false;
-// }
-// return true;
- return false;
- }
-}
-
-class FvInfoFromFdf {
- private String fvName;
- private String size;
- private String efiFileName;
-
- public FvInfoFromFdf () {
- fvName = "";
- size = "";
- efiFileName = "";
- }
- public FvInfoFromFdf (String f, String s, String e) {
- this();
- fvName = f;
- size = s;
- efiFileName = e;
- }
- public String getEfiFileName() {
- return efiFileName;
- }
- public void setEfiFileName(String efiFileName) {
- this.efiFileName = efiFileName;
- }
- public String getFvName() {
- return fvName;
- }
- public void setFvName(String fvName) {
- this.fvName = fvName;
- }
- public String getSize() {
- return size;
- }
- public void setSize(String size) {
- this.size = size;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
deleted file mode 100644
index ae5fce8340..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
+++ /dev/null
@@ -1,1084 +0,0 @@
-/** @file
-
- The file is used to create, update FrameworkModules of Fpd file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JSplitPane;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.TableModelEvent;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
-
-public class FpdFrameworkModules extends IInternalFrame {
-
- /**
- * Initialize Globals
- */
- private static final long serialVersionUID = 1L;
-
- private static final int timeToWait = 2000;
-
- private static final int pcdSyncThreadNumber = 10;
-
- private long savedMs = 0;
-
- String searchField = "";
-
- public static final int forceDbgColForFpdModTable = 7;
-
- private JSplitPane jSplitPane = null;
-
- private JPanel jPanelTop = null;
-
- private JPanel jPanelBottom = null;
-
- private JLabel jLabel = null;
-
- private JScrollPane jScrollPaneAllModules = null;
-
- private JTable jTableAllModules = null;
-
- private JPanel jPanelTopSouth = null;
-
- private JButton jButtonAddModule = null;
-
- private JLabel jLabelModulesAdded = null;
-
- private JPanel jPanelBottomSouth = null;
-
- private JScrollPane jScrollPaneFpdModules = null;
-
- private JTable jTableFpdModules = null;
-
- private JButton jButtonSettings = null;
-
- private JButton jButtonRemoveModule = null;
-
- private NonEditableTableModel modelAllModules = null;
-
- private FpdModulesTableModel modelFpdModules = null;
-
- private FpdModuleSA settingDlg = null;
-
- private FpdFileContents ffc = null;
-
- private OpeningPlatformType docConsole = null;
-
- private Map<String, ArrayList<String>> fpdMsa = null;
-
- private ArrayList<ModuleIdentification> miList = null;
-
- /**
- * Column settings for displaying all modules in workspace
- */
- private final int modNameColForAllModTable = 0;
-
- private final int pkgNameColForAllModTable = 1;
-
- private final int pathColForAllModTable = 2;
-
- private final int typeColForAllModTable = 3;
-
- private final int pkgVerColForAllModTable = 5;
-
- private final int modVerColForAllModTable = 4;
-
- /**
- * Column settings for display modules in the FPD file
- */
- private final int modNameColForFpdModTable = 0;
-
- private final int pkgNameColForFpdModTable = 1;
-
- private final int pathColForFpdModTable = 2;
-
- private final int archColForFpdModTable = 3;
-
- private final int pkgVerColForFpdModTable = 6;
-
- private final int modVerColForFpdModTable = 5;
-
- private final int typeColForFpdModTable = 4;
-
- /**
- * FpdFileContents structure
- */
- private final int ffcModGuid = 0;
-
- private final int ffcModVer = 1;
-
- private final int ffcPkgGuid = 2;
-
- private final int ffcPkgVer = 3;
-
- private final int ffcModArch = 4;
-
- /**
- * Set Column Widths, Only the PATH should not have a max width.
- */
- private final int modNameMinWidth = 168;
-
- private final int modNamePrefWidth = 200;
-
- private final int modNameMaxWidth = 350;
-
- private final int pkgNameMinWidth = 100;
-
- private final int pkgNamePrefWidth = 130;
-
- private final int pkgNameMaxWidth = 150;
-
- private final int verMinWidth = 60;
-
- private final int verMaxWidth = 80;
-
- private final int verPrefWidth = 70;
-
- private final int pathPrefWidth = 600;
-
- private final int pathMinWidth = 280;
-
- private final int archPrefWidth = 80;
-
- private final int archMinWidth = 60;
-
- private final int archMaxWidth = 100;
-
- private final int typePrefWidth = 145;
-
- private final int typeMinWidth = 100;
-
- private final int typeMaxWidth = 155;
-
- private JButton jButtonApriori = null;
-
- /**
- * This method initializes jSplitPane
- *
- * This is the main edit window
- *
- * @return javax.swing.JSplitPane jSplitPane
- */
- private JSplitPane getJSplitPane() {
- if (jSplitPane == null) {
- jSplitPane = new JSplitPane();
- jSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- jSplitPane.setDividerLocation(250);
- jSplitPane.setBottomComponent(getJPanelBottom());
- jSplitPane.setTopComponent(getJPanelTop());
- }
- return jSplitPane;
- }
-
- /**
- * This method initializes jPanelTop
- *
- * This panel contains the All Modules Table
- *
- * @return javax.swing.JPanel jPanelTop
- */
- private JPanel getJPanelTop() {
- if (jPanelTop == null) {
- jLabel = new JLabel();
- jLabel.setText(" Modules in Workspace");
- jPanelTop = new JPanel();
- jPanelTop.setLayout(new BorderLayout());
- jPanelTop.add(jLabel, java.awt.BorderLayout.NORTH);
- jPanelTop.add(getJScrollPaneAllModules(), java.awt.BorderLayout.CENTER);
- jPanelTop.add(getJPanelTopSouth(), java.awt.BorderLayout.SOUTH);
- }
- return jPanelTop;
- }
-
- /**
- * This method initializes jPanelBottom
- *
- * This panel contains the FPD Modules Table
- *
- * @return javax.swing.JPanel jPanelBottom
- */
- private JPanel getJPanelBottom() {
- if (jPanelBottom == null) {
- jLabelModulesAdded = new JLabel();
- jLabelModulesAdded.setText(" Modules Added into Platform");
- jPanelBottom = new JPanel();
- jPanelBottom.setLayout(new BorderLayout());
- jPanelBottom.add(jLabelModulesAdded, java.awt.BorderLayout.NORTH);
- jPanelBottom.add(getJPanelBottomSouth(), java.awt.BorderLayout.SOUTH);
- jPanelBottom.add(getJScrollPaneFpdModules(), java.awt.BorderLayout.CENTER);
- }
- return jPanelBottom;
- }
-
- /**
- * This method initializes jScrollPaneAllModules
- *
- * @return javax.swing.JScrollPane jScrollPaneAllModules
- */
- private JScrollPane getJScrollPaneAllModules() {
- if (jScrollPaneAllModules == null) {
- jScrollPaneAllModules = new JScrollPane();
- jScrollPaneAllModules.setPreferredSize(new java.awt.Dimension(600, 200));
- jScrollPaneAllModules.setViewportView(getJTableAllModules());
- }
- return jScrollPaneAllModules;
- }
-
- /**
- * This method initializes jTableAllModules
- *
- * @return javax.swing.JTable jTableAllModules
- */
- private JTable getJTableAllModules() {
- if (jTableAllModules == null) {
- modelAllModules = new NonEditableTableModel();
- TableSorter sorter = new TableSorter(modelAllModules);
- jTableAllModules = new JTable(sorter);
- sorter.setTableHeader(jTableAllModules.getTableHeader());
- jTableAllModules.setRowHeight(20);
- modelAllModules.addColumn("<html>Module<br>Name</html>");
- modelAllModules.addColumn("<html>Package<br>Name</html>");
- modelAllModules.addColumn("Path");
- modelAllModules.addColumn("<html>Module<br>Type</html>");
- modelAllModules.addColumn("<html>Module<br>Version</html>");
- modelAllModules.addColumn("<html>Package<br>Version</html>");
-
- javax.swing.table.TableColumn column = null;
- column = jTableAllModules.getColumnModel().getColumn(modNameColForAllModTable);
- column.setPreferredWidth(modNamePrefWidth);
- column.setMinWidth(modNameMinWidth);
- column.setMaxWidth(modNameMaxWidth);
- column = jTableAllModules.getColumnModel().getColumn(modVerColForAllModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableAllModules.getColumnModel().getColumn(pkgNameColForAllModTable);
- column.setPreferredWidth(pkgNamePrefWidth);
- column.setMinWidth(pkgNameMinWidth);
- column.setMaxWidth(pkgNameMaxWidth);
- column = jTableAllModules.getColumnModel().getColumn(pkgVerColForAllModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableAllModules.getColumnModel().getColumn(typeColForAllModTable);
- column.setPreferredWidth(typePrefWidth);
- column.setMaxWidth(typeMaxWidth);
- column.setMinWidth(typeMinWidth);
- column = jTableAllModules.getColumnModel().getColumn(pathColForAllModTable);
- column.setPreferredWidth(pathPrefWidth);
- column.setMinWidth(pathMinWidth);
-
- jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableAllModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
- jTableAllModules.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
- java.awt.Point p = e.getPoint();
- int rowIndex = jTableAllModules.rowAtPoint(p);
- TableSorter sorter = (TableSorter) jTableAllModules.getModel();
- rowIndex = sorter.getModelRowIndex(rowIndex);
- addModuleIntoPlatform (rowIndex);
- }
- }
- });
- jTableAllModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyPressed(java.awt.event.KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
- int selectedRow = jTableAllModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- TableSorter sorter = (TableSorter) jTableAllModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- addModuleIntoPlatform (selectedRow);
- }
- }
- });
-
- jTableAllModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyTyped(java.awt.event.KeyEvent e) {
-
- if (System.currentTimeMillis() - savedMs < timeToWait) {
- searchField += e.getKeyChar();
- }
- else {
- searchField = "" + e.getKeyChar();
- }
-
- int viewIndex = gotoFoundRow (searchField, jTableAllModules);
- if (viewIndex >= 0){
- jTableAllModules.changeSelection(viewIndex, 0, false, false);
- }
- savedMs = System.currentTimeMillis();
- }
- });
-
-
- }
- return jTableAllModules;
- }
-
- private int gotoFoundRow (String s, JTable model) {
- for (int i = 0; i < model.getRowCount(); ++i) {
- if (model.getValueAt(i, 0) != null && model.getValueAt(i, 0).toString().regionMatches(true, 0, s, 0, s.length())) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * This method initializes jPanelTopSouth
- *
- * This panel contains the ADD button
- *
- * @return javax.swing.JPanel jPanelTopSouth
- */
- private JPanel getJPanelTopSouth() {
- if (jPanelTopSouth == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelTopSouth = new JPanel();
- jPanelTopSouth.setLayout(flowLayout);
- jPanelTopSouth.add(getJButtonAddModule(), null);
- }
- return jPanelTopSouth;
- }
-
- private void addModuleIntoPlatform (int selectedRow) {
- String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + "";
- ModuleIdentification mi = miList.get(selectedRow);
- Vector<String> vArchs = null;
-
- vArchs = WorkspaceProfile.getModuleSupArchs(mi);
-
- if (vArchs == null) {
- JOptionPane.showMessageDialog(this, "No Supported Architectures specified in MSA file.");
- return;
- }
-
- Vector<Object> platformSupArch = new Vector<Object>();
- ffc.getPlatformDefsSupportedArchs(platformSupArch);
- platformSupArch.retainAll(vArchs);
- if (platformSupArch.size() == 0) {
- JOptionPane.showMessageDialog(this, "This Module does not support this platform architectures.");
- return;
- }
-
- String archsAdded = "";
- String mg = mi.getGuid();
- String mv = mi.getVersion();
- String pg = mi.getPackageId().getGuid();
- String pv = mi.getPackageId().getVersion();
- String mType = SurfaceAreaQuery.getModuleType(mi);
-
- ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
- if (al == null) {
- //
- // if existing ModuleSA does not specify version info.
- //
- al = fpdMsa.get(mg + "null" + pg + "null");
- if (al == null) {
- al = fpdMsa.get(mg + "null" + pg + pv);
- if (al == null){
- al = fpdMsa.get(mg + mv + pg + "null");
- if (al == null) {
- al = new ArrayList<String>();
- fpdMsa.put(mg + mv + pg + pv, al);
- }
- }
- }
- }
- //
- // filter from module SupArchs what archs has been added.
- //
- for (int i = 0; i < al.size(); ++i) {
- vArchs.remove(al.get(i));
- }
- //
- // check whether archs conform to SupArch of platform.
- //
- platformSupArch.removeAllElements();
- ffc.getPlatformDefsSupportedArchs(platformSupArch);
- vArchs.retainAll(platformSupArch);
- //
- // Archs this Module supported have already been added.
- //
- if (vArchs.size() == 0) {
- JOptionPane.showMessageDialog(this, "This Module has already been added.");
- return;
- }
- //ToDo put Arch instead of null
- boolean errorOccurred = false;
- for (int i = 0; i < vArchs.size(); ++i) {
- String arch = vArchs.get(i);
- al.add(arch);
- archsAdded += arch + " ";
- String[] row = { "", "", "", "", "", "", "" };
-
- if (mi != null) {
- row[modNameColForFpdModTable] = mi.getName();
- row[pkgNameColForFpdModTable] = mi.getPackageId().getName();
- row[pathColForFpdModTable] = path;
- row[archColForFpdModTable] = arch;
- row[pkgVerColForFpdModTable] = pv;
- row[modVerColForFpdModTable] = mv;
- row[typeColForFpdModTable] = mType;
-
- }
- modelFpdModules.addRow(row);
-
- docConsole.setSaved(false);
- try {
- //ToDo : specify archs need to add.
- ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null);
- } catch (Exception exception) {
- JOptionPane.showMessageDialog(this, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch
- + ": " + exception.getMessage());
- errorOccurred = true;
- }
- }
-
- String s = "This Module with Architecture " + archsAdded;
- if (errorOccurred) {
- s += " was added with Error. Platform may NOT Build.";
- } else {
- s += " was added Successfully.";
- }
- JOptionPane.showMessageDialog(this, s);
- TableSorter sorterFpdModules = (TableSorter)jTableFpdModules.getModel();
- int viewIndex = sorterFpdModules.getViewIndexArray()[modelFpdModules.getRowCount() - 1];
- jTableFpdModules.changeSelection(viewIndex, 0, false, false);
-
- }
-
- /**
- * This method initializes jButtonAddModule
- *
- * @return javax.swing.JButton jButtonAddModule
- */
- private JButton getJButtonAddModule() {
- if (jButtonAddModule == null) {
- jButtonAddModule = new JButton();
- jButtonAddModule.setPreferredSize(new java.awt.Dimension(130, 20));
- jButtonAddModule.setText("Add a Module");
- jButtonAddModule.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableAllModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- TableSorter sorter = (TableSorter) jTableAllModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- addModuleIntoPlatform (selectedRow);
- }
- });
- }
- return jButtonAddModule;
- }
-
- /**
- * This method initializes jPanelBottomSouth
- *
- * This panel contains the Settings and Remove Buttons
- *
- * @return javax.swing.JPanel jPanelBottomSouth
- */
- private JPanel getJPanelBottomSouth() {
- if (jPanelBottomSouth == null) {
- FlowLayout flowLayout1 = new FlowLayout();
- flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelBottomSouth = new JPanel();
- jPanelBottomSouth.setLayout(flowLayout1);
- jPanelBottomSouth.add(getJButtonSettings(), null);
- jPanelBottomSouth.add(getJButtonRemoveModule(), null);
- jPanelBottomSouth.add(getJButtonApriori(), null);
- }
- return jPanelBottomSouth;
- }
-
- /**
- * This method initializes jScrollPaneFpdModules
- *
- * @return javax.swing.JScrollPane jScrollPaneFpdModules
- */
- private JScrollPane getJScrollPaneFpdModules() {
- if (jScrollPaneFpdModules == null) {
- jScrollPaneFpdModules = new JScrollPane();
- jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(453, 200));
- jScrollPaneFpdModules.setViewportView(getJTableFpdModules());
- }
- return jScrollPaneFpdModules;
- }
-
- /**
- * This method initializes jTableFpdModules
- *
- * @return javax.swing.JTable jTableFpdModules
- */
- private JTable getJTableFpdModules() {
- if (jTableFpdModules == null) {
- modelFpdModules = new FpdModulesTableModel();
- TableSorter sorter = new TableSorter(modelFpdModules);
- jTableFpdModules = new JTable(sorter);
- sorter.setTableHeader(jTableFpdModules.getTableHeader());
- jTableFpdModules.setRowHeight(20);
- modelFpdModules.addColumn("<html>Module<br>Name</html>");
- modelFpdModules.addColumn("<html>Package<br>Name</html>");
- modelFpdModules.addColumn("Path");
- modelFpdModules.addColumn("<html>Supported<br>Architectures</html>");
- modelFpdModules.addColumn("<html>Module<br>Type</html>");
- modelFpdModules.addColumn("<html>Module<br>Version</html>");
- modelFpdModules.addColumn("<html>Package<br>Version</html>");
- modelFpdModules.addColumn("<html>Force<br>Debug</html>");
-
- javax.swing.table.TableColumn column = null;
- column = jTableFpdModules.getColumnModel().getColumn(modNameColForFpdModTable);
- column.setPreferredWidth(modNamePrefWidth);
- column.setMinWidth(modNameMinWidth);
- column.setMaxWidth(modNameMaxWidth);
- column = jTableFpdModules.getColumnModel().getColumn(modVerColForFpdModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(pkgNameColForFpdModTable);
- column.setPreferredWidth(pkgNamePrefWidth);
- column.setMinWidth(pkgNameMinWidth);
- column.setMaxWidth(pkgNameMaxWidth);
- column = jTableFpdModules.getColumnModel().getColumn(pkgVerColForFpdModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(archColForFpdModTable);
- column.setPreferredWidth(archPrefWidth);
- column.setMaxWidth(archMaxWidth);
- column.setMinWidth(archMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(pathColForFpdModTable);
- column.setPreferredWidth(pathPrefWidth);
- column.setMinWidth(pathMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(typeColForFpdModTable);
- column.setPreferredWidth(typePrefWidth);
- column.setMaxWidth(typeMaxWidth);
- column.setMinWidth(typeMinWidth);
-
- jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFpdModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
-
- jTableFpdModules.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
- java.awt.Point p = e.getPoint();
- int rowIndex = jTableFpdModules.rowAtPoint(p);
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- rowIndex = sorter.getModelRowIndex(rowIndex);
- showSettingsDlg (rowIndex);
- }
- }
- });
-
- jTableFpdModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyPressed(java.awt.event.KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
- int selectedRow = jTableFpdModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- showSettingsDlg (selectedRow);
- }
- }
- });
-
- jTableFpdModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyTyped(java.awt.event.KeyEvent e) {
-
- if (System.currentTimeMillis() - savedMs < timeToWait) {
- searchField += e.getKeyChar();
- }
- else {
- searchField = "" + e.getKeyChar();
- }
-
- int viewIndex = gotoFoundRow (searchField, jTableFpdModules);
- if (viewIndex >= 0){
- jTableFpdModules.changeSelection(viewIndex, 0, false, false);
- }
- savedMs = System.currentTimeMillis();
- }
- });
-
- jTableFpdModules.getModel().addTableModelListener(this);
- }
- return jTableFpdModules;
- }
-
- public void tableChanged(TableModelEvent arg0) {
- if (arg0.getType() == TableModelEvent.UPDATE){
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
-
- if (column != forceDbgColForFpdModTable) {
- return;
- }
- String s = m.getValueAt(row, column)+"";
- boolean dbgEnable = new Boolean(s);
- ffc.setModuleSAForceDebug(row, dbgEnable);
- docConsole.setSaved(false);
- }
- }
-
- private void showSettingsDlg (int row) {
-// As PCD sync. check is full platform range now during opening FrameworkModules editor,
-// the following check is no longer needed.
-// try {
-// Vector<String> vExceptions = new Vector<String>();
-// if (ffc.adjustPcd(row, vExceptions)) {
-// JOptionPane.showMessageDialog(frame, "Pcd entries sync. with those in MSA files.");
-// docConsole.setSaved(false);
-// }
-// }
-// catch (Exception exp) {
-// JOptionPane.showMessageDialog(frame, exp.getMessage());
-// }
-
- if (settingDlg == null) {
- settingDlg = new FpdModuleSA(ffc);
- }
-
- String[] sa = new String[5];
- ffc.getFrameworkModuleInfo(row, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, row, docConsole);
- settingDlg.setVisible(true);
- }
- /**
- * This method initializes jButtonSettings
- *
- * @return javax.swing.JButton jButtonSettings
- */
- private JButton getJButtonSettings() {
- if (jButtonSettings == null) {
- jButtonSettings = new JButton();
- jButtonSettings.setPreferredSize(new java.awt.Dimension(130,20));
- jButtonSettings.setText("Settings");
- jButtonSettings.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFpdModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- showSettingsDlg (selectedRow);
- }
- });
- }
- return jButtonSettings;
- }
-
- /**
- * This method initializes jButtonRemoveModule
- *
- * @return javax.swing.JButton jButtonRemoveModule
- */
- private JButton getJButtonRemoveModule() {
- if (jButtonRemoveModule == null) {
- jButtonRemoveModule = new JButton();
- jButtonRemoveModule.setText("Remove Module");
- FontMetrics fm = jButtonRemoveModule.getFontMetrics(jButtonRemoveModule.getFont());
- jButtonRemoveModule.setPreferredSize(new Dimension (fm.stringWidth(jButtonRemoveModule.getText()) + 40, 20));
- jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFpdModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- int nextSelection = selectedRow;
-
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
-
- String[] sa = new String[5];
- ffc.getFrameworkModuleInfo(selectedRow, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- //
- // sync. module order list in BuildOptions-UserExtensions.
- //
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- String fvBindings = ffc.getFvBinding(moduleKey);
- if (fvBindings != null) {
- String[] fvArray = fvBindings.split(" ");
- for (int i = 0; i < fvArray.length; ++i) {
- ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), "IMAGES", "1", mg, mv, pg, pv, arch);
- }
- }
-
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);
- if (mi != null) {
- mv = mi.getVersion();
- pv = mi.getPackageId().getVersion();
- }
-
- try {
- ffc.removeModuleSA(selectedRow);
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdFrameworkModules.this, exp.getMessage());
- return;
- }
-
- if (arch == null) {
- // if no arch specified in ModuleSA
- fpdMsa.remove(mg + mv + pg + pv);
-
- } else {
- ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
- if (al != null) {
- al.remove(arch);
- if (al.size() == 0) {
- fpdMsa.remove(mg + mv + pg + pv);
- }
- }
- }
-
- modelFpdModules.removeRow(selectedRow);
- if (nextSelection >= jTableFpdModules.getRowCount()) {
- nextSelection = jTableFpdModules.getRowCount() - 1;
- }
- jTableFpdModules.changeSelection(nextSelection, 0, false, false);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonRemoveModule;
- }
-
- /**
- * This method initializes jButtonApriori
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonApriori() {
- if (jButtonApriori == null) {
- jButtonApriori = new JButton();
- jButtonApriori.setText("Apriori Files");
- FontMetrics fm = jButtonApriori.getFontMetrics(jButtonApriori.getFont());
- int buttonWidth = fm.stringWidth(jButtonApriori.getText()) + 40;
- if (jButtonRemoveModule.getWidth() > buttonWidth) {
- buttonWidth = jButtonRemoveModule.getWidth();
- }
- jButtonApriori.setPreferredSize(new Dimension (buttonWidth, 20));
- jButtonApriori.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- new GenAprioriFileDialog(ffc, docConsole).setVisible(true);
- }});
- }
- return jButtonApriori;
- }
-
- /**
- *
- * @param args
- */
- public static void main(String[] args) {
- // Set the pane visable
- new FpdFrameworkModules().setVisible(true);
- }
-
- private class PcdSyncTask extends Thread {
-
- boolean pcdSynced = false;
- public void run () {
- Vector<String> vExceptions = new Vector<String>();
- pcdSync(vExceptions);
- if (pcdSynced) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "PCD in this platform are synchronized with those in MSA files.");
- docConsole.setSaved(false);
- }
- if (vExceptions.size() > 0) {
- String errorMsg = "";
- for (int i = 0; i < vExceptions.size(); ++i) {
- errorMsg += " " + vExceptions.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Error occurred during synchronization:\n" + errorMsg);
- }
- }
-
- private void pcdSync(Vector<String> v) {
-
- Vector<PcdSyncSubTask> vThreads = new Vector<PcdSyncSubTask> ();
- int moduleCount = jTableFpdModules.getRowCount();
- int start = 0;
- for (int i = 0; i < FpdFrameworkModules.pcdSyncThreadNumber; ++i) {
- int end = start + moduleCount/FpdFrameworkModules.pcdSyncThreadNumber + 1;
- if (end > moduleCount) {
- end = moduleCount;
- }
- vThreads.add(new PcdSyncSubTask (start, end, v));
- start = end;
- }
-
- for (int i = 0; i < vThreads.size(); ++i) {
- vThreads.get(i).start();
- }
-
- try {
- for (int i = 0; i < vThreads.size(); ++i) {
- vThreads.get(i).join();
- }
- }
- catch (InterruptedException e) {
-
- }
-
- }
-
- private class PcdSyncSubTask extends Thread {
-
- private int startModule = 0;
- private int endModulePlusOne = 1;
- private Vector<String> v = null;
-
- PcdSyncSubTask (int start, int endPlusOne, Vector<String> vErr) {
- startModule = start;
- endModulePlusOne = endPlusOne;
- v = vErr;
- }
-
- public void run () {
- String[] sa = new String[5];
- for (int i = startModule; i < endModulePlusOne; ++i) {
- try {
- ffc.getFrameworkModuleInfo(i, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- String key = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- if (ffc.adjustPcd(key, v)) {
- pcdSynced = true;
- }
- }
- catch (Exception exp) {
-// JOptionPane.showMessageDialog(frame, exp.getMessage());
- continue;
- }
- }
- }
- }
- }
-
- /**
- * This is the default constructor
- */
- public FpdFrameworkModules() {
- super();
- initialize();
- }
-
- public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this();
- init(fpd);
-
- }
-
- private PcdSyncTask pst = null;
- public FpdFrameworkModules(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- if (pst == null) {
- pst = new PcdSyncTask();
- }
- pst.start();
- }
-
- private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
-
- if (ffc == null) {
- ffc = new FpdFileContents(fpd);
- ffc.initDynPcdMap();
- }
-
- if (fpdMsa == null) {
- fpdMsa = new HashMap<String, ArrayList<String>>();
- }
-
- if (ffc.getFrameworkModulesCount() > 0) {
- String[][] saa = new String[ffc.getFrameworkModulesCount()][5];
- ffc.getFrameworkModulesInfo(saa);
- for (int i = 0; i < saa.length; ++i) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " "
- + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]);
- Object[] row = { "", "", "", "", "", "", "", "" };
- if (mi != null) {
- row[modNameColForFpdModTable] = mi.getName();
- row[modVerColForFpdModTable] = mi.getVersion();
- row[typeColForFpdModTable] = SurfaceAreaQuery.getModuleType(mi);
- row[pkgNameColForFpdModTable] = mi.getPackageId().getName();
- row[pkgVerColForFpdModTable] = mi.getPackageId().getVersion();
- row[archColForFpdModTable] = saa[i][ffcModArch];
- try {
- row[pathColForFpdModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- } catch (Exception e) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show FPD Modules:" + e.getMessage());
- }
-
- String fpdMsaKey = saa[i][ffcModGuid] + row[modVerColForFpdModTable]
- + saa[i][ffcPkgGuid] + row[pkgVerColForFpdModTable];
- ArrayList<String> al = fpdMsa.get(fpdMsaKey);
- if (al == null) {
- al = new ArrayList<String>();
- fpdMsa.put(fpdMsaKey, al);
- }
- al.add(saa[i][ffcModArch]);
- }
- else {
- row[modNameColForFpdModTable] = saa[i][ffcModGuid];
- row[modVerColForFpdModTable] = saa[i][ffcModVer];
- row[pkgNameColForFpdModTable] = saa[i][ffcPkgGuid];
- row[pkgVerColForFpdModTable] = saa[i][ffcPkgVer];
- row[archColForFpdModTable] = saa[i][ffcModArch];
- }
- row[forceDbgColForFpdModTable] = ffc.getModuleSAForceDebug(i);
- modelFpdModules.addRow(row);
-
- }
- TableSorter sorter = (TableSorter)jTableFpdModules.getModel();
- sorter.setSortState(modNameColForFpdModTable, TableSorter.ASCENDING);
- }
-
- showAllModules();
-
- }
-
- private void showAllModules() {
-
- if (miList == null) {
- miList = new ArrayList<ModuleIdentification>();
- }
-
- String[] s = { "", "", "", "", "", "" };
-
- Iterator ismi = GlobalData.vModuleList.iterator();
- while (ismi.hasNext()) {
- ModuleIdentification mi = (ModuleIdentification) ismi.next();
- s[modNameColForAllModTable] = mi.getName();
- s[modVerColForAllModTable] = mi.getVersion();
- s[typeColForAllModTable] = SurfaceAreaQuery.getModuleType(mi);
- s[pkgNameColForAllModTable] = mi.getPackageId().getName();
- s[pkgVerColForAllModTable] = mi.getPackageId().getVersion();
- try {
- s[pathColForAllModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- } catch (Exception e) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show All Modules:" + e.getMessage());
- }
- modelAllModules.addRow(s);
- miList.add(mi);
- }
-
-
- TableSorter sorter = (TableSorter)jTableAllModules.getModel();
- sorter.setSortState(modNameColForAllModTable, TableSorter.ASCENDING);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(633, 533);
- this.setTitle("Framework Modules");
- this.setContentPane(getJSplitPane());
- this.setVisible(true);
-
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class NonEditableTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- return false;
- }
-}
-
-class FpdModulesTableModel extends DefaultTableModel {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public Class<?> getColumnClass (int c) {
- if (getValueAt(0, c) != null){
- return getValueAt(0, c).getClass();
- }
- return String.class;
- }
-
- public boolean isCellEditable (int row, int col) {
- if (col == FpdFrameworkModules.forceDbgColForFpdModTable) {
- return true;
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java
deleted file mode 100644
index b91f0c8f03..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/** @file
- Java class FpdFvOptions is GUI for FV options in FPD file.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowEvent;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Set;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import javax.swing.JButton;
-
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-
-/**
- *
- *
- */
-public class FpdFvOptions extends JDialog {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private static JFrame frame;
- private JPanel jContentPane = null;
- private JPanel jPanelN = null;
- private JPanel jPanelS = null;
- private JPanel jPanelC = null;
- private JScrollPane jScrollPaneFvOptions = null;
- private JTable jTableFvOptions = null;
- private DefaultTableModel tableModel = null;
- private String fvName = null;
- private FpdFileContents ffc = null;
- private OpeningPlatformType docConsole = null;
- private JButton jButtonNew = null;
- private JButton jButtonDelete = null;
- private String oldOptionName = "";
- private int selectedRow = -1;
- private TableModelListener tableModelListener = null;
-
- /**
- * This is the default constructor
- */
- public FpdFvOptions(String name, DefaultTableModel tm, FpdFileContents ffc, OpeningPlatformType dc) {
- super(FrameworkWizardUI.getInstance());
- fvName = name;
- this.ffc = ffc;
- this.docConsole = dc;
- setTableModel(tm);
- initOptions();
- initialize();
-
- }
-
- protected void processWindowEvent (WindowEvent e) {
- if (e.getID() == WindowEvent.WINDOW_CLOSING) {
- if (jTableFvOptions.isEditing()) {
- jTableFvOptions.getCellEditor().stopCellEditing();
- }
- tableModel.removeTableModelListener(tableModelListener);
- this.dispose();
- }
- }
-
- private void initOptions() {
- tableModel.setRowCount(0);
- LinkedHashMap<String, String> mOpts = new LinkedHashMap<String, String>();
- ffc.getFvImagesFvImageOptions(fvName, mOpts);
- Set<String> sKey = mOpts.keySet();
- Iterator<String> iter = sKey.iterator();
- while (iter.hasNext()) {
- String name = iter.next();
- String value = mOpts.get(name);
- tableModel.addRow(new String[]{name, value});
- }
- }
-
- private boolean fvOptionNameExists (String name) {
- int count = 0;
- for (int i = 0; i < jTableFvOptions.getRowCount(); ++i) {
- if (getTableModel().getValueAt(i, 0).equals(name)) {
- ++count;
- }
- }
- if (count > 1) {
- return true;
- }
- return false;
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(650, 400);
- this.setModal(true);
- this.setTitle("FV Options");
- this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
- this.setContentPane(getJContentPane());
- this.centerWindow();
- this.setVisible(true);
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelN(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJPanelS(), java.awt.BorderLayout.SOUTH);
- jContentPane.add(getJPanelC(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jPanelN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelN() {
- if (jPanelN == null) {
- jPanelN = new JPanel();
- }
- return jPanelN;
- }
-
- /**
- * This method initializes jPanelS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelS() {
- if (jPanelS == null) {
- jPanelS = new JPanel();
- jPanelS.add(getJButtonNew(), null);
- jPanelS.add(getJButtonDelete(), null);
- }
- return jPanelS;
- }
-
- /**
- * This method initializes jPanelC
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelC() {
- if (jPanelC == null) {
- jPanelC = new JPanel();
- jPanelC.add(getJScrollPaneFvOptions(), null);
- }
- return jPanelC;
- }
-
- /**
- * This method initializes jScrollPaneFvOptions
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvOptions() {
- if (jScrollPaneFvOptions == null) {
- jScrollPaneFvOptions = new JScrollPane();
- jScrollPaneFvOptions.setPreferredSize(new java.awt.Dimension(600,320));
- jScrollPaneFvOptions.setViewportView(getJTableFvOptions());
- }
- return jScrollPaneFvOptions;
- }
-
- /**
- * This method initializes jTableFvOptions
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvOptions() {
- if (jTableFvOptions == null) {
- jTableFvOptions = new JTable(getTableModel()) {
- /**
- *
- */
- private static final long serialVersionUID = -1941328952828651192L;
-
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
-// int colIndex = columnAtPoint(p);
-// int realColumnIndex = convertColumnIndexToModel(colIndex);
-
- TableModel model = getModel();
- String optName = (String) model.getValueAt(rowIndex, 0);
- if (((FvOptsTableModel)model).getVKeyWords().contains(optName)){
- tip = optName + " is from Flash Definition File and it is NOT editable.";
- }
-
- return tip;
- }
-
- };
-
- jTableFvOptions.setRowHeight(20);
-
- jTableFvOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- oldOptionName = getTableModel().getValueAt(selectedRow, 0)+"";
- }
- }
- });
-
- tableModelListener = new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int col = arg0.getColumn();
- TableModel m = (TableModel) arg0.getSource();
-
- if (arg0.getType() == TableModelEvent.UPDATE) {
- String newOptionName = m.getValueAt(row, 0) + "";
- if (col == 0) {
- if (newOptionName.equals(oldOptionName)) {
- return;
- }
- if (fvOptionNameExists(newOptionName)) {
- JOptionPane.showMessageDialog(frame, "This Option already exists. Please choose another Option name.");
- m.setValueAt(oldOptionName, row, 0);
- return;
- }
-
- ffc.setTypedNamedFvImageNameValue(fvName, "Options", oldOptionName, m.getValueAt(row, 1)+"", newOptionName);
- docConsole.setSaved(false);
- oldOptionName = newOptionName;
- }
-
- if (col == 1) {
- ffc.setTypedNamedFvImageNameValue(fvName, "Options", oldOptionName, m.getValueAt(row, 1)+"", newOptionName);
- docConsole.setSaved(false);
- }
-
- }
- }
- };
-
- jTableFvOptions.getModel().addTableModelListener(tableModelListener);
- }
- return jTableFvOptions;
- }
-
- protected DefaultTableModel getTableModel() {
- return tableModel;
- }
-
- protected void setTableModel(DefaultTableModel tableModel) {
-
- this.tableModel = tableModel;
-
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-/**
- * This method initializes jButtonNew
- *
- * @return javax.swing.JButton
- */
-private JButton getJButtonNew() {
- if (jButtonNew == null) {
- jButtonNew = new JButton();
- jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonNew.setText("New");
- jButtonNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- tableModel.addRow(new String[]{"", ""});
- oldOptionName = "";
- }
- });
- }
- return jButtonNew;
-}
-
-/**
- * This method initializes jButtonDelete
- *
- * @return javax.swing.JButton
- */
-private JButton getJButtonDelete() {
- if (jButtonDelete == null) {
- jButtonDelete = new JButton();
- jButtonDelete.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDelete.setText("Delete");
- jButtonDelete.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFvOptions.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String optName = tableModel.getValueAt(selectedRow, 0)+"";
- if (((FvOptsTableModel)tableModel).getVKeyWords().contains(optName)){
- return;
- }
- if (((FvOptsTableModel)tableModel).getVNonEditableName().contains(optName)){
- return;
- }
-
- ffc.removeTypedNamedFvImageNameValue(fvName, "Options", optName);
- tableModel.removeRow(selectedRow);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonDelete;
-}
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java
deleted file mode 100644
index 516b063d66..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java
+++ /dev/null
@@ -1,786 +0,0 @@
-/** @file
-
- The file is used to create, update FpdHeader of Fpd file
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-
-/**
- The class is used to create, update FpdHeader of Fpd file
- It extends IInternalFrame
-
- @since PackageEditor 1.0
-
- **/
-public class FpdHeader extends IInternalFrame implements DocumentListener{
-
- private int dialogWidth = 560;
-
- private int labelColumn = 12;
-
- private int labelWidth = 155;
-
- private int buttonWidth = 60;
-
- private final int valueColumn = 168;
-
- private final int valueWidth = 320;
-
- private final int specWidth = 420;
-
- private int shortValueWidth = valueWidth - (buttonWidth + 5);
-
- private final int oneRowHeight = 20;
-
- private final int threeRowHeight = 60;
-
- private final int fourRowHeight = 80;
-
- private final int rowSep = 5;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + rowSep;
-
- private final int rowThree = rowTwo + oneRowHeight + rowSep;
-
- private final int rowFour = rowThree + oneRowHeight + rowSep;
-
- private final int rowFive = rowFour + threeRowHeight + rowSep;
-
- private final int rowSix = rowFive + fourRowHeight + rowSep;
-
- private final int rowSeven = rowSix + oneRowHeight + rowSep;
-
- private final int rowEight = rowSeven + oneRowHeight + rowSep;
-
- private final int rowNine = rowEight + fourRowHeight + threeRowHeight +rowSep;
-
- private int dialogHeight = rowNine + threeRowHeight;
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8152099582923006900L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,53"
-
- private JLabel jLabelBaseName = null;
-
- private JTextField jTextFieldBaseName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelLicense = null;
-
- private JTextArea jTextAreaLicense = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jLabelDescription = null;
-
- private JTextArea jTextAreaDescription = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPaneLicense = null;
-
- private JScrollPane jScrollPaneDescription = null;
-
- private JScrollPane jCopyrightScrollPane = null;
-
- private JLabel jLabelAbstract = null;
-
- private JTextField jTextFieldAbstract = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private JTextArea jCopyrightTextArea = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextFieldUrl = null;
-
- private FpdFileContents ffc = null;
-
- private OpeningPlatformType docConsole = null;
-
- private boolean amended = false;
-
- /**
- This method initializes jTextFieldBaseName
-
- @return javax.swing.JTextField jTextFieldBaseName
-
- **/
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
- jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));
- jTextFieldBaseName.getDocument().addDocumentListener(this);
- jTextFieldBaseName.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isUiNameType(jTextFieldBaseName.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Package Name does not match the UiNameType datatype.");
- return;
- }
- if (jTextFieldBaseName.getText().equals(ffc.getFpdHdrPlatformName())) {
- return;
- }
- ffc.setFpdHdrPlatformName(jTextFieldBaseName.getText());
- }
- });
- }
- return jTextFieldBaseName;
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField jTextFieldGuid
-
- **/
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));
- jTextFieldGuid.setPreferredSize(new java.awt.Dimension(shortValueWidth,oneRowHeight));
- jTextFieldGuid.getDocument().addDocumentListener(this);
- jTextFieldGuid.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isGuid(jTextFieldGuid.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Guid must be in registry (8-4-4-4-12) format.");
- return;
- }
- if (jTextFieldGuid.getText().equals(ffc.getFpdHdrGuidValue())) {
- return;
- }
- ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());
- }
- });
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jTextFieldVersion
-
- @return javax.swing.JTextField jTextFieldVersion
-
- **/
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));
- jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));
- jTextFieldVersion.getDocument().addDocumentListener(this);
- jTextFieldVersion.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isVersion(jTextFieldVersion.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Version does not match the Version datatype.");
- return;
- }
- if (jTextFieldVersion.getText().equals(ffc.getFpdHdrVer())) {
- return;
- }
- ffc.setFpdHdrVer(jTextFieldVersion.getText());
- }
- });
- }
- return jTextFieldVersion;
- }
-
- /**
- This method initializes jButtonGenerateGuid
-
- @return javax.swing.JButton jButtonGenerateGuid
-
- **/
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));
- jButtonGenerateGuid.setText("GEN");
- jButtonGenerateGuid.addActionListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- This method initializes jTextAreaLicense
-
- @return javax.swing.JTextArea jTextAreaLicense
-
- **/
- private JTextArea getJTextAreaLicense() {
- if (jTextAreaLicense == null) {
- jTextAreaLicense = new JTextArea();
- jTextAreaLicense.setText("");
- jTextAreaLicense.setLineWrap(true);
- jTextAreaLicense.getDocument().addDocumentListener(this);
- jTextAreaLicense.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (jTextAreaLicense.getText().length() == 0) {
- JOptionPane.showMessageDialog(FpdHeader.this, "License must be entered!");
- return;
- }
- if (jTextAreaLicense.getText().equals(ffc.getFpdHdrLicense())) {
- return;
- }
- ffc.setFpdHdrLicense(jTextAreaLicense.getText());
- }
- });
- }
- return jTextAreaLicense;
- }
-
- /**
- This method initializes jTextAreaDescription
-
- @return javax.swing.JTextArea jTextAreaDescription
-
- **/
- private JTextArea getJTextAreaDescription() {
- if (jTextAreaDescription == null) {
- jTextAreaDescription = new JTextArea();
- jTextAreaDescription.setLineWrap(true);
- jTextAreaDescription.getDocument().addDocumentListener(this);
- jTextAreaDescription.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (jTextAreaDescription.getText().length() == 0) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Description must be entered.");
- return;
- }
- if (jTextAreaDescription.getText().equals(ffc.getFpdHdrDescription())) {
- return;
- }
- ffc.setFpdHdrDescription(jTextAreaDescription.getText());
- }
- });
- }
- return jTextAreaDescription;
- }
-
- /**
- This method initializes jTextFieldSpecification
-
- @return javax.swing.JTextField jTextFieldSpecification
-
- **/
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- jTextFieldSpecification = new JTextField();
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(labelColumn,rowNine,specWidth,oneRowHeight));
- jTextFieldSpecification.setEditable(false);
- jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth,oneRowHeight));
- jTextFieldSpecification.setBorder(null);
-// jTextFieldSpecification.addFocusListener(new FocusAdapter(){
-// public void focusLost(FocusEvent e) {
-// ffc.setFpdHdrSpec(jTextFieldSpecification.getText());
-// }
-// });
- }
- return jTextFieldSpecification;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton jButtonOk
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setText("OK");
- jButtonOk.setBounds(new java.awt.Rectangle(290,351,90,20));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton jButtonCancel
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setText("Cancel");
- jButtonCancel.setBounds(new java.awt.Rectangle(390,351,90,20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jScrollPaneLicense
-
- @return javax.swing.JScrollPane jScrollPaneLicense
-
- **/
- private JScrollPane getJScrollPaneLicense() {
- if (jScrollPaneLicense == null) {
- jScrollPaneLicense = new JScrollPane();
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(valueColumn,rowFive,valueWidth,fourRowHeight));
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth,fourRowHeight));
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());
- }
- return jScrollPaneLicense;
- }
-
- /**
- This method initializes jScrollPaneDescription
-
- @return javax.swing.JScrollPane jScrollPaneDescription
-
- **/
- private JScrollPane getJScrollPaneDescription() {
- if (jScrollPaneDescription == null) {
- jScrollPaneDescription = new JScrollPane();
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(valueColumn,rowEight,valueWidth,fourRowHeight));
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());
- }
- return jScrollPaneDescription;
- }
-
- /**
- This method initializes jTextFieldAbstract
-
- @return javax.swing.JTextField jTextFieldAbstract
-
- **/
- private JTextField getJTextFieldAbstract() {
- if (jTextFieldAbstract == null) {
- jTextFieldAbstract = new JTextField();
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(valueColumn,rowSeven,valueWidth,oneRowHeight));
- jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jTextFieldAbstract.getDocument().addDocumentListener(this);
- jTextFieldAbstract.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isAbstract(jTextFieldAbstract.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Abstract must be entered.");
- return;
- }
- if (jTextFieldAbstract.getText().equals(ffc.getFpdHdrAbs())) {
- return;
- }
- ffc.setFpdHdrAbs(jTextFieldAbstract.getText());
- }
- });
- }
- return jTextFieldAbstract;
- }
-
- private JScrollPane getCopyrightScrollPane() {
- if (jCopyrightScrollPane == null) {
- jCopyrightScrollPane = new JScrollPane();
- jCopyrightScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFour, valueWidth, threeRowHeight));
- jCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jCopyrightScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
- jCopyrightScrollPane.setViewportView(getJCopyrightTextArea());
- }
- return jCopyrightScrollPane;
- }
- /**
- This method initializes jTextFieldCopyright
-
- @return javax.swing.JTextField jTextFieldCopyright
-
- **/
- private JTextArea getJCopyrightTextArea() {
- if (jCopyrightTextArea == null) {
- jCopyrightTextArea = new JTextArea();
- jCopyrightTextArea.setWrapStyleWord(true);
- jCopyrightTextArea.setLineWrap(true);
- jCopyrightTextArea.getDocument().addDocumentListener(this);
- jCopyrightTextArea.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Copyright must be entered.");
- return;
- }
- if (jCopyrightTextArea.getText().equals(ffc.getFpdHdrCopyright())) {
- return;
- }
- ffc.setFpdHdrCopyright(jCopyrightTextArea.getText());
- }
- });
- }
- return jCopyrightTextArea;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldUrl() {
- if (jTextFieldUrl == null) {
- jTextFieldUrl = new JTextField();
- jTextFieldUrl.setBounds(new java.awt.Rectangle(valueColumn,rowSix,valueWidth,oneRowHeight));
- jTextFieldUrl.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- jTextFieldUrl.getDocument().addDocumentListener(this);
- jTextFieldUrl.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e){
- if (jTextFieldUrl.getText().length() == 0 && ffc.getFpdHdrUrl() == null) {
- return;
- }
- if (jTextFieldUrl.getText().equals(ffc.getFpdHdrUrl())) {
- return;
- }
- ffc.setFpdHdrLicense(jTextAreaLicense.getText());
- ffc.setFpdHdrUrl(jTextFieldUrl.getText());
- }
- });
- }
- return jTextFieldUrl;
- }
-
- public static void main(String[] args) {
- new FpdHeader().setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public FpdHeader() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader
-
- **/
- public FpdHeader(PlatformSurfaceAreaDocument.PlatformSurfaceArea inFpd) {
- this();
- ffc = new FpdFileContents(inFpd);
- init(ffc);
-
- }
-
- public FpdHeader(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- if (amended) {
- docConsole.setSaved(false);
- amended = false;
- }
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- //this.setSize(500, 515);
- this.setContentPane(getJContentPane());
- this.setTitle("Platform Surface Area Header");
- initFrame();
-
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader
-
- **/
- private void init(FpdFileContents ffc) {
-
- if (ffc.getFpdHdrPlatformName() != null) {
- jTextFieldBaseName.setText(ffc.getFpdHdrPlatformName());
- }
- if (ffc.getFpdHdrGuidValue() != null) {
- jTextFieldGuid.setText(ffc.getFpdHdrGuidValue());
- }
- if (ffc.getFpdHdrVer() != null) {
- jTextFieldVersion.setText(ffc.getFpdHdrVer());
- }
- if (ffc.getFpdHdrLicense() != null) {
- jTextAreaLicense.setText(ffc.getFpdHdrLicense());
- }
- if (ffc.getFpdHdrAbs() != null) {
- jTextFieldAbstract.setText(ffc.getFpdHdrAbs());
- }
- if (ffc.getFpdHdrUrl() != null) {
- jTextFieldUrl.setText(ffc.getFpdHdrUrl());
- }
- if (ffc.getFpdHdrCopyright() != null) {
- jCopyrightTextArea.setText(ffc.getFpdHdrCopyright());
- }
- if (ffc.getFpdHdrDescription() != null) {
- jTextAreaDescription.setText(ffc.getFpdHdrDescription());
- }
- if (ffc.getFpdHdrSpec() != null) {
- jTextFieldSpecification.setText(ffc.getFpdHdrSpec());
- }
- ffc.setFpdHdrSpec(jTextFieldSpecification.getText());
-
- if (ffc.getPlatformDefsSkuInfoCount() == 0) {
- ffc.genPlatformDefsSkuInfo("0", "DEFAULT");
- amended = true;
- JOptionPane.showMessageDialog(this, "Default SKU set for this platform.");
- }
- Vector<Object> v = new Vector<Object>();
- ffc.getPlatformDefsSupportedArchs(v);
- if (v.size() == 0) {
- v.add("IA32");
- ffc.setPlatformDefsSupportedArchs(v);
- amended = true;
- JOptionPane.showMessageDialog(this, "Supported Arch. IA32 added for this platform.");
- }
- v.removeAllElements();
- ffc.getPlatformDefsBuildTargets(v);
- if (v.size() == 0) {
- v.add("DEBUG");
- ffc.setPlatformDefsBuildTargets(v);
- amended = true;
- JOptionPane.showMessageDialog(this, "Build target IA32 added for this platform.");
- }
- if (ffc.getPlatformDefsInterDir() == null) {
- ffc.setPlatformDefsInterDir("UNIFIED");
- amended = true;
- JOptionPane.showMessageDialog(this, "UNIFIED Intermediate Directory set for this platform.");
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setLocation(new java.awt.Point(0, 0));
- jContentPane.setSize(new java.awt.Dimension(dialogWidth - 20 ,dialogHeight - 20));
-
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(labelColumn,rowSix,labelWidth,oneRowHeight));
- jLabel.setText("URL");
- jLabelAbstract = new JLabel();
- jLabelAbstract.setBounds(new java.awt.Rectangle(labelColumn,rowSeven,labelWidth,oneRowHeight));
- jLabelAbstract.setText("Abstract");
- jLabelDescription = new JLabel();
- jLabelDescription.setText("Description");
- jLabelDescription.setBounds(new java.awt.Rectangle(labelColumn,rowEight,labelWidth,oneRowHeight));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn,rowFour,labelWidth,oneRowHeight));
- jLabelLicense = new JLabel();
- jLabelLicense.setText("License");
- jLabelLicense.setBounds(new java.awt.Rectangle(labelColumn,rowFive,labelWidth,oneRowHeight));
- jLabelVersion = new JLabel();
- jLabelVersion.setText("Version");
- jLabelVersion.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
- jLabelGuid = new JLabel();
- jLabelGuid.setPreferredSize(new java.awt.Dimension(labelWidth, oneRowHeight));
- jLabelGuid.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jLabelGuid.setText("Guid");
- jLabelBaseName = new JLabel();
- jLabelBaseName.setText("Platform Name");
- jLabelBaseName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, rowOne));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, rowTwo));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(0, rowThree));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0,rowFour));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(0,rowFive));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(0,rowSeven));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(0,rowEight));
-
- jContentPane.add(jLabelBaseName, null);
- jContentPane.add(getJTextFieldBaseName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelLicense, null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(jLabelDescription, null);
- jContentPane.add(getJTextFieldSpecification(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJScrollPaneLicense(), null);
- jContentPane.add(getJScrollPaneDescription(), null);
- jContentPane.add(jLabelAbstract, null);
- jContentPane.add(getJTextFieldAbstract(), null);
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(getCopyrightScrollPane(), null);
-
- jContentPane.add(jLabel, null);
- jContentPane.add(getJTextFieldUrl(), null);
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonGenerateGuid) {
- jTextFieldGuid.setText(Tools.generateUuidString());
- ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());
- }
- }
-
-
- /**
- This method initializes Package type and Compontent type
-
- **/
- private void initFrame() {
-
-
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = dialogWidth;
- int intCurrentWidth = this.getJContentPane().getWidth();
-
- // Tools.resizeComponentWidth(this.jTextFieldBaseName, this.getWidth(), intPreferredWidth);
- // Tools.resizeComponentWidth(this.jTextFieldGuid, this.getWidth(), intPreferredWidth);
-// Tools.relocateComponentX(this.jButtonGenerateGuid, this.getWidth(), jButtonGenerateGuid.getWidth(), 25);
- // Tools.resizeComponentWidth(this.jTextFieldVersion, this.getWidth(), intPreferredWidth);
- // Tools.resizeComponentWidth(this.jTextFieldCopyright, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldUrl, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);
- // Tools.resizeComponentWidth(this.jTextFieldSpecification, this.getWidth(), intPreferredWidth);
-
-
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
- */
- public void changedUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
- */
- public void insertUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
- */
- public void removeUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
deleted file mode 100644
index b2d577e4dd..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
+++ /dev/null
@@ -1,2240 +0,0 @@
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.JTabbedPane;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.JSplitPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.platform.ui.global.LibraryClassDescriptor;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Set;
-import java.util.Stack;
-import java.util.Vector;
-
-import javax.swing.JTextField;
-import java.awt.GridLayout;
-import javax.swing.JComboBox;
-
-public class FpdModuleSA extends JDialog implements ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JPanel jContentPane = null;
- private JTabbedPane jTabbedPane = null;
- private JPanel jPanelPcd = null;
- private JPanel jPanelLibrary = null;
- private JLabel jLabelPcdData = null;
- private JScrollPane jScrollPaneTablePcd = null;
- private JTable jTablePcd = null;
- private JPanel jPanelPcdSouth = null;
- private JScrollPane jScrollPanePcdHelp = null;
- private JTextArea jTextAreaPcdHelp = null;
- private JPanel jPanelContentPaneSouth = null;
- private JSplitPane jSplitPane = null;
- private JPanel jPanelLibraryLeft = null;
- private JPanel jPanelLibraryRight = null;
- private JLabel jLabelLibClass = null;
- private JLabel jLabelQualifiedInstance = null;
- private JScrollPane jScrollPaneSelectedInstances = null;
- private JTable jTableSelectedInstances = null;
- private JScrollPane jScrollPaneLibClass = null;
- private JTable jTableLibClass = null;
- private JScrollPane jScrollPaneQualifiedInstance = null;
- private JTable jTableLibInstances = null;
- private JPanel jPanelLibrarySouth = null;
- private JPanel jPanelLibraryCenter = null;
- private JScrollPane jScrollPaneInstanceHelp = null;
- private JTextArea jTextAreaInstanceHelp = null;
- private JLabel jLabelSelectedInstances = null;
- private JLabel jLabelInstanceHelp = null;
- private JButton jButtonAdd = null;
- private JButton jButtonDeleteInstance = null;
- private JLabel jLabelPcdHelp = null;
- private JButton jButtonOk = null;
- private JButton jButtonCancel = null;
- private IDefaultTableModel model = null;
- private IDefaultTableModel selectedInstancesTableModel = null;
- private IDefaultTableModel libClassTableModel = null;
- private IDefaultTableModel libInstanceTableModel = null;
- private DefaultTableModel optionsTableModel = null;
- private FpdFileContents ffc = null;
- private String moduleKey = null;
- private ModuleIdentification moduleId = null;
- private HashMap<LibraryClassDescriptor, ArrayList<String>> classInstanceMap = null;
- //
- // map of <{libName, supArch, supMod}, list of Module information>
- //
- private HashMap<LibraryClassDescriptor, ArrayList<String>> classConsumed = null;
- private HashMap<LibraryClassDescriptor, ArrayList<String>> classProduced = null;
-
- private JPanel jPanelModuleSaOpts = null;
- private JLabel jLabelFvBinding = null;
- private JTextField jTextFieldFvBinding = null;
- private JLabel jLabelFfsFileGuid = null;
- private JTextField jTextFieldFileGuid = null;
- private JLabel jLabelFfsFormatKey = null;
- private JTextField jTextFieldFfsKey = null;
- private JScrollPane jScrollPaneModuleSaOptions = null;
- private JTable jTableModuleSaOptions = null;
- private JButton jButtonNew = null;
- private JButton jButtonDeleteOption = null;
- private JPanel jPanelPcdFields = null;
- private JPanel jPanelPcdFieldsSecondRow = null;
- private JPanel jPanelPcdFieldsThirdRow = null;
- private JPanel jPanelPcdFieldsFirstRow = null;
- private JLabel jLabelItemType = null;
- private JComboBox jComboBoxItemType = null;
- private JLabel jLabelMaxDatumSize = null;
- private JTextField jTextFieldMaxDatumSize = null;
- private JLabel jLabelPcdDefaultValue = null;
- private JTextField jTextFieldPcdDefault = null;
- private JButton jButtonUpdatePcd = null;
- private JComboBox jComboBoxFeatureFlagValue = null;
- private OpeningPlatformType docConsole = null;
- private JPanel jPanelCustomToolChain = null;
- private JPanel jPanelToolchainS = null;
- private JPanel jPanelLibraryCenterN = null;
- private JPanel jPanelLibraryCenterC = null; // @jve:decl-index=0:visual-constraint="20,224"
-
- private final int buildTargetWidth = 150;
- private final int toolChainFamilyWidth = 150;
- private final int supportArchWidth = 150;
- private final int toolCmdCodeWidth = 200;
- private final int tagNameWidth = 150;
- private final int argWidth = 400;
-
- /**
- * This is the default constructor
- */
- public FpdModuleSA() {
- super(FrameworkWizardUI.getInstance());
- initialize();
- }
- public FpdModuleSA(FpdFileContents ffc) {
- this();
- this.ffc = ffc;
- }
-
- public void setKey(String k, int i, OpeningPlatformType dc){
- this.moduleKey = k;
- this.docConsole = dc;
- classInstanceMap = null;
- classProduced = null;
- classConsumed = null;
- int tabIndex = jTabbedPane.indexOfTab("FV Info");
- jTabbedPane.setSelectedIndex(tabIndex);
- initFvInfo(moduleKey);
- initPcdBuildDefinition(moduleKey);
- moduleId = WorkspaceProfile.getModuleId(moduleKey);
- if (moduleId == null) {
- return;
- }
- tabIndex = jTabbedPane.indexOfTab("Libraries");
- if (moduleId.isLibrary()) {
- jTabbedPane.setEnabledAt(tabIndex, false);
- }
- else {
- jTabbedPane.setEnabledAt(tabIndex, true);
- }
- }
-
- /**
- init will be called each time FpdModuleSA object is to be shown.
- @param key Module information.
- **/
- public void initPcdBuildDefinition(String key) {
- //
- // display pcd for key.
- //
- model.setRowCount(0);
- jTextAreaPcdHelp.setText("");
- jComboBoxItemType.setSelectedIndex(-1);
- jTextFieldMaxDatumSize.setText("");
- jTextFieldPcdDefault.setText("");
- int pcdCount = ffc.getPcdDataCount(key);
- if (pcdCount != 0) {
- String[][] saa = new String[pcdCount][7];
- ffc.getPcdData(key, saa);
- for (int j = 0; j < saa.length; ++j) {
- model.addRow(saa[j]);
- }
- }
- }
-
- public void initLibraries(String key) {
- libClassTableModel.setRowCount(0);
- libInstanceTableModel.setRowCount(0);
- selectedInstancesTableModel.setRowCount(0);
- Vector<String> errorMsg = new Vector<String>();
- Vector<ModuleIdentification> newInstances = new Vector<ModuleIdentification>();
-
- addConsumedClassFromModule (key);
- addProducedClassFromModule (key);
-
- int instanceCount = ffc.getLibraryInstancesCount(key);
- if (instanceCount != 0) {
- String[][] saa = new String[instanceCount][5];
- ffc.getLibraryInstances(key, saa);
- for (int i = 0; i < saa.length; ++i) {
- String libInstanceKey = saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(libInstanceKey);
- if (mi != null) {
- //
- // ToDo: verify this instance first.
- //
- saa[i][0] = mi.getName();
- saa[i][2] = mi.getVersion();
- saa[i][4] = mi.getPackageId().getVersion();
- //
- // re-evaluate lib instance usage when adding a already-selected lib instance.
- //
- addConsumedClassFromModule (libInstanceKey);
- addProducedClassFromModule (libInstanceKey);
- selectedInstancesTableModel.addRow(saa[i]);
- }
- }
- }
-
- Set<LibraryClassDescriptor> sLcd = this.classConsumed.keySet();
- Iterator<LibraryClassDescriptor> iter = sLcd.iterator();
- Stack<LibraryClassDescriptor> lcdStack = new Stack<LibraryClassDescriptor>();
- while (iter.hasNext()) {
- LibraryClassDescriptor lcd = iter.next();
- if (this.classConsumed.get(lcd) == null || this.classConsumed.get(lcd).size() == 0) {
- continue;
- }
- if (isBoundedClass(lcd, errorMsg)) {
- continue;
- }
-
- if (!lcdStack.contains(lcd)) {
- lcdStack.push(lcd);
- }
- }
-
- try {
- resolveLibraryInstances(lcdStack, true, errorMsg, newInstances);
- } catch (Exception e) {
- String exceptionMsg = e.getCause() + " " + e.getMessage();
- if (!errorMsg.contains(exceptionMsg)) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), e.getCause() + " " + e.getMessage());
- }
- }
-
- String newInstancesAddedMsg = "Library instance automatically added to this module :\n";
- for (int i = 0; i < newInstances.size(); ++i) {
- ModuleIdentification libMi = newInstances.get(i);
- newInstancesAddedMsg += libMi.getName();
- newInstancesAddedMsg += " ";
- }
- if (newInstances.size() > 0) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), newInstancesAddedMsg);
- }
-
- showClassToResolved();
-
- if (errorMsg.size() > 0) {
- String errors = "";
- for (int i = 0; i < errorMsg.size(); ++i) {
- errors += " " + errorMsg.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), errors);
- }
- }
-
- public void initFvInfo (String key) {
- //
- // display module SA options
- //
- jTextFieldFvBinding.setText("");
- String fvBinding = ffc.getFvBinding(key);
- if (fvBinding != null) {
- jTextFieldFvBinding.setText(fvBinding);
- }
- jTextFieldFileGuid.setText("");
- String fileGuid = ffc.getFfsFileNameGuid(key);
- if (fileGuid != null) {
- jTextFieldFileGuid.setText(fileGuid);
- }
- jTextFieldFfsKey.setText("");
- String ffsKey = ffc.getFfsFormatKey(key);
- if (ffsKey != null) {
- jTextFieldFfsKey.setText(ffsKey);
- }
- }
-
- public void initToolChainOptions(String key) {
-
- optionsTableModel.setRowCount(0);
- String[][] saa = new String[ffc.getModuleSAOptionsCount(key)][6];
- ffc.getModuleSAOptions(key, saa);
- for (int i = 0; i < saa.length; ++i) {
- optionsTableModel.addRow(saa[i]);
- }
- }
-
- private void filterClassConsumedByArch (Vector<LibraryClassDescriptor> v) {
- String[] moduleInfo = moduleKey.split(" ");
- Vector<String> vModuleArchs = new Vector<String>();
- //
- // Skip guid, version information, get archs to check.
- //
- for (int i = 4; i < moduleInfo.length; ++i) {
- vModuleArchs.add(moduleInfo[i]);
- }
- //
- // if module will be built on all platforms, no filter needed for lib classes.
- //
- if (vModuleArchs.size() == 0) {
- return;
- }
-
- Iterator<LibraryClassDescriptor> iter = v.iterator();
- while (iter.hasNext()) {
- LibraryClassDescriptor libInfo = iter.next();
-
- Vector<String> vSupArchs = libInfo.getVectorFromString(libInfo.supArchs);
-
- if (vSupArchs.size() == 0 || (vSupArchs.size() == 1 && vSupArchs.get(0).equalsIgnoreCase(""))) {
- //
- // update lib info to module archs only.
- //
- libInfo.supArchs = "";
- for (int i = 0; i < vModuleArchs.size(); ++i) {
- libInfo.supArchs += vModuleArchs.get(i);
- libInfo.supArchs += " ";
- }
- libInfo.supArchs.trim();
- continue;
- }
- //
- // only retain those lib class used by module archs.
- //
- vSupArchs.retainAll(vModuleArchs);
- if (vSupArchs.size() > 0) {
- //
- // update lib info to reflect which kind of arch need to select instance.
- //
- libInfo.supArchs = "";
- for (int i = 0; i < vSupArchs.size(); ++i) {
- libInfo.supArchs += vSupArchs.get(i);
- libInfo.supArchs += " ";
- }
- libInfo.supArchs.trim();
- continue;
- }
- //
- // remove this lib definition if it supports no archs module will be built under.
- //
- iter.remove();
- }
- }
-
- private void addProducedClassFromModule (String key) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
- Vector<LibraryClassDescriptor> vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
- if (this.classProduced == null) {
- this.classProduced = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
- }
- for (int i = 0; i < vClassProduced.size(); ++i) {
- ArrayList<String> producedBy = this.classProduced.get(vClassProduced.get(i));
- if (producedBy == null) {
- producedBy = new ArrayList<String>();
- }
- //
- // class already produced by previous module (lib instance).
- /*
- if (producedBy.size() == 1) {
- String instanceKey = producedBy.get(0);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
- throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
- }
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (vClassProduced.get(i).hasInterSectionWith(lcd)) {
- ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);
- String instanceKey = alreadyProducedBy.get(0);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
- throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
- }
- }
- */
- // normal case.
- //
- producedBy.add(key);
- this.classProduced.put(vClassProduced.get(i), producedBy);
-
- }
- }
-
- private Vector<LibraryClassDescriptor> addConsumedClassFromModule (String key) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
-// PackageIdentification[] depPkgList = null;
-
- //
- // Get dependency pkg list into which we will search lib instances.
- //
- //depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
- //
- // Get the lib class consumed, produced by this module itself.
- //
- Vector<LibraryClassDescriptor> vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
- for (int i = 0; i < vClassConsumed.size(); ++i) {
- vClassConsumed.get(i).supModTypes = WorkspaceProfile.getModuleType(moduleId);
- }
- filterClassConsumedByArch(vClassConsumed);
- if (this.classConsumed == null) {
- this.classConsumed = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
- }
-
- for (int i = 0; i < vClassConsumed.size(); ++i) {
- ArrayList<String> consumedBy = this.classConsumed.get(vClassConsumed.get(i));
- if (consumedBy == null) {
- consumedBy = new ArrayList<String>();
- }
- consumedBy.add(key);
- this.classConsumed.put(vClassConsumed.get(i), consumedBy);
- }
-
- return vClassConsumed;
- }
-
- private void resolveLibraryInstances(Stack<LibraryClassDescriptor> lcdStack, boolean autoSelectSingleInstance, Vector<String> errorMsg, Vector<ModuleIdentification> newInstances) throws MultipleInstanceException, NoInstanceException{
-
- if (classInstanceMap == null) {
- classInstanceMap = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
- }
- while (!lcdStack.empty()) {
- LibraryClassDescriptor cls = lcdStack.pop();
- if (isBoundedClass(cls, errorMsg)) {
- continue;
- }
- ArrayList<String> instances = getInstancesForClass(cls, null);
- if (instances.size() == 0) {
-// throw new NoInstanceException (cls.className);
- String exceptionMsg = new NoInstanceException (cls.className).getMessage();
- if (!errorMsg.contains(exceptionMsg)) {
- errorMsg.add(exceptionMsg);
- }
-
- }
- classInstanceMap.put(cls, instances);
- if (instances.size() == 1 && autoSelectSingleInstance) {
- String instanceInfo = instances.get(0);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceInfo);
- try {
- Object[] row = {libMi.getName(), libMi.getGuid(), libMi.getVersion(),
- libMi.getPackageId().getGuid(), libMi.getPackageId().getVersion()};
- if (!ffc.instanceExistsInModuleSA(moduleKey, row[1]+"", row[2]+"", row[3]+"", row[4]+"")) {
- addLibInstance(libMi);
- newInstances.add(libMi);
- docConsole.setSaved(false);
- selectedInstancesTableModel.addRow(row);
- addProducedClassFromModule (instanceInfo);
- Vector<LibraryClassDescriptor> vLcd = addConsumedClassFromModule(instanceInfo);
- for (int i = 0; i < vLcd.size(); ++i) {
- LibraryClassDescriptor lcd = vLcd.get(i);
- if (!lcdStack.contains(lcd)) {
- lcdStack.push(lcd);
- }
- }
- }
- }
- catch (Exception e) {
- if (!errorMsg.contains(e.getMessage())) {
- errorMsg.add(e.getMessage());
- }
- }
- }
- }
- }
-//
-
- /**Search classProduced map to see if this class has been produced by some instance (module).
- * @param cls
- * @return
- */
- private boolean isBoundedClass (LibraryClassDescriptor cls, Vector<String> errorMsg) {
-// if (this.classProduced.containsKey(cls)) {
-// return true;
-// }
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (cls.className.equals(lcd.className)) {
- if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
- return true;
- }
- else {
- ArrayList<String> producedBy = this.classProduced.get(lcd);
- String instancesName = "";
- for (int i = 0; i < producedBy.size(); ++i) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(producedBy.get(i));
- instancesName += mi.getName();
- instancesName += " ";
- }
- String msg = new ImproperInstanceException(lcd.className, instancesName, lcd.supArchs, lcd.supModTypes).getMessage();
- if (!errorMsg.contains(msg)) {
- errorMsg.add(msg);
- }
- }
- }
- }
-
- return false;
- }
-
- private ArrayList<String> getInstancesForClass(LibraryClassDescriptor cls, PackageIdentification[] depPkgList){
- ArrayList<String> al = new ArrayList<String>();
-
-// for (int i = 0; i < depPkgList.length; ++i) {
- Iterator ismi = GlobalData.vModuleList.iterator();
- while(ismi.hasNext()) {
- ModuleIdentification mi = (ModuleIdentification)ismi.next();
-// if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
-// continue;
-// }
- Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
-
- boolean isPotential = false;
- Iterator<LibraryClassDescriptor> lcdi = clsProduced.iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)){
- isPotential = true;
- }
-
- if (isPotential && hasBeenProduced(lcd)) {
- isPotential = false;
- break;
- }
- }
- if (isPotential) {
- al.add(mi.getGuid() + " " + mi.getVersion() + " " +
- mi.getPackageId().getGuid() + " " + mi.getPackageId().getVersion());
- }
- }
-// }
-
- return al;
- }
-
- private boolean hasBeenProduced (LibraryClassDescriptor cls) {
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
- return true;
- }
- }
- return false;
- }
-
- private ArrayList<String> getConsumedBy (String className) {
- Iterator<LibraryClassDescriptor> lcdi = this.classConsumed.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if ((lcd.className != null) && lcd.className.equals(className)) {
- return this.classConsumed.get(lcd);
- }
- }
- return null;
- }
-
- private ArrayList<String> getProducedBy (String className) {
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if ((lcd.className != null) && lcd.className.equals(className)) {
- return this.classProduced.get(lcd);
- }
- }
- return null;
- }
- //
- // Get class name list related with instanceKey from HashMap m<LibraryClass, ArrayList<instanceKey>>.
- //
- private ArrayList<String> getLibraryClassList (String instanceKey, HashMap<LibraryClassDescriptor, ArrayList<String>> m) {
- ArrayList<String> libraryClass = new ArrayList<String>();
- Iterator<LibraryClassDescriptor> lcdi = m.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if ((m.get(lcd) != null) && m.get(lcd).contains(instanceKey)) {
- libraryClass.add(lcd.className);
- }
- }
- return libraryClass;
- }
-
- private void removeInstance(String key) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
- //
- // remove pcd information of instance from current ModuleSA
- // Note that Pcd data SHOULD be removed prior to library instance
- // because Multi-Sourced PCD could not be removed, if we remove library instance first,
- // it will impact the judgement of whether a PCD entry is Multi-Sourced.
- //
- ffc.removePcdData(moduleKey, mi);
- ffc.removeLibraryInstance(moduleKey, key);
- //
- // remove class produced by this instance and add back these produced class to be bound.
- //
- Vector<LibraryClassDescriptor> clsProduced = getClassProduced(mi);
- for (int i = 0; i < clsProduced.size(); ++i) {
-
- classProduced.remove(clsProduced.get(i));
- }
- //
- // remove class consumed by this instance. we do not need to bound it now.
- //
- String[] clsConsumed = getClassConsumed(mi);
- for (int i = 0; i < clsConsumed.length; ++i) {
- ArrayList<String> al = getConsumedBy (clsConsumed[i]);
-
- if (al == null ) {
- continue;
- }
- al.remove(key);
- if (al.size() == 0) {
- ArrayList<String> from = getProducedBy (clsConsumed[i]);
- if (from == null) {
- continue;
- }
- boolean noUse = true;
- for (int j = 0; j < from.size(); ++j) {
- ArrayList<String> libClasses = getLibraryClassList(from.get(j), classProduced);
- for (int k = 0; k < libClasses.size(); ++k) {
- if (getConsumedBy (libClasses.get(k)) != null && getConsumedBy (libClasses.get(k)).size() > 0) {
- noUse = false;
- }
- }
- if (noUse) {
- removeInstance(from.get(j));
- }
- noUse = true;
- }
- }
- }
-
- }
-
-
- private Vector<LibraryClassDescriptor> getClassProduced(ModuleIdentification mi){
-
- Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
- return clsProduced;
-// String[] sClassProduced = new String[clsProduced.size()];
-// for (int i = 0; i < clsProduced.size(); ++i) {
-// sClassProduced[i] = clsProduced.get(i).className;
-// }
-// return sClassProduced;
- }
-
- private String[] getClassConsumed(ModuleIdentification mi){
-
- Vector<LibraryClassDescriptor> clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
- String[] sClassConsumed = new String[clsConsumed.size()];
- for (int i = 0; i < clsConsumed.size(); ++i) {
- sClassConsumed[i] = clsConsumed.get(i).className;
- }
- return sClassConsumed;
- }
-
- private void showClassToResolved(){
- Vector<String> errorMsg = new Vector<String>();
- libClassTableModel.setRowCount(0);
- libInstanceTableModel.setRowCount(0);
- if (classConsumed == null || classConsumed.size() == 0) {
- return;
- }
-
- Iterator<LibraryClassDescriptor> li = classConsumed.keySet().iterator();
- while(li.hasNext()){
- LibraryClassDescriptor lcd = li.next();
- if (classConsumed.get(lcd) == null || classConsumed.get(lcd).size() == 0) {
- continue;
- }
-
- if (!isBoundedClass(lcd, errorMsg)){
-
- String[] s = { lcd.className, lcd.supArchs, lcd.supModTypes };
- libClassTableModel.addRow(s);
- }
- }
-
- if (errorMsg.size() > 0) {
- String errors = "";
- for (int i = 0; i < errorMsg.size(); ++i) {
- errors += " " + errorMsg.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), errors);
- }
- }
-
- private String getModuleArch () {
- String arch = "";
- String[] moduleInfo = moduleKey.split(" ");
- for (int i = 4; i < moduleInfo.length; ++i) {
- arch += moduleInfo[i];
- arch += " ";
- }
- return arch.trim();
- }
- private void addLibInstance (ModuleIdentification libMi) throws Exception{
-
- //
- // Add pcd information of selected instance to current moduleSA
- //
- ffc.addFrameworkModulesPcdBuildDefs(libMi, getModuleArch(), ffc.getModuleSA(moduleKey));
-
- ffc.genLibraryInstance(libMi, moduleKey);
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(877, 555);
- this.setResizable(false);
- this.centerWindow();
- this.setModal(true);
- this.setTitle("Module Settings");
- this.setContentPane(getJContentPane());
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- jContentPane.add(getJPanelContentPaneSouth(), java.awt.BorderLayout.SOUTH);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("PCD Build Definition", null, getJPanelPcd(), null);
- jTabbedPane.addTab("Libraries", null, getJPanelLibrary(), null);
- jTabbedPane.addTab("FV Info", null, getJPanelModuleSaOpts(), null);
- jTabbedPane.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null);
-
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes jPanelPcd
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelPcd() {
- if (jPanelPcd == null) {
- jLabelPcdData = new JLabel();
- jLabelPcdData.setText(" PCD Data");
- jPanelPcd = new JPanel();
- jPanelPcd.setLayout(new BorderLayout());
- jPanelPcd.add(jLabelPcdData, java.awt.BorderLayout.NORTH);
- jPanelPcd.add(getJScrollPaneTablePcd(), java.awt.BorderLayout.CENTER);
- jPanelPcd.add(getJPanelPcdSouth(), java.awt.BorderLayout.SOUTH);
- jPanelPcd.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initPcdBuildDefinition(moduleKey);
- }
- });
-
- }
- return jPanelPcd;
- }
-
- /**
- * This method initializes jPanelLibrary
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibrary() {
- if (jPanelLibrary == null) {
- jPanelLibrary = new JPanel();
- jPanelLibrary.setLayout(new BorderLayout());
- jPanelLibrary.add(getJSplitPane(), java.awt.BorderLayout.NORTH);
- jPanelLibrary.add(getJPanelLibrarySouth(), java.awt.BorderLayout.SOUTH);
- jPanelLibrary.add(getJPanelLibraryCenter(), java.awt.BorderLayout.CENTER);
- jPanelLibrary.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initLibraries(moduleKey);
- }
- });
- }
- return jPanelLibrary;
- }
-
- /**
- * This method initializes jScrollPaneTablePcd
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneTablePcd() {
- if (jScrollPaneTablePcd == null) {
- jScrollPaneTablePcd = new JScrollPane();
- jScrollPaneTablePcd.setViewportView(getJTablePcd());
- }
- return jScrollPaneTablePcd;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePcd() {
- if (jTablePcd == null) {
- model = new IDefaultTableModel();
- jTablePcd = new JTable(model);
- jTablePcd.setRowHeight(20);
- jTablePcd.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
- model.addColumn("CName");
- model.addColumn("TokenSpaceGUID");
- model.addColumn("ItemType");
- model.addColumn("Token");
- model.addColumn("MaxDatumSize");
- model.addColumn("DataType");
- model.addColumn("DefaultValue");
-
- jTablePcd.getColumnModel().getColumn(0).setMinWidth(250);
-
- TableColumn tokenColumn = jTablePcd.getColumnModel().getColumn(3);
- jTablePcd.removeColumn(tokenColumn);
-
- jTablePcd.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTablePcd.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
-
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow = lsm.getMinSelectionIndex();
- String cName = model.getValueAt(selectedRow, 0)+"";
- String tsGuid = model.getValueAt(selectedRow, 1)+"";
- String itemType = model.getValueAt(selectedRow, 2)+"";
- //
- // array for pcd related information: helpText, itemType, moduleType.
- //
- String[] pcdInfo = {"", "", ""};
- Vector<String> validPcdTypes = new Vector<String>();
- getPcdInfo(moduleKey, cName, tsGuid, pcdInfo, validPcdTypes);
- jTextAreaPcdHelp.setText(pcdInfo[0]);
- initComboBox(pcdInfo[1], pcdInfo[2], validPcdTypes);
- jComboBoxItemType.setSelectedItem(itemType);
- jTextFieldMaxDatumSize.setEnabled(true);
- jTextFieldMaxDatumSize.setVisible(true);
- jTextFieldMaxDatumSize.setText(model.getValueAt(selectedRow, 4)+"");
- jTextFieldPcdDefault.setEnabled(true);
- jTextFieldPcdDefault.setText(model.getValueAt(selectedRow, 6)+"");
- if ((model.getValueAt(selectedRow, 5) != null) && model.getValueAt(selectedRow, 5).equals("VOID*")) {
- if (pcdInfo[1].equals("FEATURE_FLAG")) {
- jTextFieldMaxDatumSize.setVisible(false);
- }
- else if (pcdInfo[1].equals("FIXED_AT_BUILD")) {
- try{
- jTextFieldMaxDatumSize.setEnabled(false);
- jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(model.getValueAt(selectedRow, 6)+"")+"");
- }
- catch(Exception except){
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Unacceptable PCD Value: " + except.getMessage());
- }
- }
- else{
- jTextFieldMaxDatumSize.setText(model.getValueAt(selectedRow, 4)+"");
- }
- }
- else {
- jTextFieldMaxDatumSize.setEnabled(false);
- }
-
- if (!model.getValueAt(selectedRow, 2).equals("DYNAMIC") && !model.getValueAt(selectedRow, 2).equals("DYNAMIC_EX")) {
- jTextFieldPcdDefault.setText(model.getValueAt(selectedRow, 6)+"");
- if (model.getValueAt(selectedRow, 2).equals("FEATURE_FLAG")){
- jTextFieldPcdDefault.setVisible(false);
- jComboBoxFeatureFlagValue.setVisible(true);
- jComboBoxFeatureFlagValue.setSelectedItem(model.getValueAt(selectedRow, 6)+"");
- }
- else{
- jTextFieldPcdDefault.setVisible(true);
- jTextFieldPcdDefault.setEnabled(true);
- jComboBoxFeatureFlagValue.setVisible(false);
- }
- }
- else{
- jTextFieldPcdDefault.setEnabled(false);
- }
- }
-
-
- }
- });
-
- }
- return jTablePcd;
- }
-
- private void initComboBox(String originalType, String mType, Vector<String> validPcdTypes) {
- jComboBoxItemType.removeAllItems();
-
- if (originalType.equals("DYNAMIC")) {
- for (int i = 0; i < validPcdTypes.size(); ++i) {
- jComboBoxItemType.addItem(validPcdTypes.get(i));
- }
- }
- else {
- jComboBoxItemType.addItem(originalType);
- }
- }
-
- /**
- * @param cName
- * @param tsGuid
- * @param sa sa[0]: HelpText; sa[1]: itemType in Msa; sa[2]: isBinary;
- */
- private void getPcdInfo(String moduleKey, String cName, String tsGuid, String[] sa, Vector<String> validPcdTypes) {
- String[][] saa = new String[ffc.getLibraryInstancesCount(moduleKey)][5];
- ffc.getLibraryInstances(moduleKey, saa);
-
- try{
- if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(moduleKey), cName, tsGuid, sa, validPcdTypes)) {
- return;
- }
- for (int j = 0; j < saa.length; ++j) {
- if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),
- cName, tsGuid, sa, validPcdTypes)) {
- return;
- }
- }
- }
- catch(Exception e) {
- JOptionPane.showMessageDialog(this, "Get PCD details fail: " + e.getMessage());
- }
- }
-
- /**
- * This method initializes jPanelPcdSouth
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelPcdSouth() {
- if (jPanelPcdSouth == null) {
- jLabelPcdHelp = new JLabel();
- jLabelPcdHelp.setText("PCD Description");
- jPanelPcdSouth = new JPanel();
- jPanelPcdSouth.setPreferredSize(new java.awt.Dimension(607,200));
- jPanelPcdSouth.add(jLabelPcdHelp, null);
- jPanelPcdSouth.add(getJScrollPanePcdHelp(), null);
- jPanelPcdSouth.add(getJPanelPcdFields(), null);
- }
- return jPanelPcdSouth;
- }
-
- /**
- * This method initializes jScrollPanePcdHelp
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePcdHelp() {
- if (jScrollPanePcdHelp == null) {
- jScrollPanePcdHelp = new JScrollPane();
- jScrollPanePcdHelp.setPreferredSize(new java.awt.Dimension(500,100));
- jScrollPanePcdHelp.setViewportView(getJTextAreaPcdHelp());
- }
- return jScrollPanePcdHelp;
- }
-
- /**
- * This method initializes jTextAreaPcdHelp
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaPcdHelp() {
- if (jTextAreaPcdHelp == null) {
- jTextAreaPcdHelp = new JTextArea();
- jTextAreaPcdHelp.setEditable(false);
- }
- return jTextAreaPcdHelp;
- }
-
- /**
- * This method initializes jPanelContentPaneSouth
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentPaneSouth() {
- if (jPanelContentPaneSouth == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelContentPaneSouth = new JPanel();
- jPanelContentPaneSouth.setLayout(flowLayout);
- jPanelContentPaneSouth.add(getJButtonOk(), null);
- jPanelContentPaneSouth.add(getJButtonCancel(), null);
- }
- return jPanelContentPaneSouth;
- }
-
- /**
- * This method initializes jSplitPane
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPane() {
- if (jSplitPane == null) {
- jSplitPane = new JSplitPane();
- jSplitPane.setDividerLocation(200);
- jSplitPane.setLeftComponent(getJPanelLibraryLeft());
- jSplitPane.setRightComponent(getJPanelLibraryRight());
- jSplitPane.setPreferredSize(new java.awt.Dimension(202,200));
- }
- return jSplitPane;
- }
-
- /**
- * This method initializes jPanelLibraryLeft
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibraryLeft() {
- if (jPanelLibraryLeft == null) {
- jLabelLibClass = new JLabel();
- jLabelLibClass.setText("Library Classes Uninstantiated");
- jPanelLibraryLeft = new JPanel();
- jPanelLibraryLeft.add(jLabelLibClass, null);
- jPanelLibraryLeft.add(getJScrollPaneLibClass(), null);
- }
- return jPanelLibraryLeft;
- }
-
- /**
- * This method initializes jPanelLibraryRight
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibraryRight() {
- if (jPanelLibraryRight == null) {
- jLabelQualifiedInstance = new JLabel();
- jLabelQualifiedInstance.setText("Instances Available");
- jPanelLibraryRight = new JPanel();
- jPanelLibraryRight.add(jLabelQualifiedInstance, null);
- jPanelLibraryRight.add(getJScrollPaneQualifiedInstance(), null);
- }
- return jPanelLibraryRight;
- }
-
- /**
- * This method initializes jScrollPaneSelectedInstances
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneSelectedInstances() {
- if (jScrollPaneSelectedInstances == null) {
- jScrollPaneSelectedInstances = new JScrollPane();
- jScrollPaneSelectedInstances.setPreferredSize(new java.awt.Dimension(600,150));
- jScrollPaneSelectedInstances.setViewportView(getJTableSelectedInstances());
- }
- return jScrollPaneSelectedInstances;
- }
-
- /**
- * This method initializes jTableSelectedInstances
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableSelectedInstances() {
- if (jTableSelectedInstances == null) {
- selectedInstancesTableModel = new IDefaultTableModel();
- selectedInstancesTableModel.addColumn("Name");
- selectedInstancesTableModel.addColumn("ModuleGUID");
- selectedInstancesTableModel.addColumn("ModuleVersion");
- selectedInstancesTableModel.addColumn("PackageGUID");
- selectedInstancesTableModel.addColumn("PackageVersion");
- jTableSelectedInstances = new JTable(selectedInstancesTableModel);
- jTableSelectedInstances.setRowHeight(20);
-
- jTableSelectedInstances.getColumnModel().getColumn(0).setMinWidth(250);
-
- jTableSelectedInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- jTableSelectedInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- }
- return jTableSelectedInstances;
- }
-
- /**
- * This method initializes jScrollPaneLibClass
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneLibClass() {
- if (jScrollPaneLibClass == null) {
- jScrollPaneLibClass = new JScrollPane();
- jScrollPaneLibClass.setPreferredSize(new java.awt.Dimension(200,170));
- jScrollPaneLibClass.setViewportView(getJTableLibClass());
- }
- return jScrollPaneLibClass;
- }
-
- /**
- * This method initializes jTableLibClass
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableLibClass() {
- if (jTableLibClass == null) {
- libClassTableModel = new IDefaultTableModel();
- libClassTableModel.addColumn("LibraryClass");
- libClassTableModel.addColumn("Arch");
- libClassTableModel.addColumn("ModType");
- jTableLibClass = new JTable(libClassTableModel);
- jTableLibClass.setRowHeight(20);
- jTableLibClass.setShowGrid(false);
- jTableLibClass.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- TableColumn column = jTableLibClass.getColumnModel().getColumn(1);
- jTableLibClass.getColumnModel().removeColumn(column);
- column = jTableLibClass.getColumnModel().getColumn(1);
- jTableLibClass.getColumnModel().removeColumn(column);
-
- jTableLibClass.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow2 = lsm.getMinSelectionIndex();
- if (selectedRow2 < 0) {
- return;
- }
- //
- // display potential lib instances according to class selection
- //
- libInstanceTableModel.setRowCount(0);
- String cls = libClassTableModel.getValueAt(selectedRow2, 0).toString();
- String arch = libClassTableModel.getValueAt(selectedRow2, 1).toString();
- String modType = libClassTableModel.getValueAt(selectedRow2, 2).toString();
- LibraryClassDescriptor lcd = new LibraryClassDescriptor(cls, arch, modType);
- ArrayList<String> al = classInstanceMap.get(lcd);
- if (al == null) {
- al = getInstancesForClass(lcd, null);
- if (al.size() != 0) {
- classInstanceMap.put(lcd, al);
- }
-
- }
- ListIterator<String> li = al.listIterator();
- while(li.hasNext()) {
- String instance = li.next();
- String[] s = {"", "", "", "", ""};
- if (WorkspaceProfile.getModuleId(instance) != null) {
- s[0] = WorkspaceProfile.getModuleId(instance).getName();
- }
-
- String[] instancePart = instance.split(" ");
- for (int i = 0; i < instancePart.length; ++i){
- s[i+1] = instancePart[i];
- }
- libInstanceTableModel.addRow(s);
- }
-
- }
- }
- });
- }
- return jTableLibClass;
- }
-
- /**
- * This method initializes jScrollPaneQualifiedInstance
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneQualifiedInstance() {
- if (jScrollPaneQualifiedInstance == null) {
- jScrollPaneQualifiedInstance = new JScrollPane();
- jScrollPaneQualifiedInstance.setPreferredSize(new java.awt.Dimension(600,170));
- jScrollPaneQualifiedInstance.setViewportView(getJTableLibInstances());
- }
- return jScrollPaneQualifiedInstance;
- }
-
- /**
- * This method initializes jTableLibInstances
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableLibInstances() {
- if (jTableLibInstances == null) {
- libInstanceTableModel = new IDefaultTableModel();
- libInstanceTableModel.addColumn("Name");
- libInstanceTableModel.addColumn("ModuleGUID");
- libInstanceTableModel.addColumn("ModuleVersion");
- libInstanceTableModel.addColumn("PackageGUID");
- libInstanceTableModel.addColumn("PackageVersion");
- jTableLibInstances = new JTable(libInstanceTableModel);
- jTableLibInstances.setRowHeight(20);
-
- jTableLibInstances.getColumnModel().getColumn(0).setMinWidth(250);
-
- jTableLibInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- jTableLibInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- }
- return jTableLibInstances;
- }
-
- /**
- * This method initializes jPanelLibrarySouth
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibrarySouth() {
- if (jPanelLibrarySouth == null) {
- jPanelLibrarySouth = new JPanel();
- }
- return jPanelLibrarySouth;
- }
-
- /**
- * This method initializes jPanelLibraryCenter
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibraryCenter() {
- if (jPanelLibraryCenter == null) {
- jLabelInstanceHelp = new JLabel();
- jLabelInstanceHelp.setText("Instance Description");
- jLabelSelectedInstances = new JLabel();
- jLabelSelectedInstances.setText("Selected Instances");
- jPanelLibraryCenter = new JPanel();
- jPanelLibraryCenter.setLayout(new BorderLayout());
-
- jPanelLibraryCenter.add(getJPanelLibraryCenterC(), java.awt.BorderLayout.CENTER);
- jPanelLibraryCenter.add(getJPanelLibraryCenterN(), java.awt.BorderLayout.NORTH);
-
- }
- return jPanelLibraryCenter;
- }
-
- /**
- * This method initializes jScrollPaneInstanceHelp
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneInstanceHelp() {
- if (jScrollPaneInstanceHelp == null) {
- jScrollPaneInstanceHelp = new JScrollPane();
- jScrollPaneInstanceHelp.setPreferredSize(new java.awt.Dimension(400,50));
- jScrollPaneInstanceHelp.setViewportView(getJTextAreaInstanceHelp());
- }
- return jScrollPaneInstanceHelp;
- }
-
- /**
- * This method initializes jTextAreaInstanceHelp
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaInstanceHelp() {
- if (jTextAreaInstanceHelp == null) {
- jTextAreaInstanceHelp = new JTextArea();
- jTextAreaInstanceHelp.setEditable(false);
- }
- return jTextAreaInstanceHelp;
- }
-
- /**
- * This method initializes jButtonAdd
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTableLibInstances.getSelectedRow();
- if (row < 0) {
- return;
- }
-
- String libInstanceKey = libInstanceTableModel.getValueAt(row, 1) + " " +
- libInstanceTableModel.getValueAt(row, 2) + " " +
- libInstanceTableModel.getValueAt(row, 3) + " " +
- libInstanceTableModel.getValueAt(row, 4);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(libInstanceKey);
- try {
- addLibInstance (libMi);
- }
- catch (Exception exception) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Adding Instance " + libMi.getName() + " : \n"+ exception.getMessage());
- return;
- }
- docConsole.setSaved(false);
- Object[] s = {libInstanceTableModel.getValueAt(row, 0), libInstanceTableModel.getValueAt(row, 1),
- libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3),
- libInstanceTableModel.getValueAt(row, 4)};
- selectedInstancesTableModel.addRow(s);
-
- Vector<LibraryClassDescriptor> vLcd = addConsumedClassFromModule (libInstanceKey);
- addProducedClassFromModule (libInstanceKey);
-
- Vector<String> errorMsg = new Vector<String>();
- Vector<ModuleIdentification> newInstances = new Vector<ModuleIdentification>();
- Stack<LibraryClassDescriptor> lcdStack = new Stack<LibraryClassDescriptor>();
- for (int i = 0; i < vLcd.size(); ++i) {
- LibraryClassDescriptor lcd = vLcd.get(i);
- if (!lcdStack.contains(lcd)) {
- lcdStack.push(lcd);
- }
- }
- try {
- resolveLibraryInstances(lcdStack, true, errorMsg, newInstances);
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, exp.getMessage());
- }
-
- showClassToResolved();
-
- if (errorMsg.size() > 0) {
- String errors = "";
- for (int i = 0; i < errorMsg.size(); ++i) {
- errors += " " + errorMsg.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FpdModuleSA.this, errors);
- }
- }
- });
- }
- return jButtonAdd;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDeleteInstance() {
- if (jButtonDeleteInstance == null) {
- jButtonDeleteInstance = new JButton();
- jButtonDeleteInstance.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDeleteInstance.setText("Delete");
- jButtonDeleteInstance.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTableSelectedInstances.getSelectedRow();
- if (row < 0) {
- return;
- }
- docConsole.setSaved(false);
- String instanceKey = selectedInstancesTableModel.getValueAt(row, 1) + " "
- + selectedInstancesTableModel.getValueAt(row, 2) + " "
- + selectedInstancesTableModel.getValueAt(row, 3) + " "
- + selectedInstancesTableModel.getValueAt(row, 4);
- removeInstance(instanceKey);
-
- selectedInstancesTableModel.setRowCount(0);
- int instanceCount = ffc.getLibraryInstancesCount(moduleKey);
- if (instanceCount != 0) {
- String[][] saa = new String[instanceCount][5];
- ffc.getLibraryInstances(moduleKey, saa);
- for (int i = 0; i < saa.length; ++i) {
- String libInstanceKey = saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(libInstanceKey);
- if (mi != null) {
- //
- // ToDo: verify this instance first.
- //
- saa[i][0] = mi.getName();
- saa[i][2] = mi.getVersion();
- saa[i][4] = mi.getPackageId().getVersion();
- selectedInstancesTableModel.addRow(saa[i]);
- }
- }
- }
- showClassToResolved();
- }
- });
- }
- return jButtonDeleteInstance;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Close");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setVisible(false);
- }
- return jButtonCancel;
- }
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk) {
- if (jTableModuleSaOptions.isEditing()) {
- jTableModuleSaOptions.getCellEditor().stopCellEditing();
- }
- this.setVisible(false);
- }
- }
- /**
- * This method initializes jPanelModuleSaOpts
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModuleSaOpts() {
- if (jPanelModuleSaOpts == null) {
- FlowLayout flowLayout4 = new FlowLayout();
- flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelFfsFormatKey = new JLabel();
- jLabelFfsFormatKey.setText("FFS Format Key");
- jLabelFfsFormatKey.setPreferredSize(new java.awt.Dimension(90,16));
- jLabelFfsFileGuid = new JLabel();
- jLabelFfsFileGuid.setText("FFS File GUID");
- jLabelFfsFileGuid.setPreferredSize(new java.awt.Dimension(90,16));
- jLabelFfsFileGuid.setVisible(false);
- jLabelFvBinding = new JLabel();
- jLabelFvBinding.setText("FV Binding");
- jLabelFvBinding.setPreferredSize(new java.awt.Dimension(90,16));
- jPanelModuleSaOpts = new JPanel();
- jPanelModuleSaOpts.setLayout(flowLayout4);
- jPanelModuleSaOpts.add(jLabelFvBinding, null);
- jPanelModuleSaOpts.add(getJTextFieldFvBinding(), null);
- jPanelModuleSaOpts.add(jLabelFfsFileGuid, null);
- jPanelModuleSaOpts.add(getJTextFieldFileGuid(), null);
- jPanelModuleSaOpts.add(jLabelFfsFormatKey, null);
- jPanelModuleSaOpts.add(getJTextFieldFfsKey(), null);
- jPanelModuleSaOpts.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initFvInfo(moduleKey);
- }
- });
- }
- return jPanelModuleSaOpts;
- }
-
- private Vector<String> getVectorFromString (String s) {
- if (s == null || s.equals("null")) {
- s = "";
- }
- String[] sa1 = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sa1.length; ++i) {
- v.add(sa1[i]);
- }
- return v;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvBinding() {
- if (jTextFieldFvBinding == null) {
- jTextFieldFvBinding = new JTextField();
- jTextFieldFvBinding.setPreferredSize(new java.awt.Dimension(400,20));
- jTextFieldFvBinding.setEditable(true);
- jTextFieldFvBinding.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- String originalFvBinding = ffc.getFvBinding(moduleKey);
- String newFvBinding = jTextFieldFvBinding.getText();
- if (newFvBinding.equals(originalFvBinding)) {
- return;
- }
- if (newFvBinding.length() == 0 && originalFvBinding == null) {
- return;
- }
-
- Vector<String> oldFvList = getVectorFromString (originalFvBinding);
- Vector<String> newFvList = getVectorFromString (newFvBinding);
- String moduleInfo[] = moduleKey.split(" ");
- ffc.setFvBinding(moduleKey, newFvBinding);
- //
- // remove module from Fvs that not in newFvList now.
- //
- oldFvList.removeAll(newFvList);
- for (int j = 0; j < oldFvList.size(); ++j) {
- ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), "IMAGES", "1", moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
- }
- //
- // add module to Fvs that were not in oldFvList.
- //
- oldFvList = getVectorFromString (originalFvBinding);
- newFvList.removeAll(oldFvList);
- for (int i = 0; i < newFvList.size(); ++i) {
- ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), "IMAGES", "1", moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
- }
- docConsole.setSaved(false);
- }
- });
-
- }
- return jTextFieldFvBinding;
- }
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFileGuid() {
- if (jTextFieldFileGuid == null) {
- jTextFieldFileGuid = new JTextField();
- jTextFieldFileGuid.setPreferredSize(new java.awt.Dimension(300,20));
- jTextFieldFileGuid.setVisible(false);
- jTextFieldFileGuid.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- String originalFileGuid = ffc.getFfsFileNameGuid(moduleKey);
- String newFileGuid = jTextFieldFileGuid.getText();
- if (newFileGuid.equals(originalFileGuid)) {
- return;
- }
- if (newFileGuid.length() == 0 && originalFileGuid == null) {
- return;
- }
- if (newFileGuid.length() > 0) {
- if (!DataValidation.isGuid(newFileGuid)) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "FFS File Guid is NOT GUID Type.");
- return;
- }
- }
-
- docConsole.setSaved(false);
- if (newFileGuid.length() == 0) {
- newFileGuid = null;
- }
- ffc.setFfsFileNameGuid(moduleKey, newFileGuid);
- }
- });
-
- }
- return jTextFieldFileGuid;
- }
- /**
- * This method initializes jTextFieldFfsKey
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFfsKey() {
- if (jTextFieldFfsKey == null) {
- jTextFieldFfsKey = new JTextField();
- jTextFieldFfsKey.setPreferredSize(new java.awt.Dimension(250,20));
- jTextFieldFfsKey.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- String originalFfsKey = ffc.getFfsFormatKey(moduleKey);
- String newFfsKey = jTextFieldFfsKey.getText();
- if (newFfsKey.equals(originalFfsKey)) {
- return;
- }
- if (newFfsKey.length() == 0 && originalFfsKey == null) {
- return;
- }
- docConsole.setSaved(false);
- ffc.setFfsFormatKey(moduleKey, newFfsKey);
- }
- });
-
- }
- return jTextFieldFfsKey;
- }
- /**
- * This method initializes jScrollPaneModuleSaOptions
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneModuleSaOptions() {
- if (jScrollPaneModuleSaOptions == null) {
- jScrollPaneModuleSaOptions = new JScrollPane();
- jScrollPaneModuleSaOptions.setPreferredSize(new java.awt.Dimension(600,350));
- jScrollPaneModuleSaOptions.setViewportView(getJTableModuleSaOptions());
- }
- return jScrollPaneModuleSaOptions;
- }
- /**
- * This method initializes jTableModuleSaOptions
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableModuleSaOptions() {
- if (jTableModuleSaOptions == null) {
- optionsTableModel = new DefaultTableModel();
- optionsTableModel.addColumn("BuildTargets");
- optionsTableModel.addColumn("ToolChainFamily");
- optionsTableModel.addColumn("TagName");
- optionsTableModel.addColumn("ToolCode");
- optionsTableModel.addColumn("SupportedArchs");
- optionsTableModel.addColumn("Contents");
- jTableModuleSaOptions = new JTable(optionsTableModel);
- jTableModuleSaOptions.setRowHeight(20);
-
- jTableModuleSaOptions.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(2).setMinWidth(tagNameWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(4).setMinWidth(supportArchWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(5).setMinWidth(argWidth);
-// javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
-// JComboBox cb = new JComboBox();
-// cb.addItem("MSFT");
-// cb.addItem("GCC");
-// cb.addItem("CYGWIN");
-// cb.addItem("INTEL");
-// cb.addItem("USER_DEFINED");
-// toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch, FrameworkWizardUI.getInstance()));
-
- jTableModuleSaOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI.getInstance()));
-
- jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTableModuleSaOptions.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel)arg0.getSource();
-
- if (arg0.getType() == TableModelEvent.UPDATE){
- //ToDo Data Validition check.
- String targets = m.getValueAt(row, 0) + "";
- Vector<Object> targetName = null;
- if (targets.length() > 0) {
- targetName = new Vector<Object>();
- String[] sArray = targets.split(" ");
- for (int i = 0; i < sArray.length; ++i) {
- targetName.add(sArray[i]);
- }
- }
-
- String toolChain = m.getValueAt(row, 1) + "";
- String tagName = m.getValueAt(row, 2) + "";
- String toolCode = m.getValueAt(row, 3) + "";
- String archs = m.getValueAt(row, 4) + "";
- Vector<Object> supArch = null;
- if (archs.length() > 0) {
- supArch = new Vector<Object>();
- String[] sArray1 = archs.split(" ");
- for (int i = 0; i < sArray1.length; ++i) {
- supArch.add(sArray1[i]);
- }
- }
-
- String contents = m.getValueAt(row, 5) + "";
- docConsole.setSaved(false);
- ffc.updateModuleSAOptionsOpt(moduleKey, row, targetName, toolChain, tagName, toolCode, supArch, contents);
- }
- }
- });
- }
- return jTableModuleSaOptions;
- }
- /**
- * This method initializes jButtonNew
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNew() {
- if (jButtonNew == null) {
- jButtonNew = new JButton();
- jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonNew.setText("New");
- jButtonNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- String[] row = {"", "", "", "", "", ""};
- optionsTableModel.addRow(row);
- Vector<Object> v = null;
- Vector<Object> v1 = null;
- docConsole.setSaved(false);
- ffc.genModuleSAOptionsOpt(moduleKey, v, "", "", "", v1, "");
- }
- });
- }
- return jButtonNew;
- }
- /**
- * This method initializes jButtonDelete
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDeleteOption() {
- if (jButtonDeleteOption == null) {
- jButtonDeleteOption = new JButton();
- jButtonDeleteOption.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDeleteOption.setText("Delete");
- jButtonDeleteOption.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableModuleSaOptions.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- ffc.removeModuleSAOptionsOpt(moduleKey, jTableModuleSaOptions.getSelectedRow());
- optionsTableModel.removeRow(jTableModuleSaOptions.getSelectedRow());
- }
- });
- }
- return jButtonDeleteOption;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-/**
- * This method initializes jPanelPcdFields
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFields() {
- if (jPanelPcdFields == null) {
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(3);
- gridLayout.setColumns(2);
- jPanelPcdFields = new JPanel();
- jPanelPcdFields.setLayout(gridLayout);
- jPanelPcdFields.setPreferredSize(new java.awt.Dimension(600,90));
- jPanelPcdFields.add(getJPanelPcdFieldsFirstRow(), null);
- jPanelPcdFields.add(getJPanelPcdFieldsSecondRow(), null);
- jPanelPcdFields.add(getJPanelPcdFieldsThirdRow(), null);
- }
- return jPanelPcdFields;
-}
-/**
- * This method initializes jPanelPcdFieldsSecondRow
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFieldsSecondRow() {
- if (jPanelPcdFieldsSecondRow == null) {
- FlowLayout flowLayout2 = new FlowLayout();
- flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelMaxDatumSize = new JLabel();
- jLabelMaxDatumSize.setText("Max Datum Size");
- jPanelPcdFieldsSecondRow = new JPanel();
- jPanelPcdFieldsSecondRow.setLayout(flowLayout2);
- jPanelPcdFieldsSecondRow.add(jLabelMaxDatumSize, null);
- jPanelPcdFieldsSecondRow.add(getJTextFieldMaxDatumSize(), null);
- }
- return jPanelPcdFieldsSecondRow;
-}
-/**
- * This method initializes jPanelPcdFieldsThirdRow
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFieldsThirdRow() {
- if (jPanelPcdFieldsThirdRow == null) {
- FlowLayout flowLayout3 = new FlowLayout();
- flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelPcdDefaultValue = new JLabel();
- jLabelPcdDefaultValue.setText("Default Value");
- jLabelPcdDefaultValue.setPreferredSize(new java.awt.Dimension(91,16));
- jPanelPcdFieldsThirdRow = new JPanel();
- jPanelPcdFieldsThirdRow.setLayout(flowLayout3);
- jPanelPcdFieldsThirdRow.add(jLabelPcdDefaultValue, null);
- jPanelPcdFieldsThirdRow.add(getJTextFieldPcdDefault(), null);
- jPanelPcdFieldsThirdRow.add(getJComboBoxFeatureFlagValue(), null);
- jPanelPcdFieldsThirdRow.add(getJButtonUpdatePcd(), null);
- }
- return jPanelPcdFieldsThirdRow;
-}
-/**
- * This method initializes jPanelPcdFieldsFirstRow
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFieldsFirstRow() {
- if (jPanelPcdFieldsFirstRow == null) {
- FlowLayout flowLayout1 = new FlowLayout();
- flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelItemType = new JLabel();
- jLabelItemType.setText("Item Type");
- jLabelItemType.setPreferredSize(new java.awt.Dimension(91,16));
- jPanelPcdFieldsFirstRow = new JPanel();
- jPanelPcdFieldsFirstRow.setLayout(flowLayout1);
- jPanelPcdFieldsFirstRow.add(jLabelItemType, null);
- jPanelPcdFieldsFirstRow.add(getJComboBoxItemType(), null);
- }
- return jPanelPcdFieldsFirstRow;
-}
-/**
- * This method initializes jComboBoxItemType
- *
- * @return javax.swing.JComboBox
- */
-private JComboBox getJComboBoxItemType() {
- if (jComboBoxItemType == null) {
- jComboBoxItemType = new JComboBox();
- jComboBoxItemType.setPreferredSize(new java.awt.Dimension(200,20));
- jComboBoxItemType.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
-
- int row = jTablePcd.getSelectedRow();
- if (row < 0) {
- return;
- }
-
- if (jComboBoxItemType.getSelectedItem() != null && jComboBoxItemType.getSelectedItem().equals("FIXED_AT_BUILD")) {
- jTextFieldPcdDefault.setEnabled(true);
- }
- else {
- jTextFieldPcdDefault.setEnabled(false);
- }
- }
- });
- }
- return jComboBoxItemType;
-}
-
-private void pcdDynamicToNonDynamic(String cName, String tsGuid) {
- String[][] saa = new String[ffc.getDynamicPcdBuildDataCount()][5];
- ffc.getDynamicPcdBuildData(saa);
- String maxSize = "";
- String value = "";
- for (int i = 0; i < saa.length; ++i) {
- if (saa[i][0].equals(cName) && saa[i][2].equals(tsGuid)) {
- maxSize = saa[i][3];
- value = ffc.getDynamicPcdBuildDataValue(i);
- break;
- }
- }
-
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- value = null;
- String itemType = jComboBoxItemType.getSelectedItem()+"";
- ffc.updatePcdData(mKey, cName, tsGuid, itemType, maxSize, value);
- al.set(i, mKey + " " + itemType);
- }
-
- ffc.removeDynamicPcdBuildData(cName, tsGuid);
-}
-
-private void pcdNonDynamicToDynamic(String cName, String tsGuid) {
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- String itemType = jComboBoxItemType.getSelectedItem()+"";
- ffc.updatePcdData(mKey, cName, tsGuid, itemType, jTextFieldMaxDatumSize.getText(), jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
- al.set(i, mKey + " " + itemType);
- }
- try{
- ffc.addDynamicPcdBuildData(cName, model.getValueAt(jTablePcd.getSelectedRow(), 3), tsGuid, "DYNAMIC", model.getValueAt(jTablePcd.getSelectedRow(), 5)+"", jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
- }
- catch(Exception e){
- JOptionPane.showMessageDialog(FpdModuleSA.this, "PCD value format: " + e.getMessage());
- }
-}
-
-private void changePcdTypeWithinSameCategory (String cName, String tsGuid) {
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- String itemType = jComboBoxItemType.getSelectedItem()+"";
- ffc.updatePcdData(mKey, cName, tsGuid, itemType, null, null);
- al.set(i, mKey + " " + itemType);
- }
-}
-
-private String moduleInfo (String pcdInfo) {
-
- return pcdInfo.substring(0, pcdInfo.lastIndexOf(" "));
-}
-
-/**
- * This method initializes jTextFieldMaxDatumSize
- *
- * @return javax.swing.JTextField
- */
-private JTextField getJTextFieldMaxDatumSize() {
- if (jTextFieldMaxDatumSize == null) {
- jTextFieldMaxDatumSize = new JTextField();
- jTextFieldMaxDatumSize.setPreferredSize(new java.awt.Dimension(200,20));
- }
- return jTextFieldMaxDatumSize;
-}
-/**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
-private JTextField getJTextFieldPcdDefault() {
- if (jTextFieldPcdDefault == null) {
- jTextFieldPcdDefault = new JTextField();
- jTextFieldPcdDefault.setPreferredSize(new java.awt.Dimension(200,20));
- }
- return jTextFieldPcdDefault;
-}
-/**
- * This method initializes jButton6
- *
- * @return javax.swing.JButton
- */
-private JButton getJButtonUpdatePcd() {
- if (jButtonUpdatePcd == null) {
- jButtonUpdatePcd = new JButton();
- jButtonUpdatePcd.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonUpdatePcd.setText("Update PCD Data");
- jButtonUpdatePcd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTablePcd.getSelectedRow();
- if (row < 0) {
- return;
- }
-
- String cName = model.getValueAt(row, 0)+"";
- String tsGuid = model.getValueAt(row, 1)+"";
- String oldItemType = model.getValueAt(row, 2)+"";
- String dataType = model.getValueAt(row, 5)+"";
- String newItemType = jComboBoxItemType.getSelectedItem()+"";
- String newValue = jTextFieldPcdDefault.isVisible()? jTextFieldPcdDefault.getText():jComboBoxFeatureFlagValue.getSelectedItem()+"";
- if (newValue.length() == 0){
-
- if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {
- newValue = "0";
- }
- if (dataType.equals("BOOLEAN")){
- newValue = "FALSE";
- }
- if (dataType.equals("VOID*")) {
- newValue = "L\"\"";
- }
- }
-
- String[] pcdInfo = {"", "", ""};
- Vector<String> validPcdTypes = new Vector<String>();
- getPcdInfo (moduleKey, cName, tsGuid, pcdInfo, validPcdTypes);
- if (pcdInfo[1].equals("FIXED_AT_BUILD") && model.getValueAt(row, 5).equals("VOID*")) {
- try {
- jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(newValue)+"");
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "PCD Value MalFormed: " + exp.getMessage());
- return;
- }
- }
- String newMaxDatumSize = jTextFieldMaxDatumSize.getText();
-
- if (!newItemType.equals(oldItemType)) {
- Vector<ModuleIdentification> moduleInfo = new Vector<ModuleIdentification>();
- try {
- boolean changable = itemTypeCouldBeChanged (cName, tsGuid, newItemType, moduleInfo);
- if (!changable) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName());
- return;
- }
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName() + " " + exp.getMessage());
- return;
- }
-
- if ((oldItemType.equals("DYNAMIC") || oldItemType.equals("DYNAMIC_EX")) && !newItemType.equals("DYNAMIC") && !newItemType.equals("DYNAMIC_EX")) {
- pcdDynamicToNonDynamic(cName, tsGuid);
- }
- if (!oldItemType.equals("DYNAMIC") && !oldItemType.equals("DYNAMIC_EX") && (newItemType.equals("DYNAMIC") || newItemType.equals("DYNAMIC_EX"))) {
- pcdNonDynamicToDynamic(cName, tsGuid);
- }
- else {
- changePcdTypeWithinSameCategory (cName, tsGuid);
- }
- model.setValueAt(newItemType, row, 2);
- }
-
- ffc.updatePcdData(moduleKey, cName, tsGuid, model.getValueAt(row, 2)+"", newMaxDatumSize, newValue);
- docConsole.setSaved(false);
- model.setValueAt(newValue, row, 6);
- model.setValueAt(newMaxDatumSize, row, 4);
-
- }
- });
- }
- return jButtonUpdatePcd;
-}
-
-private boolean itemTypeCouldBeChanged (String cName, String tsGuid, String newItemType, Vector<ModuleIdentification> mi) throws Exception{
- ArrayList<String> pcdConsumers = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < pcdConsumers.size(); ++i) {
- String consumerInfo = moduleInfo (pcdConsumers.get(i));
- mi.removeAllElements();
- mi.add(WorkspaceProfile.getModuleId(consumerInfo));
- String[] sa = {"", "", ""};
- Vector<String> validPcdTypes = new Vector<String>();
- getPcdInfo (consumerInfo, cName, tsGuid, sa, validPcdTypes);
- if (validPcdTypes.size() == 0) {
- return false;
- }
- if (!sa[1].equals("DYNAMIC")) {
- return false;
- }
- if (!validPcdTypes.contains(newItemType)) {
- return false;
- }
- }
- return true;
-}
-
-/**
- * This method initializes jComboBoxFeatureFlagValue
- *
- * @return javax.swing.JComboBox
- */
-private JComboBox getJComboBoxFeatureFlagValue() {
- if (jComboBoxFeatureFlagValue == null) {
- jComboBoxFeatureFlagValue = new JComboBox();
- jComboBoxFeatureFlagValue.setPreferredSize(new java.awt.Dimension(100,20));
- jComboBoxFeatureFlagValue.setVisible(false);
- jComboBoxFeatureFlagValue.addItem("TRUE");
- jComboBoxFeatureFlagValue.addItem("FALSE");
- }
- return jComboBoxFeatureFlagValue;
-}
-/**
- * This method initializes jPanelCustomToolChain
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelCustomToolChain() {
- if (jPanelCustomToolChain == null) {
- jPanelCustomToolChain = new JPanel();
- jPanelCustomToolChain.setLayout(new BorderLayout());
- jPanelCustomToolChain.add(getJPanelToolchainS(), java.awt.BorderLayout.SOUTH);
- jPanelCustomToolChain.add(getJScrollPaneModuleSaOptions(), java.awt.BorderLayout.CENTER);
- jPanelCustomToolChain.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initToolChainOptions(moduleKey);
- }
- });
- }
- return jPanelCustomToolChain;
-}
-/**
- * This method initializes jPanelToolchainS
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelToolchainS() {
- if (jPanelToolchainS == null) {
- jPanelToolchainS = new JPanel();
- jPanelToolchainS.add(getJButtonNew(), null);
- jPanelToolchainS.add(getJButtonDeleteOption(), null);
- }
- return jPanelToolchainS;
-}
-
-/**
- * This method initializes jPanelLibraryCenterN
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelLibraryCenterN() {
- if (jPanelLibraryCenterN == null) {
- FlowLayout flowLayout5 = new FlowLayout();
- flowLayout5.setAlignment(java.awt.FlowLayout.CENTER);
- flowLayout5.setHgap(10);
- jPanelLibraryCenterN = new JPanel();
- jPanelLibraryCenterN.setLayout(flowLayout5);
- jPanelLibraryCenterN.add(jLabelInstanceHelp, null);
- jPanelLibraryCenterN.add(getJScrollPaneInstanceHelp(), null);
- jPanelLibraryCenterN.add(getJButtonAdd(), null);
- jPanelLibraryCenterN.add(getJButtonDeleteInstance(), null);
- }
- return jPanelLibraryCenterN;
-}
-/**
- * This method initializes jPanelLibraryCenterC
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelLibraryCenterC() {
- if (jPanelLibraryCenterC == null) {
- jPanelLibraryCenterC = new JPanel();
- jPanelLibraryCenterC.add(jLabelSelectedInstances, null);
- jPanelLibraryCenterC.add(getJScrollPaneSelectedInstances(), null);
- }
- return jPanelLibraryCenterC;
-}
-
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class MultipleInstanceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = -9148463005930920297L;
- private String className = null;
- private String libInstance1 = null;
- private String libInstance2 = null;
-
- MultipleInstanceException (String libClass, String instance1, String instance2) {
- super();
- className = libClass;
- libInstance1 = instance1;
- libInstance2 = instance2;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Throwable#getMessage()
- */
- @Override
- public String getMessage() {
- // TODO Auto-generated method stub
- return " Library Class " + className + "is Produced by Two Instances: "
- + libInstance1 + " and " + libInstance2 + ". Platform Build will Fail.";
- }
-
-}
-
-class ImproperInstanceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = -5279700566993277033L;
- private String className = null;
- private String libInstance = null;
- private String instanceSupArch = null;
- private String instanceSupModType = null;
-
- ImproperInstanceException (String libClass, String instance1, String arch, String type) {
- super();
- className = libClass;
- libInstance = instance1;
- instanceSupArch = arch;
- instanceSupModType = type;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Throwable#getMessage()
- */
- @Override
- public String getMessage() {
- // TODO Auto-generated method stub
- return " Library Class " + className + " Produced by Library Instance: "
- + libInstance + "\nOnly Supports " + instanceSupArch + " and Module Type " + instanceSupModType + ".\n This instance should be removed.\n";
- }
-
-}
-
-class NoInstanceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1987122786598970598L;
-
- private String className = null;
-
- NoInstanceException (String libClass) {
- className = libClass;
- }
-
- public String getMessage() {
- return "No Applicable Instance for Library Class " + className
- + ", Platform Build will Fail.";
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java
deleted file mode 100644
index c87f466bdd..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java
+++ /dev/null
@@ -1,1043 +0,0 @@
-/** @file
- Java class FpdPlatformDefs is GUI for Flash element operation in SPD file.
-
- Copyright (c) 2006, 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.
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import javax.swing.JPanel;
-
-import javax.swing.JTabbedPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.toolchain.ToolChainId;
-
-import javax.swing.JCheckBox;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-//import javax.swing.event.ListSelectionEvent;
-//import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import javax.swing.JComboBox;
-import java.awt.Dimension;
-import java.util.Vector;
-
-public class FpdPlatformDefs extends IInternalFrame {
-
- private static boolean Debug = false;
-
- private final int dialogWidth = 600;
-
- private final int oneRowHeight = 20;
-
- private final int twoRowHeight = 40;
-
- // private final int threeRowHeight = 60;
-
- private final int fourRowHeight = 80;
-
- private final int sepHeight = 6;
-
- // private final int sepWidth = 10;
-
- private final int offsetWidth = 70;
-
- private final int buttonWidth = 90;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + sepHeight * 3;
-
- private final int rowThree = rowTwo + oneRowHeight + sepHeight;
-
- private final int rowFour = rowThree + oneRowHeight + sepHeight;
-
- private final int rowFive = rowFour + fourRowHeight + sepHeight * 3;
-
- private final int rowSix = rowFive + oneRowHeight + sepHeight;
-
- private final int rowSeven = rowSix + oneRowHeight + sepHeight;
-
- private final int rowEight = rowSeven + oneRowHeight + sepHeight;
-
- private final int rowNine = rowEight + oneRowHeight + sepHeight;
-
- private final int rowTen = rowNine + fourRowHeight + sepHeight + sepHeight * 3;
-
- private final int rowEleven = rowTen + oneRowHeight + sepHeight;
-
- private final int rowTwelve = rowEleven + oneRowHeight + sepHeight;
-
- private final int dialogHeight = rowTwelve + twoRowHeight;
-
- private final int labelColumn = 12;
-
- private final int valueColumn = 168;
-
- private final int labelWidth = 155;
-
- private final int valueWidth = 320;
-
- private final int valueCenter = valueColumn + (valueWidth / 2);
-
- private final int tableHeight = fourRowHeight;
-
- private final int tableWidth = valueWidth;
-
- private JPanel jContentPane = null;
-
- private JTabbedPane jTabbedPane = null;
-
- private TargetTableModel buildTargetTableModel = null;
-
- private SkuInfoTableModel skuInfoTableModel = null;
-
- private OpeningPlatformType docConsole = null;
-
- private FpdFileContents ffc = null;
-
- private JPanel jPanelGeneralTab = null;
-
- private JPanel jPanelGeneralContainer = null;
-
- private JLabel jLabelSupArch = null;
-
- private JCheckBox jCheckBoxIa32 = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JComboBox jComboBoxInterDir = null;
-
- private JComboBox jBuildTargetComboBox = null;
-
- private JTable jTableBuildTargets = null;
-
- private JPanel jArchitectureSelections = null;
-
- private JLabel jLabelBuildTargets = null;
-
- // private JTextField jTextFieldBuildTarget = null;
-
- private JButton jButtonAddBuildTarget = null;
-
- private JButton jButtonDelBuildTarget = null;
-
- private JScrollPane jScrollPaneBuildTargets = null;
-
- private JScrollPane jScrollPaneSkuInfo = null;
-
- private JTable jTableSkuInfo = null;
-
- private JCheckBox jCheckBoxEbc = null;
-
- private JCheckBox jCheckBoxArm = null;
-
- private JCheckBox jCheckBoxPpc = null;
-
- private JLabel jLabelSkuInfo = null;
-
- private JLabel jLabelSkuId = null;
-
- private JTextField jTextFieldSkuId = null;
-
- private JLabel jLabelSkuName = null;
-
- private JTextField jTextFieldSkuName = null;
-
- private JButton jButtonSkuAdd = null;
-
- private JButton jButtonSkuDel = null;
-
- private JLabel jLabelIntermediateDirs = null;
-
- private JLabel jLabelOutputDir = null;
-
- private JTextField jTextFieldOutputDir = null;
-
- private JLabel jLabelOutputInfo = null;
-
- private int selectedRow = -1;
-
- /**
- * The following are not used by the UI
- */
- private static final long serialVersionUID = 1L;
-
- private ToolChainId tid = new ToolChainId();
-
- public FpdPlatformDefs() {
- super();
- initialize();
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- }
-
- public FpdPlatformDefs(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this();
- ffc = new FpdFileContents(fpd);
- init(ffc);
- }
-
- public FpdPlatformDefs(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- }
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("General", null, getJPanelGeneralTab(), null);
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(dialogWidth, dialogHeight);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setTitle("FPD Platform Definitions");
- this.setContentPane(getJContentPane());
- this.addInternalFrameListener(new InternalFrameAdapter() {
- public void internalFrameDeactivated(InternalFrameEvent e) {
- if (jTableBuildTargets.isEditing()) {
- jTableBuildTargets.getCellEditor().stopCellEditing();
- }
- if (jTableSkuInfo.isEditing()) {
- jTableSkuInfo.getCellEditor().stopCellEditing();
- }
-
- }
- });
- }
-
- private void init(FpdFileContents ffc) {
- Vector<Object> v = new Vector<Object>();
- ffc.getPlatformDefsSupportedArchs(v);
- showSupportedArchitectures(v);
- v.removeAllElements();
-
- ffc.getPlatformDefsBuildTargets(v);
- buildTargetTableModel.setRowCount(0);
- for (int i = 0; i < v.size(); ++i) {
- Object[] row = { v.get(i) };
- buildTargetTableModel.addRow(row);
- }
-
- String[][] saa = new String[ffc.getPlatformDefsSkuInfoCount()][2];
- ffc.getPlatformDefsSkuInfos(saa);
- for (int i = 0; i < saa.length; ++i) {
- skuInfoTableModel.addRow(saa[i]);
- }
-
- String interDir = ffc.getPlatformDefsInterDir();
- if (interDir != null) {
- jComboBoxInterDir.setSelectedItem(interDir);
- }
-
- String outputDir = ffc.getPlatformDefsOutputDir();
- if (outputDir != null) {
- jTextFieldOutputDir.setText(outputDir);
- }
- }
-
- private void showSupportedArchitectures(Vector<Object> v) {
- if (v.contains("IA32")) {
- jCheckBoxIa32.setSelected(true);
- } else {
- jCheckBoxIa32.setSelected(false);
- }
- if (v.contains("X64")) {
- jCheckBoxX64.setSelected(true);
- } else {
- jCheckBoxX64.setSelected(false);
- }
- if (v.contains("IPF")) {
- jCheckBoxIpf.setSelected(true);
- } else {
- jCheckBoxIpf.setSelected(false);
- }
- if (v.contains("EBC")) {
- jCheckBoxEbc.setSelected(true);
- } else {
- jCheckBoxEbc.setSelected(false);
- }
- if (v.contains("ARM")) {
- jCheckBoxArm.setSelected(true);
- } else {
- jCheckBoxArm.setSelected(false);
- }
- if (v.contains("PPC")) {
- jCheckBoxPpc.setSelected(true);
- } else {
- jCheckBoxPpc.setSelected(false);
- }
- }
-
- private void getSupportedArchitectures(Vector<Object> v) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- v.removeAllElements();
- if (jCheckBoxIa32.isSelected()) {
- v.add("IA32");
- }
- if (jCheckBoxX64.isSelected()) {
- v.add("X64");
- }
- if (jCheckBoxIpf.isSelected()) {
- v.add("IPF");
- }
- if (jCheckBoxEbc.isSelected()) {
- v.add("EBC");
- }
- if (jCheckBoxArm.isSelected()) {
- v.add("ARM");
- }
- if (jCheckBoxPpc.isSelected()) {
- v.add("PPC");
- }
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelGeneralTab() {
- if (jPanelGeneralTab == null) {
- jPanelGeneralTab = new JPanel();
- jPanelGeneralTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));
- jPanelGeneralTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));
- jPanelGeneralTab.setAutoscrolls(true);
- jPanelGeneralTab.setLocation(0, 0);
- jPanelGeneralTab.setLayout(null);
- jPanelGeneralTab.add(getJPanelGeneralContainer(), null);
- }
- return jPanelGeneralTab;
- }
-
- /**
- * This method initializes jPanel5
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelGeneralContainer() {
- if (jPanelGeneralContainer == null) {
- jLabelSupArch = new JLabel();
- jLabelSupArch.setText("Supported Architectures");
- jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jLabelBuildTargets = new JLabel();
- jLabelBuildTargets.setText("Build Targets");
- jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jLabelSkuInfo = new JLabel();
- jLabelSkuInfo.setText("SKU Information");
- jLabelSkuInfo.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
- jLabelSkuId = new JLabel();
- jLabelSkuId.setText("SKU ID Number");
- jLabelSkuId.setBounds(new java.awt.Rectangle(labelColumn + 10, rowSix, labelWidth, oneRowHeight));
- jLabelSkuName = new JLabel();
- jLabelSkuName.setText("SKU Name");
- jLabelSkuName.setBounds(new java.awt.Rectangle(labelColumn + 10, rowSeven, labelWidth, oneRowHeight));
- jLabelOutputInfo = new JLabel();
- jLabelOutputInfo.setText("Output Directory Configuration");
- jLabelOutputInfo.setBounds(new java.awt.Rectangle(labelColumn, rowTen, valueWidth, oneRowHeight));
- jLabelIntermediateDirs = new JLabel();
- jLabelIntermediateDirs.setText("Intermediate Build Directories");
- jLabelIntermediateDirs.setBounds(new java.awt.Rectangle(labelColumn + 10, rowEleven, valueWidth,
- oneRowHeight));
- jLabelOutputDir = new JLabel();
- jLabelOutputDir.setText("Name of the Output Directory");
- jLabelOutputDir.setBounds(new java.awt.Rectangle(labelColumn + 10, rowTwelve, valueWidth, oneRowHeight));
-
- jPanelGeneralContainer = new JPanel();
- jPanelGeneralContainer.setLayout(null);
- jPanelGeneralContainer.setLocation(new java.awt.Point(2, 2));
- jPanelGeneralContainer.setBounds(new java.awt.Rectangle(2, 2, dialogWidth * 2, dialogHeight));
- jPanelGeneralContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
-
- jPanelGeneralContainer.add(jLabelSupArch, null);
- jPanelGeneralContainer.add(getArchitectureSelections(), null);
-
- jPanelGeneralContainer.add(jLabelBuildTargets, null);
- // jPanelGeneralContainer.add(getJTextFieldBuildTarget(), null);
- jPanelGeneralContainer.add(getJBuildTargetComboBox(), null);
-
- jPanelGeneralContainer.add(getJButtonAddBuildTarget(), null);
- jPanelGeneralContainer.add(getJButtonDelBuildTarget(), null);
- jPanelGeneralContainer.add(getJScrollPaneBuildTargets(), null);
-
- jPanelGeneralContainer.add(jLabelSkuInfo, null);
- jPanelGeneralContainer.add(jLabelSkuId, null);
- jPanelGeneralContainer.add(getJTextFieldSkuId(), null);
- jPanelGeneralContainer.add(jLabelSkuName, null);
- jPanelGeneralContainer.add(getJTextFieldSkuName(), null);
- jPanelGeneralContainer.add(getJButtonSkuAdd(), null);
- jPanelGeneralContainer.add(getJButtonSkuDel(), null);
- jPanelGeneralContainer.add(getJScrollPaneSkuInfo(), null);
-
- jPanelGeneralContainer.add(jLabelOutputInfo, null);
- jPanelGeneralContainer.add(jLabelIntermediateDirs, null);
- jPanelGeneralContainer.add(getJComboBoxInterDir(), null);
- jPanelGeneralContainer.add(jLabelOutputDir, null);
- jPanelGeneralContainer.add(getJTextFieldOutputDir(), null);
-
- }
- return jPanelGeneralContainer;
- }
-
- /**
- * This method initializes jArchitectureSelections Row 4
- *
- * @return jArchitectureSelections
- */
- private JPanel getArchitectureSelections() {
- if (jArchitectureSelections == null) {
- jArchitectureSelections = new JPanel();
- jArchitectureSelections.setLayout(null);
- jArchitectureSelections.add(getJCheckBoxIa32(), null);
- jArchitectureSelections.add(getJCheckBoxX64(), null);
- jArchitectureSelections.add(getJCheckBoxIpf(), null);
- jArchitectureSelections.add(getJCheckBoxEbc(), null);
- jArchitectureSelections.add(getJCheckBoxArm(), null);
- jArchitectureSelections.add(getJCheckBoxPpc(), null);
- jArchitectureSelections.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
- jArchitectureSelections.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jArchitectureSelections.setLocation(new java.awt.Point(valueColumn, rowOne));
- jArchitectureSelections.setToolTipText("<html>A Platform may support one or more architectures,"
- + "<br>at least one architecture must be selected!</html>");
- }
- return jArchitectureSelections;
- }
-
- /**
- * This method initializes jCheckBox1
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIa32() {
- if (jCheckBoxIa32 == null) {
- jCheckBoxIa32 = new JCheckBox();
- jCheckBoxIa32.setText("IA32");
- jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
- jCheckBoxIa32.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxIa32.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxIa32;
- }
-
- /**
- * This method initializes jCheckBox2
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
- jCheckBoxX64.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxX64.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBox3
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setText("IPF");
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
- jCheckBoxIpf.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxIpf.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxIpf;
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxEbc() {
- if (jCheckBoxEbc == null) {
- jCheckBoxEbc = new JCheckBox();
- // jCheckBoxEbc.setPreferredSize(new java.awt.Dimension(50, 20));
- jCheckBoxEbc.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
- jCheckBoxEbc.setText("EBC");
- jCheckBoxEbc.setVisible(true);
- jCheckBoxEbc.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxEbc.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxEbc;
- }
-
- /**
- * This method initializes jCheckBox5
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxArm() {
- if (jCheckBoxArm == null) {
- jCheckBoxArm = new JCheckBox();
- // jCheckBoxArm.setPreferredSize(new java.awt.Dimension(52, 20));
- jCheckBoxArm.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
- jCheckBoxArm.setText("ARM");
- jCheckBoxArm.setVisible(true);
- jCheckBoxArm.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxArm.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxArm;
- }
-
- /**
- * This method initializes jCheckBox6
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPpc() {
- if (jCheckBoxPpc == null) {
- jCheckBoxPpc = new JCheckBox();
- // jCheckBoxPpc.setPreferredSize(new Dimension(50, 20));
- jCheckBoxPpc.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
- jCheckBoxPpc.setText("PPC");
- jCheckBoxPpc.setVisible(true);
- jCheckBoxPpc.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxPpc.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxPpc;
- }
-
- /**
- * Use a ComboBox for BuildTargets
- *
- * @return javax.swing.JComboBox jBuildTargetComboBox
- */
- private JComboBox getJBuildTargetComboBox() {
- if (jBuildTargetComboBox == null) {
- String toolBt = null;
- if (tid.getToolsDefTargetNames() == null)
- toolBt = "DEBUG RELEASE";
- else
- toolBt = tid.getToolsDefTargetNames().trim();
-
- if ((toolBt.contains("*")) || (toolBt.length() < 1)) {
- toolBt = "DEBUG RELEASE";
- }
- if (Debug)
- System.out.println("Using Build Targets: " + toolBt.trim());
-
- toolBt = toolBt.replaceAll(" ", ":");
- toolBt = " :" + toolBt;
- if (Debug)
- System.out.println("Using Build Targets: " + toolBt.trim());
- String[] buildTargets = toolBt.trim().split(":");
-
- jBuildTargetComboBox = new JComboBox(buildTargets);
- jBuildTargetComboBox.setEditable(true);
- jBuildTargetComboBox.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- jBuildTargetComboBox.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));
- jBuildTargetComboBox.setLocation(new java.awt.Point(valueColumn, rowTwo));
- jBuildTargetComboBox.setToolTipText("<html>Select a defined Target and then click Add,<br>"
- + "or enter a new, one word TargetName and then click Add.<br>"
- + "Remember to define the Targetname in the tool defintion file."
- + "</html>");
-
- }
- return jBuildTargetComboBox;
- }
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- // private JTextField getJTextFieldBuildTarget() {
- // if (jTextFieldBuildTarget == null) {
- // jTextFieldBuildTarget = new JTextField();
- // jTextFieldBuildTarget.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- // jTextFieldBuildTarget.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));
- // jTextFieldBuildTarget.setLocation(new java.awt.Point(valueColumn, rowTwo));
- // }
- // return jTextFieldBuildTarget;
- // }
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddBuildTarget() {
- if (jButtonAddBuildTarget == null) {
- jButtonAddBuildTarget = new JButton();
- jButtonAddBuildTarget.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonAddBuildTarget.setBounds(new java.awt.Rectangle(valueCenter - buttonWidth - 5, rowThree,
- buttonWidth, oneRowHeight));
- jButtonAddBuildTarget.setLocation(new java.awt.Point(valueCenter - buttonWidth - 5, rowThree));
- jButtonAddBuildTarget.setText("Add");
- jButtonAddBuildTarget.setVisible(true);
-
- jButtonAddBuildTarget.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- // Used with Text Field
- // if (jTextFieldBuildTarget.getText().length() > 0) {
- // String[] row = { jTextFieldBuildTarget.getText() };
- // jTextFieldBuildTarget.setText("");
- // buildTargetTableModel.addRow(row);
- // Vector<Object> v = new Vector<Object>();
- // for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- // v.add(buildTargetTableModel.getValueAt(i, 0));
- // }
- // docConsole.setSaved(false);
- // ffc.setPlatformDefsBuildTargets(v);
- // }
- // Use with ComboBox
- if (jBuildTargetComboBox.getSelectedItem().toString().length() > 0) {
- String[] row = { jBuildTargetComboBox.getSelectedItem().toString() };
- buildTargetTableModel.addRow(row);
- Vector<Object> v = new Vector<Object>();
- for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- v.add(buildTargetTableModel.getValueAt(i, 0));
- }
- docConsole.setSaved(false);
- ffc.setPlatformDefsBuildTargets(v);
- }
- }
- });
- }
- return jButtonAddBuildTarget;
- }
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDelBuildTarget() {
- if (jButtonDelBuildTarget == null) {
- jButtonDelBuildTarget = new JButton();
- jButtonDelBuildTarget.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonDelBuildTarget
- .setBounds(new java.awt.Rectangle(valueCenter + 5, rowThree, buttonWidth, oneRowHeight));
- jButtonDelBuildTarget.setLocation(new java.awt.Point(valueCenter + 5, rowThree));
- jButtonDelBuildTarget.setText("Delete");
- jButtonDelBuildTarget.setVisible(true);
-
- jButtonDelBuildTarget.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableBuildTargets.getSelectedRow() < 0) {
- return;
- }
- if (jTableBuildTargets.getRowCount() == 1) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "At least one build target should be set for this platform.");
- return;
- }
- buildTargetTableModel.removeRow(jTableBuildTargets.getSelectedRow());
- Vector<Object> v = new Vector<Object>();
- for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- v.add(buildTargetTableModel.getValueAt(i, 0));
- }
- docConsole.setSaved(false);
- ffc.setPlatformDefsBuildTargets(v);
- }
- });
- }
- return jButtonDelBuildTarget;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneBuildTargets() {
- if (jScrollPaneBuildTargets == null) {
- jScrollPaneBuildTargets = new JScrollPane();
- jScrollPaneBuildTargets.setPreferredSize(new Dimension(tableWidth - 20, tableHeight - 20));
- jScrollPaneBuildTargets.setBounds(new java.awt.Rectangle(valueColumn, rowFour, tableWidth - 5,
- tableHeight - 5));
- jScrollPaneBuildTargets.setLocation(new java.awt.Point(valueColumn, rowFour));
- jScrollPaneBuildTargets
- .setBorder(javax.swing.BorderFactory
- .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-
- jScrollPaneBuildTargets.setViewportView(getJTableBuildTargets());
- }
- return jScrollPaneBuildTargets;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableBuildTargets() {
- if (jTableBuildTargets == null) {
- buildTargetTableModel = new TargetTableModel();
-
- jTableBuildTargets = new JTable(buildTargetTableModel);
- jTableBuildTargets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableBuildTargets.setRowHeight(oneRowHeight);
- jTableBuildTargets.setToolTipText("<html>Select one of the Targets from the table and<br>"
- + "click Delete to remove the target from the platform.</html>");
- buildTargetTableModel.addColumn("Build Target");
-
- jTableBuildTargets.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- selectedRow = jTableBuildTargets.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- Vector<Object> v = new Vector<Object>();
- for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- v.add(m.getValueAt(i, 0));
- }
- docConsole.setSaved(false);
- ffc.setPlatformDefsBuildTargets(v);
- }
- }
- });
-
- }
- return jTableBuildTargets;
- }
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldSkuId() {
- if (jTextFieldSkuId == null) {
- jTextFieldSkuId = new JTextField();
- jTextFieldSkuId.setPreferredSize(new Dimension(40, oneRowHeight));
- jTextFieldSkuId.setBounds(new java.awt.Rectangle(valueColumn, rowSix, 40, oneRowHeight));
- jTextFieldSkuId.setLocation(new java.awt.Point(valueColumn, rowSix));
- jTextFieldSkuId.setToolTipText("Enter a unique integer value.");
- }
- return jTextFieldSkuId;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldSkuName() {
- if (jTextFieldSkuName == null) {
- jTextFieldSkuName = new JTextField();
- jTextFieldSkuName.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- jTextFieldSkuName.setBounds(new java.awt.Rectangle(valueColumn, rowSeven, valueWidth, oneRowHeight));
- jTextFieldSkuName.setLocation(new java.awt.Point(valueColumn, rowSeven));
- jTextFieldSkuName.setToolTipText("<html>Enter a name to help identify this SKU.<br>"
- + "This entry is not used by the build system, it is<br>"
- + "used only by this user interface.</html>");
- }
- return jTextFieldSkuName;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonSkuAdd() {
- if (jButtonSkuAdd == null) {
- jButtonSkuAdd = new JButton();
-
- jButtonSkuAdd.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonSkuAdd.setBounds(new java.awt.Rectangle(valueCenter - buttonWidth - 5, rowEight, buttonWidth,
- oneRowHeight));
- jButtonSkuAdd.setLocation(new java.awt.Point(valueCenter - buttonWidth - 5, rowEight));
- jButtonSkuAdd.setText("Add");
- jButtonSkuAdd.setVisible(true);
-
- jButtonSkuAdd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTextFieldSkuId.getText().length() > 0) {
- String[] row = { jTextFieldSkuId.getText(), jTextFieldSkuName.getText() };
- skuInfoTableModel.addRow(row);
- docConsole.setSaved(false);
- ffc.genPlatformDefsSkuInfo(row[0], row[1]);
- }
- }
- });
- }
- return jButtonSkuAdd;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonSkuDel() {
- if (jButtonSkuDel == null) {
- jButtonSkuDel = new JButton();
- jButtonSkuDel.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonSkuDel.setBounds(new java.awt.Rectangle(valueCenter + 5, rowEight, buttonWidth, oneRowHeight));
- jButtonSkuDel.setLocation(new java.awt.Point(valueCenter + 5, rowEight));
- jButtonSkuDel.setText("Delete");
- jButtonSkuDel.setVisible(true);
- jButtonSkuDel.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableSkuInfo.isEditing()) {
- jTableSkuInfo.getCellEditor().stopCellEditing();
- }
- if (jTableSkuInfo.getSelectedRow() < 1) {
- return;
- }
- docConsole.setSaved(false);
- ffc.removePlatformDefsSkuInfo(jTableSkuInfo.getSelectedRow());
- skuInfoTableModel.removeRow(jTableSkuInfo.getSelectedRow());
- }
- });
- }
- return jButtonSkuDel;
- }
-
- /**
- * This method initializes jScrollPane3
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneSkuInfo() {
- if (jScrollPaneSkuInfo == null) {
- jScrollPaneSkuInfo = new JScrollPane();
- jScrollPaneSkuInfo.setPreferredSize(new Dimension(tableWidth - 20, tableHeight - 20));
- jScrollPaneSkuInfo.setBounds(new java.awt.Rectangle(valueColumn, rowNine, tableWidth - 5, tableHeight - 5));
- jScrollPaneSkuInfo.setLocation(new java.awt.Point(valueColumn, rowNine));
-
- jScrollPaneSkuInfo
- .setBorder(javax.swing.BorderFactory
- .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-
- jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());
- }
- return jScrollPaneSkuInfo;
- }
-
- /**
- * This method initializes jTable2
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableSkuInfo() {
- if (jTableSkuInfo == null) {
- skuInfoTableModel = new SkuInfoTableModel();
- skuInfoTableModel.addColumn("SKU ID");
- skuInfoTableModel.addColumn("Name");
- jTableSkuInfo = new JTable(skuInfoTableModel);
- jTableSkuInfo.setToolTipText("<html>SKU ID 0 must always be defined as the default.<br>"
- + "0 can mean either SKU disabled, or it can be the<br>"
- + "default value if more than one SKU is defined, and the<br>"
- + "platform is not jumpered to use one of the other SKU values.</html>");
-
- jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTableSkuInfo.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String id = m.getValueAt(row, 0) + "";
- String name = m.getValueAt(row, 1) + "";
- docConsole.setSaved(false);
- ffc.updatePlatformDefsSkuInfo(row, id, name);
- }
- }
- });
- }
- return jTableSkuInfo;
- }
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxInterDir() {
- if (jComboBoxInterDir == null) {
- jComboBoxInterDir = new JComboBox();
- jComboBoxInterDir.setPreferredSize(new Dimension(75, oneRowHeight));
- jComboBoxInterDir.setBounds(new java.awt.Rectangle(valueColumn + offsetWidth, rowEleven, 95, oneRowHeight));
- jComboBoxInterDir.setLocation(new java.awt.Point(valueColumn + offsetWidth, rowEleven));
- jComboBoxInterDir.addItem("UNIFIED");
- jComboBoxInterDir.addItem("MODULE");
- jComboBoxInterDir.setSelectedIndex(0);
- jComboBoxInterDir.setToolTipText("<html>Select UNIFIED to generate intermediate directories under<br>"
- + "under platform directory tree.<br>"
- + "Select MODULE to generate intermediate directories under the<br>"
- + "individual module directories.</html>");
- jComboBoxInterDir.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- ffc.setPlatformDefsInterDir(jComboBoxInterDir.getSelectedItem() + "");
- }
- });
- }
- return jComboBoxInterDir;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField Row Twelve
- */
- private JTextField getJTextFieldOutputDir() {
- if (jTextFieldOutputDir == null) {
- jTextFieldOutputDir = new JTextField();
- jTextFieldOutputDir.setPreferredSize(new java.awt.Dimension(290, 20));
- jTextFieldOutputDir.setBounds(new java.awt.Rectangle(valueColumn + offsetWidth, rowTwelve, valueWidth - 30,
- oneRowHeight));
- jTextFieldOutputDir.setLocation(new java.awt.Point(valueColumn + offsetWidth, rowTwelve));
- jTextFieldOutputDir.setToolTipText("Select the name or URL for the output directory tree.");
- jTextFieldOutputDir.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- docConsole.setSaved(false);
- ffc.setPlatformDefsOutputDir(jTextFieldOutputDir.getText());
- }
- });
- }
- return jTextFieldOutputDir;
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class SkuInfoTableModel extends DefaultTableModel {
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int column) {
- if (row == 0) {
- return false;
- }
- return true;
- }
-}
-
-class TargetTableModel extends DefaultTableModel {
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int column) {
- if (row < 2) {
- return false;
- }
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java
deleted file mode 100644
index 401772f28a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/**
- *
- */
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JPanel;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Vector;
-
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JComboBox;
-import javax.swing.JTabbedPane;
-
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-
-/**
- * @author jlin16
- *
- */
-public class GenAprioriFileDialog extends JDialog implements ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 3627991301208644354L;
- private JPanel jContentPane = null;
- private JPanel jPanelN = null;
- private JLabel jLabelFvName = null;
- private JComboBox jComboBoxFvNames = null;
- private JTabbedPane jTabbedPane = null;
- private FpdFileContents ffc = null;
- private OpeningPlatformType docConsole = null;
-
- /**
- * This is the default constructor
- */
- public GenAprioriFileDialog(FpdFileContents inputFfc, OpeningPlatformType dc) {
- super();
- ffc = inputFfc;
- docConsole = dc;
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(670, 670);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setTitle("Apriori Files");
- this.setContentPane(getJContentPane());
- this.setResizable(false);
- this.setModal(true);
-
- String fvName = jComboBoxFvNames.getSelectedItem()+"";
- if (fvName.length() > 0) {
- jTabbedPane.removeAll();
- AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true);
- peiPane.showModulesInFv(fvName);
- peiPane.showAllModulesInPlatform();
- jTabbedPane.addTab("PEIMs", peiPane);
- AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false);
- dxePane.showModulesInFv(fvName);
- dxePane.showAllModulesInPlatform();
- jTabbedPane.addTab("DXE Drivers", dxePane);
- }
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelN(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
- docConsole.setSaved(false);
- return;
- }
- if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) {
- this.dispose();
- }
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-/**
- * This method initializes jPanelN
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelN() {
- if (jPanelN == null) {
- jLabelFvName = new JLabel();
- jLabelFvName.setText("FV Name");
- jPanelN = new JPanel();
- jPanelN.add(jLabelFvName, null);
- jPanelN.add(getJComboBoxFvNames(), null);
- }
- return jPanelN;
-}
-
-/**
- * This method initializes jComboBoxFvNames
- *
- * @return javax.swing.JComboBox
- */
-private JComboBox getJComboBoxFvNames() {
- if (jComboBoxFvNames == null) {
- jComboBoxFvNames = new JComboBox();
- jComboBoxFvNames.setPreferredSize(new java.awt.Dimension(200,20));
- Vector<String> vFvNames = new Vector<String>();
- ffc.getFvImagesFvImageFvImageNames(vFvNames);
- for (int i = 0; i < vFvNames.size(); ++i) {
- jComboBoxFvNames.addItem(vFvNames.get(i));
- }
-// if (jComboBoxFvNames.getItemCount() > 0) {
-// jComboBoxFvNames.setSelectedIndex(0);
-//
-// }
- jComboBoxFvNames.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- String fvName = jComboBoxFvNames.getSelectedItem()+"";
- if (fvName.length() > 0) {
- jTabbedPane.removeAll();
- AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true);
- peiPane.showModulesInFv(fvName);
- peiPane.showAllModulesInPlatform();
- jTabbedPane.addTab("PEIMs", peiPane);
- AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false);
- dxePane.showModulesInFv(fvName);
- dxePane.showAllModulesInPlatform();
- jTabbedPane.addTab("DXE Drivers", dxePane);
- }
-
- }
- });
- }
- return jComboBoxFvNames;
-}
-
-/**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
-private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- }
- return jTabbedPane;
-}
-
-private class AprioriModuleOrderPane extends ModuleOrderPane {
- /**
- *
- */
- private static final long serialVersionUID = -7952853414833230546L;
- private boolean forPEI = false;
- private String fvName = null;
-
- AprioriModuleOrderPane (String fvName, String file, ActionListener action, boolean b) {
-
- super(fvName, file, ffc, action);
- this.fvName = fvName;
- forPEI = b;
- getJTableModInFv().getColumnModel().getColumn(0).setHeaderValue("Modules in Apriori File");
- getJButtonOk().setText("Save");
- getJButtonCancel().setText("Close");
- }
-
- public void showModulesInFv (String fvName) {
- String id = "1";
- if (forPEI) {
- id = "0";
- }
- int size = ffc.getUserExtsIncModCount(fvName, "APRIORI", id);
-
- if (size != -1) {
- String[][] saa = new String[size][5];
- ffc.getUserExtsIncMods(fvName, "APRIORI", id, saa);
-
- for (int i = 0; i < size; ++i) {
- String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
-
- String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
- getModInFvTableModel().addRow(row);
- }
- }
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
- String id = "1";
- if (forPEI) {
- id = "0";
- }
-
- Vector<String[]> vModInFv = new Vector<String[]>();
- for (int i = 0; i < getJTableModInFv().getRowCount(); ++i) {
- String moduleName = getModInFvTableModel().getValueAt(i, 0)+"";
- if (moduleName.length() == 0 || moduleName.equals("N/A")) {
- continue;
- }
-
- String mg = getModInFvTableModel().getValueAt(i, 1)+"";
- String mv = getModInFvTableModel().getValueAt(i, 2)+"";
- String pg = getModInFvTableModel().getValueAt(i, 3)+"";
- String pv = getModInFvTableModel().getValueAt(i, 4)+"";
- String arch = getModInFvTableModel().getValueAt(i, 5)+"";
-
- String[] sa = { mg, mv, pg, pv, arch};
- vModInFv.add(sa);
-
- }
-
- ffc.removeBuildOptionsUserExtensions(fvName, "APRIORI", id);
- ffc.genBuildOptionsUserExtensions(fvName, "APRIORI", id, "", vModInFv);
-
- }
- }
-}
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java
deleted file mode 100644
index ef918f0cd7..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/** @file
- Java class GenListDialog.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.KeyStroke;
-
-import javax.swing.JButton;
-
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.util.Vector;
-
-import javax.swing.JScrollPane;
-
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-
-
-/**
- Dialog for List generation.
- @since PackageEditor 1.0
-**/
-public class GenListDialog extends JDialog implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JPanel jContentPane = null;
- private JPanel jPanelContentEast = null;
- private JPanel jPanelContentCenter = null;
- private JButton jButtonCancel = null;
- private JButton jButtonOk = null;
- private ICheckBoxList checkBoxList = null;
-
-
- private JScrollPane jScrollPane = null;
-
-
-
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk){
-
-// this.dispose();
- }
-
- if (arg0.getSource() == jButtonCancel){
- this.dispose();
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setVgap(10);
- jPanelContentEast = new JPanel();
- jPanelContentEast.setLayout(flowLayout);
- jPanelContentEast.setPreferredSize(new java.awt.Dimension(100,30));
- jPanelContentEast.add(getJButtonOk(), null);
- jPanelContentEast.add(getJButtonCancel(), null);
- }
- return jPanelContentEast;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentCenter() {
- if (jPanelContentCenter == null) {
- jPanelContentCenter = new JPanel();
- jPanelContentCenter.setLayout(new FlowLayout());
- jPanelContentCenter.add(getJScrollPane(), null);
-
- }
- return jPanelContentCenter;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- jButtonCancel.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("GenGuidValue");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(300,100));
- jScrollPane.setViewportView(getICheckBoxList());
- }
- return jScrollPane;
- }
-
- private ICheckBoxList getICheckBoxList() {
- if (checkBoxList == null) {
- checkBoxList = new ICheckBoxList();
- checkBoxList.setBounds(new java.awt.Rectangle(40,20,177,74));
-
- }
- return checkBoxList;
- }
-
- public void initList(Vector<String> v){
- checkBoxList.setAllItems(v);
- }
- public Vector<String> getList(){
- Vector<String> v = checkBoxList.getAllCheckedItemsString();
- return v;
- }
-
- public void setList(String s){
- Vector<String> v = new Vector<String>();
- if (s == null) {
- checkBoxList.setAllItemsUnchecked();
- return;
- }
- String[] sArray = s.split(" ");
- for (int i = 0; i < sArray.length; ++i){
- v.add(sArray[i]);
- }
- checkBoxList.initCheckedItem(true, v);
- }
- /**
- * This is the default constructor
- */
- public GenListDialog(JFrame frame) {
- super(frame);
- initialize();
- }
-
- public GenListDialog(ActionListener i, JFrame frame){
- this(frame);
- jButtonOk.addActionListener(i);
- jButtonOk.registerKeyboardAction(i, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(466, 157);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setModal(true);
- this.setTitle("List");
- this.setContentPane(getJContentPane());
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJPanelContentCenter(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java
deleted file mode 100644
index 856e227180..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/** @file
- Java class GenLongTextDialog.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.KeyStroke;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-
-import javax.swing.JScrollPane;
-
-
-
-/**
- Dialog for Long Text generation.
- @since PackageEditor 1.0
-**/
-public class GenLongTextDialog extends JDialog implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JPanel jContentPane = null;
- private JPanel jPanelContentEast = null;
- private JPanel jPanelContentCenter = null;
- private JButton jButtonCancel = null;
- private JButton jButtonOk = null;
- private JTextArea jTextArea = null;
-
-
- private JScrollPane jScrollPane = null;
-
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk){
-
-// this.dispose();
- }
-
- if (arg0.getSource() == jButtonCancel){
- this.dispose();
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setVgap(5);
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelContentEast = new JPanel();
- jPanelContentEast.setLayout(flowLayout);
- jPanelContentEast.setPreferredSize(new java.awt.Dimension(100,30));
- jPanelContentEast.add(getJButtonOk(), null);
- jPanelContentEast.add(getJButtonCancel(), null);
- }
- return jPanelContentEast;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentCenter() {
- if (jPanelContentCenter == null) {
- jPanelContentCenter = new JPanel();
- jPanelContentCenter.setLayout(new FlowLayout());
- jPanelContentCenter.add(getJScrollPane(), null);
-
- }
- return jPanelContentCenter;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- jButtonCancel.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("GenGuidValue");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(600,40));
- jScrollPane.setViewportView(getJTextArea());
- }
- return jScrollPane;
- }
-
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
-// jTextArea.setBounds(new java.awt.Rectangle(40,20,300,54));
-
- }
- return jTextArea;
- }
-
-
- public String getText(){
-
- return jTextArea.getText();
- }
-
- public void setText(String s){
- jTextArea.setText(s);
- }
- /**
- * This is the default constructor
- */
- public GenLongTextDialog(JFrame frame) {
- super(frame);
- initialize();
- }
-
- public GenLongTextDialog(ActionListener i, JFrame frame){
- this(frame);
- jButtonOk.addActionListener(i);
- jButtonOk.registerKeyboardAction(i, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(620, 120);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setModal(true);
- this.setTitle("Text Content");
- this.setContentPane(getJContentPane());
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.SOUTH);
- jContentPane.add(getJPanelContentCenter(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java
deleted file mode 100644
index 804dc605f4..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/** @file
- Java class GuidEditor.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Vector;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JTable;
-import javax.swing.table.TableCellEditor;
-
-
-/**
- Editor for table cell with GUID value.
- @since PackageEditor 1.0
- **/
-public class ListEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private boolean canNotBeEmpty = false;
- private JFrame topFrame = null;
- String archs;
- JButton button;
- GenListDialog dialog;
- protected static final String EDIT = "edit";
-
- public ListEditor(JFrame frame) {
- topFrame = frame;
- button = new JButton();
- button.setActionCommand(EDIT);
- button.addActionListener(this);
- button.setBorderPainted(false);
-
-
- dialog = new GenListDialog(this, frame);
-
- }
-
- public ListEditor(Vector<String> v, JFrame frame) {
- this(frame);
- dialog.initList(v);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
- */
- public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
- // TODO Auto-generated method stub
- archs = (String)arg1;
- return button;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.CellEditor#getCellEditorValue()
- */
- public Object getCellEditorValue() {
- // TODO Auto-generated method stub
- return archs;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (EDIT.equals(arg0.getActionCommand())) {
- //The user has clicked the cell, so
- //bring up the dialog.
- button.setText(archs);
- dialog.setList(archs);
- dialog.setVisible(true);
-
- //Make the renderer reappear.
- fireEditingStopped();
- }
- else { //User pressed dialog's "OK" button.
- Vector<String> v = dialog.getList();
- if (canNotBeEmpty && v.size() == 0) {
- JOptionPane.showMessageDialog(topFrame, "You must select at least one item.");
- return;
- }
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- archs = s.trim();
- dialog.dispose();
- }
-
- }
-
- /**
- * @param canNotBeEmpty The canNotBeEmpty to set.
- */
- public void setCanNotBeEmpty(boolean canNotBeEmpty) {
- this.canNotBeEmpty = canNotBeEmpty;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java
deleted file mode 100644
index 6e89ba7334..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/** @file
- Java class LongTextEditor.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JTable;
-import javax.swing.table.TableCellEditor;
-
-
-/**
- Editor for table cell with Long Text.
- @since PackageEditor 1.0
- **/
-public class LongTextEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- String text;
- JButton button;
- GenLongTextDialog dialog;
- protected static final String EDIT = "editLongText";
-
- public LongTextEditor(JFrame frame) {
-
- button = new JButton();
- button.setActionCommand(EDIT);
- button.addActionListener(this);
- button.setBorderPainted(false);
-
- dialog = new GenLongTextDialog(this, frame);
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
- */
- public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
- // TODO Auto-generated method stub
- text = (String)arg1;
- return button;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.CellEditor#getCellEditorValue()
- */
- public Object getCellEditorValue() {
- // TODO Auto-generated method stub
- return text;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (EDIT.equals(arg0.getActionCommand())) {
- //The user has clicked the cell, so
- //bring up the dialog.
- button.setText(text);
- dialog.setText(text);
- dialog.setVisible(true);
-
- //Make the renderer reappear.
- fireEditingStopped();
- }
- else { //User pressed dialog's "OK" button.
-
- text = dialog.getText().trim();
- dialog.dispose();
- }
-
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java
deleted file mode 100644
index 3f37efb38c..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/** @file
-
- The file is used to sort FrameworkModules of Fpd file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.event.*;
-import java.util.*;
-
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.*;
-
-
-public class TableSorter extends AbstractTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- protected DefaultTableModel tableModel;
- private TableRow[] rowInView;
- private int[] viewPos;
-
- public static final String DESCENDING = "down";
- public static final String NOT_SORTED = "none";
- public static final String ASCENDING = "up";
-
- private JTableHeader tableHeader;
- private MouseListener mouseListener = new MouseHandler();
- private TableModelListener tableModelListener = new TableModelHandler();
-
- private HashMap<Integer, String> sortingOrders = new HashMap<Integer, String>();
-
- public TableSorter(DefaultTableModel tableModel) {
- setTableModel(tableModel);
- }
-
-
- private void resetSortState() {
- rowInView = null;
- viewPos = null;
- }
-
- public DefaultTableModel getTableModel() {
- return tableModel;
- }
-
- public void setTableModel(DefaultTableModel dtm) {
- if (tableModel != null) {
- tableModel.removeTableModelListener(tableModelListener);
- }
-
- tableModel = dtm;
- if (tableModel != null) {
- tableModel.addTableModelListener(tableModelListener);
- }
-
- resetSortState();
- fireTableStructureChanged();
- }
-
- public JTableHeader getTableHeader() {
- return tableHeader;
- }
-
- public void setTableHeader(JTableHeader th) {
- if (tableHeader != null) {
- tableHeader.removeMouseListener(mouseListener);
- }
- tableHeader = th;
- if (tableHeader != null) {
- tableHeader.addMouseListener(mouseListener);
-
- }
- }
-
- private String getSortState(int column) {
-
- Integer i = new Integer(column);
- if (sortingOrders.get(i) != null) {
- return sortingOrders.get(i);
- }
- return NOT_SORTED;
- }
-
- private void sortStateChanged() {
- resetSortState();
- fireTableDataChanged();
-
- }
-
- public void setSortState(int column, String status) {
- Integer i = new Integer(column);
- sortingOrders.put(i, status);
- sortStateChanged();
- }
-
- private TableRow[] getSortedViewRows() {
- if (rowInView == null) {
- int rowCount = tableModel.getRowCount();
- rowInView = new TableRow[rowCount];
- int i = 0;
- while ( i < rowCount ) {
- rowInView[i] = new TableRow(i);
- ++i;
- }
-
- if (sortingOrders.size() != 0) {
- Arrays.sort(rowInView);
- }
- }
- return rowInView;
- }
-
- public int getModelRowIndex(int viewIndex) {
- TableRow[] rArray = getSortedViewRows();
- return rArray[viewIndex].modelIndex;
- }
-
- public int[] getViewIndexArray() {
- if (viewPos == null) {
- int n = getSortedViewRows().length;
- viewPos = new int[n];
- for (int i = 0; i < n; i++) {
- viewPos[getModelRowIndex(i)] = i;
- }
- }
- return viewPos;
- }
-
-
-
- public int getRowCount() {
- if (tableModel == null) {
- return 0;
- }
- return tableModel.getRowCount();
- }
-
- public String getColumnName(int col) {
- return tableModel.getColumnName(col);
- }
-
- public int getColumnCount() {
- if (tableModel == null) {
- return 0;
- }
- return tableModel.getColumnCount();
- }
-
- public Class<?> getColumnClass(int col) {
- return tableModel.getColumnClass(col);
- }
-
- public boolean isCellEditable(int row, int col) {
- int modelIndex = getModelRowIndex(row);
- return tableModel.isCellEditable(modelIndex, col);
- }
-
- public Object getValueAt(int row, int col) {
- int modelIndex = getModelRowIndex(row);
- return tableModel.getValueAt(modelIndex, col);
- }
-
- public void setValueAt(Object val, int row, int col) {
- int modelIndex = getModelRowIndex(row);
- tableModel.setValueAt(val, modelIndex, col);
- }
-
- // Helper classes
-
- private class TableRow implements Comparable {
- private int modelIndex;
-
- public TableRow(int index) {
- this.modelIndex = index;
- }
-
- public int compareTo(Object o) {
- int row1 = modelIndex;
- int row2 = ((TableRow) o).modelIndex;
-
- Iterator<Integer> mapIter = sortingOrders.keySet().iterator();
-
- while (mapIter.hasNext()) {
-
- Integer column = mapIter.next();
- Object o1 = tableModel.getValueAt(row1, column);
- Object o2 = tableModel.getValueAt(row2, column);
-
- int comparison = 0;
- if (o1 == null && o2 == null) {
- comparison = 0;
- } else if (o1 == null) {
- comparison = -1;
- } else if (o2 == null) {
- comparison = 1;
- } else {
- comparison = o1.toString().compareTo(o2.toString());;
- }
- if (comparison != 0) {
- if (getSortState(column.intValue()).equals(DESCENDING)) {
- return -comparison;
- }
- return comparison;
- }
- }
- return 0;
- }
- }
-
- private class TableModelHandler implements TableModelListener {
- public void tableChanged(TableModelEvent e) {
- if (sortingOrders.size() != 0) {
- resetSortState();
- fireTableChanged(e);
- return;
- }
- if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
-
- fireTableChanged(e);
- return;
- }
- int column = e.getColumn();
- if (e.getFirstRow() == e.getLastRow()
- && column != TableModelEvent.ALL_COLUMNS
- && getSortState(column).equals(NOT_SORTED)
- && viewPos != null) {
- int viewIndex = getViewIndexArray()[e.getFirstRow()];
- fireTableChanged(new TableModelEvent(TableSorter.this,
- viewIndex, viewIndex,
- column, e.getType()));
- return;
- }
-
- resetSortState();
- fireTableDataChanged();
- return;
- }
- }
-
- private class MouseHandler extends MouseAdapter {
- public void mouseClicked(MouseEvent e) {
- JTableHeader h = (JTableHeader) e.getSource();
- TableColumnModel columnModel = h.getColumnModel();
- int viewColumn = columnModel.getColumnIndexAtX(e.getX());
- int column = columnModel.getColumn(viewColumn).getModelIndex();
- if (column == 0) {
- String status = getSortState(column);
-
-
- if (status.equals(ASCENDING)) {
- status = DESCENDING;
- }
- else if (status.equals(DESCENDING)) {
- status = NOT_SORTED;
- }
- else if (status.equals(NOT_SORTED)) {
- status = ASCENDING;
- }
- setSortState(column, status);
- }
- }
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java
deleted file mode 100644
index df689c6ef1..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/** @file
- This file is for surface area information retrieval.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui.global;
-
-import java.util.Vector;
-
-public class LibraryClassDescriptor {
- public String className = "";
- public String supArchs = "";
- public String supModTypes = "";
-
- public LibraryClassDescriptor (String s1, String s2, String s3) {
- className = s1;
- if (s2 != null) {
- supArchs = s2;
- }
- if (s3 != null) {
- supModTypes = s3;
- }
-
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof LibraryClassDescriptor) {
- LibraryClassDescriptor id = (LibraryClassDescriptor)obj;
- if (className.equals(id.className) && sameArchs (supArchs, id.supArchs) && sameModTypes(supModTypes, id.supModTypes)) {
- return true;
- }
- return false;
- }
- else {
- return super.equals(obj);
- }
- }
-
- public int hashCode(){
- return (className + supArchs + supModTypes).toLowerCase().hashCode();
- }
-
- public String toString() {
- return "Library Class "+ className + " [SupArchs: " + supArchs + " SupModTypes: " + supModTypes + "]";
- }
-
- public boolean isSubSetByArchs (LibraryClassDescriptor lcd) {
- if (className.equals(lcd.className)) {
- Vector<String> vArchs1 = getVectorFromString(supArchs);
- Vector<String> vArchs2 = getVectorFromString(lcd.supArchs);
-
- if (isSubSet(vArchs1, vArchs2)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean isSubSetByModTypes (LibraryClassDescriptor lcd) {
- if (className.equals(lcd.className)) {
- Vector<String> vModTypes1 = getVectorFromString(supModTypes);
- Vector<String> vModTypes2 = getVectorFromString(lcd.supModTypes);
-
- if (isSubSet(vModTypes1, vModTypes2)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean hasInterSectionWith (LibraryClassDescriptor lcd) {
- if (className.equals(lcd.className)) {
- Vector<String> vArchs1 = getVectorFromString(supArchs);
- Vector<String> vArchs2 = getVectorFromString(lcd.supArchs);
- if (vArchs1.size() == 0 || (vArchs1.size() == 1 && vArchs1.get(0).equalsIgnoreCase(""))) {
- return true;
- }
- if (vArchs2.size() == 0 || (vArchs2.size() == 1 && vArchs2.get(0).equalsIgnoreCase(""))) {
- return true;
- }
- vArchs1.retainAll(vArchs2);
- if (vArchs1.size() > 0) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isSubSet (Vector<String> v1, Vector<String> v2) {
- if (v2.size() == 0 || (v2.size() == 1 && v2.get(0).equalsIgnoreCase(""))) {
- return true;
- }
- if (v2.containsAll(v1)) {
- return true;
- }
- return false;
- }
-
- public Vector<String> getVectorFromString (String s) {
- if (s == null || s.equals("null")) {
- s = "";
- }
- String[] sa1 = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sa1.length; ++i) {
- v.add(sa1[i]);
- }
- return v;
- }
-
- private boolean sameArchs (String archs1, String archs2) {
- Vector<String> vArchs1 = getVectorFromString(archs1);
- Vector<String> vArchs2 = getVectorFromString(archs2);
-
- if (vArchs1.containsAll(vArchs2) && vArchs2.containsAll(vArchs1)) {
- return true;
- }
- return false;
- }
-
- private boolean sameModTypes (String modTypes1, String modTypes2) {
- return sameArchs(modTypes1, modTypes2);
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java
deleted file mode 100644
index ad0e82ca3f..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/** @file
- This file is for surface area information retrieval.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui.global;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.BuildTargetList;
-import org.tianocore.LibraryClassDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageDependenciesDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.FilenameDocument.Filename;
-
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-/**
- * SurfaceAreaQuery class is used to query Surface Area information from msa,
- * mbd, spd and fpd files.
- *
- * This class should not instantiated. All the public interfaces is static.
- *
- * @since GenBuild 1.0
- */
-public class SurfaceAreaQuery {
-
- public static String prefix = "http://www.TianoCore.org/2006/Edk2.0";
-
- // /
- // / Contains name/value pairs of Surface Area document object. The name is
- // / always the top level element name.
- // /
- private static Map<String, XmlObject> map = null;
-
- // /
- // / mapStack is used to do nested query
- // /
- private static Stack<Map<String, XmlObject>> mapStack = new Stack<Map<String, XmlObject>>();
-
- // /
- // / prefix of name space
- // /
- private static String nsPrefix = "sans";
-
- // /
- // / xmlbeans needs a name space for each Xpath element
- // /
- private static String ns = null;
-
- // /
- // / keep the namep declaration for xmlbeans Xpath query
- // /
- private static String queryDeclaration = null;
-
- /**
- * Set a Surface Area document for query later
- *
- * @param map
- * A Surface Area document in TopLevelElementName/XmlObject
- * format.
- */
- public static void setDoc(Map<String, XmlObject> map) {
- ns = prefix;
- queryDeclaration = "declare namespace " + nsPrefix + "='" + ns + "'; ";
- SurfaceAreaQuery.map = map;
- }
-
- /**
- * Push current used Surface Area document into query stack. The given new
- * document will be used for any immediately followed getXXX() callings,
- * untill pop() is called.
- *
- * @param newMap
- * The TopLevelElementName/XmlObject format of a Surface Area
- * document.
- */
- public static void push(Map<String, XmlObject> newMap) {
- mapStack.push(SurfaceAreaQuery.map);
- SurfaceAreaQuery.map = newMap;
- }
-
- /**
- * Discard current used Surface Area document and use the top document in
- * stack instead.
- */
- public static void pop() {
- SurfaceAreaQuery.map = mapStack.pop();
- }
-
- // /
- // / Convert xPath to be namespace qualified, which is necessary for
- // XmlBeans
- // / selectPath(). For example, converting /MsaHeader/ModuleType to
- // / /ns:MsaHeader/ns:ModuleType
- // /
- private static String normalizeQueryString(String[] exp, String from) {
- StringBuffer normQueryString = new StringBuffer(4096);
-
- int i = 0;
- while (i < exp.length) {
- String newExp = from + exp[i];
- Pattern pattern = Pattern.compile("([^/]*)(/|//)([^/]+)");
- Matcher matcher = pattern.matcher(newExp);
-
- while (matcher.find()) {
- String starter = newExp.substring(matcher.start(1), matcher
- .end(1));
- String seperator = newExp.substring(matcher.start(2), matcher
- .end(2));
- String token = newExp.substring(matcher.start(3), matcher
- .end(3));
-
- normQueryString.append(starter);
- normQueryString.append(seperator);
- normQueryString.append(nsPrefix);
- normQueryString.append(":");
- normQueryString.append(token);
- }
-
- ++i;
- if (i < exp.length) {
- normQueryString.append(" | ");
- }
- }
-
- return normQueryString.toString();
- }
-
- /**
- * Search all XML documents stored in "map" for the specified xPath, using
- * relative path (starting with '$this')
- *
- * @param xPath
- * xpath query string array
- * @returns An array of XmlObject if elements are found at the specified
- * xpath
- * @returns NULL if nothing is at the specified xpath
- */
- public static XmlObject[] get(String[] xPath) {
- if (map == null) {
- return null;
- }
-
- String[] keys = (String[]) map.keySet().toArray(new String[map.size()]);
- List<XmlObject> result = new ArrayList<XmlObject>();
- for (int i = 0; i < keys.length; ++i) {
- XmlObject rootNode = (XmlObject) map.get(keys[i]);
- if (rootNode == null) {
- continue;
- }
-
- String query = queryDeclaration
- + normalizeQueryString(xPath, "$this/" + keys[i]);
- XmlObject[] tmp = rootNode.selectPath(query);
- for (int j = 0; j < tmp.length; ++j) {
- result.add(tmp[j]);
- }
- }
-
- int size = result.size();
- if (size <= 0) {
- return null;
- }
-
- return (XmlObject[]) result.toArray(new XmlObject[size]);
- }
-
- /**
- * Search XML documents named by "rootName" for the given xPath, using
- * relative path (starting with '$this')
- *
- * @param rootName
- * The top level element name
- * @param xPath
- * The xpath query string array
- * @returns An array of XmlObject if elements are found at the given xpath
- * @returns NULL if nothing is found at the given xpath
- */
- public static XmlObject[] get(String rootName, String[] xPath) {
- if (map == null) {
- return null;
- }
-
- XmlObject root = (XmlObject) map.get(rootName);
- if (root == null) {
- return null;
- }
-
- String query = queryDeclaration
- + normalizeQueryString(xPath, "$this/" + rootName);
- XmlObject[] result = root.selectPath(query);
- if (result.length > 0) {
- return result;
- }
-
- query = queryDeclaration + normalizeQueryString(xPath, "/" + rootName);
- result = root.selectPath(query);
- if (result.length > 0) {
- return result;
- }
-
- return null;
- }
-
- /**
- * Retrieve SourceFiles/Filename for specified ARCH type
- *
- * @param arch
- * architecture name
- * @returns An 2 dimension string array if elements are found at the known
- * xpath
- * @returns NULL if nothing is found at the known xpath
- */
- public static String[][] getSourceFiles(String arch) {
- String[] xPath;
- XmlObject[] returns;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[] { "/Filename" };
- } else {
- xPath = new String[] { "/Filename[not(@SupArchList) or @SupArchList='"
- + arch + "']" };
- }
-
- returns = get("SourceFiles", xPath);
-
- if (returns == null || returns.length == 0) {
- return null;
- }
-
- Filename[] sourceFileNames = (Filename[]) returns;
- String[][] outputString = new String[sourceFileNames.length][2];
- for (int i = 0; i < sourceFileNames.length; i++) {
- outputString[i][0] = sourceFileNames[i].getToolCode();
- outputString[i][1] = sourceFileNames[i].getStringValue();
- }
- return outputString;
- }
-
- /**
- * Retrieve /PlatformDefinitions/OutputDirectory from FPD
- *
- * @returns Directory names array if elements are found at the known xpath
- * @returns Empty if nothing is found at the known xpath
- */
- public static String getFpdOutputDirectory() {
- String[] xPath = new String[] { "/PlatformDefinitions/OutputDirectory" };
-
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
- if (returns != null && returns.length > 0) {
- // String TBD
- }
-
- return null;
- }
-
- public static String getFpdIntermediateDirectories() {
- String[] xPath = new String[] { "/PlatformDefinitions/IntermediateDirectories" };
-
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
- if (returns != null && returns.length > 0) {
- // TBD
- }
- return "UNIFIED";
- }
-
- public static String getBuildTarget() {
- String[] xPath = new String[] { "/PlatformDefinitions/BuildTargets" };
-
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
- if (returns != null && returns.length > 0) {
- return ((BuildTargetList) returns[0]).getStringValue();
- }
-
- return null;
- }
-
- /**
- * Retrieve <xxxHeader>/ModuleType
- *
- * @returns The module type name if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public static String getModuleType(ModuleIdentification mi) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = WorkspaceProfile.getModuleXmlObject(mi);
-
- return msa.getMsaHeader().getModuleType()+"";
- }
-
- /**
- * Retrieve PackageDependencies/Package
- *
- * @param arch
- * Architecture name
- *
- * @returns package name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
-
- public static PackageIdentification[] getDependencePkg(String arch, ModuleIdentification mi){
-
- String packageGuid = null;
- String packageVersion = null;
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile.getModuleXmlObject(mi);
- if (msa.getPackageDependencies() == null) {
- return new PackageIdentification[0];
- }
- int size = msa.getPackageDependencies().getPackageList().size();
- XmlObject[] returns = new XmlObject[size];
- for (int i = 0; i < size; ++i) {
- returns[i] = msa.getPackageDependencies().getPackageList().get(i);
- }
-
- PackageIdentification[] packageIdList = new PackageIdentification[returns.length];
- for (int i = 0; i < returns.length; i++) {
- PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];
- packageGuid = item.getPackageGuid();
- packageVersion = item.getPackageVersion();
-
- Iterator<PackageIdentification> ispi = GlobalData.vPackageList.iterator();
- String ver = "";
- while(ispi.hasNext()) {
- PackageIdentification pi = ispi.next();
- if (packageVersion != null) {
- if (pi.getGuid().equalsIgnoreCase(packageGuid) && pi.getVersion().equals(packageVersion)) {
- packageIdList[i] = pi;
- break;
- }
- }
- else {
- if (pi.getGuid().equalsIgnoreCase(packageGuid)) {
- if (pi.getVersion() != null && pi.getVersion().compareTo(ver) > 0){
- ver = pi.getVersion();
- packageIdList[i] = pi;
- }
- else if (packageIdList[i] == null){
- packageIdList[i] = pi;
- }
- }
- }
-
- }
- }
- return packageIdList;
- }
-
- /**
- * Retrieve LibraryClassDefinitions/LibraryClass for specified usage
- *
- * @param usage
- * Library class usage
- *
- * @returns LibraryClass objects list if elements are found at the known
- * xpath
- * @returns null if nothing is there
- */
- public static Vector<LibraryClassDescriptor> getLibraryClasses(String usage, ModuleIdentification mi){
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(mi);
- Vector<LibraryClassDescriptor> libraryClassInfo = new Vector<LibraryClassDescriptor>();
- if (msa.getLibraryClassDefinitions() == null) {
- return libraryClassInfo;
- }
-
- int size = msa.getLibraryClassDefinitions().getLibraryClassList().size();
-
- for (int i = 0; i < size; i++) {
- LibraryClassDocument.LibraryClass libClass = msa.getLibraryClassDefinitions().getLibraryClassList().get(i);
- if (usage.equals(libClass.getUsage().toString())) {
-
- libraryClassInfo.add(new LibraryClassDescriptor(libClass.getKeyword(), libClass.getSupArchList()+"", libClass.getSupModuleList()+""));
- }
- }
-
- return libraryClassInfo;
- }
-
- public static XmlObject[] getSpdPcdDeclarations(PackageIdentification pi) {
- XmlObject[] returns = null;
- PackageSurfaceAreaDocument.PackageSurfaceArea psa = WorkspaceProfile.getPackageXmlObject(pi);
- if (psa.getPcdDeclarations() != null && psa.getPcdDeclarations().getPcdEntryList() != null) {
- int size = psa.getPcdDeclarations().getPcdEntryList().size();
- returns = new XmlObject[size];
- for (int i = 0; i < size; ++i) {
- returns[i] = psa.getPcdDeclarations().getPcdEntryList().get(i);
- }
- }
-
- return returns;
- }
-
-}
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java
deleted file mode 100644
index 954cda112c..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/** @file
- WorkspaceProfile class.
-
- WorkspaceProfile provide initializing, instoring, querying and update global data.
- It is a bridge to intercommunicate between multiple component, such as AutoGen,
- PCD and so on.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.frameworkwizard.platform.ui.global;
-
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PcdCodedDocument;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Vector;
-
-/**
- WorkspaceProfile provide initializing, instoring, querying and update global data.
- It is a bridge to intercommunicate between multiple component, such as AutoGen,
- PCD and so on.
-
- <p>Note that all global information are initialized incrementally. All data will
- parse and record only of necessary during build time. </p>
-
- @since GenBuild 1.0
-**/
-public class WorkspaceProfile {
- ///
- /// Record current WORKSPACE Directory
- ///
- private static String workspaceDir = "";
-
- /**
- Get the current WORKSPACE Directory.
-
- @return current workspace directory
- **/
- public synchronized static String getWorkspacePath() {
- return workspaceDir;
- }
-
- public synchronized static PackageIdentification getPackageForModule(ModuleIdentification moduleId) {
- //
- // If package already defined in module
- //
- if (moduleId.getPackageId() != null) {
- return moduleId.getPackageId();
- }
-
- return null;
- }
- //
- // expanded by FrameworkWizard
- //
- public synchronized static ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleXmlObject(ModuleIdentification moduleId) {
- return GlobalData.openingModuleList.getModuleSurfaceAreaFromId(moduleId);
- }
-
- public synchronized static PackageSurfaceAreaDocument.PackageSurfaceArea getPackageXmlObject(PackageIdentification packageId) {
- return GlobalData.openingPackageList.getPackageSurfaceAreaFromId(packageId);
- }
-
- public static ModuleIdentification getModuleId(String key){
- //
- // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.
- //
- String[] keyPart = key.split(" ");
-
- Iterator<ModuleIdentification> iMiList = GlobalData.vModuleList.iterator();
-
- while (iMiList.hasNext()) {
- ModuleIdentification mi = iMiList.next();
- if (mi.getGuid().equalsIgnoreCase(keyPart[0])){
- if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){
- if(!mi.getVersion().equals(keyPart[1])){
- continue;
- }
- }
-
- PackageIdentification pi = mi.getPackageId();
- if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){
- continue;
- }
- if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){
- if(!pi.getVersion().equals(keyPart[3])){
- continue;
- }
- }
- return mi;
- }
- }
-
- return null;
- }
-
- public static Vector<String> getModuleSupArchs(ModuleIdentification mi){
- Vector<String> vArchs = null;
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi);
- if (msa.getModuleDefinitions() == null || msa.getModuleDefinitions().getSupportedArchitectures() == null) {
- return vArchs;
- }
- ListIterator li = msa.getModuleDefinitions().getSupportedArchitectures().listIterator();
- while (li.hasNext()) {
- if (vArchs == null) {
- vArchs = new Vector<String>();
- }
- vArchs.add((String)li.next());
- }
-
- return vArchs;
- }
-
- public static String getModuleType (ModuleIdentification mi) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = getModuleXmlObject(mi);
- if (msa.getMsaHeader() == null || msa.getMsaHeader().getModuleType() == null) {
- return null;
- }
- return msa.getMsaHeader().getModuleType().toString();
- }
-
- public static boolean pcdInMsa (String cName, String tsGuid, String supArchList, ModuleIdentification mi) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi);
- if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {
- return false;
- }
- ListIterator li = msa.getPcdCoded().getPcdEntryList().listIterator();
- while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();
- if (msaPcd.getCName().equals(cName) && msaPcd.getTokenSpaceGuidCName().equals(tsGuid)) {
- if (supArchList != null && msaPcd.getSupArchList() != null) {
- if (msaPcd.getSupArchList().toString().toLowerCase().contains(supArchList.trim().toLowerCase())) {
- return true;
- }
- }
- else{
- return true;
- }
- }
- }
- return false;
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java
deleted file mode 100644
index 0c23b6a854..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java
+++ /dev/null
@@ -1,1152 +0,0 @@
-/** @file
- <<The file is used to update the Build Preferences file, target.txt>>
-
- <<The program will use target.txt, the tools config file specified in that file,
- or it will use the default tools_def.txt file, and it will also scan the
- FrameworkDatabase.db file for certain parameters. >>
-
- Copyright (c) 2006, 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.
-
- Package Name: Tools
- Module Name: FrameworkWizard
-
- **/
-
-package org.tianocore.frameworkwizard.toolchain;
-
-import java.awt.event.ActionEvent;
-import java.io.*;
-import java.util.Vector;
-import java.util.Iterator;
-import java.util.Scanner;
-
-import javax.swing.*;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.*;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.PlatformSurfaceAreaDocument;
-
-/**
- * The class is used to update the target.txt file.
- *
- * It extends IDialog
- *
- */
-public class Preferences extends IFrame {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -4777906991966638888L;
-
- private final boolean Debug = false;
-
- //
- // Define class members
- //
- private final int oneRowHeight = 20;
-
- private final int twoRowHeight = 40;
-
- private final int threeRowHeight = 60;
-
- private final int sepHeight = 6;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + sepHeight;
-
- private final int rowThree = rowTwo + oneRowHeight + sepHeight;
-
- private final int rowFour = rowThree + threeRowHeight + sepHeight;
-
- private final int rowFive = rowFour + threeRowHeight + sepHeight;
-
- private final int rowSix = rowFive + oneRowHeight + sepHeight;
-
- private final int buttonRow = rowSix + oneRowHeight + sepHeight + sepHeight;
-
- private final int dialogHeight = buttonRow + twoRowHeight + twoRowHeight;
-
- private final int dialogWidth = 540;
-
- private final int lastButtonXLoc = 430;
-
- private final int next2LastButtonLoc = 329;
-
- /*
- * Define the contents for this dialog box
- */
- private static Preferences bTarget = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private final int activePlatformId = 0;
-
- private final int buildTargetId = 1;
-
- private final int targetArchId = 2;
-
- private final int toolDefFileId = 3;
-
- private final int tagNameId = 4;
-
- private final int threadEnableId = 5;
-
- private final int threadCountId = 6;
-
- private final int maxTargetLines = threadCountId + 1;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelToolsConfigFile = null;
-
- private JTextField jTextFieldToolsConfigFile = null;
-
- private final int toolConfigFileRow = rowOne;
-
- private JLabel jLabelActivePlatform = null;
-
- private JComboBox jComboBoxActivePlatform = null;
-
- private final int activePlatformRow = rowTwo;
-
- private JLabel jLabelToolChainTagName = null;
-
- private JScrollPane jScrollPaneTagName = null;
-
- private ICheckBoxList iCheckBoxListTagName = null;
-
- private final int toolChainTagNameRow = rowThree;
-
- private JLabel jLabelBuildTarget = null;
-
- private JScrollPane jScrollPaneBuildTarget = null;
-
- private ICheckBoxList iCheckBoxListBuildTarget = null;
-
- private final int buildTargetRow = rowFour;
-
- private JLabel jLabelTargetArch = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private final int targetArchRow = rowFive;
-
- private JLabel jLabelEnableThreads = null;
-
- private JLabel jLabelThreadCount = null;
-
- private final int threadRow = rowSix;
-
- private JCheckBox jCheckBoxEnableThreads = null;
-
- private JTextField jTextFieldThreadCount = null;
-
- private String threadCount = "";
-
- private boolean threadEnabled = false;
-
- private JButton jButtonBrowse = null;
-
- private JButton jButtonSave = null;
-
- private JButton jButtonCancel = null;
-
- private final int labelColumn = 12;
-
- private final int labelWidth = 155;
-
- private final int valueColumn = 168;
-
- private final int valueWidth = 352;
-
- private final int valueWidthShort = 260;
-
- private final int buttonWidth = 90;
-
- private String workspaceDir = Workspace.getCurrentWorkspace() + System.getProperty("file.separator");
-
- private String toolsDir = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + "Tools"
- + System.getProperty("file.separator") + "Conf";
-
- private String defaultToolsConf = toolsDir + System.getProperty("file.separator") + "tools_def.txt";
-
- private String targetFile = toolsDir + System.getProperty("file.separator") + "target.txt";
-
- private String[] targetFileContents = new String[500];
-
- // private String[] toolsConfContents;
-
- private String[] targetLines = new String[maxTargetLines];
-
- private int targetLineNumber[] = new int[maxTargetLines];
-
- private String toolsConfFile;
-
- private String toolsDefTargetNames = null;
-
- private final int toolsDefTargetNameField = 0;
-
- private String toolsDefTagNames = null;
-
- private final int toolsDefTagNameField = 1;
-
- private String toolsDefArchNames = null;
-
- private final int toolsDefArchNameField = 2;
-
- private String toolsDefIdentifier = null;
-
- private int targetLineNumberMax;
-
- private final int toolDefFieldCount = 5;
-
- private Vector<String> vArchList = null;
-
- private Vector<String> vDisableArchList = null;
-
- //
- // Not used by UI
- //
- // private Preferences id = null;
-
- // private EnumerationData ed = new EnumerationData();
-
- /**
- This method initializes jTextFieldToolsConfigFile
-
- @return javax.swing.JTextField jTextFieldToolsConfigFile
- **/
- private JTextField getJTextFieldToolsConfigFile() {
- if (jTextFieldToolsConfigFile == null) {
- if (targetLines[toolDefFileId] != null) {
- String sLine[] = targetLines[toolDefFileId].trim().split("=");
- jTextFieldToolsConfigFile = new JTextField(sLine[1].trim());
- } else
- jTextFieldToolsConfigFile = new JTextField();
-
- jTextFieldToolsConfigFile.setBounds(new java.awt.Rectangle(valueColumn, toolConfigFileRow, valueWidthShort,
- oneRowHeight));
- jTextFieldToolsConfigFile.setPreferredSize(new java.awt.Dimension(valueWidthShort, oneRowHeight));
- jTextFieldToolsConfigFile
- .setToolTipText("<html>"
- + "Specify the name of the filename to use for specifying"
- + "<br>the tools to use for the build. If not specified,"
- + "<br>tools_def.txt will be used for the build. This file"
- + "<br>MUST be located in the WORKSPACE/Tools/Conf directory.</html>");
-
- }
- return jTextFieldToolsConfigFile;
- }
-
- /**
- * This method initializes jComboBoxActivePlatform
- *
- * @return javax.swing.JComboBox jComboBoxActivePlatform
- *
- */
- private JComboBox getActivePlatform() {
- Vector<PlatformIdentification> vPlatformId = wt.getAllPlatforms();
-
- if (jComboBoxActivePlatform == null) {
- jComboBoxActivePlatform = new JComboBox();
- jComboBoxActivePlatform.setBounds(new java.awt.Rectangle(valueColumn, activePlatformRow, valueWidth,
- oneRowHeight));
- jComboBoxActivePlatform.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jComboBoxActivePlatform
- .setToolTipText("<html>Select &quot;Do Not Set&quot; if you want to build a platform"
- + "<br>from the directory where the FPD file exists,"
- + "<br>otherwise scroll down to select the platform.</html>");
-
- /*
- * Generate the data, selecting what is in target.txt
- */
- jComboBoxActivePlatform.addItem("Do Not Set");
- Iterator<PlatformIdentification> iter = vPlatformId.iterator();
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- String path = item.getPath().trim();
- String str = path.substring(workspaceDir.length(), path.length());
- str.replace(System.getProperty("file.separator"), "/");
- jComboBoxActivePlatform.addItem(str.trim());
- }
- if (targetLines[activePlatformId] == null)
- jComboBoxActivePlatform.setSelectedItem("Do Not Set");
- else
- jComboBoxActivePlatform.setSelectedItem(targetLines[activePlatformId]);
- }
- return jComboBoxActivePlatform;
- }
-
- /**
- * This method initializes jScrollPaneTagName
- *
- * @return javax.swing.JScrollPane jScrollPaneTagName
- *
- */
- private JScrollPane getJScrollPaneTagName() {
-
- if (jScrollPaneTagName == null) {
- jScrollPaneTagName = new JScrollPane();
- jScrollPaneTagName.setBounds(new java.awt.Rectangle(valueColumn, toolChainTagNameRow, valueWidth,
- threeRowHeight));
- jScrollPaneTagName.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
- jScrollPaneTagName.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneTagName.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
- jScrollPaneTagName.setViewportView(getICheckBoxListTagName());
- jScrollPaneTagName.setToolTipText("<html>"
- + "Specify the TagName(s) from the tool configuration file to use"
- + "<br>for your builds. If not specified, all applicable TagName"
- + " <br>tools will be used for the build.</html>");
- jScrollPaneTagName.setVisible(true);
-
- }
- return jScrollPaneTagName;
- }
-
- private ICheckBoxList getICheckBoxListTagName() {
- if (iCheckBoxListTagName == null) {
- iCheckBoxListTagName = new ICheckBoxList();
-
- if (toolsDefTagNames != null) {
- toolsDefTagNames.trim();
- String aTagNames[] = toolsDefTagNames.trim().split(" ");
- Vector<String> vTags = new Vector<String>();
- for (int i = 0; i < aTagNames.length; i++) {
- vTags.add(aTagNames[i]);
- }
- iCheckBoxListTagName.setAllItems(vTags);
- } else {
- Vector<String> defaultTags = stringToVector("MYTOOLS");
- iCheckBoxListTagName.setAllItems(defaultTags);
- }
-
- iCheckBoxListTagName.setAllItemsUnchecked();
- iCheckBoxListTagName.setToolTipText("<html>"
- + "Specify the TagName(s) from the tool configuration file to use"
- + "<br>for your builds. If not specified, all applicable TagName"
- + " <br>tools will be used for the build.</html>");
- Vector<String> vSelectedTags = new Vector<String>();
- if (targetLines[tagNameId] != null) {
- targetLines[tagNameId].trim();
- String targetTags[] = targetLines[tagNameId].trim().split(" ");
- for (int j = 0; j < targetTags.length; j++)
- vSelectedTags.add(targetTags[j]);
- iCheckBoxListTagName.initCheckedItem(true, vSelectedTags);
- }
- }
- return iCheckBoxListTagName;
- }
-
- /**
- * This method initializes jScrollPaneBuildTarget
- *
- * @return javax.swing.JComboBox jScrollPaneBuildTarget
- *
- */
- private JScrollPane getJScrollPaneBuildTarget() {
- if (jScrollPaneBuildTarget == null) {
- jScrollPaneBuildTarget = new JScrollPane();
- jScrollPaneBuildTarget.setBounds(new java.awt.Rectangle(valueColumn, buildTargetRow, valueWidth,
- threeRowHeight));
- jScrollPaneBuildTarget.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
- jScrollPaneBuildTarget.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneBuildTarget.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
- jScrollPaneBuildTarget.setViewportView(getICheckBoxListBuildTarget());
- jScrollPaneBuildTarget.setVisible(true);
- jScrollPaneBuildTarget.setToolTipText("<html>"
- + "Select the TARGET Names that you want to build, such as<BR>"
- + "BUILD or BUILD and RELEASE"
- + "<br>If you do not set any of these, all available targets"
- + "<br>will be built.</html>");
-
- }
- return jScrollPaneBuildTarget;
- }
-
- private JCheckBox getCheckBoxEnableThreads() {
- if (jCheckBoxEnableThreads == null) {
- jCheckBoxEnableThreads = new JCheckBox();
- jCheckBoxEnableThreads.setBounds(valueColumn, threadRow, 20, oneRowHeight);
- jCheckBoxEnableThreads.setToolTipText("Select this if you want to enable parallel compilation.");
- jCheckBoxEnableThreads.setSelected(threadEnabled);
- jCheckBoxEnableThreads.addActionListener(this);
-
- }
- return jCheckBoxEnableThreads;
- }
-
- private JTextField getTextFieldThreadCount() {
- if (jTextFieldThreadCount == null) {
- jTextFieldThreadCount = new JTextField();
- jTextFieldThreadCount.setBounds(valueColumn + 215, threadRow, 30, oneRowHeight);
- if (threadCount.length() > 0)
- jTextFieldThreadCount.setText(threadCount);
- jTextFieldThreadCount.setToolTipText("<html>Recommended setting is N+1,<br> where N is the number of physical processors or cores in the system</html>");
- // If CheckBoxEnableThreads is selected, then enable editing
-
- }
- return jTextFieldThreadCount;
- }
-
- private ICheckBoxList getICheckBoxListBuildTarget() {
- if (iCheckBoxListBuildTarget == null) {
-
- String aBuildTargets[] = toolsDefTargetNames.trim().split(" ");
- Vector<String> vBuildTargets = new Vector<String>();
- for (int i = 0; i < aBuildTargets.length; i++) {
- vBuildTargets.add(aBuildTargets[i]);
- }
- iCheckBoxListBuildTarget = new ICheckBoxList();
- iCheckBoxListBuildTarget.setAllItems(vBuildTargets);
- iCheckBoxListBuildTarget.setAllItemsUnchecked();
- iCheckBoxListBuildTarget.setToolTipText("<html>"
- + "Select the TARGET Names that you want to build, such as<BR>"
- + "BUILD or BUILD and RELEASE"
- + "<br>If you do not set any of these, all available targets"
- + "<br>will be built.</html>");
-
- Vector<String> vSelectedTags = new Vector<String>();
- if (targetLines[buildTargetId] != null) {
- targetLines[buildTargetId].trim();
- String targetTags[] = targetLines[buildTargetId].trim().split(" ");
- for (int j = 0; j < targetTags.length; j++)
- vSelectedTags.add(targetTags[j]);
- iCheckBoxListBuildTarget.initCheckedItem(true, vSelectedTags);
- }
- }
- return iCheckBoxListBuildTarget;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse
- .setBounds(new java.awt.Rectangle(lastButtonXLoc, toolConfigFileRow, buttonWidth, oneRowHeight));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
- jButtonBrowse.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- //
- // Select files from current workspace
- //
- String dirPrefix = toolsDir + System.getProperty("file.separator");
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- // String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
- int retval = chooser.showOpenDialog(Preferences.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(Preferences.this, "You can only select files in the Tools"
- + System.getProperty("file.separator")
- + "Conf directory!");
-
- return;
- }
-
- jTextFieldToolsConfigFile.setText("Tools/Conf/" + theFile.getName());
- } else {
- return;
- }
- }
- });
- }
- return jButtonBrowse;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonSave() {
- if (jButtonSave == null) {
- jButtonSave = new JButton();
- jButtonSave.setBounds(new java.awt.Rectangle(next2LastButtonLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonSave.setText("Save");
- jButtonSave.addActionListener(this);
- }
- return jButtonSave;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(lastButtonXLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- public static Preferences getInstance() {
- if (bTarget == null) {
- bTarget = new Preferences();
- }
- return bTarget;
- }
-
- /**
- * This is the default constructor
- */
- public Preferences() {
- super();
- init();
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- for (int i = 0; i < maxTargetLines; i++) {
- targetLines[i] = null;
- targetLineNumber[i] = -1;
- }
- initReadFiles();
- this.setSize(dialogWidth, dialogHeight);
- this.setContentPane(getJContentPane());
- this.setTitle("Build Preferences [" + toolsDefIdentifier + "]");
- this.setDefaultCloseOperation(IFrame.DISPOSE_ON_CLOSE);
- this.centerWindow();
- this.setVisible(true);
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param initReadFiles
- *
- */
- private void initReadFiles() {
- /*
- * TODO
- * Read Current target.txt file first
- * Read TOOL_CHAIN_CONF file if specified, otherwise use tools_def.txt
- */
- readTargetTxtFile();
- boolean haveBuildTargets = readToolDefinitionFile();
- if (!haveBuildTargets) {
- // Lookup Build Targets from the platforms
- readPlatformFileBuildTargets();
- }
- }
-
- private void readPlatformFileBuildTargets() {
- Vector<PlatformIdentification> vPlatformId = wt.getAllPlatforms();
- String sBuildTargets = "";
-
- // foreach platform, build a list of BuildTargets
- Iterator<PlatformIdentification> iter = vPlatformId.iterator();
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd = GlobalData.openingPlatformList
- .getOpeningPlatformById(
- item)
- .getXmlFpd();
- sBuildTargets += fpd.getPlatformDefinitions().getBuildTargets().toString() + " ";
- }
- String allTargets[] = sBuildTargets.trim().split(" ");
- for (int i = 0; i < allTargets.length; i++) {
- if (!toolsDefTargetNames.contains(allTargets[i])) {
- toolsDefTargetNames += allTargets[i] + " ";
- }
- }
- }
-
- private boolean readToolDefinitionFile() {
-
- // Parse the tool definition file looking for targets and architectures
- toolsConfFile = null;
- boolean buildTargetsExist = true;
-
- if (targetLines[toolDefFileId] != null) {
- String[] result = new String[2];
- targetLines[toolDefFileId].trim();
- result = (targetLines[toolDefFileId]).split("=");
- String resString = (Tools.convertPathToCurrentOsType(result[1])).trim();
- toolsConfFile = workspaceDir.trim() + resString.trim();
- File toolsDefFile = new File(toolsConfFile);
- if (!toolsDefFile.exists()) {
- JOptionPane.showMessageDialog(this, "<html>" + "Tool Definition file, " + toolsConfFile
- + "<br>specified in the target.txt file does not exist!"
- + "<br>Using the default Tool Definition File:<br>"
- + defaultToolsConf);
- toolsConfFile = defaultToolsConf;
- }
- } else {
- toolsConfFile = defaultToolsConf;
- }
- String[] toolsDefFields = new String[toolDefFieldCount];
- for (int i = 0; i < toolDefFieldCount; i++)
- toolsDefFields[i] = null;
- File toolDefFile = new File(toolsConfFile);
- if (toolDefFile.exists()) {
- try {
- FileReader fileReader = new FileReader(toolDefFile);
- BufferedReader reader = new BufferedReader(fileReader);
- String rLine = null;
- String result[];
- int lineCounter = 0;
- while ((rLine = reader.readLine()) != null) {
-
- if (rLine.startsWith("IDENTIFIER")) {
- result = rLine.split("=");
- toolsDefIdentifier = (result[1]).trim();
- } else if ((!rLine.startsWith("#")) && (rLine.contains("="))) {
- result = rLine.split("=");
- toolsDefFields = ((result[0]).trim()).split("_");
- if (toolsDefTargetNames == null) {
- toolsDefTargetNames = (toolsDefFields[toolsDefTargetNameField]).trim() + " ";
- } else if (!toolsDefTargetNames.contains((toolsDefFields[toolsDefTargetNameField]).trim())) {
- toolsDefTargetNames += (toolsDefFields[toolsDefTargetNameField]).trim() + " ";
- }
- if (toolsDefTagNames == null) {
- toolsDefTagNames = (toolsDefFields[toolsDefTagNameField]).trim() + " ";
- } else if (!toolsDefTagNames.contains((toolsDefFields[toolsDefTagNameField]).trim())) {
- toolsDefTagNames += (toolsDefFields[toolsDefTagNameField]).trim() + " ";
- }
- if (toolsDefArchNames == null) {
- toolsDefArchNames = (toolsDefFields[toolsDefArchNameField]).trim() + " ";
- } else if (!toolsDefArchNames.contains((toolsDefFields[toolsDefArchNameField]).trim())) {
- toolsDefArchNames += (toolsDefFields[toolsDefArchNameField]).trim() + " ";
- }
- }
- lineCounter++;
- }
- reader.close();
- // Only enable Architecture selection based on tool chain installations
- String turnOff = "";
- if (!toolsDefArchNames.contains("EBC"))
- turnOff = "EBC ";
- if (!toolsDefArchNames.contains("PPC"))
- turnOff += "PPC ";
- if (!toolsDefArchNames.contains("IPF"))
- turnOff += "IPF ";
- if (!toolsDefArchNames.contains("X64"))
- turnOff += "X64 ";
- if (!toolsDefArchNames.contains("IA32"))
- turnOff += "X64 ";
- if (!toolsDefArchNames.contains("ARM"))
- turnOff += "ARM ";
- turnOff = turnOff.trim();
- vDisableArchList = stringToVector(turnOff);
-
- if (!toolsDefTargetNames.matches("[A-Z]+")) {
- toolsDefTargetNames = toolsDefTargetNames.replace("* ", "").trim();
- if (Debug)
- System.out.println("tools_def file does not define build targets: '" + toolsDefTargetNames
- + "'");
- buildTargetsExist = false;
- }
- } catch (IOException e) {
- Log.log(toolsConfFile + " Read Error ", e.getMessage());
- e.printStackTrace();
- }
- }
- return buildTargetsExist;
- }
-
- private void readTargetTxtFile() {
- File tFile = new File(targetFile);
-
- if (tFile.exists()) {
- try {
- FileReader fileReader = new FileReader(targetFile);
- BufferedReader reader = new BufferedReader(fileReader);
- targetLineNumberMax = 0;
- String rLine = null;
- while ((rLine = reader.readLine()) != null) {
- targetFileContents[targetLineNumberMax] = rLine;
- if (rLine.startsWith("ACTIVE_PLATFORM")) {
- // Only one active platform is permitted!
- targetLines[activePlatformId] = rLine;
- targetLineNumber[activePlatformId] = targetLineNumberMax;
- }
- if ((rLine.startsWith("TARGET" + " ")) || (rLine.startsWith("TARGET" + "\t"))
- || (rLine.startsWith("TARGET="))) {
- // Handle multiple Target Names
- if (rLine.contains(","))
- targetLines[buildTargetId] = rLine.trim().replaceAll(",", " ");
- else
- targetLines[buildTargetId] = rLine.trim();
- targetLineNumber[buildTargetId] = targetLineNumberMax;
- }
- if (rLine.startsWith("TARGET_ARCH")) {
- // Handle multiple Target Architectures
- if (rLine.contains(","))
- targetLines[targetArchId] = rLine.trim().replaceAll(",", " ");
- else
- targetLines[targetArchId] = rLine.trim();
- targetLineNumber[targetArchId] = targetLineNumberMax;
- }
- if (rLine.startsWith("TOOL_CHAIN_CONF")) {
- // Only one file is permitted
- targetLines[toolDefFileId] = rLine.trim();
- targetLineNumber[toolDefFileId] = targetLineNumberMax;
- }
-
- if (rLine.startsWith("TOOL_CHAIN_TAG")) {
- // Handle multiple Tool TagNames
- if (rLine.contains(","))
- targetLines[tagNameId] = rLine.trim().replaceAll(",", " ");
- else
- targetLines[tagNameId] = rLine.trim();
- targetLineNumber[tagNameId] = targetLineNumberMax;
- }
-
- if (rLine.startsWith("MULTIPLE_THREAD")) {
- // Handle Thread Enable flag
- targetLines[threadEnableId] = rLine.trim();
- targetLineNumber[threadEnableId] = targetLineNumberMax;
- if ((rLine.trim().toLowerCase().contains("enabled")) || (rLine.trim().toLowerCase().contains("true"))) {
- threadEnabled = true;
- } else {
- threadEnabled = false;
- }
- }
-
- if (rLine.startsWith("MAX_CONCURRENT_THREAD_NUMBER")) {
- // Handle Thread Enable flag
- targetLines[threadCountId] = rLine.trim();
- targetLineNumber[threadCountId] = targetLineNumberMax;
- }
- targetLineNumberMax++;
- }
- reader.close();
- String archLine[] = new String[2];
- if (targetLines[targetArchId] != null) {
- if (targetLines[targetArchId].contains("=")) {
- if (targetLines[targetArchId].contains(","))
- targetLines[targetArchId] = targetLines[targetArchId].trim().replaceAll(",", " ");
- if (targetLines[targetArchId].length() > 0)
- archLine = targetLines[targetArchId].trim().split("=");
- vArchList = stringToVector(archLine[1]);
- }
- }
-
- if (targetLines[threadCountId] != null) {
- String tcLine[] = new String[2];
- tcLine = targetLines[threadCountId].trim().split("=");
- threadCount = tcLine[1];
- } else
- threadCount = "";
-
- if (Debug == true)
- for (int i = 0; i <= maxTargetLines; i++)
- System.out.println("targetLines[" + i + "] contains: " + targetLines[i] + " index is: "
- + targetLineNumber[i]);
- } catch (IOException e) {
- Log.log(this.targetFile + " Read Error ", e.getMessage());
- e.printStackTrace();
- }
- }
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelToolsConfigFile = new JLabel();
- jLabelToolsConfigFile.setBounds(new java.awt.Rectangle(labelColumn, toolConfigFileRow, labelWidth,
- oneRowHeight));
- jLabelToolsConfigFile.setText("Tool Chain Definition File");
- jLabelActivePlatform = new JLabel();
- jLabelActivePlatform.setText("Select Active Platform");
- jLabelActivePlatform.setBounds(new java.awt.Rectangle(labelColumn, activePlatformRow, labelWidth,
- oneRowHeight));
- jLabelToolChainTagName = new JLabel();
- jLabelToolChainTagName.setBounds(new java.awt.Rectangle(labelColumn, toolChainTagNameRow, labelWidth,
- oneRowHeight));
- jLabelToolChainTagName.setText("Select Tool Tag Name");
- jLabelBuildTarget = new JLabel();
- jLabelBuildTarget.setBounds(new java.awt.Rectangle(labelColumn, buildTargetRow, labelWidth, oneRowHeight));
- jLabelBuildTarget.setText("Select Build Target");
- jLabelTargetArch = new JLabel();
- jLabelTargetArch.setBounds(new java.awt.Rectangle(labelColumn, targetArchRow, labelWidth, oneRowHeight));
- jLabelTargetArch.setText("Build Architectures");
-
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(valueColumn, targetArchRow, valueWidth, oneRowHeight));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
-
- jLabelEnableThreads = new JLabel();
- jLabelEnableThreads.setBounds(new java.awt.Rectangle(labelColumn, threadRow, labelWidth, oneRowHeight));
- jLabelEnableThreads.setText("Enable Compiler Threading");
-
- jLabelThreadCount = new JLabel();
- jLabelThreadCount.setBounds(new java.awt.Rectangle(valueColumn + 60, threadRow, labelWidth, oneRowHeight));
- jLabelThreadCount.setText("Number of threads to start");
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 10, dialogHeight - 10));
-
- jContentPane.add(jLabelToolsConfigFile, null);
- jContentPane.add(getJTextFieldToolsConfigFile(), null);
- jContentPane.add(getJButtonBrowse(), null);
-
- jContentPane.add(jLabelActivePlatform, null);
- jContentPane.add(getActivePlatform(), null);
-
- jContentPane.add(jLabelToolChainTagName, null);
- jContentPane.add(getJScrollPaneTagName(), null);
-
- jContentPane.add(jLabelBuildTarget, null);
- jContentPane.add(getJScrollPaneBuildTarget(), null);
-
- jContentPane.add(jLabelTargetArch, null);
-
- jArchCheckBox.setDisabledItems(vDisableArchList);
- jArchCheckBox.setSelectedItems(vArchList);
- jContentPane.add(jArchCheckBox, null);
-
- jContentPane.add(jLabelEnableThreads, null);
- jContentPane.add(getCheckBoxEnableThreads(), null);
-
- jContentPane.add(jLabelThreadCount, null);
- jContentPane.add(getTextFieldThreadCount(), null);
-
- jContentPane.add(getJButtonSave(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonBrowse) {
- // TODO: Call file browser, starting in $WORKSPACE/Tools/Conf directory
-
- }
-
- if (arg0.getSource() == jButtonSave) {
- saveTargetFile();
- JOptionPane.showMessageDialog(this, "<html>The target.txt file has been saved!"
- + "<br>A copy of the original file, target.txt.bak has"
- + "<br>also been created.</html>");
- this.exit();
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.exit();
- }
-
- if (arg0.getSource() == jCheckBoxEnableThreads) {
- if (jCheckBoxEnableThreads.isSelected() == false) {
- threadCount = "";
- jTextFieldThreadCount.setText(threadCount);
- }
- }
- }
-
-
- private void updateActivePlatform() {
- int lineAP;
- if (targetLines[activePlatformId] != null) {
- lineAP = targetLineNumber[activePlatformId];
- } else {
- lineAP = targetLineNumberMax;
- targetLineNumber[activePlatformId] = lineAP;
- targetLineNumberMax++;
- }
- if (jComboBoxActivePlatform.getSelectedItem() == "Do Not Set") {
- targetFileContents[lineAP] = "";
- targetLines[activePlatformId] = "";
- } else {
- targetFileContents[lineAP] = "ACTIVE_PLATFORM = " + jComboBoxActivePlatform.getSelectedItem() + "\r\n";
- targetLines[activePlatformId] = targetFileContents[lineAP];
- }
- if (Debug)
- System.out.println("Active Platform: " + targetFileContents[lineAP]);
- }
-
- private void updateToolDefFile() {
- int lineTDF;
- if (targetLines[toolDefFileId] != null) {
- lineTDF = targetLineNumber[toolDefFileId];
- } else {
- lineTDF = targetLineNumberMax;
- targetLineNumber[toolDefFileId] = lineTDF;
- targetLineNumberMax++;
- }
- if (Debug)
- System.out.println("Tool Config File: " + jTextFieldToolsConfigFile.getText());
- if (jTextFieldToolsConfigFile.getText() == null) {
- targetFileContents[lineTDF] = "#MT#";
- targetLines[toolDefFileId] = "";
- } else {
- targetFileContents[lineTDF] = "TOOL_CHAIN_CONF = " + jTextFieldToolsConfigFile.getText();
- targetLines[toolDefFileId] = targetFileContents[lineTDF];
- }
- }
-
- private void updateToolTagNames() {
- String sTagNames = vectorToString(iCheckBoxListTagName.getAllCheckedItemsString());
- int lineTTN;
-
- if (targetLines[tagNameId] != null) {
- lineTTN = targetLineNumber[tagNameId];
- } else {
- lineTTN = targetLineNumberMax;
- targetLineNumber[tagNameId] = lineTTN;
- targetLineNumberMax++;
- }
-
- if (Debug)
- System.out.println("Tag Name(s): " + sTagNames);
-
- if (sTagNames.length() > 0) {
- targetFileContents[lineTTN] = "TOOL_CHAIN_TAG = " + sTagNames;
- targetLines[tagNameId] = targetFileContents[lineTTN];
- } else {
- targetFileContents[lineTTN] = "#MT#";
- targetLines[tagNameId] = "";
- }
- }
-
- private void updateBuildTargets() {
- String sBuildTargets = vectorToString(iCheckBoxListBuildTarget.getAllCheckedItemsString());
- int lineBT;
-
- if (targetLines[buildTargetId] != null) {
- lineBT = targetLineNumber[buildTargetId];
- } else {
- lineBT = targetLineNumberMax;
- targetLineNumber[buildTargetId] = lineBT;
- targetLineNumberMax++;
- }
- if (Debug)
- System.out.println("Build Target(s): " + sBuildTargets);
- if (sBuildTargets.length() > 0) {
- targetFileContents[lineBT] = "TARGET = " + sBuildTargets;
- targetLines[buildTargetId] = targetFileContents[lineBT];
- } else {
- targetFileContents[lineBT] = "#MT#";
- targetLines[buildTargetId] = "";
- }
-
- }
-
- private void updateArchitectures() {
- String sArchList = jArchCheckBox.getSelectedItemsString().trim();
-
- if (Debug)
- System.out.println("Architectures: " + sArchList);
-
- int lineSA;
- if (targetLines[targetArchId] != null) {
- lineSA = targetLineNumber[targetArchId];
- } else {
- lineSA = targetLineNumberMax;
- targetLineNumber[targetArchId] = lineSA;
- targetLineNumberMax++;
- }
- if (sArchList == "") {
- targetFileContents[lineSA] = "#MT#";
- targetLines[targetArchId] = "";
- } else {
- targetFileContents[lineSA] = "TARGET_ARCH = " + sArchList;
- targetLines[targetArchId] = targetFileContents[lineSA];
- }
-
- }
-
- private void updateEnableThreads() {
- int lineET;
- if (targetLines[threadEnableId] != null) {
- lineET = targetLineNumber[threadEnableId];
- } else {
- lineET = targetLineNumberMax;
- targetLineNumber[threadEnableId] = lineET;
- targetLineNumberMax++;
- }
- if (jCheckBoxEnableThreads.isSelected() == true) {
- targetFileContents[lineET] = "MULTIPLE_THREAD = enabled";
- targetLines[threadEnableId] = targetFileContents[lineET];
- } else {
- targetFileContents[lineET] = "#MT#";
- targetLines[threadEnableId] = "";
- }
- }
-
- private void updateThreadCount() {
- int lineTC;
-
- if (targetLines[threadCountId] != null) {
- lineTC = targetLineNumber[threadCountId];
- } else {
- lineTC = targetLineNumberMax;
- targetLineNumber[threadCountId] = lineTC;
- targetLineNumberMax++;
- }
- if (jCheckBoxEnableThreads.isSelected() == true) {
- // Threading must be enabled
- if (jTextFieldThreadCount.getText().length() > 0) {
- // Thread Count must be greater than 0
- Scanner scan = new Scanner(jTextFieldThreadCount.getText().trim());
- if (scan.nextInt() > 0) {
- targetFileContents[lineTC] = "MAX_CONCURRENT_THREAD_NUMBER = " + jTextFieldThreadCount.getText().trim();
- targetLines[threadCountId] = targetFileContents[lineTC];
- } else {
- Log.wrn("Build Preferences", "Threading Enabled, but thread count is not set, setting to default of 1.");
- targetFileContents[lineTC] = "MAX_CONCURRENT_THREAD_NUMBER = 1";
- targetLines[threadCountId] = "MAX_CONCURRENT_THREAD_NUMBER = 1";
- }
- } else {
- Log.wrn("Build Preferences", "Threading Enabled, but thread count is not set, setting to default of 1.");
- targetFileContents[lineTC] = "MAX_CONCURRENT_THREAD_NUMBER = 1";
- targetLines[threadCountId] = "MAX_CONCURRENT_THREAD_NUMBER = 1";
- }
- } else {
- // Don't track threads if threading is not enabled
- targetFileContents[lineTC] = "#MT#";
- targetLines[threadCountId] = "";
- threadCount = "";
- }
-
- }
- private String vectorToString(Vector<String> v) {
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- protected Vector<String> stringToVector(String s) {
- if (s == null) {
- return null;
- }
- String[] sArray = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- return v;
- }
-
- private void saveTargetFile() {
- updateActivePlatform();
- updateToolDefFile();
- updateToolTagNames();
- updateBuildTargets();
- updateArchitectures();
- updateEnableThreads();
- updateThreadCount();
-
- try {
- copy(targetFile, targetFile + ".bak");
- FileWriter fileWriter = new FileWriter(targetFile);
- BufferedWriter writer = new BufferedWriter(fileWriter);
- for (int i = 0; i < targetLineNumberMax; i++) {
- if (! targetFileContents[i].contains("#MT#"))
- writer.write(targetFileContents[i] + "\n");
- }
- writer.close();
- } catch (IOException e) {
- Log.err(toolsConfFile + " Write Error ", e.getMessage());
- e.printStackTrace();
- }
- }
-
- private void copy(String txtFile, String bakFile) throws IOException {
- File fromFile = new File(txtFile);
- File toFile = new File(bakFile);
- FileInputStream fromTxt = null;
- FileOutputStream toBak = null;
- if (!fromFile.exists()) {
- fromFile.createNewFile();
- }
- try {
- fromTxt = new FileInputStream(fromFile);
- toBak = new FileOutputStream(toFile);
- byte[] buffer = new byte[4096];
- int bytes_read;
- while ((bytes_read = fromTxt.read(buffer)) != -1) {
- toBak.write(buffer, 0, bytes_read);
- }
- } finally {
- if (fromTxt != null)
- try {
- fromTxt.close();
- } catch (IOException e) {
- Log.err(toolsConfFile + " Read Error ", e.getMessage());
-
- }
- if (toBak != null)
- try {
- toBak.close();
- } catch (IOException e) {
- Log.err(toolsConfFile + ".bak Write Error ", e.getMessage());
- }
- }
- }
-
- private void exit() {
- this.setVisible(false);
- if (bTarget != null) {
- bTarget.dispose();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java
deleted file mode 100644
index 65e20bd665..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/** @file
-
- This file is used to init tool chain and tool preference data
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.toolchain;
-
-import java.io.*;
-import java.io.File;
-import java.lang.Integer;
-import java.util.ArrayList;
-
-import javax.swing.JOptionPane;
-
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class ToolChainId {
- //
- // Define class members
- //
-
- private final boolean Debug = false;
-
- private String toolDefinitionFile = null;
-
- private final int toolDefFieldCount = 5;
-
- private String toolsDefIdentifier = null;
-
- private String toolsDefTargetNames = null;
-
- private final int toolsDefTargetNameField = 0;
-
- private String toolsDefTagNames = null;
-
- private final int toolsDefTagNameField = 1;
-
- private String toolsDefArchNames = null;
-
- private final int toolsDefArchNameField = 2;
-
- private final int toolsDefToolArgumentField = 4;
-
- private String toolCommandCodes = null;
-
- private final int toolsDefCmdCodeArgumentField = 3;
-
-
- private String activePlatform = null;
-
- private String targetArchs = null;
-
- private String tagNames = null;
-
- private String buildTargets = null;
-
- private String toolFamilies = null;
-
- private ArrayList<String> toolDefinitionContents = new ArrayList<String>(50);
-
- private static boolean threadEnabled = false;
-
- private static int maxThreadCount = 0;
-
- private String toolsDir = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + "Tools"
- + System.getProperty("file.separator") + "Conf";
-
- private String strTargetFile = toolsDir + DataType.FILE_SEPARATOR + "target.txt";
-
- private String defaultToolsConf = toolsDir + DataType.FILE_SEPARATOR + "tools_def.txt";
-
- public void init() {
- readTargetTxtFile();
- readToolDefinitionFile();
- }
-
- public ToolChainId() {
- super();
- init();
- }
-
- public String getToolDefinitionFile() {
- return toolDefinitionFile;
- }
-
- public String getActivePlatform() {
- return activePlatform;
- }
-
- public String getBuildTargets() {
- return buildTargets;
- }
-
- public String getTagNames() {
- return tagNames;
- }
-
- public String getTargetArchitectures() {
- return targetArchs;
- }
-
- public boolean getThreadEnabled() {
- return threadEnabled;
- }
-
- public int getMaxThreadCount() {
- return maxThreadCount;
- }
-
- public String getToolFamilies() {
- return toolFamilies;
- }
-
- public String getToolDefinitionIdentifier() {
- return toolsDefIdentifier;
- }
-
- public ArrayList<String> getToolDefinitionStatements() {
- return toolDefinitionContents;
- }
-
- public String getToolsDefTagNames() {
- return toolsDefTagNames;
- }
-
- public String getToolsDefTargetNames() {
- return toolsDefTargetNames;
- }
-
- public String getToolsDefCommandCodes() {
- return toolCommandCodes;
- }
-
- public String getToolsDefArchNames() {
- return toolsDefArchNames;
- }
-
- private void readTargetTxtFile() {
- File tFile = new File(strTargetFile);
-
- if (tFile.exists()) {
- try {
- FileReader fileReader = new FileReader(strTargetFile);
- BufferedReader reader = new BufferedReader(fileReader);
- String rLine = null;
- String inLine[] = new String[2];
- while ((rLine = reader.readLine()) != null) {
- rLine = rLine.trim();
- if ((rLine.startsWith("ACTIVE_PLATFORM")) && (activePlatform == null)) {
- // Only one active platform is permitted!
- inLine = rLine.split("=");
- if (inLine.length > 1) {
- activePlatform = inLine[1].trim();
- }
- }
- if ((rLine.startsWith("TARGET" + " ")) || (rLine.startsWith("TARGET" + "\t"))
- || (rLine.startsWith("TARGET="))) {
- // Handle multiple Target Names
- if (rLine.contains(",")) {
- inLine = rLine.split("=");
- if (inLine.length > 1) {
- buildTargets = inLine[1].trim().replaceAll(",", " ");
- }
- } else {
- inLine = rLine.trim().split("=");
- if (inLine.length > 1) {
- buildTargets = inLine[1].trim();
- }
- }
- }
- if (rLine.startsWith("TARGET_ARCH")) {
- // Handle multiple Target Architectures
- if (rLine.contains(",")) {
- inLine = rLine.split("=");
- if (inLine.length > 1) {
- targetArchs = inLine[1].trim().replaceAll(",", " ");
- }
- } else {
- inLine = rLine.split("=");
- if (inLine.length > 1) {
- targetArchs = inLine[1].trim();
- }
- }
- }
- if (rLine.startsWith("TOOL_CHAIN_CONF")) {
- // Only one file is permitted
- inLine = rLine.split("=");
- if (inLine.length > 1) {
- toolDefinitionFile = inLine[1].trim();
- }
- }
-
- if (rLine.startsWith("TOOL_CHAIN_TAG")) {
- // Handle multiple Tool TagNames
- if (rLine.contains(",")) {
- inLine = rLine.split("=");
- if (inLine.length > 1) {
- tagNames = inLine[1].trim().replaceAll(",", " ");
- }
- } else {
- inLine = rLine.split("=");
- if (inLine.length > 1) {
- tagNames = inLine[1].trim();
- }
- }
- }
-
- if (rLine.startsWith("MULTIPLE_THREAD")) {
- // Handle Thread Enable flag
- if ((rLine.toLowerCase().contains("enabled"))
- || (rLine.toLowerCase().contains("true"))) {
- threadEnabled = true;
- } else {
- threadEnabled = false;
- }
- }
-
- if (rLine.startsWith("MAX_CONCURRENT_THREAD_NUMBER")) {
- // Handle Thread Enable flag
- inLine = rLine.split("=");
- if (inLine.length > 1) {
- maxThreadCount = Integer.valueOf(inLine[1].trim());
- }
- }
- }
- reader.close();
- } catch (IOException e) {
- Log.log(this.strTargetFile + " Read Error ", e.getMessage());
- e.printStackTrace();
- }
- } else {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "<html>" + "Tool Preferences file: <br>" + strTargetFile
- + "<br>does not exist!</html>");
- }
- }
-
- private void readToolDefinitionFile() {
-
- // Parse the tool definition file looking for targets and architectures
- String toolsConfFile = null;
- if (toolDefinitionFile != null) {
- String resString = (Tools.convertPathToCurrentOsType(toolDefinitionFile)).trim();
- toolsConfFile = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + resString.trim();
- File toolsDefFile = new File(toolsConfFile);
- if (!toolsDefFile.exists()) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "<html>" + "Tool Definition file, " + toolDefinitionFile
- + "<br>specified in the target.txt file does not exist!"
- + "<br>Using the default Tool Definition File:<br>"
- + defaultToolsConf);
- toolsConfFile = defaultToolsConf;
- }
- } else {
- toolsConfFile = defaultToolsConf;
- }
- String[] toolsDefFields = new String[toolDefFieldCount];
- for (int i = 0; i < toolDefFieldCount; i++)
- toolsDefFields[i] = null;
- File toolDefFile = new File(toolsConfFile);
- if (toolDefFile.exists()) {
- try {
- FileReader fileReader = new FileReader(toolDefFile);
- BufferedReader reader = new BufferedReader(fileReader);
- String rLine = null;
- String result[];
- while ((rLine = reader.readLine()) != null) {
- if ((rLine.startsWith("IDENTIFIER")) && (toolsDefIdentifier == null)) {
- result = rLine.split("=");
- toolsDefIdentifier = (result[1]).trim();
- } else if ((!rLine.startsWith("#")) && (rLine.contains("="))) {
- result = rLine.split("=");
- toolsDefFields = ((result[0]).trim()).split("_");
- if (toolsDefTargetNames == null) {
- toolsDefTargetNames = (toolsDefFields[toolsDefTargetNameField]).toUpperCase().trim() + " ";
- } else if (!toolsDefTargetNames.contains((toolsDefFields[toolsDefTargetNameField]).toUpperCase().trim())) {
- toolsDefTargetNames += (toolsDefFields[toolsDefTargetNameField]).toUpperCase().trim() + " ";
- }
- if (toolsDefTagNames == null) {
- toolsDefTagNames = (toolsDefFields[toolsDefTagNameField]).toUpperCase().toUpperCase().trim() + " ";
- } else if (!toolsDefTagNames.contains((toolsDefFields[toolsDefTagNameField]).toUpperCase().trim())) {
- toolsDefTagNames += (toolsDefFields[toolsDefTagNameField]).toUpperCase().trim() + " ";
- }
- if (toolsDefArchNames == null) {
- toolsDefArchNames = (toolsDefFields[toolsDefArchNameField]).toUpperCase().trim() + " ";
- } else if (!toolsDefArchNames.contains((toolsDefFields[toolsDefArchNameField]).toUpperCase().trim())) {
- toolsDefArchNames += (toolsDefFields[toolsDefArchNameField]).toUpperCase().trim() + " ";
- }
- if ((toolFamilies == null) && (rLine.trim().contains("FAMILY"))) {
- toolFamilies = (toolsDefFields[toolsDefToolArgumentField]).toUpperCase().trim() + " ";
- } else if ((rLine.trim().contains("FAMILY"))
- && (!toolFamilies.contains((toolsDefFields[toolsDefToolArgumentField]).toUpperCase().trim()))) {
- toolFamilies += (toolsDefFields[toolsDefToolArgumentField]).toUpperCase().trim() + " ";
- }
- if ((toolCommandCodes == null)) {
- toolCommandCodes = (toolsDefFields[toolsDefCmdCodeArgumentField]).toUpperCase().trim() + " ";
- } else if ((!toolCommandCodes.contains((toolsDefFields[toolsDefCmdCodeArgumentField]).toUpperCase().trim()))) {
- toolCommandCodes += (toolsDefFields[toolsDefCmdCodeArgumentField].toUpperCase().trim()) + " ";
- }
-
- toolDefinitionContents.add(rLine.trim().replaceAll(" ", ""));
- }
- }
- reader.close();
- if (!toolsDefTargetNames.matches("[A-Z]+")) {
- toolsDefTargetNames = toolsDefTargetNames.replace("* ", "").trim();
- if (Debug)
- System.out.println("tools_def file does not define build targets: '" + toolsDefTargetNames
- + "'");
- }
- } catch (IOException e) {
- Log.log(toolsConfFile + " Read Error ", e.getMessage());
- e.printStackTrace();
- }
- }
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/Workspace.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/Workspace.java
deleted file mode 100644
index 580086ff92..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/Workspace.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/** @file
-
- The file is used to init workspace
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.frameworkwizard.workspace;
-
-import java.io.File;
-
-import org.tianocore.frameworkwizard.common.DataType;
-
-public class Workspace {
- //
- // Define static return value
- //
- public final static int WORKSPACE_VALID = 0;
-
- public final static int WORKSPACE_NOT_DEFINED = 1;
-
- public final static int WORKSPACE_NOT_EXIST = 2;
-
- public final static int WORKSPACE_NOT_DIRECTORY = 3;
-
- public final static int WORKSPACE_NOT_VALID = 4;
-
- public final static int WORKSPACE_NO_TARGET_FILE = 5;
-
- //
- // Define class members
- //
- private static String currentWorkspace = null;
-
- private static String strWorkspaceDatabaseFile = DataType.FILE_SEPARATOR + "Tools" + DataType.FILE_SEPARATOR
- + "Conf" + DataType.FILE_SEPARATOR + "FrameworkDatabase.db";
-
- private static String targetFile = DataType.FILE_SEPARATOR + "Tools" + DataType.FILE_SEPARATOR + "Conf"
- + DataType.FILE_SEPARATOR + "target.txt";
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Get Current Workspace
-
- @return currentWorkspace
-
- */
- public static String getCurrentWorkspace() {
- return currentWorkspace;
- }
-
- /**
- Set Current Workspace
-
- @param currentWorkspace
- The input data of currentWorkspace
-
- */
- public static void setCurrentWorkspace(String currentWorkspace) {
- Workspace.currentWorkspace = currentWorkspace;
- }
-
- /**
- Check if current workspace exists of not
-
- @retval true - The current WORKSPACE exists
- @retval false - The current WORKSPACE doesn't exist
-
- */
- public static int checkCurrentWorkspace() {
- return checkWorkspace(getCurrentWorkspace());
- }
-
- /**
- Check if current workspace exists or not via input workspace path
-
- @param strWorkspace
- The input data of WORKSPACE path
- @retval true - The current WORKSPACE exists
- @retval false - The current WORKSPACE doesn't exist
-
- */
- public static int checkWorkspace(String strWorkspace) {
- //
- // Check if WORKSPACE Environment is defined
- //
- if (strWorkspace == null || strWorkspace == "") {
- return Workspace.WORKSPACE_NOT_DEFINED;
- }
-
- //
- // Check if WORKSPACE Environment exists
- //
- File f = new File(strWorkspace);
- if (!f.exists()) {
- return Workspace.WORKSPACE_NOT_EXIST;
- }
-
- //
- // Check if WORKSPACE Environment is a directory
- //
- if (!f.isDirectory()) {
- return Workspace.WORKSPACE_NOT_DIRECTORY;
- }
-
- //
- // Check if FrameworkDatabase.db exists
- //
- f = new File(strWorkspace + Workspace.getStrWorkspaceDatabaseFile());
- if (!f.exists()) {
- return Workspace.WORKSPACE_NOT_VALID;
- }
-
- //
- // Check if Target.txt exists
- //
- f = new File(strWorkspace + Workspace.getTargetFile());
- if (!f.exists()) {
- return Workspace.WORKSPACE_NO_TARGET_FILE;
- }
-
- return Workspace.WORKSPACE_VALID;
- }
-
- public static String getStrWorkspaceDatabaseFile() {
- return strWorkspaceDatabaseFile;
- }
-
- public static void setStrWorkspaceDatabaseFile(String strWorkspaceDatabaseFile) {
- //Workspace.strWorkspaceDatabaseFile = strWorkspaceDatabaseFile;
- }
-
- public static String getTargetFile() {
- return targetFile;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java
deleted file mode 100644
index 9db0fe587e..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java
+++ /dev/null
@@ -1,958 +0,0 @@
-/** @file
-
- The file is used to init workspace and get basic information of workspace
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.frameworkwizard.workspace;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.Vector;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.DbPathAndFilename;
-import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;
-import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations;
-import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.MsaFilesDocument.MsaFiles;
-import org.tianocore.PackageDependenciesDocument.PackageDependencies;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.SourceFilesDocument.SourceFiles;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.common.SaveFile;
-import org.tianocore.frameworkwizard.common.Sort;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.far.FarHeader;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class WorkspaceTools {
-
- public void addFarToDb(List<String> packageList, List<String> platformList, FarHeader far) {
- //FrameworkDatabase fdb = openFrameworkDb();
-
- for (int i = 0; i < packageList.size(); i++) {
- DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();
- item.setFarGuid(far.getGuidValue());
- item.setStringValue(packageList.get(i));
- GlobalData.fdb.getPackageList().getFilenameList().add(item);
- }
-
- for (int i = 0; i < platformList.size(); i++) {
- DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();
- item.setFarGuid(far.getGuidValue());
- item.setStringValue(platformList.get(i));
- GlobalData.fdb.getPlatformList().getFilenameList().add(item);
- }
-
- DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance();
- farItem.setFarGuid(far.getGuidValue());
- farItem.setStringValue(far.getFarName());
- GlobalData.fdb.getFarList().getFilenameList().add(farItem);
-
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
-
- try {
- SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);
- } catch (Exception e) {
- Log.err("Save Database File", e.getMessage());
- }
- }
-
- public void removeFarFromDb(FarIdentification far) {
- //
- // Remove Packages
- //
- XmlCursor cursor = GlobalData.fdb.getPackageList().newCursor();
- cursor.toFirstChild();
- do {
- DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();
-
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
- cursor.removeXml();
- }
- } while (cursor.toNextSibling());
- cursor.dispose();
-
- //
- // Remove Platforms
- //
- cursor = GlobalData.fdb.getPlatformList().newCursor();
- cursor.toFirstChild();
- do {
- DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
- cursor.removeXml();
- }
- } while (cursor.toNextSibling());
-
- //
- // Remove Far
- //
- cursor = GlobalData.fdb.getFarList().newCursor();
- cursor.toFirstChild();
- do {
- DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
- cursor.removeXml();
- }
- } while (cursor.toNextSibling());
- cursor.dispose();
-
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
- try {
- SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);
- } catch (Exception e) {
- Log.err("Save Database File", e.getMessage());
- }
- }
-
- public String getPackageFarGuid(Identification packageId) {
- for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
- File tempFile = new File(path);
- if (tempFile.getPath().equalsIgnoreCase(packageId.getPath())) {
- return GlobalData.fdb.getPackageList().getFilenameArray(index).getFarGuid();
- }
- }
-
- return null;
- }
-
- public String getPlatformFarGuid(Identification platformId) {
- for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
- File tempFile = new File(path);
- if (tempFile.getPath().equalsIgnoreCase(platformId.getPath())) {
- return GlobalData.fdb.getPlatformList().getFilenameArray(index).getFarGuid();
- }
- }
-
- return null;
- }
-
- public String getModuleFarGuid(Identification moduleId) {
- PackageIdentification packageId = getPackageIdByModuleId(moduleId);
- if (packageId != null) {
- return getPackageFarGuid(packageId);
- } else {
- return null;
- }
- }
-
- /**
- Get all modules' paths from one package
-
- @return a Vector with all modules' path
-
- **/
- public Vector<String> getAllModulesOfPackage(String path) {
- Vector<String> modulePath = new Vector<String>();
- PackageIdentification id = new PackageIdentification(null, null, null, path);
- MsaFiles files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id).getMsaFiles();
- if (files != null) {
- for (int index = 0; index < files.getFilenameList().size(); index++) {
- String msaPath = files.getFilenameList().get(index);
- msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;
- msaPath = Tools.convertPathToCurrentOsType(msaPath);
- modulePath.addElement(msaPath);
- }
- }
-
- return modulePath;
- }
-
- /**
- Get all Industry Std Includes' paths from one package
-
- @return a Vector with all paths
-
- **/
- public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {
- Vector<String> includePath = new Vector<String>();
- PackageIdentification id = new PackageIdentification(null, null, null, path);
- IndustryStdIncludes files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id)
- .getIndustryStdIncludes();
- if (files != null) {
- for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {
- String temp = files.getIndustryStdHeaderList().get(index).getIncludeHeader();
- temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;
- temp = Tools.convertPathToCurrentOsType(temp);
- includePath.addElement(temp);
- }
- }
- return includePath;
- }
-
- /**
- Get all package basic information form the FrameworkDatabase.db file
-
- @return vPackageList A vector includes all packages' basic information
-
- */
- public Vector<PackageIdentification> getAllPackages() {
- return GlobalData.vPackageList;
- }
-
- /**
- Get all package which match parameter isRepackagable
-
- @param isRepackagable
- @return
-
- **/
- public Vector<PackageIdentification> getAllRepackagablePackages() {
- Vector<PackageIdentification> v = new Vector<PackageIdentification>();
- for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {
- OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index);
- if (opt.getXmlSpd() != null) {
- if (opt.getXmlSpd().getPackageDefinitions() != null) {
- if (opt.getXmlSpd().getPackageDefinitions().getRePackage()) {
- v.addElement(opt.getId());
- }
- } else {
- v.addElement(opt.getId());
- }
- } else {
- v.addElement(opt.getId());
- }
- }
- return v;
- }
-
- public Vector<FarIdentification> getAllFars() {
-
- Vector<FarIdentification> v = new Vector<FarIdentification>();
- for (int index = 0; index < GlobalData.fdb.getFarList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getFarList().getFilenameList().get(index);
- FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue());
- v.addElement(far);
- }
- return v;
- }
-
- public Vector<PackageIdentification> getPackagesByFar(FarIdentification far) {
- Identification id = null;
-
- Vector<PackageIdentification> v = new Vector<PackageIdentification>();
-
- for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
- path = Tools.convertPathToCurrentOsType(path);
-
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
-
- try {
- id = Tools.getId(path, OpenFile.openSpdFile(path));
- v.addElement(new PackageIdentification(id));
- } catch (IOException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Package Surface Area " + path, "Invalid file type");
- }
- }
- }
- return v;
- }
-
- public Vector<PlatformIdentification> getPlatformsByFar(FarIdentification far) {
- Identification id = null;
-
- Vector<PlatformIdentification> v = new Vector<PlatformIdentification>();
-
- for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
- path = Tools.convertPathToCurrentOsType(path);
-
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
- try {
- id = Tools.getId(path, OpenFile.openFpdFile(path));
- v.addElement(new PlatformIdentification(id));
- } catch (IOException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Platform Surface Area " + path, "Invalid file type");
- }
- }
- }
- return v;
- }
-
- /**
- Get all module basic information from a package
-
- @param id Package id
- @return A vector includes all modules' basic information
-
- **/
- public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) {
- Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();
- Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath());
- String modulePath = null;
-
- for (int index = 0; index < modulePaths.size(); index++) {
- modulePath = modulePaths.get(index);
- ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(modulePath);
- if (id != null) {
- v.addElement(id);
- }
- }
- Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);
- return v;
- }
-
- /**
- Get all module basic information from a platform
-
- @param id Package id
- @return A vector includes all modules' basic information
-
- **/
- public Vector<ModuleIdentification> getAllModules(PlatformIdentification fid) {
- Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();
- PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformById(fid).getXmlFpd();
- if (fpd.getFrameworkModules() != null) {
- for (int index = 0; index < fpd.getFrameworkModules().getModuleSAList().size(); index++) {
- String guid = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleGuid();
- String version = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleVersion();
- ModuleIdentification id = GlobalData.openingModuleList.getIdByGuidVersion(guid, version);
- if (id != null) {
- boolean isFind = false;
- for (int indexOfModules = 0; indexOfModules < v.size(); indexOfModules++) {
- if (v.elementAt(indexOfModules).equals(id)) {
- isFind = true;
- break;
- }
- }
- if (!isFind) {
- v.addElement(id);
- }
- }
- }
- }
- Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);
- return v;
- }
-
- /**
- Get all module basic information form the FrameworkDatabase.db file
-
- @return vModuleList A vector includes all modules' basic information
-
- */
- public Vector<ModuleIdentification> getAllModules() {
- return GlobalData.vModuleList;
- }
-
- /**
- Get all platform basic information form the FrameworkDatabase.db file
-
- @return vplatformList A vector includes all platforms' basic information
-
- */
- public Vector<PlatformIdentification> getAllPlatforms() {
- return GlobalData.vPlatformList;
- }
-
- /**
- Get all Library Class Definitions from a package
-
- @return Vector
- **/
- public Vector<String> getAllLibraryClassDefinitionsFromPackage(PackageSurfaceArea spd) {
- Vector<String> vector = new Vector<String>();
- if (spd.getLibraryClassDeclarations() != null) {
- if (spd.getLibraryClassDeclarations().getLibraryClassList().size() > 0) {
- for (int index = 0; index < spd.getLibraryClassDeclarations().getLibraryClassList().size(); index++) {
- vector.addElement(spd.getLibraryClassDeclarations().getLibraryClassList().get(index).getName());
- }
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Get all Protocol Definitions from a package
-
- @return Vector
- **/
- public Vector<String> getAllProtocolDeclarationsFromPackage(PackageSurfaceArea spd) {
- Vector<String> vector = new Vector<String>();
- if (spd.getProtocolDeclarations() != null) {
- if (spd.getProtocolDeclarations().getEntryList().size() > 0) {
- for (int index = 0; index < spd.getProtocolDeclarations().getEntryList().size(); index++) {
- vector.addElement(spd.getProtocolDeclarations().getEntryList().get(index).getCName());
- }
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Get all Ppi Definitions from a package
-
- @return Vector
- **/
- public Vector<String> getAllPpiDeclarationsFromPackage(PackageSurfaceArea spd) {
- Vector<String> vector = new Vector<String>();
- if (spd.getPpiDeclarations() != null) {
- if (spd.getPpiDeclarations().getEntryList().size() > 0) {
- for (int index = 0; index < spd.getPpiDeclarations().getEntryList().size(); index++) {
- vector.addElement(spd.getPpiDeclarations().getEntryList().get(index).getCName());
- }
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Get all Guid Definitions from a package
-
- @return Vector
- **/
- public Vector<String> getAllGuidDeclarationsFromPackage(PackageSurfaceArea spd, String type) {
- Vector<String> vector = new Vector<String>();
- boolean isFound = false;
- if (spd.getGuidDeclarations() != null) {
- if (spd.getGuidDeclarations().getEntryList().size() > 0) {
- for (int index = 0; index < spd.getGuidDeclarations().getEntryList().size(); index++) {
- Vector<String> vArch = Tools.convertListToVector(spd.getGuidDeclarations().getEntryList()
- .get(index).getGuidTypeList());
- for (int indexOfArch = 0; indexOfArch < vArch.size(); indexOfArch++) {
- if (vArch.get(indexOfArch).equals(type)) {
- isFound = true;
- break;
- }
- }
- if ((isFound) || (vArch == null) || (vArch.size() < 1)) {
- vector.addElement(spd.getGuidDeclarations().getEntryList().get(index).getCName());
- isFound = false;
- }
- }
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Get all Pcd Definitions from a package
-
- @return Vector
- **/
- public PcdVector getAllPcdDeclarationsFromPackage(PackageSurfaceArea spd) {
- PcdVector vector = new PcdVector();
- if (spd.getPcdDeclarations() != null) {
- if (spd.getPcdDeclarations().getPcdEntryList().size() > 0) {
- for (int index = 0; index < spd.getPcdDeclarations().getPcdEntryList().size(); index++) {
- String name = spd.getPcdDeclarations().getPcdEntryList().get(index).getCName();
- String guidCName = spd.getPcdDeclarations().getPcdEntryList().get(index).getTokenSpaceGuidCName();
- String help = spd.getPcdDeclarations().getPcdEntryList().get(index).getHelpText();
- Vector<String> type = Tools.convertListToVector(spd.getPcdDeclarations().getPcdEntryList()
- .get(index).getValidUsage());
- //
- // The algorithm for PCD of msa should be:
- // 1. If the type of PCD from Spd is FEATURE_FLAG,
- // the type of Msa only can be FEATURE_FLAG.
- // 2. If the type of PCD from Spd is not FEATURE_FLAG,
- // the type of Msa could be selected from the PCD's all types and "DYNAMIC" type.
- //
- boolean hasFEATURE_FLAG = false;
- boolean hasDYNAMIC = false;
- for (int indexOfType = 0; indexOfType < type.size(); indexOfType++) {
- if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_DYNAMIC)) {
- hasDYNAMIC = true;
- }
- if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {
- hasFEATURE_FLAG = true;
- }
- }
- if (hasFEATURE_FLAG) {
- type.removeAllElements();
- type.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG);
- } else {
- if (!hasDYNAMIC) {
- type.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC);
- }
- }
- vector.addPcd(new PcdIdentification(name, guidCName, help, type));
- }
- }
- }
- Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllLibraryClassDefinitionsFromWorkspace() {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllLibraryClassDefinitionsFromPackages(Vector<PackageIdentification> vpid) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < vpid.size(); index++) {
- Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllProtocolDeclarationsFromWorkspace() {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllProtocolDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < vpid.size(); index++) {
- Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllPpiDeclarationsFromWorkspace() {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllPpiDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < vpid.size(); index++) {
- Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllGuidDeclarationsFromWorkspace(String type) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- Vector<String> v = getAllGuidDeclarationsFromPackage(
- GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)),
- type);
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllGuidDeclarationsFromPackages(Vector<PackageIdentification> vpid, String type) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < vpid.size(); index++) {
- Vector<String> v = getAllGuidDeclarationsFromPackage(
- GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)),
- type);
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public PcdVector getAllPcdDeclarationsFromWorkspace() {
- PcdVector vector = new PcdVector();
- for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {
- PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public PcdVector getAllPcdDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
- PcdVector vector = new PcdVector();
- for (int index = 0; index < vpid.size(); index++) {
- PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Find a module's package's id
-
- @param id input module id
- @return package id
-
- **/
- public PackageIdentification getPackageIdByModuleId(Identification id) {
- Vector<String> modulePaths = new Vector<String>();
- Identification mid = null;
- String packagePath = null;
- String modulePath = null;
-
- //
- // For each package, get all modules list
- //
- for (int indexI = 0; indexI < GlobalData.vPackageList.size(); indexI++) {
- packagePath = GlobalData.vPackageList.elementAt(indexI).getPath();
- modulePaths = this.getAllModulesOfPackage(packagePath);
- for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
- modulePath = modulePaths.get(indexJ);
- mid = GlobalData.openingModuleList.getIdByPath(modulePath);
- //
- // Check id
- //
- if (mid != null) {
- if (mid.equals(id)) {
- return GlobalData.vPackageList.elementAt(indexI);
- }
- }
- }
- }
-
- return null;
- }
-
- /**
- Add module information to package surface area
-
- @param mid
- @throws IOException
- @throws XmlException
- @throws Exception
-
- **/
- public void addModuleToPackage(ModuleIdentification mid, PackageSurfaceArea spd) throws IOException, XmlException,
- Exception {
- String packagePath = mid.getPackageId().getPath();
- String modulePath = mid.getPath();
- if (spd == null) {
- spd = OpenFile.openSpdFile(packagePath);
- }
- MsaFiles msaFile = spd.getMsaFiles();
- if (msaFile == null) {
- msaFile = MsaFiles.Factory.newInstance();
- }
- packagePath = packagePath.substring(0, packagePath.lastIndexOf(DataType.FILE_SEPARATOR));
- String fn = Tools.getRelativePath(modulePath, packagePath);
- msaFile.addNewFilename();
- msaFile.setFilenameArray(msaFile.getFilenameList().size() - 1, fn);
- spd.setMsaFiles(msaFile);
- SaveFile.saveSpdFile(mid.getPackageId().getPath(), spd);
- //
- // Update GlobalData
- //
- GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId()).setMsaFiles(msaFile);
- }
-
- /**
- Add input package into database
-
- @param id
- * @throws Exception
-
- **/
- public void addPackageToDatabase(PackageIdentification id) throws Exception {
- String path = id.getPath();
- path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());
-
- DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();
- filename.setStringValue(path);
- GlobalData.fdb.getPackageList().addNewFilename();
- GlobalData.fdb.getPackageList().setFilenameArray(GlobalData.fdb.getPackageList().sizeOfFilenameArray() - 1,
- filename);
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
- SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);
- }
-
- /**
- Add input package into database
-
- @param id
- * @throws Exception
-
- **/
- public void addPlatformToDatabase(PlatformIdentification id) throws Exception {
- String path = id.getPath();
- path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());
-
- DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();
- filename.setStringValue(path);
- GlobalData.fdb.getPlatformList().addNewFilename();
- GlobalData.fdb.getPlatformList().setFilenameArray(GlobalData.fdb.getPlatformList().sizeOfFilenameArray() - 1,
- filename);
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
- SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);
- }
-
- /**
- Get all file's path from one module
-
- @param path
- @return
- @throws IOException
- @throws XmlException
- @throws Exception
-
- **/
- public Vector<String> getAllFilesPathOfModule(String path) {
- Vector<String> v = new Vector<String>();
- path = Tools.convertPathToCurrentOsType(path);
-
- //
- // First add msa file's path
- //
- v.addElement(path);
-
- ModuleSurfaceArea msa = GlobalData.openingModuleList
- .getModuleSurfaceAreaFromId(GlobalData.openingModuleList
- .getIdByPath(path));
- //
- // Get common defined files of module
- //
- if (msa != null) {
- //
- // Get all files' path of a module
- //
- SourceFiles sf = msa.getSourceFiles();
- if (sf != null) {
- for (int index = 0; index < sf.getFilenameList().size(); index++) {
- String temp = sf.getFilenameList().get(index).getStringValue();
- temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;
- v.addElement(Tools.convertPathToCurrentOsType(temp));
- }
- }
- }
-
- //
- // Get include header files for this module
- //
- if (msa.getLibraryClassDefinitions() != null) {
- LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();
- for (int index = 0; index < lcd.sizeOfLibraryClassArray(); index++) {
- if (lcd.getLibraryClassList().get(index).getUsage().toString()
- .equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || lcd.getLibraryClassList().get(index).getUsage().toString()
- .equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- //
- // Get library class name
- //
- String name = lcd.getLibraryClassList().get(index).getKeyword();
-
- //
- // Find file path for this class
- //
- PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId();
- PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid);
- String headerFile = getHeaderFileFromPackageByLibraryClassName(spd, name);
- if (!Tools.isEmpty(headerFile)) {
- v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())
- + DataType.FILE_SEPARATOR + headerFile));
- }
- }
- }
- }
-
- return v;
- }
-
- /**
- Get all file's path from one package
-
- @param path
- @return
- @throws IOException
- @throws XmlException
- @throws Exception
-
- **/
- public Vector<String> getAllFilesPathOfPakcage(String path) {
- Vector<String> v = new Vector<String>();
- path = Tools.convertPathToCurrentOsType(path);
- //
- // First add package
- //
- v.addElement(path);
-
- //
- // Add the package's industry std includes one by one
- //
- Vector<String> f1 = new Vector<String>();
- f1 = getAllIndustryStdIncludesOfPackage(path);
- for (int index = 0; index < f1.size(); index++) {
- v.addElement(f1.get(index));
- }
-
- //
- // Add module's files one by one
- //
- f1 = new Vector<String>();
- f1 = getAllModulesOfPackage(path);
- for (int indexI = 0; indexI < f1.size(); indexI++) {
- Vector<String> f2 = getAllFilesPathOfModule(f1.get(indexI));
- for (int indexJ = 0; indexJ < f2.size(); indexJ++) {
- v.addElement(f2.get(indexJ));
- }
- }
-
- return v;
- }
-
- /**
- Get a module's all package dependencies
-
- @param mid The module id
- @return A vector of all package dependency ids
-
- **/
- public Vector<PackageIdentification> getPackageDependenciesOfModule(ModuleIdentification mid) {
- Vector<PackageIdentification> vpid = new Vector<PackageIdentification>();
- ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);
- if (msa != null) {
- PackageDependencies pd = msa.getPackageDependencies();
- if (pd != null) {
- for (int index = 0; index < pd.getPackageList().size(); index++) {
- String guid = pd.getPackageList().get(index).getPackageGuid();
- String version = pd.getPackageList().get(index).getPackageVersion();
- PackageIdentification pid = GlobalData.openingPackageList.getIdByGuidVersion(guid, version);
- if (pid != null) {
- vpid.addElement(pid);
- }
- }
- }
- }
- return vpid;
- }
-
- public Vector<String> getAllModuleGuidXref() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {
- ModuleIdentification id = GlobalData.openingModuleList.getOpeningModuleByIndex(index).getId();
- v.addElement(id.getGuid() + " " + id.getName());
- }
- return v;
- }
-
- public Vector<String> getModuleArch(ModuleIdentification id) {
- Vector<String> v = new Vector<String>();
- ModuleSurfaceArea msa = null;
- if (id != null) {
- msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(id);
- }
- if (msa != null) {
- if (msa.getModuleDefinitions() != null) {
- v = Tools.convertListToVector(msa.getModuleDefinitions().getSupportedArchitectures());
- }
- }
- return v;
- }
-
- public String getHeaderFileFromPackageByLibraryClassName(PackageSurfaceArea spd, String name) {
- String headerFile = "";
- if (spd != null) {
- if (spd.getLibraryClassDeclarations() != null) {
- LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();
- for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {
- if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {
- return lcdl.getLibraryClassList().get(indexOfLibOfSpd).getIncludeHeader();
- }
- }
- }
- }
-
- return headerFile;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java
deleted file mode 100644
index e5f28c56c4..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.tianocore.frameworkwizard.workspace.ui;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class SwitchWorkspace extends IDialog {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 2184556370155608202L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel1 = null;
-
- private JTextField jTextFieldOld = null;
-
- private JTextField jTextFieldNew = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonBrowse = null;
-
- /**
- * This method initializes jTextFieldOld
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldOld() {
- if (jTextFieldOld == null) {
- jTextFieldOld = new JTextField();
- jTextFieldOld.setBounds(new java.awt.Rectangle(140, 10, 320, 20));
- jTextFieldOld.setEditable(false);
- jTextFieldOld.setText(Workspace.getCurrentWorkspace() == null ? "Not Defined"
- : Workspace.getCurrentWorkspace());
- }
- return jTextFieldOld;
- }
-
- /**
- * This method initializes jTextFieldNew
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldNew() {
- if (jTextFieldNew == null) {
- jTextFieldNew = new JTextField();
- jTextFieldNew.setBounds(new java.awt.Rectangle(140, 35, 220, 20));
- }
- return jTextFieldNew;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 70, 80, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(380, 70, 80, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonBrowse
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(370, 35, 90, 20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.addActionListener(this);
- }
- return jButtonBrowse;
- }
-
- /**
- * This is the default constructor
- *
- */
- public SwitchWorkspace() {
- super();
- initialize();
- }
-
- /**
- * This is the override constructor
- *
- */
- public SwitchWorkspace(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(472, 132);
- this.setContentPane(getJContentPane());
- this.setTitle("Select workspace");
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(15, 10, 120, 20));
- jLabel1.setText("Current Workspace");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(15, 35, 120, 20));
- jLabel.setText("Change to ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJTextFieldOld(), null);
- jContentPane.add(getJTextFieldNew(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonBrowse(), null);
- }
- return jContentPane;
- }
-
- private boolean check() {
- if (isEmpty(this.jTextFieldNew.getText())) {
- Log.wrn("Switch Workspace", "New workspace must be entered!");
- return false;
- }
- if (Workspace.checkWorkspace(this.jTextFieldNew.getText()) != Workspace.WORKSPACE_VALID) {
- Log.wrn("Switch Workspace", "Please select a valid workspace!");
- return false;
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listen all actions
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonCancel) {
- this.setVisible(false);
- returnType = DataType.RETURN_TYPE_CANCEL;
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (!check()) {
- return;
- } else {
- Workspace.setCurrentWorkspace(this.jTextFieldNew.getText());
- returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonBrowse) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldNew.setText(Tools.convertPathToCurrentOsType(fc.getSelectedFile().getPath()));
- }
- }
- }
-}
diff --git a/Tools/Java/Source/GenBuild/GenBuild.msa b/Tools/Java/Source/GenBuild/GenBuild.msa
deleted file mode 100644
index bfddea1ff7..0000000000
--- a/Tools/Java/Source/GenBuild/GenBuild.msa
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
- <MsaHeader>
- <ModuleName>GenBuild</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>0FC76CF5-8ACF-49a7-82E9-EA5BE953CC48</GuidValue>
- <Version>2.0</Version>
- <Abstract>This is the EFI/Tiano Tool Resources Module</Abstract>
- <Description>
- This Module provides the EFI/Tiano Tools that are used to create EFI/Tiano
- Modules and Platform Binary Files (PBF)
- These tools require compilation only once if the Developer Workstation and
- the Developer's choice of HOST tool chain are stable. If the developer
- updates either the OS or the HOST tool chain, these tools should be rebuilt.
- </Description>
- <Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
- <License>
-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.
- </License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>build.xml</Filename>
- <Filename>GenBuild.tasks</Filename>
- <Filename>org/tianocore/build/FfsProcess.java</Filename>
- <Filename>org/tianocore/build/FileProcess.java</Filename>
- <Filename>org/tianocore/build/FrameworkBuildTask.java</Filename>
- <Filename>org/tianocore/build/GenBuildTask.java</Filename>
- <Filename>org/tianocore/build/ModuleBuildFileGenerator.java</Filename>
- <Filename>org/tianocore/build/GenBuildThread.java</Filename>
-
- <Filename>org/tianocore/build/autogen/AutoGen.java</Filename>
- <Filename>org/tianocore/build/autogen/AutogenLibOrder.java</Filename>
- <Filename>org/tianocore/build/autogen/CommonDefinition.java</Filename>
-
- <Filename>org/tianocore/build/exception/AutoGenException.java</Filename>
- <Filename>org/tianocore/build/exception/GenBuildException.java</Filename>
- <Filename>org/tianocore/build/exception/PcdAutogenException.java</Filename>
- <Filename>org/tianocore/build/exception/PlatformPcdPreprocessBuildException.java</Filename>
- <Filename>org/tianocore/build/exception/XmlParseException.java</Filename>
-
- <Filename>org/tianocore/build/fpd/FpdParserTask.java</Filename>
- <Filename>org/tianocore/build/fpd/PlatformBuildFileGenerator.java</Filename>
- <Filename>org/tianocore/build/fpd/FpdParserForThread.java</Filename>
-
- <Filename>org/tianocore/build/global/DpFile.java</Filename>
- <Filename>org/tianocore/build/global/DpFileList.java</Filename>
- <Filename>org/tianocore/build/global/GenBuildLogger.java</Filename>
- <Filename>org/tianocore/build/global/GlobalData.java</Filename>
- <Filename>org/tianocore/build/global/OnDependency.java</Filename>
- <Filename>org/tianocore/build/global/OutputManager.java</Filename>
- <Filename>org/tianocore/build/global/Spd.java</Filename>
- <Filename>org/tianocore/build/global/SurfaceAreaQuery.java</Filename>
- <Filename>org/tianocore/build/global/VariableTask.java</Filename>
-
- <Filename>org/tianocore/build/id/FpdModuleIdentification.java</Filename>
- <Filename>org/tianocore/build/id/Identification.java</Filename>
- <Filename>org/tianocore/build/id/ModuleIdentification.java</Filename>
- <Filename>org/tianocore/build/id/PackageIdentification.java</Filename>
- <Filename>org/tianocore/build/id/PlatformIdentification.java</Filename>
-
- <Filename>org/tianocore/build/pcd/action/PCDAutoGenAction.java</Filename>
- <Filename>org/tianocore/build/pcd/action/PcdDatabase.java</Filename>
- <Filename>org/tianocore/build/pcd/action/PlatformPcdPreprocessActionForBuilding.java</Filename>
-
- <Filename>org/tianocore/build/toolchain/ConfigReader.java</Filename>
- <Filename>org/tianocore/build/toolchain/ToolChainConfig.java</Filename>
- <Filename>org/tianocore/build/toolchain/ToolChainElement.java</Filename>
- <Filename>org/tianocore/build/toolchain/ToolChainInfo.java</Filename>
- <Filename>org/tianocore/build/toolchain/ToolChainKey.java</Filename>
- <Filename>org/tianocore/build/toolchain/ToolChainMap.java</Filename>
-
- <Filename>org/tianocore/build/tools/ModuleItem.java</Filename>
- <Filename>org/tianocore/build/tools/PackageItem.java</Filename>
- </SourceFiles>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/Tools/Java/Source/GenBuild/GenBuild.tasks b/Tools/Java/Source/GenBuild/GenBuild.tasks
deleted file mode 100644
index d581323b8d..0000000000
--- a/Tools/Java/Source/GenBuild/GenBuild.tasks
+++ /dev/null
@@ -1,8 +0,0 @@
-FPDParser = org.tianocore.build.fpd.FpdParserTask
-bl = org.tianocore.build.global.VariableTask
-GenBuild = org.tianocore.build.GenBuildTask
-FrameworkBuild = org.tianocore.build.FrameworkBuildTask
-OnDependency = org.tianocore.build.global.OnDependency
-sourcefiles = org.tianocore.build.global.DpFileList
-targetfiles = org.tianocore.build.global.DpFileList
-file = org.tianocore.build.global.DpFile
diff --git a/Tools/Java/Source/GenBuild/build.xml b/Tools/Java/Source/GenBuild/build.xml
deleted file mode 100644
index 2f9476f4bd..0000000000
--- a/Tools/Java/Source/GenBuild/build.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="GenBuild" default="GenBuild" basedir=".">
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="SurfaceArea.jar"/>
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="Common.jar"/>
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="PcdTools.jar"/>
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
- </path>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>
- <target name="GenBuild" depends="install"/>
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="." destdir="${buildDir}">
- <classpath refid="classpath"/>
- <compilerarg value="-Xlint"/>
- </javac>
- </target>
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false" quiet="true">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/GenBuild" includes="${buildDir}"/>
- </delete>
- </target>
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: GenBuild.jar"/>
- <delete file="${installLocation}/GenBuild.jar"/>
- <if>
- <available file="${installLocation}/GenBuild.jar"/>
- <then>
- <echo message="You must manually remove the file: ${installLocation}/GenBuild.jar"/>
- <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
- </then>
- </if>
- </target>
- <target name="install" depends="source">
- <copy file="GenBuild.tasks" toDir="${buildDir}"/>
- <jar destfile="${installLocation}/GenBuild.jar"
- basedir="${buildDir}"
- includes="**"
- />
- </target>
-</project>
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/FfsProcess.java b/Tools/Java/Source/GenBuild/org/tianocore/build/FfsProcess.java
deleted file mode 100644
index f63b7d95f0..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/FfsProcess.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/** @file
- File is FfsProcess class which is used to get the corresponding FFS layout
- information for driver module.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.build;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.security.MessageDigest;
-import java.util.Vector;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.xmlbeans.XmlCursor;
-import org.tianocore.BuildOptionsDocument;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.global.SurfaceAreaQuery;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.common.definitions.EdkDefinitions;
-import org.tianocore.common.logger.EdkLog;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- <p><code>FfsProcess</code> is a class to find the corresponding FFS layout. </p>
-
- <p>The FFS Layout is like following: </p>
-
- <pre>
- &lt;Ffs type="APPLICATION"&gt;
- &lt;Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_APPLICATION" /&gt;
- &lt;Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE" /&gt;
- &lt;Sections EncapsulationType="Compress"&gt;
- &lt;Sections EncapsulationType="Guid-Defined"&gt;
- &lt;Section SectionType="EFI_SECTION_PE32" /&gt;
- &lt;Section SectionType="EFI_SECTION_USER_INTERFACE" /&gt;
- &lt;Section SectionType="EFI_SECTION_VERSION" /&gt;
- &lt;/Sections&gt;
- &lt;/Sections&gt;
- &lt;/Ffs&gt;
- </pre>
-
- @since GenBuild 1.0
-**/
-public class FfsProcess {
-
- private BuildOptionsDocument.BuildOptions.Ffs ffsXmlObject;
-
- private Project project = null;
- ///
- /// ANT script to call GenFfs
- ///
- private Element ffsNode = null;
-
- ///
- /// Module base name
- ///
- private String basename;
-
- ///
- /// Sections type: normal
- ///
- private static int MODE_NONE = 0;
-
- ///
- /// Sections type: compress
- ///
- private static int MODE_COMPRESS = 1;
-
- ///
- /// Sections type: guid-define
- ///
- private static int MODE_GUID_DEFINED = 2;
-
- ///
- /// mapping from section type to section output file extension
- ///
- public static final String[][] sectionExt = EdkDefinitions.SectionTypeExtensions;
-
- /**
- search in the type, if componentType is listed in type, return true;
- otherwise return false.
-
- @param type a list supported component type separated by comma
- @param componentType current module component type
- @return whether componentType is one of type
- **/
- private boolean isMatch(String type, String componentType) {
- String[] items = type.split("[ \t]*,[ \t]*");
- for (int i = 0; i < items.length; i++) {
- if (items[i].equalsIgnoreCase(componentType)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- Find the corresponding FFS layout in <code>FPD</code>.
-
- @param buildType Current module's component type
- @param project Ant project
- @return whether find the corresponding FFS layout
- @throws BuildException
- If can't find FFS Layout in FPD.
- **/
- public boolean initSections(String buildType, Project project, FpdModuleIdentification fpdModuleId) throws BuildException {
- this.project = project;
- //
- // Try to find Ffs layout from FPD file
- //
- SurfaceAreaQuery saq = new SurfaceAreaQuery(GlobalData.getFpdBuildOptionsMap());
- BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = saq.getFpdFfs();
- for (int i = 0; i < ffsArray.length; i++) {
- if (isMatch(ffsArray[i].getFfsKey(), buildType)) {
- ffsXmlObject = ffsArray[i];
- genDigest();
- return true;
- }
- }
-
- //
- // If FfsFormatKey is not null, report exception and fail build
- // Otherwise report warning message
- //
- if (buildType == null) {
- EdkLog.log(EdkLog.EDK_WARNING, "Warning: this module doesn't specify a FfsFormatKey. ");
- } else {
- throw new BuildException("Can't find the FfsFormatKey [" + buildType + "] attribute in the FPD file!");
- }
-
- return false;
- }
-
- /**
- Recursive parse the FFS layout. Find out all section type here used.
-
- @param document BaseName_build.xml Xml document
- @param basename Module's base name
- @param guid Module's GUID
- @param targetFilename Module's final file name (GUID-BaseName.APP)
- @return List of section type
- **/
- public String[] getGenSectionElements(Document document, String basename, String guid, String targetFilename) {
- this.basename = basename;
- if (ffsXmlObject == null) {
- return new String[0];
- }
- Vector<String> sectionList = new Vector<String>();
- XmlCursor cursor = null;
-
- cursor = ffsXmlObject.newCursor();
-
- int mode = MODE_NONE;
- Element genffsfileEle = document.createElement("genffsfile");
- genffsfileEle.setAttribute("outputDir", "${BIN_DIR}");
- genffsfileEle.setAttribute("moduleType", "${MODULE_TYPE}");
- genffsfileEle.setAttribute("BaseName", basename);
- genffsfileEle.setAttribute("fileGuid", guid);
-
- if (cursor.toFirstChild()) {
- do {
- if (cursor.getName().getLocalPart().equalsIgnoreCase("Attribute")) {
- String name = cursor.getAttributeText(new QName("Name"));
- String value = cursor.getAttributeText(new QName("Value"));
- genffsfileEle.setAttribute(changeAttributeName(name), value);
- } else if (cursor.getName().getLocalPart().equalsIgnoreCase("Section")) {
- cursor.push();
- dealSection(mode, document, genffsfileEle, cursor, sectionList);
- cursor.pop();
- } else if (cursor.getName().getLocalPart().equalsIgnoreCase("Sections")) {
- cursor.push();
- dealSections(mode, document, genffsfileEle, cursor, sectionList);
- cursor.pop();
- }
- } while (cursor.toNextSibling());
- }
- //
- // Check dependency
- //
- Element outofdateEle = document.createElement("OnDependency");
- Element sourceEle = document.createElement("sourcefiles");
- Vector<String> sections = new Vector<String>();
- for (int i = 0; i < sectionList.size(); i++) {
- String section = (String) sectionList.get(i);
- if (isSectionType(section)) {
- sections.addElement(section);
- }
- Element pathEle = document.createElement("file");
- pathEle.setAttribute("name", getSectionFile(basename, section));
- sourceEle.appendChild(pathEle);
- }
- //
- // add FFS layout digest into the source file list
- //
- Element pathEle = document.createElement("file");
- pathEle.setAttribute("name", "${DEST_DIR_OUTPUT}" + File.separator + "ffs.md5");
- sourceEle.appendChild(pathEle);
-
- String[] result = sections.toArray(new String[sections.size()]);
-
- outofdateEle.appendChild(sourceEle);
- Element targetEle = document.createElement("targetfiles");
- Element fileEle = document.createElement("file");
- fileEle.setAttribute("name", "${BIN_DIR}" + File.separatorChar + targetFilename);
- targetEle.appendChild(fileEle);
- outofdateEle.appendChild(targetEle);
- Element sequentialEle = document.createElement("sequential");
- sequentialEle.appendChild(genffsfileEle);
- outofdateEle.appendChild(sequentialEle);
- ffsNode = outofdateEle;
- return result;
- }
-
- /**
- Change the attribute name. For example:
-
- <pre>
- Before change: FFS_ATTRIB_CHECKSUM
- After change: ffsATTRIBCHECKSUM
- </pre>
-
- @param name Original attribute name
- @return Changed attribute name
- **/
- private String changeAttributeName(String name) {
- String[] strs = name.split("_");
- String str = strs[0].toLowerCase();
- for (int j = 1; j < strs.length; j++) {
- str += strs[j];
- }
- return str;
- }
-
- /**
- Recursively deal with Sections. If sections does not specify a type, then omit it.
-
- @param mode Current node mode (MODE_NONE | MODE_COMPREE | MODE_GUID_DEFINED)
- @param doc Xml Document
- @param root Root Node
- @param cursor Current FFS layout cursor
- @param list List of section type here used
- **/
- private void dealSections(int mode, Document doc, Element root, XmlCursor cursor, Vector<String> list) {
- String type = cursor.getAttributeText(new QName("EncapsulationType"));
- String toolName = cursor.getAttributeText(new QName("ToolName"));
- String sectType = cursor.getAttributeText(new QName("SectionType"));
- if (type == null && sectType == null) {
- if (cursor.toFirstChild()) {
- do {
- if (cursor.getName().getLocalPart().equalsIgnoreCase("Section")) {
- cursor.push();
- dealSection(mode, doc, root, cursor, list);
- cursor.pop();
- } else if (cursor.getName().getLocalPart().equalsIgnoreCase("Sections")) {
- cursor.push();
- dealSections(mode, doc, root, cursor, list);
- cursor.pop();
- }
- } while (cursor.toNextSibling());
- }
- return;
- }
- Element ele;
- Element toolEle = null;
- if (type.equalsIgnoreCase("COMPRESS") && (toolName == null || toolName.equalsIgnoreCase(""))) {
- mode = MODE_COMPRESS;
- //
- // <gensection sectiontype="EFI_SECTION_COMPRESSION">
- //
- ele = doc.createElement("gensection");
- ele.setAttribute("sectionType", "EFI_SECTION_COMPRESSION");
-
- } else {
- mode = MODE_GUID_DEFINED;
- //
- // <gensection sectiontype="EFI_SECTION_GUID_DEFINED">
- //
- ele = doc.createElement("gensection");
- if (type != null) {
- if (type.equalsIgnoreCase("COMPRESS")) {
- ele.setAttribute("sectionType", "EFI_SECTION_COMPRESSION");
- }else {
- ele.setAttribute("sectiontype", "EFI_SECTION_GUID_DEFINED");
- }
-
- } else {
- ele.setAttribute("sectiontype", sectType);
- }
- //
- // <tool toolName="${OEMTOOLPATH}\toolname"
- // outputPath = "${DEST_DIR_OUTPUT}">
- //
- toolEle = doc.createElement("tool");
- if (toolName == null || toolName.equalsIgnoreCase("")) {
- toolEle.setAttribute("toolName", "${WORKSPACE_DIR}" + File.separatorChar + "Tools" + File.separatorChar + "bin"
- + File.separatorChar + "GenCRC32Section");
- }else{
- File toolExe = new File(toolName);
- //
- // If <Tool> element exist, add sub element under <tool> .
- //
- if (toolExe.isAbsolute()) {
- toolEle.setAttribute("toolName", toolName);
- } else {
- toolEle.setAttribute("toolName", "${WORKSPACE_DIR}" + File.separatorChar + "Tools" + File.separatorChar + "bin"
- + File.separatorChar + toolName);
- }
- }
-
- toolEle.setAttribute("outputPath", "${DEST_DIR_OUTPUT}");
- ele.appendChild(toolEle);
- }
- if (cursor.toFirstChild()) {
- do {
- if (cursor.getName().getLocalPart().equalsIgnoreCase("Section")) {
- cursor.push();
- if (toolEle == null) {
- dealSection(mode, doc, ele, cursor, list);
- } else {
- dealSection(mode, doc, toolEle, cursor, list);
- }
-
- cursor.pop();
- } else if (cursor.getName().getLocalPart().equalsIgnoreCase("Sections")) {
- cursor.push();
- if (toolEle == null) {
- dealSections(mode, doc, ele, cursor, list);
- } else {
- dealSections(mode, doc, toolEle, cursor, list);
- }
-
- cursor.pop();
- }
- } while (cursor.toNextSibling());
- }
- root.appendChild(ele);
- }
-
- /**
- Recursively deal with section.
-
- @param mode Current node mode (MODE_NONE | MODE_COMPREE | MODE_GUID_DEFINED)
- @param doc Xml Document
- @param root Root Node
- @param cursor Current FFS layout cursor
- @param list List of section type here used
- **/
- private void dealSection(int mode, Document doc, Element root, XmlCursor cursor, Vector<String> list) {
- String type = cursor.getAttributeText(new QName("SectionType"));
- String alignment = cursor.getAttributeText(new QName("Alignment"));
-
- //
- // Judge if file is specified? Yes, just use the file, else call Build Macro
- // If fileName is null, means without FileNames specify in FPD file
- //
- String fileName = null;
- cursor.push();
- if (cursor.toFirstChild()) {
- do {
- if (cursor.getName().getLocalPart().equalsIgnoreCase("Filenames")) {
- cursor.push();
- if (cursor.toFirstChild()) {
- do {
- if (cursor.getName().getLocalPart().equalsIgnoreCase("Filename")) {
- fileName = cursor.getTextValue();
- }
- } while (cursor.toNextSibling());
- }
- cursor.pop();
- }
- } while (cursor.toNextSibling());
- }
-
- cursor.pop();
-
- if (fileName == null) {
- list.addElement(type);
- } else {
- list.addElement(fileName);
- }
-
- if (mode == MODE_GUID_DEFINED) {
- //
- // <input file="${DEST_DIR_OUTPUT}\Bds.pe32"/>
- //
- Element ele = doc.createElement("input");
- if (fileName == null) {
- ele.setAttribute("file", getSectionFile(basename, type));
- } else {
- ele.setAttribute("file", fileName);
- }
- root.appendChild(ele);
- } else {
- //
- // <sectFile fileName= "..."/>
- //
- Element ele = doc.createElement("sectFile");
- if (fileName == null) {
- ele.setAttribute("fileName", getSectionFile(basename, type));
- } else {
- ele.setAttribute("fileName", fileName);
- }
- if (alignment != null) {
- ele.setAttribute("Alignment", alignment);
- }
- root.appendChild(ele);
- }
- }
-
- /**
- Get the corresponding section file suffix.
-
- @param type Section type
- @return Corresponding section file extension
- **/
- private String getSectionFile(String basename, String type) {
- for (int i = 0; i < sectionExt.length; i++) {
- if (sectionExt[i][0].equalsIgnoreCase(type)) {
- return "${DEST_DIR_OUTPUT}" + File.separatorChar + basename + sectionExt[i][1];
- }
- }
- return type;
- }
-
- private boolean isSectionType(String type) {
- for (int i = 0; i < sectionExt.length; i++) {
- if (sectionExt[i][0].equalsIgnoreCase(type)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- Return the ANT script to call GenFfs Tool.
-
- @return ANT script to call GenFfs Tool
- **/
- public Element getFfsNode() {
- return ffsNode;
- }
-
- private void genDigest() {
- String digestFilePath = project.getProperty("DEST_DIR_OUTPUT");
- if (digestFilePath == null) {
- EdkLog.log(EdkLog.EDK_WARNING, "Warning: cannot get DEST_DIR_OUTPUT!");
- return;
- }
-
- //
- // use MD5 algorithm
- //
- MessageDigest md5 = null;
- try {
- md5 = MessageDigest.getInstance("MD5");
- //
- // convert the FFS layout XML DOM tree into string and use it to
- // calculate its MD5 digest value
- //
- md5.update(ffsXmlObject.xmlText().getBytes());
- } catch (Exception e) {
- EdkLog.log(EdkLog.EDK_WARNING, "Warning: " + e.getMessage());
- return;
- }
-
- //
- // get the MD5 digest value
- //
- byte[] digest = md5.digest();
-
- //
- // put the digest in a file named "ffs.md5" if it doesn't exist, otherwise
- // we will compare the digest in the file with the one just calculated
- //
- digestFilePath += File.separator + "ffs.md5";
- File digestFile = new File(digestFilePath);
- if (digestFile.exists()) {
- byte[] oldDigest = new byte[digest.length];
- try {
- FileInputStream fIn = new FileInputStream(digestFile);
- fIn.read(oldDigest);
- fIn.close();
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
-
- boolean noChange = true;
- for (int i = 0; i < oldDigest.length; ++i) {
- if (digest[i] != oldDigest[i]) {
- noChange = false;
- break;
- }
- }
-
- if (noChange) {
- return;
- }
- }
-
- //
- // update the "ffs.md5" file content with new digest value
- //
- try {
- FileOutputStream fOut = new FileOutputStream(digestFile);
- fOut.write(digest);
- fOut.close();
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/FileProcess.java b/Tools/Java/Source/GenBuild/org/tianocore/build/FileProcess.java
deleted file mode 100644
index 59a2e587bd..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/FileProcess.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/** @file
- File is FileProcess class which is used to generate ANT script to build
- source files.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.build;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- <p><code>FileProcess</code> is class to generate ANT script to build source
- files.</p>
-
- <p>If file does not specify file type, <code>FileProcess</code> will judge
- by its extension. Following is the current supported extensions. </p>
-
- <pre>
- Source File Suffix File Type Description
- .h CHeader C header file
- .c CCode C source file
- .inc ASMHeader Assembly header file
- .asm ASM Assembly source file, usually for IA32 and X64 Arch and MSFT tool chain
- .S ASM Assembly source file, usually for IPF Arch
- .s ASM Assembly source file, usually for IA32 and X64 Arch and GCC tool chain
- .uni UNI Unicode file
- .vfr VFR Visual Forms Representation File
- .fv FV Firmware Volume
- .SEC FFS Firmware File System file
- .PEI FFS Firmware File System file
- .DXE FFS Firmware File System file
- .APP FFS Firmware File System file
- .FVI FFS Firmware File System file
- .FFS FFS Firmware File System file
- .bmp BMP Graphic File
- .i PPCode IPF PreProcessor Code
- </pre>
-
- @since GenBuild 1.0
-**/
-public class FileProcess {
- ///
- /// The mapping information about source suffix, tool code, file type.
- ///
- public final String[][] fileTypes = { {".h", "", "CHeader" },
- {".c", "CC", "CCode" },
- {".inc", "", "ASMHeader" },
- {".asm", "ASM", "ASM" },
- {".S", "ASM", "ASM" },
- {".s", "ASM", "ASM" },
- {".uni", "", "UNI" },
- {".vfr", "", "VFR" },
- {".Vfr", "", "VFR" },
- {".dxs", "", "DPX"},
- {".fv", "", "FV" },
- {".efi", "", "EFI" },
- {".SEC", "", "FFS" },
- {".PEI", "", "FFS" },
- {".DXE", "", "FFS" },
- {".APP", "", "FFS" },
- {".FYI", "", "FFS" },
- {".FFS", "", "FFS" },
- {".bmp", "", "BMP" },
- {".i", "PP", "PPCode"}};
- ///
- /// Current ANT context.
- ///
- private Project project;
-
- ///
- /// Current module's include pathes
- ///
- private String[] includes;
-
- ///
- /// Xml Document.
- ///
- private Document document;
-
- ///
- /// The flag to ensure all unicode files build before others.
- ///
- private boolean unicodeFirst = true;
-
- ///
- /// The flag present whether current module contains Unicode files or not.
- ///
- private boolean unicodeExist = false;
-
- /**
- Initialize the project, includes, sourceFiles, document members.
-
- @param project ANT project
- @param includes Module include pathes
- @param sourceFiles Modules source files
- @param document XML document
- **/
- public void init(Project project, String[] includes, Document document) {
- this.document = document;
- this.includes = includes;
- this.project = project;
- }
-
- /**
- Parse file without file type.
-
- @param filename Source file name
- @param root Root node
- @param unicodeFirst whether build Unicode file firstly or not
- **/
- public synchronized void parseFile(String filename, String family, Node root, boolean unicodeFirst) {
- this.unicodeFirst = unicodeFirst;
- parseFile(filename, family, root);
- }
-
- /**
- Get whether current module contains Unicode files or not.
-
- @return Whether current module contains Unicode files or not
- **/
- public boolean isUnicodeExist() {
- return unicodeExist;
- }
-
- /**
- Parse file.
-
- @param filename Source file name
- @param filetype Source file type
- @param root Root node
- @param unicodeFirst whether build Unicode file firstly or not
- **/
- public synchronized void parseFile(String filename, String filetype, String family, Node root, boolean unicodeFirst) {
- this.unicodeFirst = unicodeFirst;
- parseFile(filename, filetype, family, root);
- }
-
- /**
- Find out source file's type.
-
- @param filename Source file name
- @param root Root node
- **/
- public synchronized void parseFile(String filename, String family, Node root) throws BuildException {
- for (int i = 0; i < fileTypes.length; i++) {
- if (filename.endsWith(fileTypes[i][0])) {
- parseFile(filename, fileTypes[i][2], family, root);
- return ;
- }
- }
- }
-
- /**
- Parse file. If flag <code>unicodeFirst</code> is true, then build all
- unicode files firstly.
-
- <p>Note that AutoGen.c is processed specially. It's output path is always
- <code>${DEST_DIR_OUTPUT}</code>, others are <code>${DEST_DIR_OUTPUT}</code>
- and relative to module path. </p>
-
- @param filename Source file name
- @param filetype Source file type
- @param root Root node
- **/
- public synchronized void parseFile(String filename, String filetype, String family, Node root) {
- //
- // Filter file with family. Only family is specified in source file and
- // not include current family will skip the file.
- //
- String toolCode = getToolCodeByFileType(filetype);
- if (family != null && !family.trim().equalsIgnoreCase("")) {
- String toolChainFamily = project.getProperty(toolCode + "_FAMILY");
- if (toolChainFamily != null) {
- if(!toolChainFamily.equalsIgnoreCase(family)) {
- return ;
- }
- }
- }
-
- if (unicodeFirst) {
- if ( ! filetype.equalsIgnoreCase("UNI")){
- return ;
- }
- unicodeExist= true;
- } else {
- if (filetype.equalsIgnoreCase("UNI")){
- return ;
- }
- }
-
- //
- // If file is C or ASM header file, skip it
- //
- if (filetype.equalsIgnoreCase("CHeader") || filetype.equalsIgnoreCase("ASMHeader")) {
- return;
- }
-
- //
- // If file is pre-processor file, skip it
- //
- if (filetype.equalsIgnoreCase("PPCode")) {
- return;
- }
-
- //
- // If define CC_EXT in tools_def.txt file, the source file with
- // different suffix is skipped
- //
- String toolsDefExtName = project.getProperty(toolCode + "_EXT");
- if (toolsDefExtName != null) {
- String[] exts = toolsDefExtName.split(" ");
- for (int i = 0; i < exts.length; i++) {
- if ( ! filename.endsWith(exts[i])) {
- return ;
- }
- }
- }
-
- String module_path = project.getProperty("MODULE_DIR");
- File moduleFile = new File(module_path);
- File sourceFile = new File(filename);
-
- //
- // If source file is AutoGen.c, then Filepath is .
- //
- String sourceFilepath = "";
- String sourceFilename = "";
- String sourceFileext = "";
- if (sourceFile.getPath().endsWith("AutoGen.c")) {
- sourceFilepath = ".";
- sourceFilename = "AutoGen";
- sourceFileext = ".c";
- filetype = "AUTOGEN";
- } else {
- // sourceFile.
- String str = sourceFile.getPath().substring(moduleFile.getPath().length() + 1);
- int index = str.lastIndexOf(File.separatorChar);
- sourceFilepath = ".";
- if (index > 0) {
- sourceFilepath = str.substring(0, index);
- str = str.substring(index + 1);
- }
- sourceFilename = str;
- index = str.lastIndexOf('.');
- if (index > 0) {
- sourceFilename = str.substring(0, index);
- sourceFileext = str.substring(index);
- }
- }
- // <Build_filetype FILEPATH="" FILENAME="" />
- Element ele = document.createElement("Build_" + filetype);
- ele.setAttribute("FILEPATH", sourceFilepath);
- ele.setAttribute("FILENAME", sourceFilename);
- ele.setAttribute("FILEEXT", sourceFileext.substring(1));
- Element includesEle = document.createElement("EXTRA.INC");
- for (int i = 0; i < includes.length; i++) {
- Element includeEle = document.createElement("includepath");
- includeEle.setAttribute("path", project.replaceProperties(includes[i]));
- includesEle.appendChild(includeEle);
- }
- ele.appendChild(includesEle);
- root.appendChild(ele);
- }
-
- private String getToolCodeByFileType(String fileType) {
- for (int i = 0; i < fileTypes.length; i++) {
- if (fileTypes[i][2].equalsIgnoreCase(fileType)) {
- return fileTypes[i][1];
- }
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java b/Tools/Java/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
deleted file mode 100644
index 8482401bb0..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/** @file FrameworkBuildTask.java
-
- The file is ANT task to find MSA or FPD file and build them.
-
- Copyright (c) 2006, 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.
- **/
-package org.tianocore.build;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.tianocore.build.exception.AutoGenException;
-import org.tianocore.build.exception.GenBuildException;
-import org.tianocore.build.exception.PcdAutogenException;
-import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;
-import org.tianocore.build.fpd.FpdParserForThread;
-import org.tianocore.build.fpd.FpdParserTask;
-import org.tianocore.build.global.GenBuildLogger;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.toolchain.ConfigReader;
-import org.tianocore.build.toolchain.ToolChainInfo;
-import org.tianocore.common.definitions.ToolDefinitions;
-import org.tianocore.common.exception.EdkException;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- <p>
- <code>FrameworkBuildTask</code> is an Ant task. The main function is finding
- and processing a FPD or MSA file, then building a platform or stand-alone
- module.
-
- <p>
- The task search current directory and find out all MSA and FPD files by file
- extension. Base on ACTIVE_PLATFORM policy, decide to build a platform or a
- stand-alone module. The ACTIVE_PLATFORM policy is:
-
- <pre>
- 1. More than one MSA files, report error;
- 2. Only one MSA file, but ACTIVE_PLATFORM is not specified, report error;
- 3. Only one MSA file, and ACTIVE_PLATFORM is also specified, build this module;
- 4. No MSA file, and ACTIVE_PLATFORM is specified, build the active platform;
- 5. No MSA file, no ACTIVE_PLATFORM, and no FPD file, report error;
- 6. No MSA file, no ACTIVE_PLATFORM, and only one FPD file, build the platform;
- 7. No MSA file, no ACTIVE_PLATFORM, and more than one FPD files, Report Error!
- </pre>
-
- <p>
- Framework build task also parse target file [${WORKSPACE_DIR}/Tools/Conf/target.txt].
- And load all system environment variables to Ant properties.
-
- <p>
- The usage for this task is :
-
- <pre>
- &lt;FrameworkBuild type="cleanall" /&gt;
- </pre>
-
- @since GenBuild 1.0
-**/
-public class FrameworkBuildTask extends Task{
-
- private Set<File> fpdFiles = new LinkedHashSet<File>();
-
- private Set<File> msaFiles = new LinkedHashSet<File>();
-
- ///
- /// This is only for none-multi-thread build to reduce overriding message
- ///
- public static Hashtable<String, String> originalProperties = new Hashtable<String, String>();
-
- String toolsDefFilename = ToolDefinitions.DEFAULT_TOOLS_DEF_FILE_PATH;
-
- String targetFilename = ToolDefinitions.TARGET_FILE_PATH;
-
- String dbFilename = ToolDefinitions.FRAMEWORK_DATABASE_FILE_PATH;
-
- String activePlatform = null;
-
- ///
- /// The flag to present current is multi-thread enabled
- ///
- public static boolean multithread = false;
-
- ///
- /// The concurrent thread number
- ///
- public static int MAX_CONCURRENT_THREAD_NUMBER = 2;
-
- ///
- /// there are three type: all (build), clean and cleanall
- ///
- private String type = "all";
-
- public void execute() throws BuildException {
- //
- // set Logger
- //
- GenBuildLogger logger = new GenBuildLogger(getProject());
- EdkLog.setLogLevel(EdkLog.EDK_DEBUG);
- EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
-
- try {
- processFrameworkBuild();
- }catch (BuildException e) {
- //
- // Add more logic process here
- //
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (PcdAutogenException e) {
- //
- // Add more logic process here
- //
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (AutoGenException e) {
- //
- // Add more logic process here
- //
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (PlatformPcdPreprocessBuildException e) {
- //
- // Add more logic process here
- //
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (GenBuildException e) {
- //
- // Add more logic process here
- //
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (EdkException e) {
- //
- // Add more logic process here
- //
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- }
- }
-
- private void processFrameworkBuild() throws EdkException, GenBuildException, AutoGenException, PcdAutogenException, PlatformPcdPreprocessBuildException {
- try {
- //
- // Get current working dir
- //
- File dummyFile = new File(".");
- File cwd = dummyFile.getCanonicalFile();
- File[] files = cwd.listFiles();
-
- //
- // Scan current dir, and find out all .FPD and .MSA files
- //
- for (int i = 0; i < files.length; i++) {
- if (files[i].isFile()) {
- if (files[i].getName().endsWith(ToolDefinitions.FPD_EXTENSION)) {
- //
- // Found FPD file
- //
- fpdFiles.add(files[i]);
- } else if (files[i].getName().endsWith(ToolDefinitions.MSA_EXTENSION)) {
- //
- // Found MSA file
- //
- msaFiles.add(files[i]);
- }
- }
- }
- } catch (IOException ex) {
- BuildException buildException = new BuildException("Scanning current directory error. \n" + ex.getMessage());
- buildException.setStackTrace(ex.getStackTrace());
- throw buildException;
- }
-
- //
- // Import all system environment variables to ANT properties
- //
- importSystemEnvVariables();
-
- //
- // Read target.txt file
- //
- readTargetFile();
-
- //
- // Global Data initialization
- //
- File workspacePath = new File(getProject().getProperty("WORKSPACE"));
- getProject().setProperty("WORKSPACE_DIR", workspacePath.getPath().replaceAll("(\\\\)", "/"));
- GlobalData.initInfo(getProject(), dbFilename, workspacePath.getPath(), toolsDefFilename);
-
- //
- // If find MSA file and ACTIVE_PLATFORM is set, build the module;
- // else fail build.
- // If without MSA file, and ACTIVE_PLATFORM is set, build the ACTIVE_PLATFORM.
- // If ACTIVE_PLATFORM is not set, and only find one FPD file, build the platform;
- // If find more than one FPD files, report error.
- //
- File buildFile = null;
- if (msaFiles.size() > 0) {
- if (activePlatform == null) {
- throw new BuildException("If trying to build a single module, please set ACTIVE_PLATFORM in file [" + targetFilename + "]. ");
- }
- //
- // Build the single module
- //
- buildFile = msaFiles.toArray(new File[1])[0];
- } else if (activePlatform != null) {
- buildFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);
- } else if (fpdFiles.size() == 1) {
- buildFile = fpdFiles.toArray(new File[1])[0];
- } else if (fpdFiles.size() > 1) {
- throw new BuildException("Found " + fpdFiles.size() + " FPD files in current dir. ");
- }
-
- //
- // If there is no build files or FPD files or MSA files, stop build
- //
- else {
- throw new BuildException("Can't find any FPD or MSA files in the current directory. ");
- }
-
- //
- // Build every FPD files (PLATFORM build)
- //
- if (buildFile.getName().endsWith(ToolDefinitions.FPD_EXTENSION)) {
- EdkLog.log(this, "Processing the FPD file [" + buildFile.getPath() + "] ..>> ");
- //
- // Iff for platform build will enable the multi-thread if set in target.txt
- //
- if (multithread && type.equalsIgnoreCase("all")) {
- EdkLog.log(this, "Multi-thread build is enabled. ");
- FpdParserForThread fpdParserForThread = new FpdParserForThread();
- fpdParserForThread.setType(type);
- fpdParserForThread.setProject(getProject());
- fpdParserForThread.setFpdFile(buildFile);
- fpdParserForThread.perform();
- return ;
- }
-
- FpdParserTask fpdParserTask = new FpdParserTask();
- fpdParserTask.setType(type);
- fpdParserTask.setProject(getProject());
- fpdParserTask.setFpdFile(buildFile);
- fpdParserTask.perform();
-
- //
- // If cleanall delete the Platform_build.xml
- //
- if (type.compareTo("cleanall") == 0) {
- File platformBuildFile =
- new File(getProject().getProperty("BUILD_DIR")
- + File.separatorChar
- + getProject().getProperty("PLATFORM")
- + "_build.xml");
- platformBuildFile.deleteOnExit();
- }
- }
-
- //
- // Build every MSA files (SINGLE MODULE BUILD)
- //
- else if (buildFile.getName().endsWith(ToolDefinitions.MSA_EXTENSION)) {
- if (multithread) {
- EdkLog.log(this, EdkLog.EDK_WARNING, "Multi-Thead do not take effect on Stand-Alone (Single) module build. ");
- multithread = false;
- }
- File tmpFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);
- EdkLog.log(this, "Using the FPD file [" + tmpFile.getPath() + "] for the active platform. ");
-
- File[] moduleFiles = msaFiles.toArray(new File[msaFiles.size()]);
- for (int i = 0; i < moduleFiles.length; ++i) {
- EdkLog.log(this, "Processing the MSA file [" + moduleFiles[i].getPath() + "] ..>> ");
- GenBuildTask genBuildTask = new GenBuildTask();
- genBuildTask.setSingleModuleBuild(true);
- genBuildTask.setType(type);
- getProject().setProperty("PLATFORM_FILE", activePlatform);
- if( !multithread) {
- originalProperties.put("PLATFORM_FILE", activePlatform);
- }
- genBuildTask.setProject(getProject());
- genBuildTask.setMsaFile(moduleFiles[i]);
- genBuildTask.perform();
- }
- }
- }
-
- /**
- Import system environment variables to ANT properties. If system variable
- already exiests in ANT properties, skip it.
-
- **/
- private void importSystemEnvVariables() {
- Map<String, String> sysProperties = System.getenv();
- Iterator<String> iter = sysProperties.keySet().iterator();
- while (iter.hasNext()) {
- String name = iter.next();
-
- //
- // If system environment variable is not in ANT properties, add it
- //
- if (getProject().getProperty(name) == null) {
- getProject().setProperty(name, sysProperties.get(name));
- }
- }
-
- Hashtable allProperties = getProject().getProperties();
- Iterator piter = allProperties.keySet().iterator();
- while (piter.hasNext()) {
- String name = (String)piter.next();
- originalProperties.put(new String(name), new String((String)allProperties.get(name)));
- }
- }
-
- public void setType(String type) {
- this.type = type.toLowerCase();
- }
-
- private void readTargetFile() throws EdkException{
- String targetFile = getProject().getProperty("WORKSPACE_DIR") + File.separatorChar + targetFilename;
-
- String[][] targetFileInfo = ConfigReader.parse(getProject(), targetFile);
-
- //
- // Get ToolChain Info from target.txt
- //
- ToolChainInfo envToolChainInfo = new ToolChainInfo();
- String str = getValue(ToolDefinitions.TARGET_KEY_TARGET, targetFileInfo);
- if (str == null || str.trim().equals("")) {
- envToolChainInfo.addTargets("*");
- } else {
- envToolChainInfo.addTargets(str);
- }
- str = getValue(ToolDefinitions.TARGET_KEY_TOOLCHAIN, targetFileInfo);
- if (str == null || str.trim().equals("")) {
- envToolChainInfo.addTagnames("*");
- } else {
- envToolChainInfo.addTagnames(str);
- }
- str = getValue(ToolDefinitions.TARGET_KEY_ARCH, targetFileInfo);
- if (str == null || str.trim().equals("")) {
- envToolChainInfo.addArchs("*");
- } else {
- envToolChainInfo.addArchs(str);
- }
- GlobalData.setToolChainEnvInfo(envToolChainInfo);
-
- str = getValue(ToolDefinitions.TARGET_KEY_TOOLS_DEF, targetFileInfo);
- if (str != null && str.trim().length() > 0) {
- toolsDefFilename = str;
- }
-
- str = getValue(ToolDefinitions.TARGET_KEY_ACTIVE_PLATFORM, targetFileInfo);
- if (str != null && ! str.trim().equals("")) {
- if ( ! str.endsWith(".fpd")) {
- throw new BuildException("FPD file's extension must be \"" + ToolDefinitions.FPD_EXTENSION + "\"!");
- }
- activePlatform = str;
- }
-
- str = getValue(ToolDefinitions.TARGET_KEY_MULTIPLE_THREAD, targetFileInfo);
- if (str != null && str.trim().equalsIgnoreCase("Enable")) {
- multithread = true;
- }
-
- str = getValue(ToolDefinitions.TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER, targetFileInfo);
- //
- // Need to check the # of threads iff multithread is enabled.
- //
- if ((multithread) && (str != null )) {
- try {
- int threadNum = Integer.parseInt(str);
- if (threadNum > 0) {
- MAX_CONCURRENT_THREAD_NUMBER = threadNum;
- }
- } catch (Exception ex) {
- //
- // Give a warning message, and keep the default value
- //
- EdkLog.log(this, EdkLog.EDK_WARNING, "Incorrent number specified for MAX_CONCURRENT_THREAD_NUMBER in file [" + targetFilename + "]");
- }
- }
- }
-
- private String getValue(String key, String[][] map) {
- for (int i = 0; i < map[0].length; i++){
- if (key.equalsIgnoreCase(map[0][i])) {
- return map[1][i];
- }
- }
- return null;
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java
deleted file mode 100644
index 2225a56edb..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java
+++ /dev/null
@@ -1,858 +0,0 @@
-/** @file
- This file is ANT task GenBuild.
-
- The file is used to parse a specified Module, and generate its build time
- ANT script build.xml, then call the the ANT script to build the module.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.build;
-
-import java.io.File;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildListener;
-import org.apache.tools.ant.Location;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Ant;
-import org.apache.tools.ant.taskdefs.Property;
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.build.autogen.AutoGen;
-import org.tianocore.build.exception.AutoGenException;
-import org.tianocore.build.exception.GenBuildException;
-import org.tianocore.build.exception.PcdAutogenException;
-import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;
-import org.tianocore.build.fpd.FpdParserTask;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.global.OutputManager;
-import org.tianocore.build.global.SurfaceAreaQuery;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.id.PackageIdentification;
-import org.tianocore.build.id.PlatformIdentification;
-import org.tianocore.build.tools.ModuleItem;
-import org.tianocore.common.definitions.ToolDefinitions;
-import org.tianocore.common.exception.EdkException;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- <p>
- <code>GenBuildTask</code> is an ANT task that can be used in ANT build
- system.
-
- <p>The main function of this task is to parse module's surface area (MSA),
- then generate the corresponding <em>BaseName_build.xml</em> (the real ANT
- build script) and call this to build the module. The whole process including:
-
- <pre>
- 1. generate AutoGen.c and AutoGen.h;
- 2. build all dependent library instances;
- 3. build all source files inlcude AutoGen.c;
- 4. generate sections;
- 5. generate FFS file if it is driver module while LIB file if it is Library module.
- </pre>
-
-
- <p>
- The usage is (take module <em>HelloWorld</em> for example):
- </p>
-
- <pre>
- &lt;GenBuild
- msaFile="${PACKAGE_DIR}/Application/HelloWorld/HelloWorld.msa"
- type="cleanall" /&gt;
- </pre>
-
- <p>
- This task calls <code>AutoGen</code> to generate <em>AutoGen.c</em> and
- <em>AutoGen.h</em>.
- </p>
-
- <p>
- This task will also set properties for current module, such as PACKAGE,
- PACKAGE_GUID, PACKAGE_VERSION, PACKAGE_DIR, PACKAGE_RELATIVE_DIR
- (relative to Workspace), MODULE or BASE_NAME, GUID, VERSION, MODULE_DIR,
- MODULE_RELATIVE_DIR (relative to Package), CONFIG_DIR, BIN_DIR,
- DEST_DIR_DEBUG, DEST_DIR_OUTPUT, TARGET, ARCH, TOOLCHAIN, TOOLCHAIN_FAMILY,
- SUBSYSTEM, ENTRYPOINT, EBC_TOOL_LIB_PATH, all compiler command related
- properties (CC, CC_FLAGS, CC_DPATH, CC_SPATH, CC_FAMILY, CC_EXT).
- </p>
-
- @since GenBuild 1.0
-**/
-public class GenBuildTask extends Ant {
-
- ///
- /// Module surface area file.
- ///
- File msaFile;
-
- public ModuleIdentification parentId;
-
- private String type = "all";
-
- ///
- /// Module's Identification.
- ///
- private ModuleIdentification moduleId;
-
- private Vector<Property> properties = new Vector<Property>();
-
- private boolean isSingleModuleBuild = false;
-
- private SurfaceAreaQuery saq = null;
-
- /**
- Public construct method. It is necessary for ANT task.
- **/
- public GenBuildTask() {
- }
-
- /**
-
- @throws BuildException
- From module build, exception from module surface area invalid.
- **/
- public void execute() throws BuildException {
- this.setTaskName("GenBuild");
- try {
- processGenBuild();
- } catch (PcdAutogenException e) {
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (AutoGenException e) {
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (PlatformPcdPreprocessBuildException e) {
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (GenBuildException e) {
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (EdkException e) {
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- } catch (Exception e) {
- BuildException buildException = new BuildException(e.getMessage());
- buildException.setStackTrace(e.getStackTrace());
- throw buildException;
- }
- }
-
- private void processGenBuild() throws EdkException, BuildException, GenBuildException, AutoGenException, PcdAutogenException, PlatformPcdPreprocessBuildException {
- if (!FrameworkBuildTask.multithread) {
- cleanupProperties();
- }
-
- //
- // Enable all specified properties
- //
- Iterator<Property> iter = properties.iterator();
- while (iter.hasNext()) {
- Property item = iter.next();
- getProject().setProperty(item.getName(), item.getValue());
- }
-
- //
- // GenBuild should specify either msaFile or moduleGuid & packageGuid
- //
- if (msaFile == null ) {
- String moduleGuid = getProject().getProperty("MODULE_GUID");
- String moduleVersion = getProject().getProperty("MODULE_VERSION");
- String packageGuid = getProject().getProperty("PACKAGE_GUID");
- String packageVersion = getProject().getProperty("PACKAGE_VERSION");
- //
- // If one of module Guid or package Guid is not specified, report error
- //
- if (moduleGuid == null || packageGuid == null) {
- throw new BuildException("GenBuild parameter error.");
- }
-
- PackageIdentification packageId = new PackageIdentification(packageGuid, packageVersion);
- GlobalData.refreshPackageIdentification(packageId);
- moduleId = new ModuleIdentification(moduleGuid, moduleVersion);
- moduleId.setPackage(packageId);
- GlobalData.refreshModuleIdentification(moduleId);
- Map<String, XmlObject> doc = GlobalData.getNativeMsa(moduleId);
- saq = new SurfaceAreaQuery(doc);
- } else {
- Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile);
- saq = new SurfaceAreaQuery(doc);
- moduleId = saq.getMsaHeader();
- moduleId.setMsaFile(msaFile);
- }
-
- String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED", null, null);
- if (producedLibraryClasses.length == 0) {
- moduleId.setLibrary(false);
- } else {
- moduleId.setLibrary(true);
- }
- moduleId.setBinary(saq.getBinaryModule());
-
- //
- // Judge whether it is single module build or not
- //
- if (isSingleModuleBuild) {
- //
- // Single Module build
- //
- prepareSingleModuleBuild();
- }
-
- //
- // If single module : get arch from pass down, otherwise intersection MSA
- // supported ARCHs and tools def
- //
- Set<String> archListSupByToolChain = new LinkedHashSet<String>();
- String[] archs = GlobalData.getToolChainInfo().getArchs();
-
- for (int i = 0; i < archs.length; i ++) {
- archListSupByToolChain.add(archs[i]);
- }
-
- Set<String> archSet = new LinkedHashSet<String>();
- String archString = getProject().getProperty("ARCH");
- if (archString != null && archString.length() > 0) {
- String[] fpdArchList = archString.split(" ");
-
- for (int i = 0; i < fpdArchList.length; i++) {
- if (archListSupByToolChain.contains(fpdArchList[i])) {
- archSet.add(fpdArchList[i]);
- }
- }
- } else {
- archSet = archListSupByToolChain;
- }
-
- String[] archList = archSet.toArray(new String[archSet.size()]);
-
- //
- // Judge if arch is all supported by current module. If not, throw Exception.
- //
- List moduleSupportedArchs = saq.getModuleSupportedArchs();
- if (moduleSupportedArchs != null) {
- for (int k = 0; k < archList.length; k++) {
- if (!moduleSupportedArchs.contains(archList[k])) {
- EdkLog.log(this, EdkLog.EDK_WARNING, "Specified architecture [" + archList[k] + "] is not supported by " + moduleId + ". The module " + moduleId + " only supports [" + moduleSupportedArchs + "] architectures.");
- archList[k] = "";
- }
- }
- }
-
- if (archList.length == 0) {
- EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: " + "[" + archString + "] is not supported for " + moduleId + " in this build!\n");
- }
-
- for (int k = 0; k < archList.length; k++) {
- if (archList[k] == "") {
- continue;
- }
-
- getProject().setProperty("ARCH", archList[k]);
-
- FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, archList[k]);
-
- //
- // Whether the module is built before
- //
- if ((moduleId.isLibrary() == false || isSingleModuleBuild) && GlobalData.hasFpdModuleSA(fpdModuleId) == false) {
- if (isSingleModuleBuild) {
- EdkLog.log(this, EdkLog.EDK_ERROR, "Error: " + moduleId + " for " + archList[k] + " was not found in current platform FPD file!\n");
- throw new BuildException("No platform containing this module!");
- } else {
- EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: " + moduleId + " for " + archList[k] + " was not found in current platform FPD file!\n");
- }
- continue;
- } else if (GlobalData.isModuleBuilt(fpdModuleId)) {
- break;
- } else {
- GlobalData.registerBuiltModule(fpdModuleId);
- }
-
- //
- // For Every TOOLCHAIN, TARGET
- //
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; i ++){
- //
- // Prepare for target related common properties
- // TARGET
- //
- getProject().setProperty("TARGET", targetList[i]);
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j ++){
- //
- // check if any tool is defined for current target + toolchain + arch
- // don't do anything if no tools found
- //
- if (GlobalData.isCommandSet(targetList[i], toolchainList[j], archList[k]) == false) {
- EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: No build issued. No tools found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");
- continue;
- }
-
- //
- // Prepare for toolchain related common properties
- // TOOLCHAIN
- //
- getProject().setProperty("TOOLCHAIN", toolchainList[j]);
-
- EdkLog.log(this, "Build " + moduleId + " start >>>");
- EdkLog.log(this, "Target: " + targetList[i] + " Tagname: " + toolchainList[j] + " Arch: " + archList[k]);
- saq.push(GlobalData.getDoc(fpdModuleId));
-
- //
- // Prepare for all other common properties
- // PACKAGE, PACKAGE_GUID, PACKAGE_VERSION, PACKAGE_DIR, PACKAGE_RELATIVE_DIR
- // MODULE or BASE_NAME, GUID or FILE_GUID, VERSION, MODULE_TYPE
- // MODULE_DIR, MODULE_RELATIVE_DIR
- // SUBSYSTEM, ENTRYPOINT, EBC_TOOL_LIB_PATH
- //
- setModuleCommonProperties(archList[k]);
-
- //
- // OutputManage prepare for
- // BIN_DIR, DEST_DIR_DEBUG, DEST_DIR_OUTPUT, BUILD_DIR, FV_DIR
- //
- OutputManager.getInstance().update(getProject());
-
- if (type.equalsIgnoreCase("all") || type.equalsIgnoreCase("build")) {
- applyBuild(targetList[i], toolchainList[j], fpdModuleId);
- } else {
- applyNonBuildTarget(fpdModuleId);
- }
- }
- }
- }
- }
-
- /**
- This method is used to prepare Platform-related information.
-
- <p>In Single Module Build mode, platform-related information is not ready.
- The method read the system environment variable <code>ACTIVE_PLATFORM</code>
- and search in the Framework Database. Note that platform name in the Framework
- Database must be unique. </p>
-
- **/
- private void prepareSingleModuleBuild() throws EdkException {
- //
- // Find out the package which the module belongs to
- //
- PackageIdentification packageId = GlobalData.getPackageForModule(moduleId);
- GlobalData.refreshPackageIdentification(packageId);
- moduleId.setPackage(packageId);
- GlobalData.refreshModuleIdentification(moduleId);
-
- //
- // Read ACTIVE_PLATFORM's FPD file
- //
- String filename = getProject().getProperty("PLATFORM_FILE");
-
- if (filename == null){
- throw new BuildException("Please set ACTIVE_PLATFORM in the file: Tools/Conf/target.txt if you want to build a single module!");
- }
-
- PlatformIdentification platformId = GlobalData.getPlatform(filename);
-
- //
- // Read FPD file (Call FpdParserTask's method)
- //
- FpdParserTask fpdParser = new FpdParserTask();
- fpdParser.setProject(getProject());
- fpdParser.parseFpdFile(platformId.getFpdFile());
- getProject().setProperty("ARCH", fpdParser.getAllArchForModule(moduleId));
- }
-
- private void cleanupProperties() {
- Project newProject = new Project();
-
- Hashtable<String, String> passdownProperties = FrameworkBuildTask.originalProperties;
- Iterator<String> iter = passdownProperties.keySet().iterator();
- while (iter.hasNext()) {
- String item = iter.next();
- newProject.setProperty(item, passdownProperties.get(item));
- }
-
- newProject.setInputHandler(getProject().getInputHandler());
-
- Iterator listenerIter = getProject().getBuildListeners().iterator();
- while (listenerIter.hasNext()) {
- newProject.addBuildListener((BuildListener) listenerIter.next());
- }
-
- getProject().initSubProject(newProject);
-
- setProject(newProject);
- }
-
- /**
- Set Module-Related information to properties.
-
- @param arch current build ARCH
- **/
- private void setModuleCommonProperties(String arch) {
- //
- // Prepare for all other common properties
- // PACKAGE, PACKAGE_GUID, PACKAGE_VERSION, PACKAGE_DIR, PACKAGE_RELATIVE_DIR
- //
- PackageIdentification packageId = moduleId.getPackage();
- getProject().setProperty("PACKAGE", packageId.getName());
- getProject().setProperty("PACKAGE_GUID", packageId.getGuid());
- getProject().setProperty("PACKAGE_VERSION", packageId.getVersion());
- getProject().setProperty("PACKAGE_DIR", packageId.getPackageDir().replaceAll("(\\\\)", "/"));
- getProject().setProperty("PACKAGE_RELATIVE_DIR", packageId.getPackageRelativeDir().replaceAll("(\\\\)", "/"));
-
- //
- // MODULE or BASE_NAME, GUID or FILE_GUID, VERSION, MODULE_TYPE
- // MODULE_DIR, MODULE_RELATIVE_DIR
- //
- getProject().setProperty("MODULE", moduleId.getName());
- String baseName = saq.getModuleOutputFileBasename();
- if (baseName == null) {
- getProject().setProperty("BASE_NAME", moduleId.getName());
- } else {
- getProject().setProperty("BASE_NAME", baseName);
- }
- getProject().setProperty("GUID", moduleId.getGuid());
- getProject().setProperty("FILE_GUID", moduleId.getGuid());
- getProject().setProperty("VERSION", moduleId.getVersion());
- getProject().setProperty("MODULE_TYPE", moduleId.getModuleType());
- File msaFile = moduleId.getMsaFile();
- String msaFileName = msaFile.getName();
- getProject().setProperty("MODULE_DIR", msaFile.getParent().replaceAll("(\\\\)", "/"));
- getProject().setProperty("MODULE_RELATIVE_DIR", moduleId.getModuleRelativePath().replaceAll("(\\\\)", "/")
- + File.separatorChar + msaFileName.substring(0, msaFileName.lastIndexOf('.')));
-
- //
- // SUBSYSTEM
- //
- String[][] subsystemMap = { { "BASE", "EFI_BOOT_SERVICE_DRIVER"},
- { "SEC", "EFI_BOOT_SERVICE_DRIVER" },
- { "PEI_CORE", "EFI_BOOT_SERVICE_DRIVER" },
- { "PEIM", "EFI_BOOT_SERVICE_DRIVER" },
- { "DXE_CORE", "EFI_BOOT_SERVICE_DRIVER" },
- { "DXE_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
- { "DXE_RUNTIME_DRIVER", "EFI_RUNTIME_DRIVER" },
- { "DXE_SAL_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
- { "DXE_SMM_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
- { "TOOL", "EFI_BOOT_SERVICE_DRIVER" },
- { "UEFI_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },
- { "UEFI_APPLICATION", "EFI_APPLICATION" },
- { "USER_DEFINED", "EFI_BOOT_SERVICE_DRIVER"} };
-
- String subsystem = "EFI_BOOT_SERVICE_DRIVER";
- for (int i = 0; i < subsystemMap.length; i++) {
- if (moduleId.getModuleType().equalsIgnoreCase(subsystemMap[i][0])) {
- subsystem = subsystemMap[i][1];
- break ;
- }
- }
- getProject().setProperty("SUBSYSTEM", subsystem);
-
- //
- // ENTRYPOINT
- //
- if (arch.equalsIgnoreCase("EBC")) {
- getProject().setProperty("ENTRYPOINT", "EfiStart");
- } else {
- getProject().setProperty("ENTRYPOINT", "_ModuleEntryPoint");
- }
-
- getProject().setProperty("OBJECTS", "");
- }
-
- private void getCompilerFlags(String target, String toolchain, FpdModuleIdentification fpdModuleId) throws EdkException {
- String[] cmd = GlobalData.getToolChainInfo().getCommands();
- for ( int m = 0; m < cmd.length; m++) {
- //
- // Set cmd, like CC, DLINK
- //
- String[] key = new String[]{target, toolchain, fpdModuleId.getArch(), cmd[m], null};
- key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_PATH;
- String cmdPath = GlobalData.getCommandSetting(key, fpdModuleId);
- key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_NAME;
- String cmdName = GlobalData.getCommandSetting(key, fpdModuleId);
- if (cmdName.length() == 0) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "Warning: " + cmd[m] + " hasn't been defined!");
- getProject().setProperty(cmd[m], "");
- continue;
- }
- File cmdFile = new File(cmdPath + File.separatorChar + cmdName);
- getProject().setProperty(cmd[m], cmdFile.getPath().replaceAll("(\\\\)", "/"));
-
- //
- // set CC_FLAGS
- //
- key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_FLAGS;
- String cmdFlags = GlobalData.getCommandSetting(key, fpdModuleId);
- if (cmdFlags != null)
- {
- getProject().setProperty(cmd[m] + "_FLAGS", cmdFlags);
- }
- else
- {
- getProject().setProperty(cmd[m] + "_FLAGS", "");
- }
-
- //
- // Set CC_EXT
- //
- key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_EXT;
- String extName = GlobalData.getCommandSetting(key, fpdModuleId);
- if ( extName != null && ! extName.equalsIgnoreCase("")) {
- getProject().setProperty(cmd[m] + "_EXT", extName);
- } else {
- getProject().setProperty(cmd[m] + "_EXT", "");
- }
-
- //
- // set CC_FAMILY
- //
- key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_FAMILY;
- String toolChainFamily = GlobalData.getCommandSetting(key, fpdModuleId);
- if (toolChainFamily != null) {
- getProject().setProperty(cmd[m] + "_FAMILY", toolChainFamily);
- }
-
- //
- // set CC_SPATH
- //
- key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_SPATH;
- String spath = GlobalData.getCommandSetting(key, fpdModuleId);
- if (spath != null) {
- getProject().setProperty(cmd[m] + "_SPATH", spath.replaceAll("(\\\\)", "/"));
- } else {
- getProject().setProperty(cmd[m] + "_SPATH", "");
- }
-
- //
- // set CC_DPATH
- //
- key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_DPATH;
- String dpath = GlobalData.getCommandSetting(key, fpdModuleId);
- if (dpath != null) {
- getProject().setProperty(cmd[m] + "_DPATH", dpath.replaceAll("(\\\\)", "/"));
- } else {
- getProject().setProperty(cmd[m] + "_DPATH", "");
- }
-
- //
- // Set CC_LIBPATH
- //
- key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_LIBPATH;
- String libpath = GlobalData.getCommandSetting(key, fpdModuleId);
- if (libpath != null) {
- getProject().setProperty(cmd[m] + "_LIBPATH", libpath.replaceAll("(\\\\)", "/"));
- } else {
- getProject().setProperty(cmd[m] + "_LIBPATH", "");
- }
-
- //
- // Set CC_INCLUDEPATH
- //
- key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_INCLUDEPATH;
- String includepath = GlobalData.getCommandSetting(key, fpdModuleId);
- if (dpath != null) {
- getProject().setProperty(cmd[m] + "_INCLUDEPATH", includepath.replaceAll("(\\\\)", "/"));
- } else {
- getProject().setProperty(cmd[m] + "_INCLUDEPATH", "");
- }
- }
- }
-
- public void setMsaFile(File msaFile) {
- this.msaFile = msaFile;
- }
-
- /**
- Method is for ANT to initialize MSA file.
-
- @param msaFilename MSA file name
- **/
- public void setMsaFile(String msaFilename) {
- String moduleDir = getProject().getProperty("MODULE_DIR");
-
- //
- // If is Single Module Build, then use the Base Dir defined in build.xml
- //
- if (moduleDir == null) {
- moduleDir = getProject().getBaseDir().getPath();
- }
- msaFile = new File(moduleDir + File.separatorChar + msaFilename);
- }
-
- public void addConfiguredModuleItem(ModuleItem moduleItem) {
- PackageIdentification packageId = new PackageIdentification(moduleItem.getPackageGuid(), moduleItem.getPackageVersion());
- ModuleIdentification moduleId = new ModuleIdentification(moduleItem.getModuleGuid(), moduleItem.getModuleVersion());
- moduleId.setPackage(packageId);
- this.moduleId = moduleId;
- }
-
- /**
- Add a property.
-
- @param p property
- **/
- public void addProperty(Property p) {
- properties.addElement(p);
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws EdkException {
- //
- // Call AutoGen to generate AutoGen.c and AutoGen.h for non-binary module
- //
- if (!fpdModuleId.getModule().isBinary()) {
- AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch(), saq, parentId);
- autogen.genAutogen();
- }
-
- //
- // Get compiler flags
- //
- try {
- getCompilerFlags(buildTarget, buildTagname, fpdModuleId);
- }
- catch (EdkException ee) {
- throw new BuildException(ee.getMessage());
- }
-
- //
- // Prepare LIBS
- //
- ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());
- String propertyLibs = "";
- for (int i = 0; i < libinstances.length; i++) {
- propertyLibs += getProject().getProperty("BIN_DIR") + File.separatorChar + libinstances[i].getName() + ".lib" + " ";
- }
- getProject().setProperty("LIBS", propertyLibs.replaceAll("(\\\\)", "/"));
-
- //
- // Get all includepath and set to INCLUDE_PATHS
- //
- String[] includes = prepareIncludePaths(fpdModuleId);
-
- //
- // if it is CUSTOM_BUILD
- // then call the exist BaseName_build.xml directly.
- //
- String buildFilename = "";
- if ((buildFilename = GetCustomizedBuildFile(fpdModuleId.getArch())) != "") {
- EdkLog.log(this, "Call user-defined " + buildFilename);
-
- String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + buildFilename;
- antCall(antFilename, null);
-
- return ;
- }
-
- //
- // Generate ${BASE_NAME}_build.xml
- // TBD
- //
- String ffsKeyword = saq.getModuleFfsKeyword();
- ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId, includes, saq);
- buildFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
- fileGenerator.genBuildFile(buildFilename);
-
- //
- // Ant call ${BASE_NAME}_build.xml
- //
- String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
- antCall(antFilename, null);
- }
-
- private void applyNonBuildTarget(FpdModuleIdentification fpdModuleId){
- //
- // if it is CUSTOM_BUILD
- // then call the exist BaseName_build.xml directly.
- //
- if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
- EdkLog.log(this, "Calling user-defined " + moduleId.getName() + "_build.xml");
-
- String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
- antCall(antFilename, this.type);
-
- return ;
- }
-
- String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
- antCall(antFilename, this.type);
- }
-
- private void applyClean(FpdModuleIdentification fpdModuleId){
- //
- // if it is CUSTOM_BUILD
- // then call the exist BaseName_build.xml directly.
- //
- if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
- EdkLog.log(this, "Calling user-defined " + moduleId.getName() + "_build.xml");
-
- String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
- antCall(antFilename, "clean");
-
- return ;
- }
-
- String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
- antCall(antFilename, "clean");
- }
-
- private void applyCleanall(FpdModuleIdentification fpdModuleId){
- //
- // if it is CUSTOM_BUILD
- // then call the exist BaseName_build.xml directly.
- //
- if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
- EdkLog.log(this, "Calling user-defined " + moduleId.getName() + "_build.xml");
-
- String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
- antCall(antFilename, "cleanall");
-
- return ;
- }
-
- String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
- antCall(antFilename, "cleanall");
- }
-
- private void antCall(String antFilename, String target) {
- Ant ant = new Ant();
- ant.setProject(getProject());
- ant.setAntfile(antFilename);
- if (target != null) {
- ant.setTarget(target);
- }
- ant.setInheritAll(true);
- ant.init();
- ant.execute();
- }
-
- public void setSingleModuleBuild(boolean isSingleModuleBuild) {
- this.isSingleModuleBuild = isSingleModuleBuild;
- }
-
- private String[] prepareIncludePaths(FpdModuleIdentification fpdModuleId) throws EdkException{
- //
- // Prepare the includes: PackageDependencies and Output debug direactory
- //
- Set<String> includes = new LinkedHashSet<String>();
- String arch = fpdModuleId.getArch();
-
- //
- // WORKSPACE
- //
- includes.add("${WORKSPACE_DIR}" + File.separatorChar);
-
- //
- // Module iteself
- //
- includes.add("${MODULE_DIR}");
- includes.add("${MODULE_DIR}" + File.separatorChar + archDir(arch));
-
- //
- // Packages in PackageDenpendencies
- //
- PackageIdentification[] packageDependencies = saq.getDependencePkg(fpdModuleId.getArch());
- for (int i = 0; i < packageDependencies.length; i++) {
- GlobalData.refreshPackageIdentification(packageDependencies[i]);
- File packageFile = packageDependencies[i].getSpdFile();
- includes.add(packageFile.getParent() + File.separatorChar + "Include");
- includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
- }
-
- //
- // All Dependency Library Instance's PackageDependencies
- //
- ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());
- for (int i = 0; i < libinstances.length; i++) {
- saq.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));
- PackageIdentification[] libraryPackageDependencies = saq.getDependencePkg(fpdModuleId.getArch());
- for (int j = 0; j < libraryPackageDependencies.length; j++) {
- GlobalData.refreshPackageIdentification(libraryPackageDependencies[j]);
- File packageFile = libraryPackageDependencies[j].getSpdFile();
- includes.add(packageFile.getParent() + File.separatorChar + "Include");
- includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
- }
- saq.pop();
- }
-
-
- //
- // The package which the module belongs to
- // TBD
- includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include");
- includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
-
- //
- // Debug files output directory
- //
- includes.add("${DEST_DIR_DEBUG}");
-
- //
- // set to INCLUDE_PATHS property
- //
- Iterator<String> iter = includes.iterator();
- StringBuffer includePaths = new StringBuffer();
- while (iter.hasNext()) {
- includePaths.append(iter.next());
- includePaths.append("; ");
- }
- getProject().setProperty("INCLUDE_PATHS", getProject().replaceProperties(includePaths.toString()).replaceAll("(\\\\)", "/"));
-
- return includes.toArray(new String[includes.size()]);
- }
-
- /**
- Return the name of the directory that corresponds to the architecture.
- This is a translation from the XML Schema tag to a directory that
- corresponds to our directory name coding convention.
-
- **/
- private String archDir(String arch) {
- return arch.replaceFirst("X64", "x64")
- .replaceFirst("IPF", "Ipf")
- .replaceFirst("IA32", "Ia32")
- .replaceFirst("ARM", "Arm")
- .replaceFirst("EBC", "Ebc");
- }
-
-
- public void setExternalProperties(Vector<Property> v) {
- this.properties = v;
- }
-
- private String GetCustomizedBuildFile(String arch) {
- String[][] files = saq.getSourceFiles(arch);
- for (int i = 0; i < files.length; ++i) {
- if (files[i][1].endsWith("build.xml")) {
- return files[i][1];
- }
- }
-
- return "";
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildThread.java b/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildThread.java
deleted file mode 100644
index 738a448f3a..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildThread.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/** @file
- This file is for single module thread definition.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.build;
-
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildListener;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Property;
-import org.tianocore.build.GenBuildTask;
-import org.tianocore.build.fpd.FpdParserForThread;
-import org.tianocore.build.global.GenBuildLogger;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- Add more comment here.
-
- @since GenBuild 1.0
-**/
-public class GenBuildThread implements Runnable {
-
- private ModuleIdentification parentModuleId = null;
-
- private ModuleIdentification moduleId = null;
-
- private Set<FpdModuleIdentification> dependencies = new LinkedHashSet<FpdModuleIdentification>();
-
- private int status = FpdParserForThread.STATUS_DEPENDENCY_NOT_READY;
-
- private Project project = null;
-
- public Object semaphore = new Object();
-
- private String arch = null;
-
- private boolean highPriority = false;
-
- private Thread thread;
-
- public GenBuildThread(ModuleIdentification moduleId, String arch) {
- this.moduleId = moduleId;
- this.arch = arch;
- thread = new Thread(FpdParserForThread.tg, this, moduleId + ":" + arch);
- }
-
- public boolean start() {
- if (highPriority) {
- thread.setPriority(Thread.MAX_PRIORITY);
- }
-
- status = FpdParserForThread.STATUS_START_RUN;
-
- thread.start();
-
- return true;
- }
-
- public void run() {
-
- FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, arch);
-
- try {
- //
- // Prepare pass down properties
- // ARCH, MODULE_GUID, MODULE_VERSION, PACKAGE_GUID, PACKAGE_VERSION, PLATFORM_FILE
- //
- Vector<Property> properties = new Vector<Property>();
- Property property = new Property();
- property.setName("ARCH");
- property.setValue(arch);
- properties.add(property);
-
- property = new Property();
- property.setName("MODULE_GUID");
- property.setValue(moduleId.getGuid());
- properties.add(property);
-
- property = new Property();
- property.setName("MODULE_VERSION");
- if (moduleId.getVersion() == null) {
- property.setValue("");
- } else {
- property.setValue(moduleId.getVersion());
- }
- properties.add(property);
-
- property = new Property();
- property.setName("PACKAGE_GUID");
- property.setValue(moduleId.getPackage().getGuid());
- properties.add(property);
-
- property = new Property();
- property.setName("PACKAGE_VERSION");
- if (moduleId.getPackage().getVersion() == null) {
- property.setValue("");
- } else {
- property.setValue(moduleId.getPackage().getVersion());
- }
- properties.add(property);
-
- //
- // Build the Module
- //
- GenBuildTask genBuildTask = new GenBuildTask();
-
- Project newProject = new Project();
-
- Hashtable passdownProperties = project.getProperties();
- Iterator iter = passdownProperties.keySet().iterator();
- while (iter.hasNext()) {
- String item = (String) iter.next();
- newProject.setProperty(item, (String) passdownProperties.get(item));
- }
-
- newProject.setInputHandler(project.getInputHandler());
-
- Iterator listenerIter = project.getBuildListeners().iterator();
- GenBuildLogger newLogger = null;
- while (listenerIter.hasNext()) {
- BuildListener item = (BuildListener)listenerIter.next();
- if (item instanceof GenBuildLogger) {
- newLogger = (GenBuildLogger)((GenBuildLogger)item).clone();
- newLogger.setId(fpdModuleId);
- newProject.addBuildListener(newLogger);
- } else {
- newProject.addBuildListener(item);
- }
- }
-
- project.initSubProject(newProject);
-
- genBuildTask.setProject(newProject);
-
- genBuildTask.setExternalProperties(properties);
-
- genBuildTask.parentId = parentModuleId;
-
- genBuildTask.perform();
- } catch (BuildException be) {
-
- EdkLog.log("GenBuild", EdkLog.EDK_ALWAYS, fpdModuleId + " build error. \n" + be.getMessage());
-
- if (FpdParserForThread.errorModule == null) {
- FpdParserForThread.errorModule = fpdModuleId;
- }
-
- synchronized (FpdParserForThread.deamonSemaphore) {
- FpdParserForThread.subCount();
- FpdParserForThread.deamonSemaphore.notifyAll();
- }
-
- return ;
- }
-
- status = FpdParserForThread.STATUS_END_RUN;
-
- EdkLog.log("GenBuild", EdkLog.EDK_ALWAYS, fpdModuleId + " build finished. ");
-
- //
- //
- //
- synchronized (FpdParserForThread.deamonSemaphore) {
- FpdParserForThread.subCount();
- FpdParserForThread.deamonSemaphore.notifyAll();
- }
- }
-
- public void setArch(String arch) {
- this.arch = arch;
- }
-
- public void setDependencies(Set<FpdModuleIdentification> dependencies) {
- this.dependencies = dependencies;
- }
-
- public void setModuleId(ModuleIdentification moduleId) {
- this.moduleId = moduleId;
- }
-
- public void setParentModuleId(ModuleIdentification parentModuleId) {
- this.parentModuleId = parentModuleId;
- }
-
- public void setProject(Project project) {
- this.project = project;
- }
-
- public void setHighPriority(boolean highPriority) {
- this.highPriority = highPriority;
- }
-
-
- public Set<FpdModuleIdentification> getDependencies() {
- return dependencies;
- }
-
- public ModuleIdentification getModuleId() {
- return moduleId;
- }
-
- public int getStatus() {
- //
- // Add code here to judge dependency
- //
- if (status == FpdParserForThread.STATUS_DEPENDENCY_NOT_READY) {
- Iterator<FpdModuleIdentification> iter = dependencies.iterator();
- boolean flag = true;
- while (iter.hasNext()) {
- FpdModuleIdentification item = iter.next();
- if (FpdParserForThread.allThreads.get(item).getStatus() == 1) {
- flag = false;
- break ;
- }
- }
- if (flag) {
- status = FpdParserForThread.STATUS_DEPENDENCY_READY;
- }
- }
- return status;
- }
-
- public void setStatus(int status) {
- this.status = status;
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java b/Tools/Java/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java
deleted file mode 100644
index bbb51cd93f..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/ModuleBuildFileGenerator.java
+++ /dev/null
@@ -1,523 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
- **/
-package org.tianocore.build;
-
-import java.io.File;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.tianocore.build.exception.GenBuildException;
-import org.tianocore.build.fpd.FpdParserTask;
-import org.tianocore.build.global.SurfaceAreaQuery;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.id.PackageIdentification;
-import org.tianocore.common.exception.EdkException;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class ModuleBuildFileGenerator {
-
- ///
- /// Pass: TARGET, TOOLCHAIN, ARCH
- /// PACKAGE, PACKAGE_GUID, PACKAGE_VERSION
- ///
- String[] inheritProperties = {"ARCH", "MODULE_GUID", "MODULE_VERSION", "PACKAGE_GUID", "PACKAGE_VERSION"};
-
- ///
- /// The information at the header of <em>build.xml</em>.
- ///
- private String info = "DO NOT EDIT \n"
- + "This file is auto-generated by the build utility\n"
- + "\n"
- + "Abstract:\n"
- + "Auto-generated ANT build file for build EFI Modules and Platforms\n";
-
- private FpdModuleIdentification fpdModuleId;
-
- private Project project;
-
- private String ffsKeyword;
-
- private String[] includes;
-
- private SurfaceAreaQuery saq = null;
-
- public ModuleBuildFileGenerator(Project project, String ffsKeyword, FpdModuleIdentification fpdModuleId, String[] includes, SurfaceAreaQuery saq) {
- this.project = project;
- this.fpdModuleId = fpdModuleId;
- this.ffsKeyword = ffsKeyword;
- this.includes = includes;
- this.saq = saq;
- }
-
- /**
- The whole BaseName_build.xml is composed of seven part.
- <ul>
- <li> ANT properties; </li>
- <li> Dependent module (dependent library instances in most case); </li>
- <li> Source files; </li>
- <li> Sections if module is not library; </li>
- <li> Output (different for library module and driver module); </li>
- <li> Clean; </li>
- <li> Clean all. </li>
- </ul>
-
- @throws BuildException
- Error throws during BaseName_build.xml generating.
- **/
- public void genBuildFile(String buildFilename) throws GenBuildException, EdkException {
- FfsProcess fp = new FfsProcess();
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- try {
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- Document document = dombuilder.newDocument();
- Comment rootComment = document.createComment(info);
-
- //
- // create root element and its attributes
- //
- Element root = document.createElement("project");
- root.setAttribute("name", fpdModuleId.getModule().getName());
- root.setAttribute("default", "all");
- root.setAttribute("basedir", ".");
-
- //
- // element for External ANT tasks
- //
- root.appendChild(document.createComment("Apply external ANT tasks"));
- Element ele = document.createElement("taskdef");
- ele.setAttribute("resource", "frameworktasks.tasks");
- root.appendChild(ele);
- ele = document.createElement("taskdef");
- ele.setAttribute("resource", "cpptasks.tasks");
- root.appendChild(ele);
- ele = document.createElement("typedef");
- ele.setAttribute("resource", "cpptasks.types");
- root.appendChild(ele);
- ele = document.createElement("taskdef");
- ele.setAttribute("resource", "net/sf/antcontrib/antlib.xml");
- root.appendChild(ele);
-
- //
- // Generate the default target,
- // which depends on init, sections and output target
- //
- root.appendChild(document.createComment("Default target"));
- ele = document.createElement("target");
- ele.setAttribute("name", "all");
- ele.setAttribute("depends", "libraries, sourcefiles, sections, output");
- root.appendChild(ele);
-
- //
- // compile all source files
- //
- root.appendChild(document.createComment("Compile all dependency Library instances."));
- ele = document.createElement("target");
- ele.setAttribute("name", "libraries");
-
- //
- // Parse all sourfiles but files specified in sections
- //
- if (!FrameworkBuildTask.multithread) {
- applyLibraryInstance(document, ele);
- }
- root.appendChild(ele);
-
- //
- // compile all source files
- //
- root.appendChild(document.createComment("sourcefiles target"));
- ele = document.createElement("target");
- ele.setAttribute("name", "sourcefiles");
-
- //
- // Parse all sourfiles but files specified in sections
- //
- applyCompileElement(document, ele);
- root.appendChild(ele);
-
- //
- // generate the init target
- // main purpose is create all nessary pathes
- // generate the sections target
- //
- root.appendChild(document.createComment("sections target"));
- ele = document.createElement("target");
- ele.setAttribute("name", "sections");
- applySectionsElement(document, ele, fp);
- root.appendChild(ele);
-
- //
- // generate the output target
- //
- root.appendChild(document.createComment("output target"));
- ele = document.createElement("target");
- ele.setAttribute("name", "output");
- applyOutputElement(document, ele, fp);
- root.appendChild(ele);
-
-
- //
- // generate the clean target
- //
- root.appendChild(document.createComment("clean target"));
- ele = document.createElement("target");
- ele.setAttribute("name", "clean");
- applyCleanElement(document, ele);
- root.appendChild(ele);
-
- //
- // generate the Clean All target
- //
- root.appendChild(document.createComment("Clean All target"));
- ele = document.createElement("target");
- ele.setAttribute("name", "cleanall");
- applyDeepcleanElement(document, ele);
- root.appendChild(ele);
-
- //
- // add the root element to the document
- //
- document.appendChild(rootComment);
- document.appendChild(root);
- //
- // Prepare the DOM document for writing
- //
- Source source = new DOMSource(document);
-
- //
- // Prepare the output file
- //
- File file = new File(buildFilename);
-
- //
- // generate all directory path
- //
- (new File(file.getParent())).mkdirs();
- FileOutputStream outputStream = new FileOutputStream(file);
- Result result = new StreamResult(new OutputStreamWriter(outputStream));
-
- //
- // Write the DOM document to the file
- //
- Transformer xformer = TransformerFactory.newInstance().newTransformer();
- xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
- xformer.setOutputProperty(OutputKeys.INDENT, "yes");
- xformer.transform(source, result);
- } catch (ParserConfigurationException ex) {
- GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());
- e.setStackTrace(ex.getStackTrace());
- throw e;
- } catch (FileNotFoundException ex) {
- GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());
- e.setStackTrace(ex.getStackTrace());
- throw e;
- } catch (TransformerConfigurationException ex) {
- GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());
- e.setStackTrace(ex.getStackTrace());
- throw e;
- } catch (TransformerException ex) {
- GenBuildException e = new GenBuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());
- e.setStackTrace(ex.getStackTrace());
- throw e;
- }
- }
-
- /**
- Generate the clean elements for BaseName_build.xml.
-
- @param document current BaseName_build.xml XML document
- @param root Root element for current
- **/
- private void applyCleanElement(Document document, Node root) {
- //
- // <delete includeemptydirs="true">
- // <fileset dir="${DEST_DIR_OUTPUT}" includes="" excludes="" />
- // </delete>
- //
- Element deleteEle = document.createElement("delete");
- deleteEle.setAttribute("includeemptydirs", "true");
- Element filesetEle = document.createElement("fileset");
- filesetEle.setAttribute("dir", "${DEST_DIR_OUTPUT}");
- filesetEle.setAttribute("includes", "**/*");
- filesetEle.setAttribute("excludes", "*.xml");
- deleteEle.appendChild(filesetEle);
- root.appendChild(deleteEle);
- }
-
- /**
- Generate the cleanall elements for BaseName_build.xml.
-
- @param document current BaseName_build.xml XML document
- @param root Root element for current
- **/
- private void applyDeepcleanElement(Document document, Node root) {
- //
- // <delete includeemptydirs="true">
- // <fileset dir="${DEST_DIR_OUTPUT}" includes="" excludes="" />
- // </delete>
- //
- Element deleteEle = document.createElement("delete");
- deleteEle.setAttribute("includeemptydirs", "true");
- Element filesetEle = document.createElement("fileset");
- filesetEle.setAttribute("dir", "${DEST_DIR_OUTPUT}");
- filesetEle.setAttribute("includes", "**/*");
- filesetEle.setAttribute("excludes", "*.xml");
- deleteEle.appendChild(filesetEle);
- root.appendChild(deleteEle);
-
- //
- // <delete includeemptydirs="true">
- // <fileset dir="${DEST_DIR_DEBUG}" includes="" />
- // </delete>
- //
- deleteEle = document.createElement("delete");
- deleteEle.setAttribute("includeemptydirs", "true");
- filesetEle = document.createElement("fileset");
- filesetEle.setAttribute("dir", "${DEST_DIR_DEBUG}");
- filesetEle.setAttribute("includes", "**/*");
- deleteEle.appendChild(filesetEle);
- root.appendChild(deleteEle);
- }
-
- /**
- Generate the dependent library instances elements for BaseName_build.xml.
-
- @param document current BaseName_build.xml XML document
- @param root Root element for current
- **/
- private void applyLibraryInstance(Document document, Node root) throws EdkException {
- ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());
- for (int i = 0; i < libinstances.length; i++) {
- //
- // Put package file path to module identification
- //
- PackageIdentification packageId = libinstances[i].getPackage();
-
- //
- // Generate ANT script to build library instances
- //
- Element ele = document.createElement("GenBuild");
- ele.setAttribute("type", "build");
-
- //
- // Prepare pass down information
- //
- Map<String, String> passDownMap = new LinkedHashMap<String, String>();
- for (int j = 0; j < inheritProperties.length; j ++){
- passDownMap.put(inheritProperties[j], "${" + inheritProperties[j] + "}");
- }
-
- passDownMap.put("MODULE_GUID", libinstances[i].getGuid());
- passDownMap.put("MODULE_VERSION", libinstances[i].getVersion());
-
- passDownMap.put("PACKAGE_GUID", packageId.getGuid());
- passDownMap.put("PACKAGE_VERSION", packageId.getVersion());
-
- for (int j = 0; j < inheritProperties.length; j ++){
- Element property = document.createElement("property");
- property.setAttribute("name", inheritProperties[j]);
- property.setAttribute("value", passDownMap.get(inheritProperties[j]));
- ele.appendChild(property);
- }
-
- root.appendChild(ele);
- }
- }
-
- /**
- Generate the build source files elements for BaseName_build.xml.
-
- @param document current BaseName_build.xml XML document
- @param root Root element for current
- **/
- private void applyCompileElement(Document document, Node root) {
- //
- // sourceFiles[][0] is FileType,
- // [][1] is File name relative to Module_Dir,
- // [][2] is ToolChainFamily
- //
- String[][] sourceFiles = saq.getSourceFiles(fpdModuleId.getArch());
-
- FileProcess fileProcess = new FileProcess();
- fileProcess.init(project, includes, document);
-
- boolean isBinaryModule = fpdModuleId.getModule().isBinary();
- boolean isLibraryModule = fpdModuleId.getModule().isLibrary();
-
- if (!isBinaryModule) {
- //
- // Initialize some properties by user
- //
- Element initEle = document.createElement("Build_Init");
- Element initIncEle = document.createElement("EXTRA.INC");
- for (int i = 0; i < includes.length; i++) {
- Element includeEle = document.createElement("includepath");
- includeEle.setAttribute("path", includes[i]);
- initIncEle.appendChild(includeEle);
- }
- initEle.appendChild(initIncEle);
- root.appendChild(initEle);
- }
-
- String moduleDir = project.getProperty("MODULE_DIR");
- //
- // Parse all Unicode files
- //
- for (int i = 0; i < sourceFiles.length; i++) {
- //
- // Go through all source files. Add MODULE_DIR to preffix
- //
- File sourceFile = new File(moduleDir + File.separatorChar + sourceFiles[i][1]);
- sourceFiles[i][1] = sourceFile.getPath();
- String filetype = sourceFiles[i][0];
- if (filetype != null) {
- fileProcess.parseFile(sourceFiles[i][1], filetype, sourceFiles[i][2], root, true);
- } else {
- fileProcess.parseFile(sourceFiles[i][1], sourceFiles[i][2], root, true);
- }
- }
-
- //
- // If exist Unicode file
- //
- if (fileProcess.isUnicodeExist()) {
- Element ele = document.createElement("Build_Unicode_Database");
- ele.setAttribute("FILEPATH", ".");
- ele.setAttribute("FILENAME", "${BASE_NAME}");
- Element includesEle = document.createElement("EXTRA.INC");
- for (int i = 0; i < includes.length; i++) {
- Element includeEle = document.createElement("includepath");
- includeEle.setAttribute("path", includes[i]);
- includesEle.appendChild(includeEle);
- }
- ele.appendChild(includesEle);
- root.appendChild(ele);
- }
-
- //
- // Don't build AutoGen.c for library and binary module
- //
- if (!isLibraryModule && !isBinaryModule) {
- fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", null, root, false);
- }
-
- //
- // Parse all source files but Unicode files
- //
- for (int i = 0; i < sourceFiles.length; i++) {
- String filetype = sourceFiles[i][0];
- if (filetype != null) {
- fileProcess.parseFile(sourceFiles[i][1], filetype, sourceFiles[i][2], root, false);
- } else {
- fileProcess.parseFile(sourceFiles[i][1], sourceFiles[i][2], root, false);
- }
- }
-
- //
- // Initialize SOURCE_FILES for dependcy check use
- //
- String str = "";
- for (int i = 0; i < sourceFiles.length; i++) {
- str += " " + sourceFiles[i][1];
- }
- project.setProperty("SOURCE_FILES", str.replaceAll("(\\\\)", "/"));
- }
-
- /**
- Generate the section elements for BaseName_build.xml. Library module will
- skip this process.
-
- @param document current BaseName_build.xml XML document
- @param root Root element for current
- **/
- private void applySectionsElement(Document document, Node root, FfsProcess fp) {
- if (fpdModuleId.getModule().isLibrary()) {
- return ;
- }
- if (fp.initSections(ffsKeyword, project, fpdModuleId)) {
- String targetFilename = fpdModuleId.getModule().getGuid() + "-" + "${BASE_NAME}" + FpdParserTask.getSuffix(fpdModuleId.getModule().getModuleType());
- String[] list = fp.getGenSectionElements(document, "${BASE_NAME}", fpdModuleId.getModule().getGuid(), targetFilename);
-
- for (int i = 0; i < list.length; i++) {
- String sectiontype = list[i];
- if (sectiontype.equalsIgnoreCase("EFI_SECTION_RAW") && project.getProperty("MODULE_TYPE").equalsIgnoreCase("SEC")) {
- sectiontype += "_SEC";
- }
- if ((sectiontype.equalsIgnoreCase("EFI_SECTION_PE32") ||
- sectiontype.equalsIgnoreCase("EFI_SECTION_TE"))
- && !fpdModuleId.getModule().isLibrary()
- && !fpdModuleId.getModule().isBinary()) {
- //
- // Generate code to generate efi file
- //
- Element ele = document.createElement("GenEfi");
- ele.setAttribute("FILEPATH", ".");
- ele.setAttribute("FILENAME", "${BASE_NAME}");
- root.appendChild(ele);
- }
- Element ele = document.createElement(sectiontype);
- ele.setAttribute("FILEPATH", ".");
- ele.setAttribute("FILENAME", "${BASE_NAME}");
- root.appendChild(ele);
- }
- }
- }
-
- /**
- Generate the output elements for BaseName_build.xml. If module is library,
- call the <em>LIB</em> command, else call the <em>GenFfs</em> command.
-
- @param document current BaseName_build.xml XML document
- @param root Root element for current
- **/
- private void applyOutputElement(Document document, Node root, FfsProcess fp) {
- if (fpdModuleId.getModule().isLibrary()) {
- //
- // call Lib command
- //
- Element cc = document.createElement("Build_Library");
- cc.setAttribute("FILENAME", fpdModuleId.getModule().getName());
- root.appendChild(cc);
- }
- //
- // if it is a module but library
- //
- else {
- if (fp.getFfsNode() != null) {
- root.appendChild(fp.getFfsNode());
- }
- }
- }
-
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
deleted file mode 100644
index ad69f07c13..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
+++ /dev/null
@@ -1,2303 +0,0 @@
-/** @file
- AutoGen class.
-
- This class is to generate Autogen.h and Autogen.c according to module surface area
- or library surface area.
-
- Copyright (c) 2006, 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.
-
- **/
-
-package org.tianocore.build.autogen;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.build.exception.AutoGenException;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.global.SurfaceAreaQuery;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.id.PackageIdentification;
-import org.tianocore.build.pcd.action.PCDAutoGenAction;
-import org.tianocore.common.definitions.ToolDefinitions;
-import org.tianocore.common.definitions.EdkDefinitions;
-import org.tianocore.common.exception.EdkException;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- This class is to generate Autogen.h and Autogen.c according to module surface
- area or library surface area.
-**/
-public class AutoGen {
- ///
- /// The output path of Autogen.h and Autogen.c
- ///
- private String outputPath;
-
- ///
- /// The name of FV directory
- ///
- private String fvDir;
-
- ///
- /// The base name of module or library.
- ///
- private ModuleIdentification moduleId;
-
- ///
- /// The build architecture
- ///
- private String arch;
-
- ///
- /// PcdAutogen instance which is used to manage how to generate the PCD
- /// information.
- ///
- private PCDAutoGenAction myPcdAutogen;
-
- ///
- /// the one of type : NOT_PCD_DRIVER, PEI_PCD_DRIVER, DXE_PCD_DRIVER
- ///
- private CommonDefinition.PCD_DRIVER_TYPE pcdDriverType;
-
- ///
- /// The Guid CName list which recoreded in module or library surface area
- /// and it's dependence on library instance surface area.
- ///
- private Set<String> mGuidCNameList = new HashSet<String>();
-
- ///
- /// The dependence package list which recoreded in module or library surface
- /// area and it's dependence on library instance surface area.
- ///
- private List<PackageIdentification> mDepPkgList = new LinkedList<PackageIdentification>();
-
- ///
- /// For non library module, add its library instance's construct and destructor to
- /// list. String[0] recode LibConstructor name, String[1] recode Lib instance
- /// module type.
- ///
- private List<String[]> libConstructList = new ArrayList<String[]>();
- private List<String[]> libDestructList = new ArrayList<String[]>();
-
- ///
- /// List to store SetVirtalAddressMapCallBack, ExitBootServiceCallBack
- ///
- private List<String> setVirtalAddList = new ArrayList<String>();
- private List<String> exitBootServiceList = new ArrayList<String>();
-
- private StringBuffer functionDeclarations = new StringBuffer(10240);
- private StringBuffer globalDeclarations = new StringBuffer(10240);
-
- //
- // flag of PcdComponentNameDisable, PcdDriverDiagnosticDisable
- //
- private boolean componentNamePcd = false;
- private boolean driverDiagnostPcd = false;
-
- //
- // Instance of SurfaceAreaQuery
- //
- private SurfaceAreaQuery saq = null;
-
- private ModuleIdentification parentId = null;
-
- /**
- Construct function
-
- This function mainly initialize some member variable.
-
- @param fvDir
- Absolute path of FV directory.
- @param outputPath
- Output path of AutoGen file.
- @param moduleId
- Module identification.
- @param arch
- Target architecture.
- **/
- public AutoGen(String fvDir, String outputPath, ModuleIdentification moduleId, String arch, SurfaceAreaQuery saq, ModuleIdentification parentId) {
- this.outputPath = outputPath;
- this.moduleId = moduleId;
- this.arch = arch;
- this.fvDir = fvDir;
- this.saq = saq;
- this.parentId = parentId;
- }
-
- /**
- saveFile function
-
- This function save the content in stringBuffer to file.
-
- @param fileName
- The name of file.
- @param fileBuffer
- The content of AutoGen file in buffer.
- @return boolean
- "true" successful
- "false" failed
- **/
- private boolean saveFile(String fileName, StringBuffer fileBuffer) {
-
- File autoGenH = new File(fileName);
-
- //
- // if the file exists, compare their content
- //
- if (autoGenH.exists()) {
- char[] oldFileBuffer = new char[(int) autoGenH.length()];
- try {
- FileReader fIn = new FileReader(autoGenH);
- fIn.read(oldFileBuffer, 0, (int) autoGenH.length());
- fIn.close();
- } catch (IOException e) {
- EdkLog.log(EdkLog.EDK_INFO, this.moduleId.getName()
- + "'s "
- + fileName
- + " is exist, but can't be open!!");
- return false;
- }
-
- //
- // if we got the same file, don't re-generate it to prevent
- // sources depending on it from re-building
- //
- if (fileBuffer.toString().compareTo(new String(oldFileBuffer)) == 0) {
- return true;
- }
- }
-
- try {
- FileWriter fOut = new FileWriter(autoGenH);
- fOut.write(fileBuffer.toString());
- fOut.flush();
- fOut.close();
- } catch (IOException e) {
- EdkLog.log(EdkLog.EDK_INFO, this.moduleId.getName()
- + "'s "
- + fileName
- + " can't be create!!");
- return false;
- }
- return true;
- }
-
- /**
- genAutogen function
-
- This function call libGenAutoGen or moduleGenAutogen function, which
- dependence on generate library autogen or module autogen.
-
- @throws BuildException
- Failed to creat AutoGen.c & AutoGen.h.
- **/
- public void genAutogen() throws EdkException {
- //
- // If outputPath do not exist, create it.
- //
- File path = new File(outputPath);
- path.mkdirs();
-
- //
- // Check current is library or not, then call the corresponding
- // function.
- //
- if (this.moduleId.isLibrary()) {
- libGenAutogen();
- } else {
- moduleGenAutogen();
- }
- }
-
- /**
- moduleGenAutogen function
-
- This function generates AutoGen.c & AutoGen.h for module.
-
- @throws BuildException
- Faile to create module AutoGen.c & AutoGen.h.
- **/
- void moduleGenAutogen() throws EdkException {
- setPcdComponentName();
- setPcdDriverDiagnostic();
- collectLibInstanceInfo();
- moduleGenAutogenC();
- moduleGenAutogenH();
- }
-
- /**
- libGenAutogen function
-
- This function generates AutoGen.c & AutoGen.h for library.
-
- @throws BuildException
- Faile to create library AutoGen.c & AutoGen.h
- **/
- void libGenAutogen() throws EdkException {
- libGenAutogenC();
- libGenAutogenH();
- }
-
- /**
- moduleGenAutogenH
-
- This function generates AutoGen.h for module.
-
- @throws BuildException
- Failed to generate AutoGen.h.
- **/
- void moduleGenAutogenH() throws EdkException {
-
- Set<String> libClassIncludeH;
- String moduleType;
- // List<String> headerFileList;
- List<String> headerFileList;
- Iterator item;
- StringBuffer fileBuffer = new StringBuffer(8192);
-
- //
- // Write Autogen.h header notation
- //
- fileBuffer.append(CommonDefinition.AUTOGENHNOTATION);
-
- //
- // Add #ifndef ${BaseName}_AUTOGENH
- // #def ${BseeName}_AUTOGENH
- //
- fileBuffer.append(CommonDefinition.IFNDEF
- + CommonDefinition.AUTOGENH
- + this.moduleId.getGuid().replaceAll("-", "_")
- + ToolDefinitions.LINE_SEPARATOR);
- fileBuffer.append(CommonDefinition.DEFINE
- + CommonDefinition.AUTOGENH
- + this.moduleId.getGuid().replaceAll("-", "_")
- + ToolDefinitions.LINE_SEPARATOR
- + ToolDefinitions.LINE_SEPARATOR);
-
- //
- // Write the specification version and release version at the begine
- // of autogen.h file.
- // Note: the specification version and release version should
- // be got from module surface area instead of hard code by it's
- // moduleType.
- //
- moduleType = saq.getModuleType();
-
- //
- // Add "extern int __make_me_compile_correctly;" at begin of
- // AutoGen.h.
- //
- fileBuffer.append(CommonDefinition.AUTOGENHBEGIN);
-
- //
- // Put EFI_SPECIFICATION_VERSION, and EDK_RELEASE_VERSION.
- //
- String[] specList = saq.getExternSpecificaiton();
- for (int i = 0; i < specList.length; i++) {
- fileBuffer.append(CommonDefinition.DEFINE + specList[i]
- + "\r\n");
- }
- //
- // Write consumed package's mdouleInfo related .h file to autogen.h
- //
- // PackageIdentification[] consumedPkgIdList = SurfaceAreaQuery
- // .getDependencePkg(this.arch);
- PackageIdentification[] consumedPkgIdList = saq.getDependencePkg(this.arch);
- if (consumedPkgIdList != null) {
- headerFileList = depPkgToAutogenH(consumedPkgIdList, moduleType);
- item = headerFileList.iterator();
- while (item.hasNext()) {
- fileBuffer.append(item.next().toString());
- }
- }
-
- //
- // Write library class's related *.h file to autogen.h.
- //
- List<String> libClasses = new ArrayList<String>(100);
- String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);
- for (int i = 0; i < libClassList.length; ++i) {
- libClasses.add(libClassList[i]);
- }
-
- libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);
- for (int i = 0; i < libClassList.length; ++i) {
- libClasses.add(libClassList[i]);
- }
- //
- // Add AutoGen used library class
- //
- int moduleTypeId = CommonDefinition.getModuleType(moduleType);
- if (!libClasses.contains("DebugLib") && moduleTypeId != CommonDefinition.ModuleTypeUnknown
- && moduleTypeId != CommonDefinition.ModuleTypeBase) {
- libClasses.add("DebugLib");
- }
- switch (moduleTypeId) {
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- if (!libClasses.contains("UefiBootServicesTableLib")) {
- libClasses.add("UefiBootServicesTableLib");
- }
- break;
- }
- LibraryClassToAutogenH(fileBuffer, libClasses.toArray(new String[libClasses.size()]));
- fileBuffer.append("\r\n");
-
- //
- // If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
- // {DEST_DIR_DRBUG}/FlashMap.h
- //
- if (saq.isHaveTianoR8FlashMap()) {
- fileBuffer.append(CommonDefinition.INCLUDE);
- fileBuffer.append(" <");
- fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\r\n");
- copyFlashMapHToDebugDir();
- }
-
- // Write PCD autogen information to AutoGen.h.
- //
- if (this.myPcdAutogen != null) {
- fileBuffer.append("\r\n");
- fileBuffer.append(this.myPcdAutogen.getHAutoGenString());
- }
-
- fileBuffer.append(globalDeclarations);
- fileBuffer.append(functionDeclarations);
- //
- // Append the #endif at AutoGen.h
- //
- fileBuffer.append("#endif\r\n");
-
- //
- // Save string buffer content in AutoGen.h.
- //
- if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {
- throw new AutoGenException("Failed to generate AutoGen.h !!!");
- }
- }
-
- /**
- moduleGenAutogenC
-
- This function generates AutoGen.c for module.
-
- @throws BuildException
- Failed to generate AutoGen.c.
- **/
- void moduleGenAutogenC() throws EdkException {
-
- StringBuffer fileBuffer = new StringBuffer(8192);
- //
- // Write Autogen.c header notation
- //
- fileBuffer.append(CommonDefinition.AUTOGENCNOTATION);
-
- //
- // Get the native MSA file infomation. Since before call autogen,
- // the MSA native <Externs> information were overrided. So before
- // process <Externs> it should be set the DOC as the Native MSA info.
- //
- Map<String, XmlObject> doc = GlobalData.getNativeMsa(this.moduleId);
- saq.push(doc);
- //
- // Write <Extern>
- // DriverBinding/ComponentName/DriverConfiguration/DriverDialog
- // to AutoGen.c
- //
- if (!moduleId.getModuleType().equalsIgnoreCase("UEFI_APPLICATION")) {
- ExternsDriverBindingToAutoGenC(fileBuffer);
- }
-
- //
- // Write DriverExitBootServicesEvent/DriverSetVirtualAddressMapEvent
- // to Autogen.c
- //
- ExternCallBackToAutoGenC(fileBuffer);
-
- //
- // Write EntryPoint to autgoGen.c
- //
- String[] entryPointList = saq.getModuleEntryPointArray();
- String[] unloadImageList = saq.getModuleUnloadImageArray();
- EntryPointToAutoGen(CommonDefinition.remDupString(entryPointList),
- CommonDefinition.remDupString(unloadImageList),
- fileBuffer);
-
- pcdDriverType = saq.getPcdDriverType();
-
- //
- // Restore the DOC which include the FPD module info.
- //
- saq.pop();
-
- //
- // Write Guid to autogen.c
- //
- String guid = CommonDefinition.formatGuidName(saq.getModuleGuid());
- if (this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
- globalDeclarations.append("extern GUID gEfiCallerIdGuid;\r\n");
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = {");
- } else if (!this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_USER_DEFINED)) {
- globalDeclarations.append("extern EFI_GUID gEfiCallerIdGuid;\r\n");
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {");
- }
-
- if (guid == null) {
- throw new AutoGenException("Guid value must set!\n");
- }
-
- //
- // Formate Guid as ANSI c form.Example:
- // {0xd2b2b828, 0x826, 0x48a7,{0xb3, 0xdf, 0x98, 0x3c, 0x0, 0x60, 0x24,
- // 0xf0}}
- //
-
- fileBuffer.append(guid);
- fileBuffer.append("};\r\n");
-
- //
- // Generate library instance consumed protocol, guid, ppi, pcd list.
- // Save those to this.protocolList, this.ppiList, this.pcdList,
- // this.guidList. Write Consumed library constructor and desconstuct to
- // autogen.c
- //
- LibInstanceToAutogenC(fileBuffer);
-
- //
- // Get module dependent Package identification.
- //
- PackageIdentification[] packages = saq.getDependencePkg(this.arch);
- for (int i = 0; i < packages.length; i++) {
- if (!this.mDepPkgList.contains(packages[i])) {
- this.mDepPkgList.add(packages[i]);
- }
-
- }
-
- //
- // Write consumed ppi, guid, protocol, etc to autogen.c
- //
- CNameToAutogenC(fileBuffer);
-
- //
- // Call pcd autogen.
- //
- this.myPcdAutogen = new PCDAutoGenAction(moduleId,
- arch,
- false,
- null,
- pcdDriverType,
- parentId);
-
- this.myPcdAutogen.execute();
- if (this.myPcdAutogen != null) {
- fileBuffer.append("\r\n");
- fileBuffer.append(this.myPcdAutogen.getCAutoGenString());
- }
-
- if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {
- throw new AutoGenException("Failed to generate AutoGen.c !!!");
- }
-
- }
-
- /**
- libGenAutogenH
-
- This function generates AutoGen.h for library.
-
- @throws BuildException
- Failed to generate AutoGen.c.
- **/
- void libGenAutogenH() throws EdkException {
-
- Set<String> libClassIncludeH;
- String moduleType;
- List<String> headerFileList;
- Iterator item;
- StringBuffer fileBuffer = new StringBuffer(10240);
-
- //
- // Write Autogen.h header notation
- //
- fileBuffer.append(CommonDefinition.AUTOGENHNOTATION);
-
- //
- // Add #ifndef ${BaseName}_AUTOGENH
- // #def ${BseeName}_AUTOGENH
- //
- fileBuffer.append(CommonDefinition.IFNDEF
- + CommonDefinition.AUTOGENH
- + this.moduleId.getGuid().replaceAll("-", "_")
- + ToolDefinitions.LINE_SEPARATOR);
- fileBuffer.append(CommonDefinition.DEFINE
- + CommonDefinition.AUTOGENH
- + this.moduleId.getGuid().replaceAll("-", "_")
- + ToolDefinitions.LINE_SEPARATOR
- + ToolDefinitions.LINE_SEPARATOR);
-
- //
- // Write EFI_SPECIFICATION_VERSION and EDK_RELEASE_VERSION
- // to autogen.h file.
- // Note: the specification version and release version should
- // be get from module surface area instead of hard code.
- //
- fileBuffer.append(CommonDefinition.AUTOGENHBEGIN);
- String[] specList = saq.getExternSpecificaiton();
- for (int i = 0; i < specList.length; i++) {
- fileBuffer.append(CommonDefinition.DEFINE + specList[i] + "\r\n");
- }
- // fileBuffer.append(CommonDefinition.autoGenHLine1);
- // fileBuffer.append(CommonDefinition.autoGenHLine2);
-
- //
- // Write consumed package's mdouleInfo related *.h file to autogen.h.
- //
- moduleType = saq.getModuleType();
- PackageIdentification[] cosumedPkglist = saq.getDependencePkg(this.arch);
- headerFileList = depPkgToAutogenH(cosumedPkglist, moduleType);
- item = headerFileList.iterator();
- while (item.hasNext()) {
- fileBuffer.append(item.next().toString());
- }
- //
- // Write library class's related *.h file to autogen.h
- //
- List<String> libClasses = new ArrayList<String>(100);
- String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);
- for (int i = 0; i < libClassList.length; ++i) {
- libClasses.add(libClassList[i]);
- }
-
- libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);
- for (int i = 0; i < libClassList.length; ++i) {
- libClasses.add(libClassList[i]);
- }
- //
- // Add AutoGen used library class
- //
- int moduleTypeId = CommonDefinition.getModuleType(moduleType);
- if (!libClasses.contains("DebugLib") && moduleTypeId != CommonDefinition.ModuleTypeUnknown
- && moduleTypeId != CommonDefinition.ModuleTypeBase) {
- libClasses.add("DebugLib");
- }
- switch (moduleTypeId) {
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- if (!libClasses.contains("UefiBootServicesTableLib")) {
- libClasses.add("UefiBootServicesTableLib");
- }
- break;
- }
- LibraryClassToAutogenH(fileBuffer, libClasses.toArray(new String[libClasses.size()]));
- fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);
-
- //
- // If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
- // {DEST_DIR_DRBUG}/FlashMap.h
- //
- if (saq.isHaveTianoR8FlashMap()) {
- fileBuffer.append(CommonDefinition.INCLUDE);
- fileBuffer.append(" <");
- fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\r\n");
- copyFlashMapHToDebugDir();
- }
-
- //
- // Write PCD information to library AutoGen.h.
- //
- if (this.myPcdAutogen != null) {
- fileBuffer.append("\r\n");
- fileBuffer.append(this.myPcdAutogen.getHAutoGenString());
- }
- //
- // generate function prototype for constructor and destructor
- //
- LibConstructorToAutogenH(moduleType);
- LibDestructorToAutogenH(moduleType);
- ExternCallBackToAutoGenH(moduleType);
- fileBuffer.append(functionDeclarations);
- //
- // Append the #endif at AutoGen.h
- //
- fileBuffer.append("#endif\r\n");
- //
- // Save content of string buffer to AutoGen.h file.
- //
- if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {
- throw new AutoGenException("Failed to generate AutoGen.h !!!");
- }
- }
-
- /**
- libGenAutogenC
-
- This function generates AutoGen.h for library.
-
- @throws BuildException
- Failed to generate AutoGen.c.
- **/
- void libGenAutogenC() throws EdkException {
- StringBuffer fileBuffer = new StringBuffer(10240);
-
- //
- // Write Autogen.c header notation
- //
- fileBuffer.append(CommonDefinition.AUTOGENCNOTATION);
-
- fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);
- fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);
-
- //
- // Call pcd autogen.
- //
- this.myPcdAutogen = new PCDAutoGenAction(moduleId,
- arch,
- true,
- saq.getModulePcdEntryNameArray(this.arch),
- pcdDriverType,
- parentId);
- this.myPcdAutogen.execute();
- if (this.myPcdAutogen != null) {
- fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);
- fileBuffer.append(this.myPcdAutogen.getCAutoGenString());
- }
- }
-
- /**
- LibraryClassToAutogenH
-
- This function returns *.h files declared by library classes which are
- consumed or produced by current build module or library.
-
- @param libClassList
- List of library class which consumed or produce by current
- build module or library.
- @return includeStrList List of *.h file.
- **/
- void LibraryClassToAutogenH(StringBuffer fileBuffer, String[] libClassList)
- throws EdkException {
- String includeName[];
- String str = "";
-
- //
- // Get include file from GlobalData's SPDTable according to
- // library class name.
- //
- for (int i = 0; i < libClassList.length; i++) {
- includeName = GlobalData.getLibraryClassHeaderFiles(
- saq.getDependencePkg(this.arch),
- libClassList[i]);
- if (includeName == null) {
- throw new AutoGenException("Can not find library class ["
- + libClassList[i] + "] declaration in any SPD package. ");
- }
- for (int j = 0; j < includeName.length; j++) {
- String includeNameStr = includeName[j];
- if (includeNameStr != null) {
- fileBuffer.append(CommonDefinition.INCLUDE);
- fileBuffer.append(" <");
- fileBuffer.append(includeNameStr);
- fileBuffer.append(">\r\n");
- includeNameStr = null;
- }
- }
- }
- }
-
- /**
- IncludesToAutogenH
-
- This function add include file in AutoGen.h file.
-
- @param packageNameList
- List of module depended package.
- @param moduleType
- Module type.
- @return
- **/
- List<String> depPkgToAutogenH(PackageIdentification[] packageNameList,
- String moduleType) throws AutoGenException {
-
- List<String> includeStrList = new LinkedList<String>();
- String pkgHeader;
- String includeStr = "";
-
- //
- // Get include file from moduleInfo file
- //
- for (int i = 0; i < packageNameList.length; i++) {
- pkgHeader = GlobalData.getPackageHeaderFiles(packageNameList[i],
- moduleType);
- if (pkgHeader == null) {
- throw new AutoGenException("Can not find package ["
- + packageNameList[i]
- + "] declaration in any SPD package. ");
- } else if (!pkgHeader.equalsIgnoreCase("")) {
- includeStr = CommonDefinition.INCLUDE + " <" + pkgHeader + ">\r\n";
- includeStrList.add(includeStr);
- }
- }
-
- return includeStrList;
- }
-
- /**
- EntryPointToAutoGen
-
- This function convert <ModuleEntryPoint> & <ModuleUnloadImage>
- information in mas to AutoGen.c
-
- @param entryPointList
- List of entry point.
- @param fileBuffer
- String buffer fo AutoGen.c.
- @throws Exception
- **/
- void EntryPointToAutoGen(String[] entryPointList, String[] unloadImageList, StringBuffer fileBuffer)
- throws EdkException {
-
- String typeStr = saq.getModuleType();
- String debugStr = "DEBUG ((EFI_D_INFO | EFI_D_LOAD, \"Module Entry Point (%s) 0x%%p\\n\", (VOID *)(UINTN)%s));\r\n";
- int unloadImageCount = 0;
- int entryPointCount = 0;
-
- //
- // The parameters and return value of entryPoint is difference
- // for difference module type.
- //
- switch (CommonDefinition.getModuleType(typeStr)) {
-
- case CommonDefinition.ModuleTypePeiCore:
- if (entryPointList == null ||entryPointList.length != 1 ) {
- throw new AutoGenException("Module type = 'PEI_CORE', can have only one module entry point!");
- } else {
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(entryPointList[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");
- functionDeclarations.append(" IN VOID *OldCoreData\r\n");
- functionDeclarations.append(" );\r\n\r\n");
-
- fileBuffer.append("EFI_STATUS\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleEntryPointList (\r\n");
- fileBuffer.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");
- fileBuffer.append(" IN VOID *OldCoreData\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
- fileBuffer.append(" return ");
- fileBuffer.append(entryPointList[0]);
- fileBuffer.append(" (PeiStartupDescriptor, OldCoreData);\r\n");
- fileBuffer.append("}\r\n\r\n");
- }
- break;
-
- case CommonDefinition.ModuleTypeDxeCore:
- fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");
- if (entryPointList == null || entryPointList.length != 1) {
- throw new AutoGenException("Module type = 'DXE_CORE', can have only one module entry point!");
- } else {
- functionDeclarations.append("VOID\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(entryPointList[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN VOID *HobStart\r\n");
- functionDeclarations.append(" );\r\n\r\n");
-
- fileBuffer.append("VOID\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleEntryPointList (\r\n");
- fileBuffer.append(" IN VOID *HobStart\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
- fileBuffer.append(" ");
- fileBuffer.append(entryPointList[0]);
- fileBuffer.append(" (HobStart);\r\n");
- fileBuffer.append("}\r\n\r\n");
- }
- break;
-
- case CommonDefinition.ModuleTypePeim:
- entryPointCount = 0;
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = 0;\r\n");
- if (entryPointList == null || entryPointList.length == 0) {
- fileBuffer.append("EFI_STATUS\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleEntryPointList (\r\n");
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
- fileBuffer.append(" return EFI_SUCCESS;\r\n");
- fileBuffer.append("}\r\n\r\n");
- break;
- }
- for (int i = 0; i < entryPointList.length; i++) {
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(entryPointList[i]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
- functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
- functionDeclarations.append(" );\r\n");
- entryPointCount++;
- }
-
- fileBuffer.append("EFI_STATUS\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleEntryPointList (\r\n");
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
- if (entryPointCount == 1) {
- fileBuffer.append(String.format(" " + debugStr, entryPointList[0], entryPointList[0]));
- fileBuffer.append(" return ");
- fileBuffer.append(entryPointList[0]);
- fileBuffer.append(" (FfsHeader, PeiServices);\r\n");
- } else {
- fileBuffer.append(" EFI_STATUS Status;\r\n");
- fileBuffer.append(" EFI_STATUS CombinedStatus;\r\n\r\n");
- fileBuffer.append(" CombinedStatus = EFI_LOAD_ERROR;\r\n\r\n");
- for (int i = 0; i < entryPointList.length; i++) {
- if (!entryPointList[i].equals("")) {
- fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));
- fileBuffer.append(" Status = ");
- fileBuffer.append(entryPointList[i]);
- fileBuffer.append(" (FfsHeader, PeiServices);\r\n");
- fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) {\r\n");
- fileBuffer.append(" CombinedStatus = Status;\r\n");
- fileBuffer.append(" }\r\n\r\n");
- } else {
- break;
- }
- }
- fileBuffer.append(" return CombinedStatus;\r\n");
- }
- fileBuffer.append("}\r\n\r\n");
- break;
-
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- entryPointCount = 0;
- //
- // If entryPoint is null, create an empty ProcessModuleEntryPointList
- // function.
- //
- if (entryPointList == null || entryPointList.length == 0) {
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
- fileBuffer.append(Integer.toString(entryPointCount));
- fileBuffer.append(";\r\n");
- fileBuffer.append("EFI_STATUS\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleEntryPointList (\r\n");
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
- fileBuffer.append(" return EFI_SUCCESS;\r\n");
- fileBuffer.append("}\r\n\r\n");
-
- } else {
- for (int i = 0; i < entryPointList.length; i++) {
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(entryPointList[i]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");
- functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- functionDeclarations.append(" );\r\n");
- entryPointCount++;
- }
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
- fileBuffer.append(Integer.toString(entryPointCount));
- fileBuffer.append(";\r\n");
- fileBuffer.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");
- fileBuffer.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n\r\n");
-
- fileBuffer.append("EFI_STATUS\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleEntryPointList (\r\n");
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
-
- for (int i = 0; i < entryPointList.length; i++) {
- fileBuffer.append(" if (SetJump (&mJumpContext) == 0) {\r\n");
- fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));
- fileBuffer.append(" ExitDriver (");
- fileBuffer.append(entryPointList[i]);
- fileBuffer.append(" (ImageHandle, SystemTable));\r\n");
- fileBuffer.append(" ASSERT (FALSE);\r\n");
- fileBuffer.append(" }\r\n");
- }
- fileBuffer.append(" return mDriverEntryPointStatus;\r\n");
- fileBuffer.append("}\r\n\r\n");
-
- fileBuffer.append("VOID\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ExitDriver (\r\n");
- fileBuffer.append(" IN EFI_STATUS Status\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
- fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");
- fileBuffer.append(" mDriverEntryPointStatus = Status;\r\n");
- fileBuffer.append(" }\r\n");
- fileBuffer.append(" LongJump (&mJumpContext, (UINTN)-1);\r\n");
- fileBuffer.append(" ASSERT (FALSE);\r\n");
- fileBuffer.append("}\r\n\r\n");
- }
-
-
- //
- // Add "ModuleUnloadImage" for DxeSmmDriver module type;
- //
-
- unloadImageCount = 0;
- if (unloadImageList != null) {
- for (int i = 0; i < unloadImageList.length; i++) {
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append(unloadImageList[i]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle\r\n");
- functionDeclarations.append(" );\r\n");
- unloadImageCount++;
- }
- }
-
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");
- fileBuffer.append(Integer.toString(unloadImageCount));
- fileBuffer.append(";\r\n\r\n");
-
- fileBuffer.append("EFI_STATUS\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleUnloadList (\r\n");
- fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n");
- fileBuffer.append(" )\r\n");
- fileBuffer.append("{\r\n");
-
- if (unloadImageCount == 0) {
- fileBuffer.append(" return EFI_SUCCESS;\r\n");
- } else if (unloadImageCount == 1) {
- fileBuffer.append(" return ");
- fileBuffer.append(unloadImageList[0]);
- fileBuffer.append("(ImageHandle);\r\n");
- } else {
- fileBuffer.append(" EFI_STATUS Status;\r\n\r\n");
- fileBuffer.append(" Status = EFI_SUCCESS;\r\n\r\n");
- for (int i = 0; i < unloadImageList.length; i++) {
- if (i == 0) {
- fileBuffer.append(" Status = ");
- fileBuffer.append(unloadImageList[i]);
- fileBuffer.append("(ImageHandle);\r\n");
- } else {
- fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");
- fileBuffer.append(" ");
- fileBuffer.append(unloadImageList[i]);
- fileBuffer.append("(ImageHandle);\r\n");
- fileBuffer.append(" } else {\r\n");
- fileBuffer.append(" Status = ");
- fileBuffer.append(unloadImageList[i]);
- fileBuffer.append("(ImageHandle);\r\n");
- fileBuffer.append(" }\r\n");
- }
- }
- fileBuffer.append(" return Status;\r\n");
- }
- fileBuffer.append("}\r\n\r\n");
- break;
-
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- entryPointCount = 0;
- fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");
- //
- // If entry point is null, create a empty ProcessModuleEntryPointList function.
- //
- if (entryPointList == null || entryPointList.length == 0) {
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = 0;\r\n");
- fileBuffer.append("EFI_STATUS\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleEntryPointList (\r\n");
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
- fileBuffer.append(" return EFI_SUCCESS;\r\n");
- fileBuffer.append("}\r\n");
-
- } else {
- for (int i = 0; i < entryPointList.length; i++) {
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(entryPointList[i]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");
- functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- functionDeclarations.append(" );\r\n");
- entryPointCount++;
- }
-
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
- fileBuffer.append(Integer.toString(entryPointCount));
- fileBuffer.append(";\r\n");
- if (entryPointCount > 1) {
- fileBuffer.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");
- fileBuffer.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n");
- }
- fileBuffer.append("\r\n");
-
- fileBuffer.append("EFI_STATUS\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleEntryPointList (\r\n");
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
-
- if (entryPointCount == 1) {
- fileBuffer.append(String.format(" " + debugStr, entryPointList[0], entryPointList[0]));
- fileBuffer.append(" return ");
- fileBuffer.append(entryPointList[0]);
- fileBuffer.append(" (ImageHandle, SystemTable);\r\n");
- } else {
- for (int i = 0; i < entryPointList.length; i++) {
- if (!entryPointList[i].equals("")) {
- fileBuffer.append(" if (SetJump (&mJumpContext) == 0) {\r\n");
- fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));
- if (CommonDefinition.getModuleType(typeStr) == CommonDefinition.ModuleTypeUefiApplication) {
- fileBuffer.append(" Exit (");
- } else {
- fileBuffer.append(" ExitDriver (");
- }
- fileBuffer.append(entryPointList[i]);
- fileBuffer.append(" (ImageHandle, SystemTable));\r\n");
- fileBuffer.append(" ASSERT (FALSE);\r\n");
- fileBuffer.append(" }\r\n");
- } else {
- break;
- }
- }
- fileBuffer.append(" return mDriverEntryPointStatus;\r\n");
- }
- fileBuffer.append("}\r\n\r\n");
-
- if (CommonDefinition.getModuleType(typeStr) != CommonDefinition.ModuleTypeUefiApplication) {
- fileBuffer.append("VOID\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ExitDriver (\r\n");
- fileBuffer.append(" IN EFI_STATUS Status\r\n");
- fileBuffer.append(" )\r\n\r\n");
- fileBuffer.append("{\r\n");
- if (entryPointCount <= 1) {
- fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");
- fileBuffer.append(" ProcessLibraryDestructorList (gImageHandle, gST);\r\n");
- fileBuffer.append(" }\r\n");
- fileBuffer.append(" gBS->Exit (gImageHandle, Status, 0, NULL);\r\n");
- } else {
- fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");
- fileBuffer.append(" mDriverEntryPointStatus = Status;\r\n");
- fileBuffer.append(" }\r\n");
- fileBuffer.append(" LongJump (&mJumpContext, (UINTN)-1);\r\n");
- fileBuffer.append(" ASSERT (FALSE);\r\n");
- }
- fileBuffer.append("}\r\n\r\n");
- }
- }
-
- if (CommonDefinition.getModuleType(typeStr) == CommonDefinition.ModuleTypeUefiApplication) {
- break;
- }
- //
- // Add ModuleUnloadImage for DxeDriver and UefiDriver module type.
- //
- //entryPointList = SurfaceAreaQuery.getModuleUnloadImageArray();
- //
- // Remover duplicate unload entry point.
- //
- //entryPointList = CommonDefinition.remDupString(entryPointList);
- //entryPointCount = 0;
- unloadImageCount = 0;
- if (unloadImageList != null) {
- for (int i = 0; i < unloadImageList.length; i++) {
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(unloadImageList[i]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle\r\n");
- functionDeclarations.append(" );\r\n");
- unloadImageCount++;
- }
- }
-
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");
- fileBuffer.append(Integer.toString(unloadImageCount));
- fileBuffer.append(";\r\n\r\n");
-
- fileBuffer.append("EFI_STATUS\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessModuleUnloadList (\r\n");
- fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n");
- fileBuffer.append(" )\r\n");
- fileBuffer.append("{\r\n");
-
- if (unloadImageCount == 0) {
- fileBuffer.append(" return EFI_SUCCESS;\r\n");
- } else if (unloadImageCount == 1) {
- fileBuffer.append(" return ");
- fileBuffer.append(unloadImageList[0]);
- fileBuffer.append("(ImageHandle);\r\n");
- } else {
- fileBuffer.append(" EFI_STATUS Status;\r\n\r\n");
- fileBuffer.append(" Status = EFI_SUCCESS;\r\n\r\n");
- for (int i = 0; i < unloadImageList.length; i++) {
- if (i == 0) {
- fileBuffer.append(" Status = ");
- fileBuffer.append(unloadImageList[i]);
- fileBuffer.append("(ImageHandle);\r\n");
- } else {
- fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");
- fileBuffer.append(" ");
- fileBuffer.append(unloadImageList[i]);
- fileBuffer.append("(ImageHandle);\r\n");
- fileBuffer.append(" } else {\r\n");
- fileBuffer.append(" Status = ");
- fileBuffer.append(unloadImageList[i]);
- fileBuffer.append("(ImageHandle);\r\n");
- fileBuffer.append(" }\r\n");
- }
- }
- fileBuffer.append(" return Status;\r\n");
- }
- fileBuffer.append("}\r\n\r\n");
- break;
- }
- }
-
- /**
- CNameToAutogenc
-
- This function gets GUIDs from SPD file accrodeing to <Protocols> <Ppis>
- <Guids> information and write those GUIDs to AutoGen.c.
-
- @param fileBuffer
- String Buffer for Autogen.c file.
-
- **/
- void CNameToAutogenC(StringBuffer fileBuffer) throws AutoGenException {
- String[] cNameGuid = null;
- String guidKeyWord = null;
-
- String[] cnameList = saq.getCNameArray(this.arch);
- for (int i = 0; i < cnameList.length; i++) {
- this.mGuidCNameList.add(cnameList[i]);
- }
-
-
- Iterator guidIterator = this.mGuidCNameList.iterator();
- while (guidIterator.hasNext()) {
- guidKeyWord = guidIterator.next().toString();
- cNameGuid = GlobalData.getGuid(this.mDepPkgList, guidKeyWord);
- if (cNameGuid == null) {
- cNameGuid = GlobalData.getProtocolGuid(this.mDepPkgList, guidKeyWord);
- if (cNameGuid == null) {
- cNameGuid = GlobalData.getPpiGuid(this.mDepPkgList, guidKeyWord);
- if (cNameGuid == null) {
- //
- // If can't find GUID declaration in every package, stop the build
- //
- EdkLog.log(EdkLog.EDK_INFO,"WARN: Can not find Guid [" + guidKeyWord + "] declaration in any SPD file.");
- continue;
- //throw new AutoGenException("Can not find Guid [" + guidKeyWord
- // + "] declaration in any SPD package. ");
- }
- }
- }
-
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
- fileBuffer.append(cNameGuid[0]);
- fileBuffer.append(" = { ");
- fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));
- fileBuffer.append("} ;");
- }
- }
-
- /**
- LibInstanceToAutogenC
-
- This function adds dependent library instance to autogen.c,which
- includeing library's constructor, destructor, and library dependent ppi,
- protocol, guid, pcd information.
-
- @param fileBuffer
- String buffer for AutoGen.c
- @throws BuildException
- **/
- void LibInstanceToAutogenC(StringBuffer fileBuffer) throws EdkException {
- String moduleType = this.moduleId.getModuleType();
- //
- // Add library constructor to AutoGen.c
- //
- LibConstructorToAutogenC(libConstructList, moduleType, fileBuffer);
- //
- // Add library destructor to AutoGen.c
- //
- LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer);
- }
-
- /**
- LibConstructorToAutogenH
-
- This function writes library constructor declarations AutoGen.h. The library
- constructor's parameter and return value depend on module type.
-
- @param libInstanceList
- List of library construct name.
- @param moduleType
- Module type.
- @param fileBuffer
- String buffer for AutoGen.c
- @throws Exception
- **/
- void LibConstructorToAutogenH(String moduleType) throws EdkException {
- boolean isFirst = true;
-
- //
- // If not yet parse this library instance's constructor
- // element,parse it.
- //
- String libConstructName = saq.getLibConstructorName();
- if (libConstructName == null) {
- return;
- }
-
- //
- // The library constructor's parameter and return value depend on
- // module type.
- //
- if (moduleType.equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
- functionDeclarations.append("RETURN_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libConstructName);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" VOID\r\n");
- functionDeclarations.append(" );\r\n");
- } else {
- switch (CommonDefinition.getModuleType(moduleType)) {
- case CommonDefinition.ModuleTypeBase:
- functionDeclarations.append("RETURN_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libConstructName);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" VOID\r\n");
- functionDeclarations.append(" );\r\n");
- break;
-
- case CommonDefinition.ModuleTypePeiCore:
- case CommonDefinition.ModuleTypePeim:
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libConstructName);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
- functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
- functionDeclarations.append(" );\r\n");
- break;
-
- case CommonDefinition.ModuleTypeDxeCore:
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libConstructName);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");
- functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- functionDeclarations.append(" );\r\n");
- break;
-
- }
- }
- }
-
- /**
- LibDestructorToAutogenH
-
- This function writes library destructor declarations AutoGen.h. The library
- destructor's parameter and return value depend on module type.
-
- @param libInstanceList
- List of library destructor name.
- @param moduleType
- Module type.
- @param fileBuffer
- String buffer for AutoGen.c
- @throws Exception
- **/
- void LibDestructorToAutogenH(String moduleType) throws EdkException {
- boolean isFirst = true;
- String libDestructName = saq.getLibDestructorName();
- if (libDestructName == null) {
- return;
- }
-
- if (moduleType.equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
- functionDeclarations.append("RETURN_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libDestructName);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" VOID\r\n");
- functionDeclarations.append(" );\r\n");
- } else {
- switch (CommonDefinition.getModuleType(moduleType)) {
- case CommonDefinition.ModuleTypeBase:
- functionDeclarations.append("RETURN_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libDestructName);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" VOID\r\n");
- functionDeclarations.append(" );\r\n");
- break;
- case CommonDefinition.ModuleTypePeiCore:
- case CommonDefinition.ModuleTypePeim:
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libDestructName);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
- functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
- functionDeclarations.append(" );\r\n");
- break;
- case CommonDefinition.ModuleTypeDxeCore:
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libDestructName);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");
- functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- functionDeclarations.append(" );\r\n");
- break;
- }
- }
- }
-
- /**
- LibConstructorToAutogenc
-
- This function writes library constructor list to AutoGen.c. The library
- constructor's parameter and return value depend on module type.
-
- @param libInstanceList
- List of library construct name.
- @param moduleType
- Module type.
- @param fileBuffer
- String buffer for AutoGen.c
- @throws Exception
- **/
- void LibConstructorToAutogenC(List<String[]> libInstanceList,
- String moduleType, StringBuffer fileBuffer) throws EdkException {
- boolean isFirst = true;
-
- //
- // The library constructor's parameter and return value depend on
- // module type.
- //
- for (int i = 0; i < libInstanceList.size(); i++) {
- if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
- functionDeclarations.append("RETURN_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libInstanceList.get(i)[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" VOID\r\n");
- functionDeclarations.append(" );\r\n");
- } else {
- switch (CommonDefinition.getModuleType(moduleType)) {
- case CommonDefinition.ModuleTypeBase:
- functionDeclarations.append("RETURN_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libInstanceList.get(i)[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" VOID\r\n");
- functionDeclarations.append(" );\r\n");
- break;
-
- case CommonDefinition.ModuleTypePeiCore:
- case CommonDefinition.ModuleTypePeim:
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libInstanceList.get(i)[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
- functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
- functionDeclarations.append(" );\r\n");
- break;
-
- case CommonDefinition.ModuleTypeDxeCore:
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libInstanceList.get(i)[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");
- functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- functionDeclarations.append(" );\r\n");
- break;
-
- }
- }
- }
-
- //
- // Add ProcessLibraryConstructorList in AutoGen.c
- //
- fileBuffer.append("VOID\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessLibraryConstructorList (\r\n");
- switch (CommonDefinition.getModuleType(moduleType)) {
- case CommonDefinition.ModuleTypeBase:
- fileBuffer.append(" VOID\r\n");
- break;
-
- case CommonDefinition.ModuleTypePeiCore:
- case CommonDefinition.ModuleTypePeim:
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
- break;
-
- case CommonDefinition.ModuleTypeDxeCore:
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- break;
- }
-
- fileBuffer.append(" )\r\n");
- fileBuffer.append("{\r\n");
- //
- // If no constructor function, return EFI_SUCCESS.
- //
- for (int i = 0; i < libInstanceList.size(); i++) {
- if (isFirst) {
- fileBuffer.append(" EFI_STATUS Status;\r\n");
- fileBuffer.append(" Status = EFI_SUCCESS;\r\n");
- fileBuffer.append("\r\n");
- isFirst = false;
- }
- if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
- fileBuffer.append(" Status = ");
- fileBuffer.append(libInstanceList.get(i)[0]);
- fileBuffer.append("();\r\n");
- } else {
- switch (CommonDefinition.getModuleType(moduleType)) {
- case CommonDefinition.ModuleTypeBase:
- fileBuffer.append(" Status = ");
- fileBuffer.append(libInstanceList.get(i)[0]);
- fileBuffer.append("();\r\n");
- break;
- case CommonDefinition.ModuleTypePeiCore:
- case CommonDefinition.ModuleTypePeim:
- fileBuffer.append(" Status = ");
- fileBuffer.append(libInstanceList.get(i)[0]);
- fileBuffer.append(" (FfsHeader, PeiServices);\r\n");
- break;
- case CommonDefinition.ModuleTypeDxeCore:
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- fileBuffer.append(" Status = ");
- fileBuffer.append(libInstanceList.get(i)[0]);
- fileBuffer.append(" (ImageHandle, SystemTable);\r\n");
- break;
- default:
- EdkLog.log(EdkLog.EDK_INFO,"Autogen doesn't know how to deal with module type - " + moduleType + "!");
- }
-
- }
- fileBuffer.append(" ASSERT_EFI_ERROR (Status);\r\n");
- }
- fileBuffer.append("}\r\n");
- }
-
- /**
- LibDestructorToAutogenc
-
- This function writes library destructor list to AutoGen.c. The library
- destructor's parameter and return value depend on module type.
-
- @param libInstanceList
- List of library destructor name.
- @param moduleType
- Module type.
- @param fileBuffer
- String buffer for AutoGen.c
- @throws Exception
- **/
- void LibDestructorToAutogenC(List<String[]> libInstanceList,
- String moduleType, StringBuffer fileBuffer) throws EdkException {
- boolean isFirst = true;
- for (int i = 0; i < libInstanceList.size(); i++) {
- if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
- functionDeclarations.append("RETURN_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libInstanceList.get(i)[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" VOID\r\n");
- functionDeclarations.append(" );\r\n");
- } else {
- switch (CommonDefinition.getModuleType(moduleType)) {
- case CommonDefinition.ModuleTypeBase:
- functionDeclarations.append("RETURN_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libInstanceList.get(i)[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" VOID\r\n");
- functionDeclarations.append(" );\r\n");
- break;
- case CommonDefinition.ModuleTypePeiCore:
- case CommonDefinition.ModuleTypePeim:
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libInstanceList.get(i)[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
- functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
- functionDeclarations.append(" );\r\n");
- break;
- case CommonDefinition.ModuleTypeDxeCore:
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- functionDeclarations.append("EFI_STATUS\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(libInstanceList.get(i)[0]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");
- functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- functionDeclarations.append(" );\r\n");
- break;
- }
- }
- }
-
- //
- // Write ProcessLibraryDestructor list to autogen.c
- //
- switch (CommonDefinition.getModuleType(moduleType)) {
- case CommonDefinition.ModuleTypeBase:
- case CommonDefinition.ModuleTypePeiCore:
- case CommonDefinition.ModuleTypePeim:
- break;
- case CommonDefinition.ModuleTypeDxeCore:
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSmmDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- fileBuffer.append("VOID\r\n");
- fileBuffer.append("EFIAPI\r\n");
- fileBuffer.append("ProcessLibraryDestructorList (\r\n");
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
- fileBuffer.append(" )\r\n");
- fileBuffer.append("{\r\n");
- //
- // If no library destructor function, return EFI_SUCCESS.
- //
-
- for (int i = 0; i < libInstanceList.size(); i++) {
- if (isFirst) {
- fileBuffer.append(" EFI_STATUS Status;\r\n");
- fileBuffer.append(" Status = EFI_SUCCESS;\r\n");
- fileBuffer.append("\r\n");
- isFirst = false;
- }
- if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
- fileBuffer.append(" Status = ");
- fileBuffer.append(libInstanceList.get(i)[0]);
- fileBuffer.append("();\r\n");
- fileBuffer.append(" VOID\r\n");
- } else {
- fileBuffer.append(" Status = ");
- fileBuffer.append(libInstanceList.get(i)[0]);
- fileBuffer.append("(ImageHandle, SystemTable);\r\n");
- fileBuffer.append(" ASSERT_EFI_ERROR (Status);\r\n");
- }
- }
- fileBuffer.append("}\r\n");
- break;
- }
- }
-
- /**
- ExternsDriverBindingToAutoGenC
-
- This function is to write DRIVER_BINDING, COMPONENT_NAME,
- DRIVER_CONFIGURATION, DRIVER_DIAGNOSTIC in AutoGen.c.
-
- @param fileBuffer
- String buffer for AutoGen.c
- **/
- void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer)
- throws EdkException {
- //
- // Get the arry of extern. The driverBindingGroup is a 2 dimension array.
- // The second dimension is include following element: DriverBinding,
- // ComponentName, DriverConfiguration, DriverDiag;
- //
- String[][] driverBindingGroup = this.saq.getExternProtocolGroup();
-
-
- //
- // inital BitMask;
- //
- int BitMask = 0;
-
- //
- // Write driver binding protocol extern to autogen.c
- //
- for (int i = 0; i < driverBindingGroup.length; i++) {
- if (driverBindingGroup[i][0] != null) {
- globalDeclarations.append("extern EFI_DRIVER_BINDING_PROTOCOL ");
- globalDeclarations.append(driverBindingGroup[i][0]);
- globalDeclarations.append(";\r\n");
- }
- }
-
- //
- // Write component name protocol extern to autogen.c
- //
- if (!componentNamePcd) {
- for (int i = 0; i < driverBindingGroup.length; i++) {
- if (driverBindingGroup[i][1]!= null) {
- if (driverBindingGroup[i][0] != null) {
- BitMask |= 0x01;
- globalDeclarations.append("extern EFI_COMPONENT_NAME_PROTOCOL ");
- globalDeclarations.append(driverBindingGroup[i][1]);
- globalDeclarations.append(";\r\n");
- } else {
- throw new AutoGenException("DriverBinding can't be empty!!");
- }
- }
- }
- }
-
- //
- // Write driver configration protocol extern to autogen.c
- //
- for (int i = 0; i < driverBindingGroup.length; i++) {
- if (driverBindingGroup[i][2] != null) {
- if (driverBindingGroup[i][0] != null) {
- BitMask |= 0x02;
- globalDeclarations.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");
- globalDeclarations.append(driverBindingGroup[i][2]);
- globalDeclarations.append(";\r\n");
- } else {
- throw new AutoGenException("DriverBinding can't be empty!!");
- }
- }
- }
-
- //
- // Write driver dignastic protocol extern to autogen.c
- //
- if (!driverDiagnostPcd) {
- for (int i = 0; i < driverBindingGroup.length; i++) {
- if (driverBindingGroup[i][3] != null) {
- if (driverBindingGroup[i][0] != null) {
- BitMask |= 0x04;
- globalDeclarations.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");
- globalDeclarations.append(driverBindingGroup[i][3]);
- globalDeclarations.append(";\r\n");
- } else {
- throw new AutoGenException("DriverBinding can't be empty!!");
- }
- }
- }
- }
-
-
- //
- // Write driver module protocol bitmask.
- //
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverModelProtocolBitmask = ");
- fileBuffer.append(Integer.toString(BitMask));
- fileBuffer.append(";\r\n");
-
- //
- // Write driver module protocol list entry
- //
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = ");
-
- fileBuffer.append(Integer.toString(driverBindingGroup.length));
- fileBuffer.append(";\r\n");
-
- //
- // Write drive module protocol list to autogen.c
- //
- if (driverBindingGroup.length > 0) {
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {");
- }
-
-
- for (int i = 0; i < driverBindingGroup.length; i++) {
- if (i != 0) {
- fileBuffer.append(",");
- }
- //
- // DriverBinding
- //
- fileBuffer.append("\r\n {\r\n");
- fileBuffer.append(" &");
- fileBuffer.append(driverBindingGroup[i][0]);
- fileBuffer.append(", \r\n");
-
- //
- // ComponentName
- //
- if (driverBindingGroup[i][1] != null && componentNamePcd != true) {
- fileBuffer.append(" &");
- fileBuffer.append(driverBindingGroup[i][1]);
- fileBuffer.append(", \r\n");
- } else {
- fileBuffer.append(" NULL, \r\n");
- }
-
- //
- // DriverConfiguration
- //
- if (driverBindingGroup[i][2] != null) {
- fileBuffer.append(" &");
- fileBuffer.append(driverBindingGroup[i][2]);
- fileBuffer.append(", \r\n");
- } else {
- fileBuffer.append(" NULL, \r\n");
- }
-
- //
- // DriverDiagnostic
- //
- if (driverBindingGroup[i][3] != null && driverDiagnostPcd != true) {
- fileBuffer.append(" &");
- fileBuffer.append(driverBindingGroup[i][3]);
- fileBuffer.append(", \r\n");
- } else {
- fileBuffer.append(" NULL, \r\n");
- }
- fileBuffer.append(" }");
- }
-
- if (driverBindingGroup.length > 0) {
- fileBuffer.append("\r\n};\r\n");
- }
- }
-
- /**
- ExternCallBackToAutoGenC
-
- This function adds <SetVirtualAddressMapCallBack> and
- <ExitBootServicesCallBack> infomation to AutoGen.c
-
- @param fileBuffer
- String buffer for AutoGen.c
- @throws BuildException
- **/
- void ExternCallBackToAutoGenH(String moduleType)
- throws EdkException {
- //
- // Collect module's <SetVirtualAddressMapCallBack> and
- // <ExitBootServiceCallBack> and add to setVirtualAddList
- // exitBootServiceList.
- //
- String[] setVirtuals = saq.getSetVirtualAddressMapCallBackArray();
- String[] exitBoots = saq.getExitBootServicesCallBackArray();
- //
- // Add c code in autogen.c which relate to <SetVirtualAddressMapCallBack>
- // and <ExitBootServicesCallBack>
- //
- switch (CommonDefinition.getModuleType(moduleType)) {
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- //
- // Write SetVirtualAddressMap function definition.
- //
- for (int i = 0; setVirtuals != null && i < setVirtuals.length; i++) {
- if (setVirtuals[i].equalsIgnoreCase("")) {
- continue;
- }
- functionDeclarations.append("VOID\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(setVirtuals[i]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_EVENT Event,\r\n");
- functionDeclarations.append(" IN VOID *Context\r\n");
- functionDeclarations.append(" );\r\n\r\n");
- }
-
- //
- // Write DriverExitBootServices function definition.
- //
- for (int i = 0; exitBoots != null && i < exitBoots.length; i++) {
- if (exitBoots[i].equalsIgnoreCase("")) {
- continue;
- }
-
- functionDeclarations.append("VOID\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(exitBoots[i]);
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_EVENT Event,\r\n");
- functionDeclarations.append(" IN VOID *Context\r\n");
- functionDeclarations.append(" );\r\n\r\n");
- }
- break;
- default:
- break;
- }
- }
-
- /**
- ExternCallBackToAutoGenC
-
- This function adds <SetVirtualAddressMapCallBack> and
- <ExitBootServicesCallBack> infomation to AutoGen.c
-
- @param fileBuffer
- String buffer for AutoGen.c
- @throws BuildException
- **/
- void ExternCallBackToAutoGenC(StringBuffer fileBuffer)
- throws EdkException {
- //
- // Collect module's <SetVirtualAddressMapCallBack> and
- // <ExitBootServiceCallBack> and add to setVirtualAddList
- // exitBootServiceList.
- //
- String[] setVirtuals = saq.getSetVirtualAddressMapCallBackArray();
- String[] exitBoots = saq.getExitBootServicesCallBackArray();
- if (setVirtuals != null) {
- for (int j = 0; j < setVirtuals.length; j++) {
- this.setVirtalAddList.add(setVirtuals[j]);
- }
- }
- if (exitBoots != null) {
- for (int k = 0; k < exitBoots.length; k++) {
- this.exitBootServiceList.add(exitBoots[k]);
- }
- }
- //
- // Add c code in autogen.c which relate to <SetVirtualAddressMapCallBack>
- // and <ExitBootServicesCallBack>
- //
- String moduleType = this.moduleId.getModuleType();
- switch (CommonDefinition.getModuleType(moduleType)) {
- case CommonDefinition.ModuleTypeDxeDriver:
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:
- case CommonDefinition.ModuleTypeDxeSalDriver:
- case CommonDefinition.ModuleTypeUefiDriver:
- case CommonDefinition.ModuleTypeUefiApplication:
- //
- // If moduleType is one of above, call setVirtualAddressToAutogenC,
- // and setExitBootServiceToAutogenC.
- //
- setVirtualAddressToAutogenC(fileBuffer);
- setExitBootServiceToAutogenC(fileBuffer);
- break;
- default:
- break;
- }
- }
-
- /**
- copyFlashMapHToDebugDir
-
- This function is to copy the falshmap.h to debug directory and change
- its name to TianoR8FlashMap.h
-
- @param
- @return
- **/
- private void copyFlashMapHToDebugDir() throws AutoGenException{
-
- File inFile = new File(fvDir + File.separatorChar + CommonDefinition.FLASHMAPH);
- int size = (int)inFile.length();
- byte[] buffer = new byte[size];
- File outFile = new File (this.outputPath + File.separatorChar + CommonDefinition.TIANOR8PLASHMAPH);
- //
- // If TianoR8FlashMap.h existed and the flashMap.h don't change,
- // do nothing.
- //
- if ((!outFile.exists()) ||(inFile.lastModified() - outFile.lastModified()) >= 0) {
- if (inFile.exists()) {
- try {
- FileInputStream fis = new FileInputStream (inFile);
- fis.read(buffer);
- FileOutputStream fos = new FileOutputStream(outFile);
- fos.write(buffer);
- fis.close();
- fos.close();
- } catch (IOException e) {
- throw new AutoGenException("The file, flashMap.h can't be open!");
- }
-
- } else {
- throw new AutoGenException("The file, flashMap.h doesn't exist!");
- }
- }
- }
-
- /**
- This function first order the library instances, then collect
- library instance 's PPI, Protocol, GUID,
- SetVirtalAddressMapCallBack, ExitBootServiceCallBack, and
- Destructor, Constructor.
-
- @param
- @return
- **/
- private void collectLibInstanceInfo() throws EdkException{
- int index;
-
- String moduleType = moduleId.getModuleType();
- String libConstructName = null;
- String libDestructName = null;
- String libModuleType = null;
- String[] setVirtuals = null;
- String[] exitBoots = null;
-
- ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);
- if (libraryIdList.length <= 0) {
- return;
- }
- //
- // Reorder library instance sequence.
- //
- AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList, this.arch);
- List<ModuleIdentification> orderList = libOrder.orderLibInstance();
- //
- // Process library instance one by one.
- //
- for (int i = 0; i < orderList.size(); i++) {
- //
- // Get library instance basename.
- //
- ModuleIdentification libInstanceId = orderList.get(i);
-
- //
- // Get override map
- //
-
- Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);
- saq.push(libDoc);
- //
- // check if the library instance support current module
- //
- String[] libraryClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED,
- this.arch,
- moduleType
- );
- if (libraryClassList.length <= 0) {
- throw new EdkException("Library instance " + libInstanceId.getName()
- + " doesn't support module type " + moduleType);
- }
- //
- // Get CName list from <PPis>, <Protocols>, <Guids>, etc. of this library
- // instance.
- //
- String[] guidCNameList = saq.getCNameArray(this.arch);
- PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);
-
- //
- // Add those ppi, protocol, guid in global ppi,
- // protocol, guid
- // list.
- //
- for (index = 0; index < guidCNameList.length; index++) {
- this.mGuidCNameList.add(guidCNameList[index]);
- }
-
- for (index = 0; index < pkgList.length; index++) {
- if (!this.mDepPkgList.contains(pkgList[index])) {
- this.mDepPkgList.add(pkgList[index]);
- }
- }
-
- //
- // If not yet parse this library instance's constructor
- // element,parse it.
- //
- libConstructName = saq.getLibConstructorName();
- libDestructName = saq.getLibDestructorName();
- libModuleType = saq.getModuleType();
-
- //
- // Collect SetVirtualAddressMapCallBack and
- // ExitBootServiceCallBack.
- //
- setVirtuals = saq.getSetVirtualAddressMapCallBackArray();
- exitBoots = saq.getExitBootServicesCallBackArray();
- if (setVirtuals != null) {
- for (int j = 0; j < setVirtuals.length; j++) {
- this.setVirtalAddList.add(setVirtuals[j]);
- }
- }
- if (exitBoots != null) {
- for (int k = 0; k < exitBoots.length; k++) {
- this.exitBootServiceList.add(exitBoots[k]);
- }
- }
- saq.pop();
- //
- // Add dependent library instance constructor function.
- //
- if (libConstructName != null) {
- this.libConstructList.add(new String[] {libConstructName, libModuleType});
- }
- //
- // Add dependent library instance destructor fuction.
- //
- if (libDestructName != null) {
- this.libDestructList.add(new String[] {libDestructName, libModuleType});
- }
- }
- }
-
- private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){
- //
- // Entry point lib for these module types needs to know the count
- // of entryPoint.
- //
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverSetVirtualAddressMapEventCount = ");
-
- //
- // If the list is not valid or has no entries set count to zero else
- // set count to the number of valid entries
- //
- int Count = 0;
- int i = 0;
- if (this.setVirtalAddList != null) {
- for (i = 0; i < this.setVirtalAddList.size(); i++) {
- if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {
- break;
- }
- }
- Count = i;
- }
-
- fileBuffer.append(Integer.toString(Count));
- fileBuffer.append(";\r\n\r\n");
- if (this.setVirtalAddList == null || this.setVirtalAddList.size() == 0) {
- //
- // No data so make a NULL list
- //
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {\r\n");
- fileBuffer.append(" NULL\r\n");
- fileBuffer.append("};\r\n\r\n");
- } else {
- //
- // Write SetVirtualAddressMap function definition.
- //
- for (i = 0; i < this.setVirtalAddList.size(); i++) {
- if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {
- break;
- }
- functionDeclarations.append("VOID\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(this.setVirtalAddList.get(i));
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_EVENT Event,\r\n");
- functionDeclarations.append(" IN VOID *Context\r\n");
- functionDeclarations.append(" );\r\n\r\n");
- }
-
- //
- // Write SetVirtualAddressMap entry point array.
- //
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {");
- for (i = 0; i < this.setVirtalAddList.size(); i++) {
- if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {
- break;
- }
-
- if (i == 0) {
- fileBuffer.append("\r\n ");
- } else {
- fileBuffer.append(",\r\n ");
- }
-
- fileBuffer.append(this.setVirtalAddList.get(i));
- }
- //
- // add the NULL at the end of _gDriverSetVirtualAddressMapEvent list.
- //
- fileBuffer.append(",\r\n NULL");
- fileBuffer.append("\r\n};\r\n\r\n");
- }
- }
-
-
- private void setExitBootServiceToAutogenC(StringBuffer fileBuffer){
- //
- // Entry point lib for these module types needs to know the count.
- //
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverExitBootServicesEventCount = ");
-
- //
- // If the list is not valid or has no entries set count to zero else
- // set count to the number of valid entries.
- //
- int Count = 0;
- int i = 0;
- if (this.exitBootServiceList != null) {
- for (i = 0; i < this.exitBootServiceList.size(); i++) {
- if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {
- break;
- }
- }
- Count = i;
- }
- fileBuffer.append(Integer.toString(Count));
- fileBuffer.append(";\r\n\r\n");
-
- if (this.exitBootServiceList == null || this.exitBootServiceList.size() == 0) {
- //
- // No data so make a NULL list.
- //
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {\r\n");
- fileBuffer.append(" NULL\r\n");
- fileBuffer.append("};\r\n\r\n");
- } else {
- //
- // Write DriverExitBootServices function definition.
- //
- for (i = 0; i < this.exitBootServiceList.size(); i++) {
- if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {
- break;
- }
-
- functionDeclarations.append("VOID\r\n");
- functionDeclarations.append("EFIAPI\r\n");
- functionDeclarations.append(this.exitBootServiceList.get(i));
- functionDeclarations.append(" (\r\n");
- functionDeclarations.append(" IN EFI_EVENT Event,\r\n");
- functionDeclarations.append(" IN VOID *Context\r\n");
- functionDeclarations.append(" );\r\n\r\n");
- }
-
- //
- // Write DriverExitBootServices entry point array.
- //
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {");
- for (i = 0; i < this.exitBootServiceList.size(); i++) {
- if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {
- break;
- }
-
- if (i == 0) {
- fileBuffer.append("\r\n ");
- } else {
- fileBuffer.append(",\r\n ");
- }
- fileBuffer.append(this.exitBootServiceList.get(i));
- }
-
- fileBuffer.append(",\r\n NULL");
- fileBuffer.append("\r\n};\r\n\r\n");
- }
- }
- /**
- setPcdComponentName
-
- Get the Pcd Value of ComponentName to
- decide whether need to disable the componentName.
-
- **/
- public void setPcdComponentName (){
- String pcdValue = null;
- pcdValue = saq.getPcdValueBycName("PcdComponentNameDisable");
- if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {
- this.componentNamePcd = true;
- }
- }
-
- /**
- setPcdDriverDiagnostic
-
- Get the Pcd Value of DriverDiagnostic to
- decide whether need to disable DriverDiagnostic.
-
- **/
- public void setPcdDriverDiagnostic (){
- String pcdValue = null;
- pcdValue = saq.getPcdValueBycName("PcdDriverDiagnosticsDisable");
- if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {
- this.driverDiagnostPcd = true;
- }
- }
-
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java
deleted file mode 100644
index a131b89cc8..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/**@file
- AutogenLibOrder class.
-
- This class is to reorder library instance sequence according to library
- dependence.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.build.autogen;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.HashSet;
-
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.build.exception.AutoGenException;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.global.SurfaceAreaQuery;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.common.exception.EdkException;
-import org.tianocore.common.logger.EdkLog;
-/**
- This class This class is to reorder library instance sequence according to
- library dependence.
-**/
-public class AutogenLibOrder {
- ///
- /// The map of library class and its library instance.
- ///
- private Map<String, ModuleIdentification> libClassProducer = new HashMap<String, ModuleIdentification>();
-
- ///
- /// The map of library instance and its consumed Library Classes.
- ///
- private Map<ModuleIdentification, String[]> libInstanceConsumes = new HashMap<ModuleIdentification, String[]>();
-
- ///
- /// The map of library instance and its implemeted Library Classes.
- ///
- private Map<ModuleIdentification, String[]> libInstanceProduces = new HashMap<ModuleIdentification, String[]>();
-
- ///
- /// The map of library instance and its consumers.
- ///
- private Map<ModuleIdentification, HashSet<ModuleIdentification>> libInstanceConsumedBy = new HashMap<ModuleIdentification, HashSet<ModuleIdentification>>();
-
- ///
- /// List of library instance. It is String[3] list, String[0] is libraryName,
- /// String[1] is libraryConstructor name, String[2] is libDestructor name.
- ///
- private ModuleIdentification[] libInstanceList = null;
-
- /**
- Constructor function
-
- This function mainly initialize some member variable.
-
- @param libraryList List of the library instance.
- @throws Exception
- **/
- AutogenLibOrder(ModuleIdentification[] libraryList, String arch) throws EdkException {
- ModuleIdentification libInstance;
- String[] libClassDeclList = null;
- String[] libClassConsmList = null;
-
- libInstanceList = libraryList;
- for (int i = 0; i < libraryList.length; i++) {
- libInstance = libraryList[i];
- //
- // Fetch the constructor & destructor.
- //
- Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstance, arch);
- SurfaceAreaQuery saq = new SurfaceAreaQuery(libDoc);
- libInstance.setConstructor(saq.getLibConstructorName());
- libInstance.setDestructor(saq.getLibDestructorName());
-
- //
- // Create library class consume database.
- //
- libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch, null);
- if (libClassConsmList != null) {
- if (this.libInstanceConsumes.containsKey(libInstance)) {
- throw new AutoGenException(
- libraryList[i].getName()
- + "-- this library instance already exists, please check the library instance list!");
- } else {
- this.libInstanceConsumes.put(libInstance, libClassConsmList);
- }
- }
-
- //
- // Create library class implementer database
- //
- libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch, null);
- if (libClassDeclList != null) {
- this.libInstanceProduces.put(libInstance, libClassDeclList);
- for (int j = 0; j < libClassDeclList.length; j++) {
- if (this.libClassProducer.containsKey(libClassDeclList[j])) {
- EdkLog.log(EdkLog.EDK_ERROR,libClassDeclList[j]
- + " class is already implemented by "
- + this.libClassProducer.get(libClassDeclList[j]));
- throw new AutoGenException("Library Class: " + libClassDeclList
- + " already has a library instance!");
- } else {
- this.libClassProducer.put(libClassDeclList[j], libInstance);
- }
- }
- }
- }
-
- //
- // Create a consumed-by database
- //
- for (Iterator it = libClassProducer.keySet().iterator(); it.hasNext();) {
- String className = (String)it.next();
- libInstance = libClassProducer.get(className);
- libInstanceConsumedBy.put(libInstance, new HashSet<ModuleIdentification>());
-
- for (int k = 0; k < libraryList.length; ++k) {
- ModuleIdentification consumer = libraryList[k];
- String[] consumedClassList = libInstanceConsumes.get(consumer);
-
- for (int l = 0; l < consumedClassList.length; ++l) {
- if (consumedClassList[l].equals(className)) {
- libInstanceConsumedBy.get(libInstance).add(consumer);
- }
- }
- }
- }
- }
-
- /**
- orderLibInstance
-
- This function reorder the library instance according the library class
- dependency, using DAG anaylysis algothim
-
- @return List which content the ordered library instance.
- **/
- List<ModuleIdentification> orderLibInstance() throws EdkException {
- LinkedList<ModuleIdentification> orderList = new LinkedList<ModuleIdentification>();
- LinkedList<ModuleIdentification> noConsumerList = new LinkedList<ModuleIdentification>();
-
- //
- // First, add the library instance without consumers to the Q
- //
- for (int i = 0; i < libInstanceList.length; ++i) {
- if (libInstanceList[i] == null) {
- continue;
- }
-
- if (libInstanceConsumedBy.get(libInstanceList[i]) == null || libInstanceConsumedBy.get(libInstanceList[i]).size() == 0) {
- noConsumerList.add(libInstanceList[i]);
- }
- }
-
- while (noConsumerList.size() > 0) {
- ModuleIdentification n = noConsumerList.poll();
- orderList.addFirst(n);
-
- String[] consumedClassList = libInstanceConsumes.get(n);
- for (int i = 0; i < consumedClassList.length; ++i) {
- ModuleIdentification m = libClassProducer.get(consumedClassList[i]);
- if (m == null) {
- continue;
- }
- HashSet<ModuleIdentification> consumedBy = libInstanceConsumedBy.get(m);
- if (consumedBy == null || consumedBy.size() == 0) {
- continue;
- }
-
- consumedBy.remove(n);
- if (consumedBy.size() == 0) {
- noConsumerList.addLast(m);
- }
- }
-
- boolean circularlyConsumed = false;
- while (noConsumerList.size() == 0 && !circularlyConsumed) {
- circularlyConsumed = true;
- for (int i = 0; i < libInstanceList.length; ++i) {
- ModuleIdentification libInstance = libInstanceList[i];
- if (!libInstance.hasConstructor()) {
- continue;
- }
-
- HashSet<ModuleIdentification> consumedBy = libInstanceConsumedBy.get(libInstance);
- if (consumedBy == null || consumedBy.size() == 0) {
- continue;
- }
-
- ModuleIdentification[] consumedByList = consumedBy.toArray(new ModuleIdentification[consumedBy.size()]);
- for (int j = 0; j < consumedByList.length; ++j) {
- ModuleIdentification consumer = consumedByList[j];
- if (consumer.hasConstructor()) {
- continue;
- }
-
- //
- // if there's no constructor in the library instance's consumer,
- // remove it from the consumer list
- //
- consumedBy.remove(consumer);
- circularlyConsumed = false;
- if (consumedBy.size() == 0) {
- noConsumerList.addLast(libInstance);
- break;
- }
- }
-
- if (noConsumerList.size() > 0) {
- break;
- }
- }
-
- if (noConsumerList.size() == 0 && !circularlyConsumed) {
- break;
- }
- }
- }
-
- //
- // Append the remaining library instance to the end of sorted list
- //
- boolean HasError = false;
- for (int i = 0; i < libInstanceList.length; ++i) {
- HashSet<ModuleIdentification> consumedBy = libInstanceConsumedBy.get(libInstanceList[i]);
- if (consumedBy != null && consumedBy.size() > 0 && libInstanceList[i].hasConstructor()) {
- EdkLog.log(EdkLog.EDK_ERROR, libInstanceList[i].getName()
- + " with constructor has a circular dependency!");
- ModuleIdentification[] consumedByList = consumedBy.toArray(new ModuleIdentification[consumedBy.size()]);
- for (int j = 0; j < consumedByList.length; ++j) {
- EdkLog.log(EdkLog.EDK_ERROR, " consumed by " + consumedByList[j].getName());
- }
- HasError = true;
- }
-
- if (!orderList.contains(libInstanceList[i])) {
- orderList.add(libInstanceList[i]);
- }
- }
- if (HasError) {
- throw new AutoGenException("Circular dependency in library instances is found!");
- }
-
- return orderList;
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/CommonDefinition.java b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/CommonDefinition.java
deleted file mode 100644
index cb750ffd47..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/CommonDefinition.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/** @file
- CommonDefinition class.
-
- This class is to define some common marcos and funcions, which used by AutoGen.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.build.autogen;
-
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import org.tianocore.common.definitions.EdkDefinitions;
-import org.tianocore.common.definitions.ToolDefinitions;
-/**
- CommonDefinition
-
- This class is to define some common marcos, which used by AutoGen.
-
-**/
-public class CommonDefinition {
-
- ///
- /// final static string
- ///
- public final static String LIBRARY = "LIBRARY";
-
- public final static String AUTOGENHBEGIN = "extern int __make_me_compile_correctly;"
- + ToolDefinitions.LINE_SEPARATOR;
-
- public final static String INCLUDE = "#include";
-
- //public final static String DEBUGPROPERYMASK = "const UINT8 _gDebugPropertyMask "
- // + "= DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED"
- // + " | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED"
- // + " | DEBUG_PROPERTY_DEBUG_CODE_ENABLED;"
- // + ToolDefinitions.LINE_SEPARATOR;
-
- //public final static String DEFAULERROLEVEL = "const UINTN _gModuleDefaultErrorLevel"
- // + " = EFI_D_ERROR | EFI_D_LOAD;"
- // + ToolDefinitions.LINE_SEPARATOR;
-
-
- public final static String INCLUDEAUTOGENH = INCLUDE
- + " <AutoGen.h>"
- + ToolDefinitions.LINE_SEPARATOR;
-
- public final static String DEFINE = "#define ";
-
- public final static String GEFI = "gEfi";
-
- public final static String PRTOCOLGUID = "ProtocolGuid";
-
- public final static String PPIGUID = "PpiGuid";
-
- public final static String GUID = "Guid";
-
- public final static String TIANOR8PLASHMAPH = "TianoR8FlashMap.h";
-
- public final static String FLASHMAPH = "FlashMap.h";
-
- public final static String IFNDEF = "#ifndef ";
-
- public final static String AUTOGENH = "_AUTOGENH_";
-
-
- ///
- /// AutoGen.h and AutoGen.c file's header
- ///
- public final static String AUTOGENHNOTATION = "/**"
- + ToolDefinitions.LINE_SEPARATOR
- + " DO NOT EDIT"
- + ToolDefinitions.LINE_SEPARATOR
- + " FILE auto-generated by GenBuild tasks"
- + ToolDefinitions.LINE_SEPARATOR
- + " Module name:"
- + ToolDefinitions.LINE_SEPARATOR
- + " AutoGen.h"
- + ToolDefinitions.LINE_SEPARATOR
- + " Abstract:"
- + " Auto-generated AutoGen.h for building module or library."
- + ToolDefinitions.LINE_SEPARATOR
- + "**/"
- + ToolDefinitions.LINE_SEPARATOR
- + ToolDefinitions.LINE_SEPARATOR;
-
- public final static String AUTOGENCNOTATION = "/**"
- + ToolDefinitions.LINE_SEPARATOR
- + " DO NOT EDIT"
- + ToolDefinitions.LINE_SEPARATOR
- + " FILE auto-generated by GenBuild tasks"
- + ToolDefinitions.LINE_SEPARATOR
- + " Module name:"
- + ToolDefinitions.LINE_SEPARATOR
- + " AutoGen.c"
- + ToolDefinitions.LINE_SEPARATOR
- + " Abstract:"
- + " Auto-generated AutoGen.c for building module or library."
- + ToolDefinitions.LINE_SEPARATOR
- + "**/"
- + ToolDefinitions.LINE_SEPARATOR
- + ToolDefinitions.LINE_SEPARATOR;
-
- ///
- /// The defintions for identifying current module
- /// is PEI Pcd driver or Dxe Pcd driver.
- ///
- public static enum PCD_DRIVER_TYPE { NOT_PCD_DRIVER,
- PEI_PCD_DRIVER,
- DXE_PCD_DRIVER,
- UNKNOWN_PCD_DRIVER
- };
-
-
- ///
- /// module type
- ///
- public final static int ModuleTypeBase = 0;
- public final static int ModuleTypeSec = 1;
- public final static int ModuleTypePeiCore = 2;
- public final static int ModuleTypePeim = 3;
- public final static int ModuleTypeDxeCore = 4;
- public final static int ModuleTypeDxeDriver = 5;
- public final static int ModuleTypeDxeRuntimeDriver = 6;
- public final static int ModuleTypeDxeSmmDriver = 7;
- public final static int ModuleTypeDxeSalDriver = 8;
- public final static int ModuleTypeUefiDriver = 9;
- public final static int ModuleTypeUefiApplication = 10;
- public final static int ModuleTypeUnknown = 11;
-
- ///
- /// Usaged style
- ///
- public final static String ALWAYSCONSUMED = "ALWAYS_CONSUMED";
- public final static String ALWAYSPRODUCED = "ALWAYS_PRODUCED";
-
-
- public static class MyEnum {
- String moduleTypeStr;
- int type;
-
- MyEnum (String str, int type) {
- this.type = type;
- this.moduleTypeStr = str;
- }
-
- int ForInt(String str) {
- if (str.equals(this.moduleTypeStr)) {
- return this.type;
- } else
- return -1;
- }
- }
-
- ///
- /// Module type
- ///
- public static final MyEnum[] moduleEnum = new MyEnum[] {
- new MyEnum(EdkDefinitions.MODULE_TYPE_BASE, ModuleTypeBase),
- new MyEnum(EdkDefinitions.MODULE_TYPE_SEC, ModuleTypeSec),
- new MyEnum(EdkDefinitions.MODULE_TYPE_PEI_CORE, ModuleTypePeiCore),
- new MyEnum(EdkDefinitions.MODULE_TYPE_PEIM, ModuleTypePeim),
- new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_CORE, ModuleTypeDxeCore),
- new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_DRIVER, ModuleTypeDxeDriver),
- new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_RUNTIME_DRIVER, ModuleTypeDxeRuntimeDriver),
- new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_SAL_DRIVER, ModuleTypeDxeSalDriver),
- new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_SMM_DRIVER, ModuleTypeDxeSmmDriver),
- new MyEnum(EdkDefinitions.MODULE_TYPE_UEFI_DRIVER, ModuleTypeUefiDriver),
- new MyEnum(EdkDefinitions.MODULE_TYPE_UEFI_APPLICATION, ModuleTypeUefiApplication)};
-
- /**
- getModuleType
-
- This function get the module type value according module type string.
-
- @param moduleTypeStr String of modlue type.
- @return
- **/
- public static int getModuleType(String moduleTypeStr) {
- int returnValue = -1;
- for (int i = 0; i < CommonDefinition.moduleEnum.length; i++) {
- returnValue = CommonDefinition.moduleEnum[i].ForInt(moduleTypeStr);
- if (returnValue != -1) {
- return returnValue;
- }
- }
- return CommonDefinition.ModuleTypeUnknown;
- }
-
- /**
- formateGuidName
-
- This function is to formate GUID to ANSI c form.
-
- @param guidNameCon
- String of GUID.
- @return Formated GUID.
- **/
- public static String formatGuidName(String guidNameConv) {
- String[] strList;
- String guid = "";
- int index = 0;
- if (guidNameConv
- .matches("[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}")) {
- strList = guidNameConv.split("-");
- guid = "0x" + strList[0] + ", ";
- guid = guid + "0x" + strList[1] + ", ";
- guid = guid + "0x" + strList[2] + ", ";
- guid = guid + "{";
- guid = guid + "0x" + strList[3].substring(0, 2) + ", ";
- guid = guid + "0x" + strList[3].substring(2, 4);
-
- while (index < strList[4].length()) {
- guid = guid + ", ";
- guid = guid + "0x" + strList[4].substring(index, index + 2);
- index = index + 2;
- }
- guid = guid + "}";
- return guid;
- } else if (guidNameConv
- .matches("0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?")) {
- strList = guidNameConv.split(",");
-
- //
- // chang Microsoft specific form to ANSI c form
- //
- for (int i = 0; i < 3; i++) {
- guid = guid + strList[i] + ",";
- }
- guid = guid + "{";
-
- for (int i = 3; i < strList.length; i++) {
- if (i == strList.length - 1) {
- guid = guid + strList[i];
- } else {
- guid = guid + strList[i] + ",";
- }
- }
- guid = guid + "}";
- return guid;
- } else {
- System.out
- .println("Check GUID Value, It doesn't conform to the registry format specified in the schema!!!");
- return "0";
-
- }
- }
-
- /**
- Remove deuplicat string in list
-
- This function is to duplicat string in list
-
- @param String[]
- String list.
- @return String[] String list which remove the duplicate string.
- **/
- public static String[] remDupString (String[] orgList){
- Set<String> strList = new LinkedHashSet<String>();
- String[] desList ;
- if (orgList == null) {
- return new String[0];
- }
- for (int i = 0; i < orgList.length; i++) {
- strList.add(orgList[i]);
- }
- desList = new String[strList.size()];
- Iterator item = strList.iterator();
- int index = 0;
- while (item.hasNext()) {
- desList[index] = (String)item.next();
- index++;
- }
- return desList;
- }
-
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/AutoGenException.java b/Tools/Java/Source/GenBuild/org/tianocore/build/exception/AutoGenException.java
deleted file mode 100644
index 5db092be48..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/AutoGenException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
- AutoGenException class.
-
- The class handle the exception throwed by entity class.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.exception;
-
-
-/**
- The class handle the exception throwed by entity class.
-**/
-public class AutoGenException extends GenBuildException {
- static final long serialVersionUID = -8034897190740066939L;
- /**
- Constructure function
-
- @param expStr exception message string.
- **/
- public AutoGenException(String expStr) {
- super(expStr);
- }
-
- public AutoGenException() {
-
- }
-
- public AutoGenException(Exception e, String messsge){
- super(e, messsge);
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/GenBuildException.java b/Tools/Java/Source/GenBuild/org/tianocore/build/exception/GenBuildException.java
deleted file mode 100644
index b81d54cba2..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/GenBuildException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
- GenBuildException class.
-
- The class handle the exception throwed by entity class.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.exception;
-
-import org.tianocore.common.exception.EdkException;
-
-/**
- The class handle the exception throwed by entity class.
-**/
-public class GenBuildException extends EdkException {
- static final long serialVersionUID = -8034897190740066937L;
- /**
- Constructure function
-
- @param expStr exception message string.
- **/
- public GenBuildException(String expStr) {
- super(expStr);
- }
-
- public GenBuildException() {
- super();
- }
- public GenBuildException(Exception e, String message){
- super(e, message);
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/PcdAutogenException.java b/Tools/Java/Source/GenBuild/org/tianocore/build/exception/PcdAutogenException.java
deleted file mode 100644
index 3a3430c820..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/PcdAutogenException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/** @file
- AutoGenException class.
-
- The class handle the exception throwed by entity class.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.exception;
-
-/**
- The class handle the exception throwed by entity class.
-**/
-public class PcdAutogenException extends AutoGenException {
- static final long serialVersionUID = -8034897190740066936L;
- /**
- Constructure function
-
- @param expStr exception message string.
- **/
- public PcdAutogenException(String expStr) {
- super(expStr);
- }
-
- public PcdAutogenException() {
- super();
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/PlatformPcdPreprocessBuildException.java b/Tools/Java/Source/GenBuild/org/tianocore/build/exception/PlatformPcdPreprocessBuildException.java
deleted file mode 100644
index 6bf6110148..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/PlatformPcdPreprocessBuildException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
- PlatformPcdPreprocessBuildException class.
-
- The class handle the exception throwed by PlatformPcdPreprocessActionForBuilding class.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.exception;
-
-public class PlatformPcdPreprocessBuildException extends GenBuildException {
- /**
- serial version ID
- **/
- private static final long serialVersionUID = -1014589090055424954L;
-
- /**
- Constructure function
-
- @param expStr exception message string.
- **/
- public PlatformPcdPreprocessBuildException(String expStr) {
- super(expStr);
- }
-
- public PlatformPcdPreprocessBuildException() {
- super();
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/XmlParseException.java b/Tools/Java/Source/GenBuild/org/tianocore/build/exception/XmlParseException.java
deleted file mode 100644
index 44d3fdc389..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/exception/XmlParseException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/** @file
- XmlParseException class.
-
- The class handle the exception throwed by entity class.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.exception;
-
-/**
- The class handle the exception throwed by entity class.
-**/
-public class XmlParseException extends GenBuildException {
- static final long serialVersionUID = -8034897190740066934L;
- /**
- Constructure function
-
- @param expStr exception message string.
- **/
- public XmlParseException(String expStr) {
- super(expStr);
- }
-
- public XmlParseException() {
- super();
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java b/Tools/Java/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java
deleted file mode 100644
index ac930f1257..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/fpd/FpdParserForThread.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/** @file
- This file is ANT task FpdParserTask.
-
- Copyright (c) 2006, 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.
- **/
-package org.tianocore.build.fpd;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Ant;
-import org.apache.xmlbeans.XmlObject;
-
-import org.tianocore.build.global.GenBuildLogger;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.global.OutputManager;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.FrameworkBuildTask;
-import org.tianocore.build.GenBuildThread;
-import org.tianocore.common.exception.EdkException;
-import org.tianocore.common.logger.EdkLog;
-
-/**
-
- @since GenBuild 1.0
-**/
-public class FpdParserForThread extends FpdParserTask {
-
- public static Map<FpdModuleIdentification, GenBuildThread> allThreads = new LinkedHashMap<FpdModuleIdentification, GenBuildThread>();
-
- List<String> queueList = new ArrayList<String>();
-
- public final static Object deamonSemaphore = new Object();
-
- private final static Object countSemaphore = new Object();
-
- public static int STATUS_DEPENDENCY_NOT_READY = 1;
-
- public static int STATUS_DEPENDENCY_READY = 2;
-
- public static int STATUS_START_RUN = 3;
-
- public static int STATUS_END_RUN = 4;
-
- private int currentQueueCode = 0;
-
- public static int currentRunNumber = 0;
-
- public static int totalNumber = 0;
-
- public static int remainNumber = 0;
-
- public static ThreadGroup tg = new ThreadGroup("Framework");
-
- public static FpdModuleIdentification errorModule = null;
-
- /**
- Public construct method. It is necessary for ANT task.
- **/
- public FpdParserForThread() {
- }
-
- /**
-
-
- **/
- public void execute() throws BuildException {
-
- this.setTaskName(".........");
- //
- // Parse FPD file
- //
- parseFpdFile();
-
- //
- // Prepare BUILD_DIR
- //
- isUnified = OutputManager.getInstance().prepareBuildDir(getProject());
- String buildDir = getProject().getProperty("BUILD_DIR");
-
- //
- // For every Target and ToolChain
- //
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; i++) {
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j++) {
- //
- // Prepare FV_DIR
- //
- String ffsCommonDir = buildDir + File.separatorChar
- + targetList[i] + "_"
- + toolchainList[j];
- File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
- fvDir.mkdirs();
- getProject().setProperty("FV_DIR", fvDir.getPath().replaceAll("(\\\\)", "/"));
-
- //
- // Gen Fv.inf files
- //
- genFvInfFiles(ffsCommonDir);
- }
- }
-
- //
- // Gen build.xml
- //
- String platformBuildFile = buildDir + File.separatorChar + platformId.getName() + "_build.xml";
- PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, isUnified, saq, platformBuildFile, aprioriType);
- fileGenerator.genBuildFile();
-
- //
- // Prepare Queue
- //
- queueList.add("libqueue");
-
- String[] validFv = saq.getFpdValidImageNames();
-
- for (int i = 0; i < validFv.length; i++) {
- queueList.add(validFv[i]);
- }
-
- Iterator<String> fvsNameIter = fvs.keySet().iterator();
-
- while (fvsNameIter.hasNext()) {
- String fvName = fvsNameIter.next();
- if (!isContain(validFv, fvName)) {
- queueList.add(fvName);
- }
- }
-
- //
- // Ant call ${PLATFORM}_build.xml
- //
- Ant ant = new Ant();
- ant.setProject(getProject());
- ant.setAntfile(platformBuildFile);
- ant.setTarget("prebuild");
- ant.setInheritAll(true);
- ant.init();
- ant.execute();
-
- remainNumber = totalNumber = allThreads.size();
-
- EdkLog.log(this, EdkLog.EDK_ALWAYS, "Total thread number is " + totalNumber);
- GenBuildLogger.setCacheEnable(true);
- //
- // Waiting for all thread over, or time out
- //
- synchronized (deamonSemaphore) {
-
- while (true) {
- //
- // If all modules are already built
- //
- if (currentQueueCode >= queueList.size()) {
- break ;
- }
-
- int percentage = (totalNumber - remainNumber) * 100 / totalNumber;
- updateTaskName(percentage);
- EdkLog.log(this, EdkLog.EDK_ALWAYS, percentage + "% finished. Has built " + (totalNumber - remainNumber) + " modules of " + totalNumber + " total. ");
-
- Set<FpdModuleIdentification> currentQueueModules = fvs.get(queueList.get(currentQueueCode));
-
- if (currentQueueModules == null) {
- ++currentQueueCode;
- continue ;
- }
- Iterator<FpdModuleIdentification> currentIter = currentQueueModules.iterator();
-
- GenBuildThread a = null;
-
- boolean existNoneReady = false;
-
- while (currentIter.hasNext()) {
- GenBuildThread item = allThreads.get(currentIter.next());
- if (item.getStatus() == STATUS_DEPENDENCY_NOT_READY) {
- existNoneReady = true;
- } else if (item.getStatus() == STATUS_DEPENDENCY_READY) {
- a = item;
- addCount();
- a.start();
- if (currentRunNumber == FrameworkBuildTask.MAX_CONCURRENT_THREAD_NUMBER) {
- break ;
- }
- }
- }
-
- if (a != null) {
- //
- // Exist ready thread
- //
- EdkLog.log(this, EdkLog.EDK_DEBUG, "Exist ready thread");
-
- } else if (existNoneReady && currentRunNumber == 0) {
- //
- // No active thread, but still have dependency not read thread
- //
- throw new BuildException("Existing some modules can't resolve depedencies. ");
- } else if (!existNoneReady && currentRunNumber == 0) {
- //
- // Current queue build finish, move to next
- //
- EdkLog.log(this, EdkLog.EDK_DEBUG, "Current queue build finish, move to next");
- ++currentQueueCode;
- continue ;
- } else {
- //
- // active thread exist, but no ready thread
- //
- EdkLog.log(this, EdkLog.EDK_DEBUG, "Active thread exist, but no ready thread. Current running number is " + currentRunNumber);
- }
-
- try {
- deamonSemaphore.wait();
-
- //
- // if find error. Waiting running threads to finish
- //
- if (errorModule != null) {
- while (currentRunNumber > 0) {
- deamonSemaphore.wait();
- }
-
- GenBuildLogger.setCacheEnable(false);
-
- GenBuildLogger.flushErrorModuleLog(errorModule);
-
- EdkLog.flushLogToFile(new File(buildDir + File.separatorChar + "build.log"));
-
- throw new BuildException(errorModule + " build error. ");
- }
- } catch (InterruptedException ex) {
- BuildException e = new BuildException("Thread wait Error. \n" + ex.getMessage());
- e.setStackTrace(ex.getStackTrace());
- throw e;
- }
- }
- }
-
- GenBuildLogger.setCacheEnable(false);
- //
- // call fvs, postbuild
- //
- ant = new Ant();
- ant.setProject(getProject());
- ant.setAntfile(platformBuildFile);
- ant.setTarget("fvs");
- ant.setInheritAll(true);
- ant.init();
- ant.execute();
-
- ant = new Ant();
- ant.setProject(getProject());
- ant.setAntfile(platformBuildFile);
- ant.setTarget("postbuild");
- ant.setInheritAll(true);
- ant.init();
- ant.execute();
-
- EdkLog.flushLogToFile(new File(buildDir + File.separatorChar + "build.log"));
- }
-
-
- /**
- Parse all modules listed in FPD file.
- **/
- void parseModuleSAFiles() throws EdkException{
-
- Map<FpdModuleIdentification, Map<String, XmlObject>> moduleSAs = saq.getFpdModules();
-
- //
- // For every Module lists in FPD file.
- //
- Set<FpdModuleIdentification> keys = moduleSAs.keySet();
- Iterator<FpdModuleIdentification> iter = keys.iterator();
- while (iter.hasNext()) {
- FpdModuleIdentification fpdModuleId = iter.next();
-
- //
- // Generate GenBuildThread
- //
- GenBuildThread genBuildThread = new GenBuildThread(fpdModuleId.getModule(), fpdModuleId.getArch());
- genBuildThread.setParentModuleId(null);
- genBuildThread.setProject(getProject());
-
- Set<FpdModuleIdentification> dependencies = new LinkedHashSet<FpdModuleIdentification>();
-
- GlobalData.registerFpdModuleSA(fpdModuleId, moduleSAs.get(fpdModuleId));
-
- //
- // Add all dependent Library Instance
- //
- saq.push(GlobalData.getDoc(fpdModuleId));
-
- ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());
- saq.pop();
-
- for (int i = 0; i < libinstances.length; i++) {
- FpdModuleIdentification libFpdModuleId = new FpdModuleIdentification(libinstances[i], fpdModuleId.getArch());
- //
- // Add to dependencies
- //
- dependencies.add(libFpdModuleId);
-
- //
- // Create thread for library instances
- //
- GenBuildThread liBuildThread = new GenBuildThread(libinstances[i], fpdModuleId.getArch());
- liBuildThread.setParentModuleId(fpdModuleId.getModule());
- liBuildThread.setProject(getProject());
- liBuildThread.setStatus(STATUS_DEPENDENCY_READY);
- liBuildThread.setHighPriority(true);
- allThreads.put(libFpdModuleId, liBuildThread);
-
- updateFvs("libqueue", libFpdModuleId);
-
- saq.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));
- GlobalData.addMsaBuildOption(libinstances[i], parseMsaBuildOptions(false));
- GlobalData.addMsaFamilyBuildOption(libinstances[i], parseMsaBuildOptions(true));
- saq.pop();
- }
-
- genBuildThread.setDependencies(dependencies);
-
-// if (dependencies.size() == 0) {
- genBuildThread.setStatus(STATUS_DEPENDENCY_READY);
-// }
-
- allThreads.put(fpdModuleId, genBuildThread);
-
- //
- // Put fpdModuleId to the corresponding FV
- //
- saq.push(GlobalData.getDoc(fpdModuleId));
- String fvBinding = saq.getModuleFvBindingKeyword();
-
- fpdModuleId.setFvBinding(fvBinding);
- updateFvs(fvBinding, fpdModuleId);
-
- //
- // Prepare for out put file name
- //
- ModuleIdentification moduleId = fpdModuleId.getModule();
-
- String baseName = saq.getModuleOutputFileBasename();
-
- if (baseName == null) {
- baseName = moduleId.getName();
- }
- outfiles.put(fpdModuleId, fpdModuleId.getArch() + File.separatorChar
- + moduleId.getGuid() + "-" + baseName
- + getSuffix(moduleId.getModuleType()));
-
- //
- // parse module build options, if any
- //
- GlobalData.addModuleToolChainOption(fpdModuleId, parseModuleBuildOptions(false));
- GlobalData.addModuleToolChainFamilyOption(fpdModuleId, parseModuleBuildOptions(true));
-
- //
- // parse MSA build options
- //
- GlobalData.addMsaBuildOption(moduleId, parseMsaBuildOptions(false));
- GlobalData.addMsaFamilyBuildOption(moduleId, parseMsaBuildOptions(true));
-
- saq.pop();
- }
- }
-
- private boolean isContain(String[] list, String item) {
- for (int i = 0; i < list.length; i++) {
- if (list[i].equalsIgnoreCase(item)) {
- return true;
- }
- }
- return false;
- }
-
- public synchronized static void addCount() {
- synchronized (countSemaphore) {
- ++currentRunNumber;
- }
- }
-
- public synchronized static void subCount() {
- synchronized (countSemaphore) {
- --currentRunNumber;
- --remainNumber;
- }
- }
-
- private void updateTaskName(int percentage){
- int number = percentage/10;
- StringBuffer str = new StringBuffer(9);
- for(int i = 0; i < 9; i++) {
- if (i < number) {
- str.append('>');
- } else {
- str.append('.');
- }
- }
- this.setTaskName(str.toString());
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java b/Tools/Java/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
deleted file mode 100644
index 325dc437b6..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
+++ /dev/null
@@ -1,950 +0,0 @@
-/** @file
- This file is ANT task FpdParserTask.
-
- FpdParserTask is used to parse FPD (Framework Platform Description) and generate
- build.out.xml. It is for Package or Platform build use.
-
- Copyright (c) 2006, 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.
- **/
-package org.tianocore.build.fpd;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Ant;
-import org.apache.tools.ant.taskdefs.Property;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-
-import org.tianocore.common.definitions.EdkDefinitions;
-import org.tianocore.common.definitions.ToolDefinitions;
-import org.tianocore.common.exception.EdkException;
-import org.tianocore.common.logger.EdkLog;
-import org.tianocore.build.FrameworkBuildTask;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.global.OutputManager;
-import org.tianocore.build.global.SurfaceAreaQuery;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.id.PackageIdentification;
-import org.tianocore.build.id.PlatformIdentification;
-import org.tianocore.build.pcd.action.PlatformPcdPreprocessActionForBuilding;
-import org.tianocore.build.toolchain.ToolChainElement;
-import org.tianocore.build.toolchain.ToolChainMap;
-import org.tianocore.build.toolchain.ToolChainInfo;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- <code>FpdParserTask</code> is an ANT task. The main function is parsing Framework
- Platform Descritpion (FPD) XML file and generating its ANT build script for
- corresponding platform.
-
- <p>The task sets global properties PLATFORM, PLATFORM_DIR, PLATFORM_RELATIVE_DIR
- and BUILD_DIR. </p>
-
- <p>The task generates ${PLATFORM}_build.xml file which will be called by top level
- build.xml. The task also generate Fv.inf files (File is for Tool GenFvImage). </p>
-
- <p>FpdParserTask task stores all FPD information to GlobalData. And parse
- tools definition file to set up compiler options for different Target and
- different ToolChainTag. </p>
-
- <p>The method parseFpdFile is also prepared for single module build. </p>
-
- @since GenBuild 1.0
-**/
-public class FpdParserTask extends Task {
-
- ///
- /// Be used to ensure Global data will be initialized only once.
- ///
- private static boolean parsed = false;
-
- private File fpdFile = null;
-
- PlatformIdentification platformId;
-
- private String type;
-
- ///
- /// Mapping from modules identification to out put file name
- ///
- Map<FpdModuleIdentification, String> outfiles = new LinkedHashMap<FpdModuleIdentification, String>();
-
- ///
- /// Mapping from FV name to its modules
- ///
- Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();
-
- ///
- /// Mapping from FV apriori file to its type (PEI or DXE)
- ///
- Map<String, String> aprioriType = new HashMap<String, String>();
-
- ///
- /// FpdParserTask can specify some ANT properties.
- ///
- private Vector<Property> properties = new Vector<Property>();
-
- SurfaceAreaQuery saq = null;
-
- boolean isUnified = true;
-
- public static String PEI_APRIORI_GUID = "1b45cc0a-156a-428a-af62-49864da0e6e6";
-
- public static String DXE_APRIORI_GUID = "fc510ee7-ffdc-11d4-bd41-0080c73c8881";
-
- /**
- Public construct method. It is necessary for ANT task.
- **/
- public FpdParserTask() {
- }
-
- /**
- ANT task's entry method. The main steps is described as following:
-
- <ul>
- <li>Initialize global information (Framework DB, SPD files and all MSA files
- listed in SPD). This step will execute only once in whole build process;</li>
- <li>Parse specified FPD file; </li>
- <li>Generate FV.inf files; </li>
- <li>Generate PlatformName_build.xml file for Flatform build; </li>
- <li>Collect PCD information. </li>
- </ul>
-
- @throws BuildException
- Surface area is not valid.
- **/
- public void execute() throws BuildException {
- this.setTaskName("FpdParser");
-
- //
- // Parse FPD file
- //
- parseFpdFile();
-
- //
- // Prepare BUILD_DIR
- //
- isUnified = OutputManager.getInstance().prepareBuildDir(getProject());
-
- String buildDir = getProject().getProperty("BUILD_DIR");
- //
- // For every Target and ToolChain
- //
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; i++) {
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j++) {
- //
- // Prepare FV_DIR
- //
- String ffsCommonDir = buildDir + File.separatorChar
- + targetList[i] + "_"
- + toolchainList[j];
- File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
- fvDir.mkdirs();
- getProject().setProperty("FV_DIR", fvDir.getPath().replaceAll("(\\\\)", "/"));
-
- //
- // Gen Fv.inf files
- //
- genFvInfFiles(ffsCommonDir);
- }
- }
-
- //
- // Gen build.xml
- //
- String platformBuildFile = buildDir + File.separatorChar + platformId.getName() + "_build.xml";
- PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, isUnified, saq, platformBuildFile, aprioriType);
- fileGenerator.genBuildFile();
-
- //
- // Ant call ${PLATFORM}_build.xml
- //
- Ant ant = new Ant();
- ant.setProject(getProject());
- ant.setAntfile(platformBuildFile);
- ant.setTarget(type);
- ant.setInheritAll(true);
- ant.init();
- ant.execute();
- }
-
- /**
- Generate Fv.inf files. The Fv.inf file is composed with four
- parts: Options, Attributes, Components and Files. The Fv.inf files
- will be under FV_DIR.
-
- @throws BuildException
- File write FV.inf files error.
- **/
- void genFvInfFiles(String ffsCommonDir) throws BuildException {
- String[] validFv = saq.getFpdValidImageNames();
- for (int i = 0; i < validFv.length; i++) {
- //
- // Get all global variables from FPD and set them to properties
- //
- String[][] globalVariables = saq.getFpdGlobalVariable();
- for (int j = 0; j < globalVariables.length; j++) {
- getProject().setProperty(globalVariables[j][0], globalVariables[j][1]);
- }
-
- getProject().setProperty("FV_FILENAME", validFv[i]);
-
- File fvFile = new File(getProject().replaceProperties( getProject().getProperty("FV_DIR") + File.separatorChar + validFv[i] + ".inf"));
- if (fvFile.exists() && (fvFile.lastModified() >= fpdFile.lastModified())) {
- //
- // don't re-generate FV.inf if fpd has not been changed
- //
- continue;
- }
- fvFile.getParentFile().mkdirs();
-
- try {
- FileWriter fw = new FileWriter(fvFile);
- BufferedWriter bw = new BufferedWriter(fw);
-
- //
- // Options
- //
- String[][] options = saq.getFpdOptions(validFv[i]);
- if (options.length > 0) {
- bw.write("[options]");
- bw.newLine();
- for (int j = 0; j < options.length; j++) {
- StringBuffer str = new StringBuffer(100);
- str.append(options[j][0]);
- while (str.length() < 40) {
- str.append(' ');
- }
- str.append("= ");
- str.append(options[j][1]);
- bw.write(getProject().replaceProperties(str.toString()));
- bw.newLine();
- }
- bw.newLine();
- }
-
- //
- // Attributes;
- //
- String[][] attributes = saq.getFpdAttributes(validFv[i]);
- if (attributes.length > 0) {
- bw.write("[attributes]");
- bw.newLine();
- for (int j = 0; j < attributes.length; j++) {
- StringBuffer str = new StringBuffer(100);
- str.append(attributes[j][0]);
- while (str.length() < 40) {
- str.append(' ');
- }
- str.append("= ");
- str.append(attributes[j][1]);
- bw.write(getProject().replaceProperties(str.toString()));
- bw.newLine();
- }
- bw.newLine();
- }
-
- //
- // Components
- //
- String[][] components = saq.getFpdComponents(validFv[i]);
- if (components.length > 0) {
- bw.write("[components]");
- bw.newLine();
- for (int j = 0; j < components.length; j++) {
- StringBuffer str = new StringBuffer(100);
- str.append(components[j][0]);
- while (str.length() < 40) {
- str.append(' ');
- }
- str.append("= ");
- str.append(components[j][1]);
- bw.write(getProject().replaceProperties(str.toString()));
- bw.newLine();
- }
- bw.newLine();
- }
-
- //
- // Files
- //
- Set<FpdModuleIdentification> moduleSeqSet = getModuleSequenceForFv(validFv[i]);
-
- Set<FpdModuleIdentification> filesSet = fvs.get(validFv[i]);
-
- FpdModuleIdentification[] files = null;
-
- if (moduleSeqSet == null) {
- if (filesSet != null) {
- files = filesSet.toArray(new FpdModuleIdentification[filesSet.size()]);
- }
- } else if (filesSet == null) {
- if (moduleSeqSet.size() != 0) {
- throw new BuildException("Can not find any modules belongs to FV[" + validFv[i] + "], but listed some in BuildOptions.UserExtensions[@UserID='IMAGES' @Identifier='1']");
- }
- } else {
- //
- // if moduleSeqSet and filesSet is inconsistent, report error
- //
- if(moduleSeqSet.size() != filesSet.size()){
- throw new BuildException("Modules for FV[" + validFv[i] + "] defined in FrameworkModules and in BuildOptions.UserExtensions[@UserID='IMAGES' @Identifier='1'] are inconsistent. ");
- } else {
- //
- // whether all modules in moduleSeqSet listed in filesSet
- //
- Iterator<FpdModuleIdentification> iter = moduleSeqSet.iterator();
- while (iter.hasNext()) {
- FpdModuleIdentification item = iter.next();
- if (!filesSet.contains(item)) {
- throw new BuildException("Can not find " + item + " belongs to FV[" + validFv[i] + "]");
- }
- }
- }
-
- files = moduleSeqSet.toArray(new FpdModuleIdentification[moduleSeqSet.size()]);
- }
-
-
- if (files != null) {
- bw.write("[files]");
- bw.newLine();
-
- Set<FpdModuleIdentification> modules = null;
-
- if ( (modules = getPeiApriori(validFv[i])) != null) {
- //
- // Special GUID - validFv[i].FFS
- //
- String str = ffsCommonDir + File.separatorChar + "FV" + File.separatorChar + PEI_APRIORI_GUID + "-" + validFv[i] + ".FFS";
- bw.write(getProject().replaceProperties("EFI_FILE_NAME = " + str));
- bw.newLine();
-
- File aprioriFile = new File(getProject().getProperty("FV_DIR") + File.separatorChar + validFv[i] + ".apr");
- aprioriType.put(validFv[i], PEI_APRIORI_GUID);
- genAprioriFile(modules, aprioriFile);
- } else if((modules = getDxeApriori(validFv[i])) != null) {
- //
- // Special GUID - validFv[i].FFS
- //
- String str = ffsCommonDir + File.separatorChar + "FV" + File.separatorChar + DXE_APRIORI_GUID + "-" + validFv[i] + ".FFS";
- bw.write(getProject().replaceProperties("EFI_FILE_NAME = " + str));
- bw.newLine();
-
- File aprioriFile = new File(getProject().getProperty("FV_DIR") + File.separatorChar + validFv[i] + ".apr");
- aprioriType.put(validFv[i], DXE_APRIORI_GUID);
- genAprioriFile(modules, aprioriFile);
- }
-
- for (int j = 0; j < files.length; j++) {
- String str = ffsCommonDir + File.separatorChar + outfiles.get(files[j]);
- bw.write(getProject().replaceProperties("EFI_FILE_NAME = " + str));
- bw.newLine();
- }
- }
- bw.flush();
- bw.close();
- fw.close();
- } catch (IOException ex) {
- BuildException buildException = new BuildException("Generation of the FV file [" + fvFile.getPath() + "] failed!\n" + ex.getMessage());
- buildException.setStackTrace(ex.getStackTrace());
- throw buildException;
- } catch (EdkException ex) {
- BuildException buildException = new BuildException("Generation of the FV file [" + fvFile.getPath() + "] failed!\n" + ex.getMessage());
- buildException.setStackTrace(ex.getStackTrace());
- throw buildException;
- }
- }
- }
-
- /**
- This method is used for Single Module Build.
-
- @throws BuildException
- FPD file is not valid.
- **/
- public void parseFpdFile(File fpdFile) throws BuildException, EdkException {
- this.fpdFile = fpdFile;
- parseFpdFile();
-
- //
- // Call Platform_build.xml prebuild firstly in stand-alone build
- // Prepare BUILD_DIR
- //
- isUnified = OutputManager.getInstance().prepareBuildDir(getProject());
-
- String buildDir = getProject().getProperty("BUILD_DIR");
- //
- // For every Target and ToolChain
- //
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; i++) {
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j++) {
- //
- // Prepare FV_DIR
- //
- String ffsCommonDir = buildDir + File.separatorChar
- + targetList[i] + "_"
- + toolchainList[j];
- File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
- fvDir.mkdirs();
- }
- }
-
- String platformBuildFile = buildDir + File.separatorChar + platformId.getName() + "_build.xml";
- PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, isUnified, saq, platformBuildFile, aprioriType);
- fileGenerator.genBuildFile();
-
- Ant ant = new Ant();
- ant.setProject(getProject());
- ant.setAntfile(platformBuildFile);
- ant.setTarget("prebuild");
- ant.setInheritAll(true);
- ant.init();
- ant.execute();
- }
-
- /**
- Parse FPD file.
-
- @throws BuildException
- FPD file is not valid.
- **/
- void parseFpdFile() throws BuildException {
- try {
- XmlObject doc = XmlObject.Factory.parse(fpdFile);
-
- if (!doc.validate()) {
- throw new BuildException("Platform Surface Area file [" + fpdFile.getPath() + "] format is invalid!");
- }
-
- Map<String, XmlObject> map = new HashMap<String, XmlObject>();
- map.put("PlatformSurfaceArea", doc);
- saq = new SurfaceAreaQuery(map);
-
- //
- // Initialize
- //
- platformId = saq.getFpdHeader();
- platformId.setFpdFile(fpdFile);
- getProject().setProperty("PLATFORM", platformId.getName());
- getProject().setProperty("PLATFORM_FILE", platformId.getRelativeFpdFile().replaceAll("(\\\\)", "/"));
- getProject().setProperty("PLATFORM_DIR", platformId.getFpdFile().getParent().replaceAll("(\\\\)", "/"));
- getProject().setProperty("PLATFORM_RELATIVE_DIR", platformId.getPlatformRelativeDir().replaceAll("(\\\\)", "/"));
-
- if( !FrameworkBuildTask.multithread) {
- FrameworkBuildTask.originalProperties.put("PLATFORM", platformId.getName());
- FrameworkBuildTask.originalProperties.put("PLATFORM_FILE", platformId.getRelativeFpdFile().replaceAll("(\\\\)", "/"));
- FrameworkBuildTask.originalProperties.put("PLATFORM_DIR", platformId.getFpdFile().getParent().replaceAll("(\\\\)", "/"));
- FrameworkBuildTask.originalProperties.put("PLATFORM_RELATIVE_DIR", platformId.getPlatformRelativeDir().replaceAll("(\\\\)", "/"));
- }
-
- //
- // Build mode. User-defined output dir.
- //
- String buildMode = saq.getFpdIntermediateDirectories();
- String userDefinedOutputDir = saq.getFpdOutputDirectory();
-
- OutputManager.getInstance().setup(userDefinedOutputDir, buildMode);
-
- //
- // TBD. Deal PCD and BuildOption related Info
- //
- GlobalData.setFpdBuildOptions(saq.getFpdBuildOptions());
-
- GlobalData.setToolChainPlatformInfo(saq.getFpdToolChainInfo());
-
- //
- // Parse all list modules SA
- //
- parseModuleSAFiles();
-
- //
- // TBD. Deal PCD and BuildOption related Info
- //
- parseToolChainFamilyOptions();
- parseToolChainOptions();
-
- //
- // check if the tool chain is valid or not
- //
- checkToolChain();
-
- saq.push(map);
-
- //
- // Pcd Collection. Call CollectPCDAction to collect pcd info.
- //
- if (!parsed) {
- PlatformPcdPreprocessActionForBuilding ca = new PlatformPcdPreprocessActionForBuilding();
- ca.perform(platformId.getFpdFile().getPath());
- }
- } catch (IOException ex) {
- BuildException buildException = new BuildException("Parsing of the FPD file [" + fpdFile.getPath() + "] failed!\n" + ex.getMessage());
- buildException.setStackTrace(ex.getStackTrace());
- throw buildException;
- } catch (XmlException ex) {
- BuildException buildException = new BuildException("Parsing of the FPD file [" + fpdFile.getPath() + "] failed!\n" + ex.getMessage());
- buildException.setStackTrace(ex.getStackTrace());
- throw buildException;
- } catch (EdkException ex) {
- BuildException buildException = new BuildException("Parsing of the FPD file [" + fpdFile.getPath() + "] failed!\n" + ex.getMessage());
- buildException.setStackTrace(ex.getStackTrace());
- throw buildException;
- }
- if (!parsed) {
- parsed = true;
- }
- }
-
- /**
- Parse all modules listed in FPD file.
- **/
- void parseModuleSAFiles() throws EdkException{
- Map<FpdModuleIdentification, Map<String, XmlObject>> moduleSAs = saq.getFpdModules();
-
- //
- // For every Module lists in FPD file.
- //
- Set<FpdModuleIdentification> keys = moduleSAs.keySet();
- Iterator iter = keys.iterator();
- while (iter.hasNext()) {
- FpdModuleIdentification fpdModuleId = (FpdModuleIdentification) iter.next();
-
- //
- // Judge if Module is existed?
- // TBD
- GlobalData.registerFpdModuleSA(fpdModuleId, moduleSAs.get(fpdModuleId));
-
- //
- // Put fpdModuleId to the corresponding FV
- //
- saq.push(GlobalData.getDoc(fpdModuleId));
- String fvBinding = saq.getModuleFvBindingKeyword();
-
- fpdModuleId.setFvBinding(fvBinding);
- updateFvs(fvBinding, fpdModuleId);
-
- //
- // Prepare for out put file name
- //
- ModuleIdentification moduleId = fpdModuleId.getModule();
-
- String baseName = saq.getModuleOutputFileBasename();
-
- if (baseName == null) {
- baseName = moduleId.getName();
- }
- outfiles.put(fpdModuleId, fpdModuleId.getArch() + File.separatorChar
- + moduleId.getGuid() + "-" + baseName
- + getSuffix(moduleId.getModuleType()));
-
- //
- // parse module build options, if any
- //
- GlobalData.addModuleToolChainOption(fpdModuleId, parseModuleBuildOptions(false));
- GlobalData.addModuleToolChainFamilyOption(fpdModuleId, parseModuleBuildOptions(true));
-
- //
- // parse MSA build options
- //
- GlobalData.addMsaBuildOption(moduleId, parseMsaBuildOptions(false));
- GlobalData.addMsaFamilyBuildOption(moduleId, parseMsaBuildOptions(true));
-
- ModuleIdentification[] libraryInstances = saq.getLibraryInstance(null);
- for (int i = 0; i < libraryInstances.length; i++) {
- saq.push(GlobalData.getDoc(libraryInstances[i], fpdModuleId.getArch()));
- GlobalData.addMsaBuildOption(libraryInstances[i], parseMsaBuildOptions(false));
- GlobalData.addMsaFamilyBuildOption(libraryInstances[i], parseMsaBuildOptions(true));
- saq.pop();
- }
-
- saq.pop();
- }
- }
-
- ToolChainMap parseModuleBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
- String[][] options = saq.getModuleBuildOptions(toolChainFamilyFlag);
- if (options == null || options.length == 0) {
- return new ToolChainMap();
- }
- return parseOptions(options);
- }
-
- private ToolChainMap parsePlatformBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
- String[][] options = saq.getPlatformBuildOptions(toolChainFamilyFlag);
- if (options == null || options.length == 0) {
- return new ToolChainMap();
- }
- return parseOptions(options);
- }
-
- ToolChainMap parseMsaBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
- String[][] options = saq.getMsaBuildOptions(toolChainFamilyFlag);
- if (options == null || options.length == 0) {
- return new ToolChainMap();
- }
- return parseOptions(options);
- }
-
- private ToolChainMap parseOptions(String[][] options) throws EdkException {
- ToolChainMap map = new ToolChainMap();
- int flagIndex = ToolChainElement.ATTRIBUTE.value;
-
- for (int i = 0; i < options.length; ++i) {
- String flagString = options[i][flagIndex];
- if (flagString == null) {
- flagString = "";
- }
- options[i][flagIndex] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_FLAGS;
- map.put(options[i], flagString.trim());
- }
-
- return map;
- }
-
- private void parseToolChainFamilyOptions() throws EdkException {
- GlobalData.setPlatformToolChainFamilyOption(parsePlatformBuildOptions(true));
- }
-
- private void parseToolChainOptions() throws EdkException {
- GlobalData.setPlatformToolChainOption(parsePlatformBuildOptions(false));
- }
-
- /**
- Add the current module to corresponding FV.
-
- @param fvName current FV name
- @param moduleName current module identification
- **/
- void updateFvs(String fvName, FpdModuleIdentification fpdModuleId) {
- if (fvName == null || fvName.trim().length() == 0) {
- fvName = "NULL";
- }
- String[] fvNameArray = fvName.split("[, \t]+");
- for (int i = 0; i < fvNameArray.length; i++) {
- //
- // Put module to corresponding fvName
- //
- if (fvs.containsKey(fvNameArray[i])) {
- Set<FpdModuleIdentification> set = fvs.get(fvNameArray[i]);
- set.add(fpdModuleId);
- } else {
- Set<FpdModuleIdentification> set = new LinkedHashSet<FpdModuleIdentification>();
- set.add(fpdModuleId);
- fvs.put(fvNameArray[i], set);
- }
- }
- }
-
- /**
- Get the suffix based on module type. Current relationship are listed:
-
- <pre>
- <b>ModuleType</b> <b>Suffix</b>
- BASE .FFS
- SEC .SEC
- PEI_CORE .PEI
- PEIM .PEI
- DXE_CORE .DXE
- DXE_DRIVER .DXE
- DXE_RUNTIME_DRIVER .DXE
- DXE_SAL_DRIVER .DXE
- DXE_SMM_DRIVER .DXE
- TOOL .FFS
- UEFI_DRIVER .DXE
- UEFI_APPLICATION .APP
- USER_DEFINED .FFS
- </pre>
-
- @param moduleType module type
- @return
- @throws BuildException
- If module type is null
- **/
- public static String getSuffix(String moduleType) throws BuildException {
- if (moduleType == null) {
- throw new BuildException("Module type is not specified.");
- }
-
- String[][] suffix = EdkDefinitions.ModuleTypeExtensions;
-
- for (int i = 0; i < suffix.length; i++) {
- if (suffix[i][0].equalsIgnoreCase(moduleType)) {
- return suffix[i][1];
- }
- }
- //
- // Default is '.FFS'
- //
- return ".FFS";
- }
- /**
- Add a property.
-
- @param p property
- **/
- public void addProperty(Property p) {
- properties.addElement(p);
- }
-
- public void setFpdFile(File fpdFile) {
- this.fpdFile = fpdFile;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getAllArchForModule(ModuleIdentification moduleId) {
- String archs = "";
- Iterator<FpdModuleIdentification> iter = outfiles.keySet().iterator();
- while (iter.hasNext()) {
- FpdModuleIdentification fpdModuleId = iter.next();
-
- if (fpdModuleId.getModule().equals(moduleId)) {
- archs += fpdModuleId.getArch() + " ";
- }
- }
-
- return archs;
- }
-
- private void genAprioriFile(Set<FpdModuleIdentification> modules, File file) {
- try {
- FileWriter fw = new FileWriter(file);
- BufferedWriter bw = new BufferedWriter(fw);
-
- Iterator<FpdModuleIdentification> iter = modules.iterator();
- while(iter.hasNext()) {
- bw.write(iter.next().getModule().getGuid());
- bw.newLine();
- }
-
- bw.flush();
- bw.close();
- fw.close();
- } catch (IOException ex) {
- BuildException buildException = new BuildException("Generation of the Apriori file [" + file.getPath() + "] failed!\n" + ex.getMessage());
- buildException.setStackTrace(ex.getStackTrace());
- throw buildException;
- }
- }
-
- private Set<FpdModuleIdentification> getPeiApriori(String fvName) throws EdkException {
- Node node = saq.getPeiApriori(fvName);
- Set<FpdModuleIdentification> result = new LinkedHashSet<FpdModuleIdentification>();
- if (node == null) {
- return null;
- }
-
- NodeList childNodes = node.getChildNodes();
- for (int i = 0; i < childNodes.getLength(); i++) {
- Node childItem = childNodes.item(i);
- if (childItem.getNodeType() == Node.ELEMENT_NODE) {
- //
- // Find child elements "IncludeModules"
- //
- if (childItem.getNodeName().compareTo("IncludeModules") == 0) {
- //
- // result will be updated
- //
- processNodes(childItem, result);
- } else if (childItem.getNodeName().compareTo("FvName") == 0) {
-
- } else if (childItem.getNodeName().compareTo("InfFileName") == 0) {
-
- } else {
- //
- // Report Warning
- //
- EdkLog.log(this, EdkLog.EDK_WARNING, "Unrecognised element " + childItem.getNodeName() + " under FPD.BuildOptions.UserExtensions[UserID='APRIORI' Identifier='0']");
- }
- }
- }
-
- return result;
- }
-
- private Set<FpdModuleIdentification> getDxeApriori(String fvName) throws EdkException {
- Node node = saq.getDxeApriori(fvName);
- Set<FpdModuleIdentification> result = new LinkedHashSet<FpdModuleIdentification>();
- if (node == null) {
- return null;
- }
-
- NodeList childNodes = node.getChildNodes();
- for (int i = 0; i < childNodes.getLength(); i++) {
- Node childItem = childNodes.item(i);
- if (childItem.getNodeType() == Node.ELEMENT_NODE) {
- //
- // Find child elements "IncludeModules"
- //
- if (childItem.getNodeName().compareTo("IncludeModules") == 0) {
- //
- // result will be updated
- //
- processNodes(childItem, result);
- } else if (childItem.getNodeName().compareTo("FvName") == 0) {
-
- } else if (childItem.getNodeName().compareTo("InfFileName") == 0) {
-
- } else {
- //
- // Report Warning
- //
- EdkLog.log(this, EdkLog.EDK_WARNING, "Unrecognised element " + childItem.getNodeName() + " under FPD.BuildOptions.UserExtensions[UserID='APRIORI' Identifier='1']");
- }
- }
- }
-
- return result;
- }
-
- private Set<FpdModuleIdentification> getModuleSequenceForFv(String fvName) throws EdkException {
- Node node = saq.getFpdModuleSequence(fvName);
- Set<FpdModuleIdentification> result = new LinkedHashSet<FpdModuleIdentification>();
-
- if ( node == null) {
- EdkLog.log(this, EdkLog.EDK_WARNING, "FV[" + fvName + "] does not specify module sequence in FPD. Assuming present sequence as default sequence in FV. ");
- return null;
- } else {
- NodeList childNodes = node.getChildNodes();
- for (int i = 0; i < childNodes.getLength(); i++) {
- Node childItem = childNodes.item(i);
- if (childItem.getNodeType() == Node.ELEMENT_NODE) {
- //
- // Find child elements "IncludeModules"
- //
- if (childItem.getNodeName().compareTo("IncludeModules") == 0) {
- //
- // result will be updated
- //
- processNodes(childItem, result);
- } else if (childItem.getNodeName().compareTo("FvName") == 0) {
-
- } else if (childItem.getNodeName().compareTo("InfFileName") == 0) {
-
- } else {
- //
- // Report Warning
- //
- EdkLog.log(this, EdkLog.EDK_WARNING, "Unrecognised element " + childItem.getNodeName() + " under FPD.BuildOptions.UserExtensions[UserID='IMAGES' Identifier='1']");
- }
- }
- }
- }
-
- return result;
- }
-
- private void processNodes(Node node, Set<FpdModuleIdentification> result) throws EdkException {
- //
- // Found out all elements "Module"
- //
- NodeList childNodes = node.getChildNodes();
- for (int j = 0; j < childNodes.getLength(); j++) {
- Node childItem = childNodes.item(j);
- if (childItem.getNodeType() == Node.ELEMENT_NODE) {
- if (childItem.getNodeName().compareTo("Module") == 0) {
- String moduleGuid = null;
- String moduleVersion = null;
- String packageGuid = null;
- String packageVersion = null;
- String arch = null;
-
- NamedNodeMap attr = childItem.getAttributes();
- for (int i = 0; i < attr.getLength(); i++) {
- Node attrItem = attr.item(i);
- if (attrItem.getNodeName().compareTo("ModuleGuid") == 0) {
- moduleGuid = attrItem.getNodeValue();
- } else if (attrItem.getNodeName().compareTo("ModuleVersion") == 0) {
- moduleVersion = attrItem.getNodeValue();
- } else if (attrItem.getNodeName().compareTo("PackageGuid") == 0) {
- packageGuid = attrItem.getNodeValue();
- } else if (attrItem.getNodeName().compareTo("PackageVersion") == 0) {
- packageVersion = attrItem.getNodeValue();
- } else if (attrItem.getNodeName().compareTo("Arch") == 0) {
- arch = attrItem.getNodeValue();
- } else {
- //
- // Report warning
- //
- EdkLog.log(this, EdkLog.EDK_WARNING, "Unrecognised attribute " + attrItem.getNodeName() + " under FPD.BuildOptions.UserExtensions[UserID='IMAGES' Identifier='1'].IncludeModules.Module");
- }
- }
-
- PackageIdentification packageId = new PackageIdentification(packageGuid, packageVersion);
- GlobalData.refreshPackageIdentification(packageId);
-
- ModuleIdentification moduleId = new ModuleIdentification(moduleGuid, moduleVersion);
- moduleId.setPackage(packageId);
- GlobalData.refreshModuleIdentification(moduleId);
-
- if (arch == null) {
- throw new EdkException("Attribute [Arch] is required for element FPD.BuildOptions.UserExtensions[UserID='IMAGES' Identifier='1'].IncludeModules.Module. ");
- }
-
- result.add(new FpdModuleIdentification(moduleId, arch));
- } else {
- //
- // Report Warning
- //
- EdkLog.log(this, EdkLog.EDK_WARNING, "Unrecognised element " + childItem.getNodeName() + " under FPD.BuildOptions.UserExtensions[UserID='IMAGES' Identifier='1'].IncludeModules");
- }
- }
- }
- }
-
-
- private void checkToolChain() throws EdkException {
- ToolChainInfo toolChainInfo = GlobalData.getToolChainInfo();
-
- if (toolChainInfo.getTargets().length == 0) {
- throw new EdkException("No valid target found! "+
- "Please check the TARGET definition in Tools/Conf/target.txt, "+
- "or the <BuildTarget>, <BuildOptions> in the FPD file.");
- }
-
- if (toolChainInfo.getTagnames().length == 0) {
- throw new EdkException("No valid tool chain found! "+
- "Please check the TOOL_CHAIN_TAG definition in Tools/Conf/target.txt, "+
- "or the <BuildOptions> in the FPD file.");
- }
-
- if (toolChainInfo.getArchs().length == 0) {
- throw new EdkException("No valid architecture found! "+
- "Please check the TARGET_ARCH definition in Tools/Conf/target.txt, "+
- "or the <SupportedArchitectures>, <BuildOptions> in the FPD file.");
- }
-
- if (toolChainInfo.getCommands().length == 0) {
- throw new EdkException("No valid COMMAND found! Please check the tool chain definitions "+
- "in Tools/Conf/tools_def.txt.");
- }
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java b/Tools/Java/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java
deleted file mode 100644
index ad2ee2cdd2..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java
+++ /dev/null
@@ -1,708 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
- **/
-package org.tianocore.build.fpd;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.global.SurfaceAreaQuery;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.id.ModuleIdentification;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- class PlatformBuildFileGenerator is used to generate ${PLATFORM}_build.xml file.
-
- @since GenBuild 1.0
-**/
-public class PlatformBuildFileGenerator {
-
- ///
- /// Mapping from modules identification to out put file name
- ///
- private Map<FpdModuleIdentification, String> outfiles;
-
- ///
- /// Mapping from FV name to its modules
- ///
- private Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();
-
-
- private boolean isUnified = true;
-
- private SurfaceAreaQuery saq = null;
-
- private File platformBuildFile = null;
-
- private Map<String, String> aprioriType = null;
-
- private Project project;
-
- private String info = "DO NOT EDIT \n"
- + "This file is auto-generated by the build utility\n"
- + "\n"
- + "Abstract:\n"
- + "Auto-generated ANT build file for building EFI Modules and Platforms\n";
-
- public PlatformBuildFileGenerator(Project project, Map<FpdModuleIdentification, String> outfiles, Map<String, Set<FpdModuleIdentification>> fvs, boolean isUnified, SurfaceAreaQuery saq, String platformBuildFile, Map<String, String> aprioriType){
- this.project = project;
- this.outfiles = outfiles;
- this.isUnified = isUnified;
- this.fvs = fvs;
- this.saq = saq;
- this.platformBuildFile = new File(platformBuildFile);
- this.aprioriType = aprioriType;
- }
-
- /**
- Generate build.out.xml file.
-
- @throws BuildException
- build.out.xml XML document create error
- **/
- public void genBuildFile() throws BuildException {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- try {
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- Document document = dombuilder.newDocument();
- Comment rootComment = document.createComment(info);
- //
- // create root element and its attributes
- //
- Element root = document.createElement("project");
- root.setAttribute("name", project.getProperty("PLATFORM"));
- root.setAttribute("default", "all");
- root.setAttribute("basedir", ".");
-
- //
- // element for External ANT tasks
- //
- root.appendChild(document.createComment("Apply external ANT tasks"));
- Element ele = document.createElement("taskdef");
- ele.setAttribute("resource", "GenBuild.tasks");
- root.appendChild(ele);
-
- ele = document.createElement("taskdef");
- ele.setAttribute("resource", "frameworktasks.tasks");
- root.appendChild(ele);
-
- ele = document.createElement("taskdef");
- ele.setAttribute("resource", "net/sf/antcontrib/antlib.xml");
- root.appendChild(ele);
-
- ele = document.createElement("property");
- ele.setAttribute("environment", "env");
- root.appendChild(ele);
-
- //
- // Default Target
- //
- root.appendChild(document.createComment("Default target"));
- ele = document.createElement("target");
- ele.setAttribute("name", "all");
- ele.setAttribute("depends", "prebuild, modules, fvs, postbuild");
- root.appendChild(ele);
-
- //
- // Modules and Fvs Target
- //
- applyModules(document, root);
-
- applyFvs(document, root);
-
- //
- // Clean Target
- //
- applyClean(document, root);
-
- //
- // Deep Clean Target
- //
- applyCleanall(document, root);
-
- //
- // User Extension pre build
- //
- applyUserExtensionsPreBuild(document, root);
-
- //
- // User Extension Post build
- //
- applyUserExtensionsPostBuild(document, root);
- applyUserExtensions(document, root);
-
- document.appendChild(rootComment);
- document.appendChild(root);
- //
- // Prepare the DOM document for writing
- //
- Source source = new DOMSource(document);
- //
- // generate all directory path
- //
- (new File(platformBuildFile.getParent())).mkdirs();
- Result result = new StreamResult(platformBuildFile);
- //
- // Write the DOM document to the file
- //
- Transformer xformer = TransformerFactory.newInstance().newTransformer();
- xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
- xformer.setOutputProperty(OutputKeys.INDENT, "yes");
- xformer.transform(source, result);
- } catch (Exception ex) {
- throw new BuildException("Generating platform build file [" + platformBuildFile.getPath() + "_build.xml] failed. \n" + ex.getMessage());
- }
- }
-
- /**
- 1. Get All valid Fv Image Names in sequence
- 2. For each FV, get modules by sequences
- 3. Get other modules
-
- @param document XML document
- @param root Node
- **/
- private void applyModules(Document document, Node root) {
- root.appendChild(document.createComment("Modules target"));
- Element ele = document.createElement("target");
- ele.setAttribute("name", "modules");
-
- //
- // Try to build apriori if necessary
- //
- //
- // For every Target and ToolChain
- //
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; i++){
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j++){
- //
- // Prepare FV_DIR
- //
- String ffsCommonDir = project.getProperty("BUILD_DIR") + File.separatorChar
- + targetList[i] + "_"
- + toolchainList[j];
- File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
- Element fvEle = document.createElement("var");
- fvEle.setAttribute("name", "FV_DIR");
- fvEle.setAttribute("value", fvDir.getPath().replaceAll("(\\\\)", "/"));
- ele.appendChild(fvEle);
-
- Iterator<String> aprIter = aprioriType.keySet().iterator();
- while (aprIter.hasNext()) {
- String fvName = aprIter.next();
- Element moduleEle = document.createElement("Build_Apriori");
- moduleEle.setAttribute("FILENAME", fvName);
- moduleEle.setAttribute("GUID", aprioriType.get(fvName));
- ele.appendChild(moduleEle);
- }
- }
- }
-
- //
- // Get all valid FV name
- //
- String[] validFv = saq.getFpdValidImageNames();
-
- //
- // For each valid FV, get all modules in sequence
- //
- for (int i = 0; i < validFv.length; i++) {
- if (fvs.containsKey(validFv[i])) {
- Set<FpdModuleIdentification> set = fvs.get(validFv[i]);
- Iterator<FpdModuleIdentification> iter = set.iterator();
- while (iter.hasNext()) {
- FpdModuleIdentification fpdModuleId = iter.next();
- applySingleModule(document, ele, fpdModuleId);
- }
- }
- }
-
- //
- // Get all other modules
- //
- Iterator<String> fvsNameIter = fvs.keySet().iterator();
-
- while (fvsNameIter.hasNext()) {
- String fvName = fvsNameIter.next();
- if (!isContain(validFv, fvName)) {
- Set<FpdModuleIdentification> set = fvs.get(fvName);
- Iterator iter = set.iterator();
- while (iter.hasNext()) {
- FpdModuleIdentification fpdModuleId = (FpdModuleIdentification) iter.next();
- applySingleModule(document, ele, fpdModuleId);
- }
- }
- }
-
- root.appendChild(ele);
- }
-
- private void applySingleModule(Document document, Node root, FpdModuleIdentification fpdModuleId) {
- ModuleIdentification moduleId = fpdModuleId.getModule();
- Element moduleEle = document.createElement("GenBuild");
- moduleEle.setAttribute("type", "build");
- //
- // Inherit Properties.
- //{"ARCH", "PACKAGE", "PACKAGE_GUID", "PACKAGE_VERSION", "MODULE_DIR"}
- //
-
- //
- // ARCH
- //
- Element property = document.createElement("property");
- property.setAttribute("name", "ARCH");
- property.setAttribute("value", fpdModuleId.getArch());
- moduleEle.appendChild(property);
-
- //
- // MODULE_GUID
- //
- property = document.createElement("property");
- property.setAttribute("name", "MODULE_GUID");
- property.setAttribute("value", moduleId.getGuid());
- moduleEle.appendChild(property);
-
- //
- // MODULE_VERSION
- //
- property = document.createElement("property");
- property.setAttribute("name", "MODULE_VERSION");
- property.setAttribute("value", moduleId.getVersion());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE_GUID
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE_GUID");
- property.setAttribute("value", moduleId.getPackage().getGuid());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE_VERSION
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE_VERSION");
- property.setAttribute("value", moduleId.getPackage().getVersion());
- moduleEle.appendChild(property);
-
- root.appendChild(moduleEle);
- }
-
- private boolean isContain(String[] list, String item) {
- for (int i = 0; i < list.length; i++) {
- if (list[i].equalsIgnoreCase(item)) {
- return true;
- }
- }
- return false;
- }
-
- private void applyFvs(Document document, Node root) {
- //
- // FVS Target
- //
- root.appendChild(document.createComment("FVs target"));
- Element ele = document.createElement("target");
- ele.setAttribute("name", "fvs");
-
- //
- // For every Target and ToolChain
- //
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; i++){
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j++){
- String fvOutputDir = project.getProperty("BUILD_DIR") + File.separatorChar
- + targetList[i] + "_"
- + toolchainList[j] + File.separatorChar + "FV";
- String[] validFv = saq.getFpdValidImageNames();
- for (int k = 0; k < validFv.length; k++) {
- String inputFile = fvOutputDir + "" + File.separatorChar + validFv[k].toUpperCase() + ".inf";
- Element fvEle = document.createElement("genfvimage");
- fvEle.setAttribute("infFile", inputFile);
- fvEle.setAttribute("outputDir", fvOutputDir);
- ele.appendChild(fvEle);
- }
- }
- }
- root.appendChild(ele);
- }
-
- private void applyClean(Document document, Node root) {
- //
- // Clean Target
- //
- root.appendChild(document.createComment("Clean target"));
- Element ele = document.createElement("target");
- ele.setAttribute("name", "clean");
-
- if (isUnified) {
- Element cleanEle = document.createElement("delete");
- cleanEle.setAttribute("includeemptydirs", "true");
- Element filesetEle = document.createElement("fileset");
- filesetEle.setAttribute("dir", project.getProperty("BUILD_DIR"));
- filesetEle.setAttribute("includes", "**\\OUTPUT\\**");
- cleanEle.appendChild(filesetEle);
- ele.appendChild(cleanEle);
- } else {
- Set set = outfiles.keySet();
- Iterator iter = set.iterator();
- while (iter.hasNext()) {
- FpdModuleIdentification fpdModuleId = (FpdModuleIdentification) iter.next();
- ModuleIdentification moduleId = fpdModuleId.getModule();
-
- Element ifEle = document.createElement("if");
- Element availableEle = document.createElement("available");
- availableEle.setAttribute("file", moduleId.getMsaFile().getParent() + File.separatorChar
- + "build.xml");
- ifEle.appendChild(availableEle);
- Element elseEle = document.createElement("then");
-
- Element moduleEle = document.createElement("ant");
- moduleEle.setAttribute("antfile", moduleId.getMsaFile().getParent() + File.separatorChar
- + "build.xml");
- moduleEle.setAttribute("target", "clean");
- //
- // Inherit Properties.
- //{"ARCH", "PACKAGE", "PACKAGE_GUID", "PACKAGE_VERSION", "MODULE_DIR"}
- //
-
- //
- // ARCH
- //
- Element property = document.createElement("property");
- property.setAttribute("name", "ARCH");
- property.setAttribute("value", fpdModuleId.getArch());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE");
- property.setAttribute("value", moduleId.getPackage().getName());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE_GUID
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE_GUID");
- property.setAttribute("value", moduleId.getPackage().getGuid());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE_VERSION
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE_VERSION");
- property.setAttribute("value", moduleId.getPackage().getVersion());
- moduleEle.appendChild(property);
-
- //
- // MODULE_DIR
- //
- property = document.createElement("property");
- property.setAttribute("name", "MODULE_DIR");
- property.setAttribute("value", moduleId.getMsaFile().getParent());
- moduleEle.appendChild(property);
- elseEle.appendChild(moduleEle);
- ifEle.appendChild(elseEle);
- ele.appendChild(ifEle);
- }
- }
- root.appendChild(ele);
- }
-
- private void applyCleanall(Document document, Node root) {
- //
- // Deep Clean Target
- //
- root.appendChild(document.createComment("Target: cleanall"));
- Element ele = document.createElement("target");
- ele.setAttribute("name", "cleanall");
-
- if (isUnified) {
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; ++i) {
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j++) {
- Element cleanAllEle = document.createElement("delete");
- cleanAllEle.setAttribute("dir", project.getProperty("BUILD_DIR") + File.separatorChar + targetList[i] + "_" + toolchainList[j]);
- ele.appendChild(cleanAllEle);
- }
- }
- } else {
- Set set = outfiles.keySet();
- Iterator iter = set.iterator();
- while (iter.hasNext()) {
- FpdModuleIdentification fpdModuleId = (FpdModuleIdentification) iter.next();
- ModuleIdentification moduleId = fpdModuleId.getModule();
-
- Element ifEle = document.createElement("if");
- Element availableEle = document.createElement("available");
- availableEle.setAttribute("file", moduleId.getMsaFile().getParent() + File.separatorChar
- + "build.xml");
- ifEle.appendChild(availableEle);
- Element elseEle = document.createElement("then");
-
- Element moduleEle = document.createElement("ant");
- moduleEle.setAttribute("antfile", moduleId.getMsaFile().getParent() + File.separatorChar
- + "build.xml");
- moduleEle.setAttribute("target", "cleanall");
- //
- // Inherit Properties.
- //{"ARCH", "PACKAGE", "PACKAGE_GUID", "PACKAGE_VERSION", "MODULE_DIR"}
- //
-
- //
- // ARCH
- //
- Element property = document.createElement("property");
- property.setAttribute("name", "ARCH");
- property.setAttribute("value", fpdModuleId.getArch());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE");
- property.setAttribute("value", moduleId.getPackage().getName());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE_GUID
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE_GUID");
- property.setAttribute("value", moduleId.getPackage().getGuid());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE_VERSION
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE_VERSION");
- property.setAttribute("value", moduleId.getPackage().getVersion());
- moduleEle.appendChild(property);
-
- //
- // MODULE_DIR
- //
- property = document.createElement("property");
- property.setAttribute("name", "MODULE_DIR");
- property.setAttribute("value", moduleId.getMsaFile().getParent());
- moduleEle.appendChild(property);
- elseEle.appendChild(moduleEle);
- ifEle.appendChild(elseEle);
- ele.appendChild(ifEle);
- }
- }
- root.appendChild(ele);
- }
-
- private void applyUserExtensionsPreBuild(Document document, Node root) {
- //
- // User Extensions
- //
- root.appendChild(document.createComment("Pre-Build Processing"));
- Element ele = document.createElement("target");
- ele.setAttribute("name", "prebuild");
-
- Node node = saq.getFpdUserExtensionPreBuild();
- if (node != null) {
- //
- // For every Target and ToolChain
- //
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; i++){
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j++){
- //
- // Prepare FV_DIR
- //
- String ffsCommonDir = project.getProperty("BUILD_DIR") + File.separatorChar
- + targetList[i] + "_"
- + toolchainList[j];
- File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
- Element fvEle = document.createElement("var");
- fvEle.setAttribute("name", "FV_DIR");
- fvEle.setAttribute("value", fvDir.getPath().replaceAll("(\\\\)", "/"));
- ele.appendChild(fvEle);
-
- Element targetDirEle = document.createElement("var");
- targetDirEle.setAttribute("name", "TARGET_DIR");
- targetDirEle.setAttribute("value", ffsCommonDir.replaceAll("(\\\\)", "/"));
- ele.appendChild(targetDirEle);
-
- NodeList childNodes = node.getChildNodes();
- for (int k = 0; k < childNodes.getLength(); k++) {
- Node childItem = childNodes.item(k);
- if (childItem.getNodeType() == Node.ELEMENT_NODE) {
- ele.appendChild(recursiveNode(childItem, document));
- }
- }
- }
- }
- }
-
- root.appendChild(ele);
- }
-
- private void applyUserExtensionsPostBuild(Document document, Node root) {
- //
- // User Extensions
- //
- root.appendChild(document.createComment("Post-Build Processing"));
- Element ele = document.createElement("target");
- ele.setAttribute("name", "postbuild");
-
- Node node = saq.getFpdUserExtensionPostBuild();
- if (node != null) {
- //
- // For every Target and ToolChain
- //
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; i++){
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j++){
- //
- // Prepare FV_DIR
- //
- String ffsCommonDir = project.getProperty("BUILD_DIR") + File.separatorChar
- + targetList[i] + "_"
- + toolchainList[j];
- File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
- Element fvEle = document.createElement("var");
- fvEle.setAttribute("name", "FV_DIR");
- fvEle.setAttribute("value", fvDir.getPath().replaceAll("(\\\\)", "/"));
- ele.appendChild(fvEle);
-
- Element targetDirEle = document.createElement("var");
- targetDirEle.setAttribute("name", "TARGET_DIR");
- targetDirEle.setAttribute("value", ffsCommonDir.replaceAll("(\\\\)", "/"));
- ele.appendChild(targetDirEle);
-
- NodeList childNodes = node.getChildNodes();
- for (int k = 0; k < childNodes.getLength(); k++) {
- Node childItem = childNodes.item(k);
- if (childItem.getNodeType() == Node.ELEMENT_NODE) {
- ele.appendChild(recursiveNode(childItem, document));
- }
- }
-
- }
- }
- }
-
- root.appendChild(ele);
- }
-
- private void applyUserExtensions(Document document, Node root) {
- Node[] nodeList = saq.getFpdUserExtensions();
- for (int nodeIndex = 0; nodeIndex < nodeList.length; ++nodeIndex) {
- Node node = nodeList[nodeIndex];
- //
- // User Extensions
- //
- root.appendChild(document.createComment("User Defined Target"));
- Element ele = document.createElement("target");
- ele.setAttribute("name", node.getAttributes().getNamedItem("Identifier").getNodeValue());
-
- if (node != null) {
- //
- // For every Target and ToolChain
- //
- String[] targetList = GlobalData.getToolChainInfo().getTargets();
- for (int i = 0; i < targetList.length; i++){
- String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
- for(int j = 0; j < toolchainList.length; j++){
- //
- // Prepare FV_DIR
- //
- String ffsCommonDir = project.getProperty("BUILD_DIR") + File.separatorChar
- + targetList[i] + "_"
- + toolchainList[j];
- File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
- Element fvEle = document.createElement("var");
- fvEle.setAttribute("name", "FV_DIR");
- fvEle.setAttribute("value", fvDir.getPath().replaceAll("(\\\\)", "/"));
- ele.appendChild(fvEle);
-
- Element targetDirEle = document.createElement("var");
- targetDirEle.setAttribute("name", "TARGET_DIR");
- targetDirEle.setAttribute("value", ffsCommonDir.replaceAll("(\\\\)", "/"));
- ele.appendChild(targetDirEle);
-
- NodeList childNodes = node.getChildNodes();
- for (int k = 0; k < childNodes.getLength(); k++) {
- Node childItem = childNodes.item(k);
- if (childItem.getNodeType() == Node.ELEMENT_NODE) {
- ele.appendChild(recursiveNode(childItem, document));
- }
- }
-
- }
- }
- }
-
- root.appendChild(ele);
- }
- }
-
- private Element recursiveNode(Node node, Document document) {
- Element root = document.createElement(node.getNodeName());
- NamedNodeMap attr = node.getAttributes();
- for (int i = 0; i < attr.getLength(); i++) {
- Node attrItem = attr.item(i);
- root.setAttribute(attrItem.getNodeName(), attrItem.getNodeValue());
- }
- NodeList childNodes = node.getChildNodes();
- for (int i = 0; i < childNodes.getLength(); i++) {
- Node childItem = childNodes.item(i);
- if (childItem.getNodeType() == Node.ELEMENT_NODE) {
- root.appendChild(recursiveNode(childItem, document));
- }
- else if (childItem.getNodeType() == Node.TEXT_NODE){
- if (!childItem.getNodeValue().trim().equalsIgnoreCase("")) {
- root.setTextContent(childItem.getNodeValue());
- }
- }
- }
- return root;
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/DpFile.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/DpFile.java
deleted file mode 100644
index af6590f5b6..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/DpFile.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/** @file
-This file is used to define class which represents dependency file in ANT task
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.global;
-
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.BuildException;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.LineNumberReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- DpFile is a ANT DataType which can be used to specify dependency files from
- a file list file, from file list string separated by space, comma or semi-comma,
- or from file name with absolute path
- **/
-public class DpFile extends DataType {
- ///
- /// keep the list of files path
- ///
- private List<String> nameList = new ArrayList<String>();
-
- /**
- Empty constructor just in case
- **/
- public DpFile() {
- }
-
- /**
- Empty execute method of ANT task, just in case
- **/
- public void execute() {
- }
-
- /**
- Standard set method of ANT task/datatype, for ListFile attribute. It simply
- fetch one file path a line from specified list file, and put them in nameList
-
- @param fileListFile file which contains a file list, one file a line,
- with full path
- **/
- public void setListFile(String fileListFile) {
- File file = new File(fileListFile);
- if (!file.exists()) {
- return;
- }
-
- try {
- FileReader fileReader = new FileReader(file);
- LineNumberReader lineReader = new LineNumberReader(fileReader);
-
- String filePath = null;
- while ((filePath = lineReader.readLine()) != null) {
- filePath = filePath.trim();
- if (filePath.length() == 0) {
- continue;
- }
- this.nameList.add(filePath);
- }
-
- lineReader.close();
- fileReader.close();
- } catch (IOException e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- Standard set method of ANT task/datatype, for List attribute.
-
- @param fileList string with file pathes separated by space, comma,
- or semi-comma
- **/
- public void setList(String fileList) {
- //
- // space, comma or semi-comma separated files list
- //
- Pattern pattern = Pattern.compile("([^ ,;\n\r]++)[ ,;\n\r]*+");
- Matcher matcher = pattern.matcher(fileList);
-
- while (matcher.find()) {
- //
- // keep each file name before " ,;\n\r"
- //
- String filePath = fileList.substring(matcher.start(1), matcher.end(1)).trim();
- if (filePath.length() == 0) {
- continue;
- }
- nameList.add(Path.translateFile(filePath));
- }
-
- }
-
- /**
- Standard set method of ANT task/datatype, for Name attribute.
-
- @param fileName string of a file full path
- **/
- public void setName(String fileName) {
- this.nameList.add(fileName);
- }
-
- /**
- Fetch the file name list.
-
- @returns A string list which contains file names specified to check dependnecy
- **/
- public List<String> getList() {
- return this.nameList;
- }
-}
-
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/DpFileList.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/DpFileList.java
deleted file mode 100644
index dd032526d8..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/DpFileList.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/** @file
-This file is used to nest elements corresponding to DpFile
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.global;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.FileSet;
-
-/**
- DpFileList is a container of Dpfile at the point of ANT task/datatype
- **/
-public class DpFileList extends DataType {
- ///
- /// Keep all the file names from all nested DpFile
- ///
- List<String> nameList = new ArrayList<String>();
-
- /**
- Empty constructor just in case
- **/
- public DpFileList() {
- }
-
- /**
- Empty execute method of ANT task. ANT will call it even we don't need it.
- **/
- public void execute() {
- }
-
- /**
- Standard add method of ANT task, for nested DpFile type of elements. It just
- simply fetch the files list from DpFile and put them in its own nameList.
-
- @param f a DpFile object which will be instantiated by ANT
- **/
- public void addConfiguredFile(DpFile f) {
- this.nameList.addAll(f.getList());
- }
-
- public void addConfiguredFileSet(FileSet fileSet) {
- DirectoryScanner ds = fileSet.getDirectoryScanner(getProject());
- String dir = fileSet.getDir(getProject()).getAbsolutePath();
- String[] files = ds.getIncludedFiles();
-
- for (int i = 0; i < files.length; ++i) {
- nameList.add(dir + "/" + files[i]);
- }
- }
-}
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java
deleted file mode 100644
index b1e119a501..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*++
-
- Copyright (c) 2006, 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.
-
- Module Name:
- GenBuildLogger.java
-
- Abstract:
-
- --*/
-
-package org.tianocore.build.global;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildEvent;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DefaultLogger;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.util.StringUtils;
-
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.common.logger.EdkLog;
-import org.tianocore.common.logger.LogMethod;
-
-public class GenBuildLogger extends DefaultLogger implements LogMethod {
-
- Project project = null;
-
- ///
- /// flag to present whether cache all msg or not
- /// true means to cache.
- ///
- private static boolean flag = false;
-
- private static Map<FpdModuleIdentification, List<String>> map = new LinkedHashMap<FpdModuleIdentification, List<String> >(256);
-
- private FpdModuleIdentification id = null;
- //
- // semaroph for multi thread
- //
- public static Object semaphore = new Object();
-
- public GenBuildLogger () {
-
- }
-
- public GenBuildLogger (Project project) {
- this.project = project;
- }
-
- /**
- Rules: flag = false: means no cache Action: Print it to console
-
- flag = true: mean cache all msg exception some special Action: loglevel
- is EDK_ALWAYS -- Print but no cache loglevel is EDK_ERROR -- Print and
- cache the msg others -- No print and cache the msg
- **/
- public synchronized void putMessage(Object msgSource, int msgLevel, String msg) {
- if (this.project == null) {
- return;
- }
-
- //
- // If msgLevel is always print, then print it
- //
- switch (msgLevel) {
- case EdkLog.EDK_ALWAYS:
- //
- // Do some special
- //
- log(msgSource, msg, Project.MSG_ERR);
- break;
- case EdkLog.EDK_ERROR:
- log(msgSource, msg, Project.MSG_ERR);
- break;
- case EdkLog.EDK_WARNING:
- log(msgSource, msg, Project.MSG_WARN);
- break;
- case EdkLog.EDK_INFO:
- log(msgSource, msg, Project.MSG_INFO);
- break;
- case EdkLog.EDK_VERBOSE:
- log(msgSource, msg, Project.MSG_VERBOSE);
- break;
- case EdkLog.EDK_DEBUG:
- log(msgSource, msg, Project.MSG_DEBUG);
- break;
- }
- }
-
- public static void flushErrorModuleLog(FpdModuleIdentification errorModuleId) {
- List<String> errorLogs = map.get(errorModuleId);
- if (errorLogs != null) {
- EdkLog.log("ErrorLog", EdkLog.EDK_ERROR, errorModuleId + " error logs: ");
- for(int i = 0; i < errorLogs.size(); i++) {
- EdkLog.log(EdkLog.EDK_ERROR, errorLogs.get(i));
- }
- }
- }
-
- public void flushToFile(File file) {
- //
- // Put all messages in map to file
- //
- String msg = "Writing log to file [" + file.getPath() + "]";
- log("Logging", msg, Project.MSG_INFO);
- try {
- BufferedWriter bw = new BufferedWriter(new FileWriter(file));
- Iterator<FpdModuleIdentification> iter = map.keySet().iterator();
- List<String> mainLogs = null;
- while (iter.hasNext()) {
- FpdModuleIdentification item = iter.next();
- if(item == null) {
- mainLogs = map.get(item);
- continue ;
- }
- bw.write(">>>>>>>>>>>>>");
- bw.write(" " + item + " Build Log ");
- bw.write(">>>>>>>>>>>>>");
- bw.newLine();
- List<String> allMessages = map.get(item);
- for(int i = 0; i < allMessages.size(); i++) {
- bw.write(allMessages.get(i));
- bw.newLine();
- }
- }
- if (mainLogs != null) {
- bw.write(">>>>>>>>>>>>>");
- bw.write(" Main Logs (already print to command) ");
- bw.write(">>>>>>>>>>>>>");
- bw.newLine();
- for(int i = 0; i < mainLogs.size(); i++) {
- bw.write(mainLogs.get(i));
- bw.newLine();
- }
- }
- bw.flush();
- bw.close();
- } catch (IOException e) {
- new BuildException("Writing log error. " + e.getMessage());
- }
-
- }
-
- private void log(Object msgSource, String msg, int level) {
- if (msgSource instanceof Task) {
- ((Task)msgSource).getProject().log((Task)msgSource, msg, level);
- } else if (msgSource instanceof String){
- //
- // Pad 12 space to keep message in unify format
- //
- msg = msg.replaceAll("\n", "\n ");
- this.project.log(String.format("%12s", "[" + msgSource + "] ") + msg, level);
- } else {
- this.project.log(msg, level);
- }
- }
- public void targetStarted(BuildEvent event) {
- if (!flag) {
- super.targetStarted(event);
- }
- }
-
- public void messageLogged(BuildEvent event) {
-
- int currentLevel = event.getPriority();
- //
- // If current level is upper than Ant Level, skip it
- //
- if (currentLevel <= this.msgOutputLevel) {
- String originalMessage = event.getMessage();
-
- StringBuffer message = new StringBuffer();
- if (!emacsMode && event.getTask() != null) {
- String label = String.format("%12s", "[" + event.getTask().getTaskName() + "] ");
- //
- // Append label first
- //
- message.append(label);
-
- //
- // Format all output message's line separator
- //
- try {
- BufferedReader r = new BufferedReader(new StringReader(originalMessage));
- boolean ifFirstLine = true;
- String line = null;
- while ((line = r.readLine()) != null) {
- if (!ifFirstLine) {
- message.append(StringUtils.LINE_SEP);
- }
- ifFirstLine = false;
- message.append(line);
- }
- } catch (IOException e) {
- message.append(originalMessage);
- }
- } else {
- message.append(originalMessage);
- }
-
- String msg = message.toString();
- if (currentLevel == Project.MSG_ERR) {
- printMessage(msg, err, currentLevel);
- } else if(currentLevel == Project.MSG_WARN) {
- printMessage(msg, out, currentLevel);
- } else if(!flag) {
- printMessage(msg, out, currentLevel);
- }
- log(msg);
- }
- }
-
- public static void setCacheEnable(boolean enable) {
- flag = enable;
- }
-
- protected synchronized void log(String message) {
- //
- // cache log
- //
- if (map.containsKey(this.id)) {
- map.get(this.id).add(message);
- } else {
- List<String> list = new Vector<String>(1024);
- list.add(message);
- map.put(this.id, list);
- }
- }
-
- public Object clone() {
- GenBuildLogger newLogger = new GenBuildLogger();
- //
- // Transfer emacs mode, out, err, level to new Logger
- //
- newLogger.setEmacsMode(this.emacsMode);
- newLogger.setOutputPrintStream(this.out);
- newLogger.setErrorPrintStream(this.err);
- newLogger.setMessageOutputLevel(this.msgOutputLevel);
-
- //
- // Transfer project
- //
- newLogger.project = this.project;
- return newLogger;
- }
-
- public void setId(FpdModuleIdentification id) {
- this.id = id;
- }
-
- public void buildFinished(BuildEvent event) {
- if (this.msgOutputLevel >= Project.MSG_VERBOSE) {
- int level = this.msgOutputLevel;
- synchronized(semaphore){
- this.msgOutputLevel = this.msgOutputLevel - 1;
- super.buildFinished(event);
- this.msgOutputLevel = level;
- }
- } else {
- super.buildFinished(event);
- }
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java
deleted file mode 100644
index b5605d4cb1..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java
+++ /dev/null
@@ -1,948 +0,0 @@
-/** @file
- GlobalData class.
-
- GlobalData provide initializing, instoring, querying and update global data.
- It is a bridge to intercommunicate between multiple component, such as AutoGen,
- PCD and so on.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.build.global;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tools.ant.Project;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.tianocore.DbPathAndFilename;
-import org.tianocore.FrameworkDatabaseDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.id.PackageIdentification;
-import org.tianocore.build.id.PlatformIdentification;
-import org.tianocore.build.toolchain.ToolChainConfig;
-import org.tianocore.build.toolchain.ToolChainElement;
-import org.tianocore.build.toolchain.ToolChainInfo;
-import org.tianocore.build.toolchain.ToolChainKey;
-import org.tianocore.build.toolchain.ToolChainMap;
-import org.tianocore.common.definitions.ToolDefinitions;
-import org.tianocore.common.exception.EdkException;
-import org.tianocore.common.logger.EdkLog;
-import org.tianocore.pcd.entity.MemoryDatabaseManager;
-
-/**
- GlobalData provide initializing, instoring, querying and update global data.
- It is a bridge to intercommunicate between multiple component, such as AutoGen,
- PCD and so on.
-
- <p>Note that all global information are initialized incrementally. All data will
- parse and record only of necessary during build time. </p>
-
- @since GenBuild 1.0
-**/
-public class GlobalData {
- ///
- /// Record current WORKSPACE Directory
- ///
- private static String workspaceDir = "";
-
- ///
- /// Be used to ensure Global data will be initialized only once.
- ///
- private static boolean globalFlag = false;
-
- ///
- /// Framework Database information: package list and platform list
- ///
- private static Set<PackageIdentification> packageList = new HashSet<PackageIdentification>();
-
- private static Set<PlatformIdentification> platformList = new HashSet<PlatformIdentification>();
-
- ///
- /// Every detail SPD informations: Module list, Library class definition,
- /// Package header file, GUID/PPI/Protocol definitions
- ///
- private static final Map<PackageIdentification, Spd> spdTable = new HashMap<PackageIdentification, Spd>();
-
- ///
- /// Build informations are divided into three parts:
- /// 1. From MSA 2. From FPD 3. From FPD' ModuleSA
- ///
- private static Map<ModuleIdentification, Map<String, XmlObject>> nativeMsa = new HashMap<ModuleIdentification, Map<String, XmlObject>>();
-
- private static Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleSA= new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();
-
- private static Map<String, XmlObject> fpdBuildOptionsMap = new HashMap<String, XmlObject>();
-
- private static XmlObject fpdBuildOptions;
-
- private static XmlObject fpdDynamicPcds;
-
- ///
- /// Parsed modules list
- ///
- private static Map<FpdModuleIdentification, Map<String, XmlObject>> parsedModules = new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();
-
- ///
- /// built modules list with ARCH, TARGET, TOOLCHAIN
- ///
- private static Set<FpdModuleIdentification> builtModules = new HashSet<FpdModuleIdentification>();
-
- ///
- /// PCD memory database stored all PCD information which collected from FPD,MSA and SPD.
- ///
- private static final MemoryDatabaseManager pcdDbManager = new MemoryDatabaseManager();
-
- ///
- /// build target + tool chain family/tag name + arch + command types + command options
- ///
- ///
- /// Tool Chain Data
- /// toolsDef - build tool program information
- /// fpdBuildOption - all modules's build options for tool tag or tool chain families
- /// moduleSaBuildOption - build options for a specific module
- ///
- private static ToolChainConfig toolsDef;
-
- private static ToolChainInfo toolChainInfo;
- private static ToolChainInfo toolChainEnvInfo;
- private static ToolChainInfo toolChainPlatformInfo;
-
- private static ToolChainMap platformToolChainOption;
- private static ToolChainMap platformToolChainFamilyOption;
-
- private static Map<FpdModuleIdentification, ToolChainMap> moduleToolChainOption = new HashMap<FpdModuleIdentification, ToolChainMap>();
- private static Map<FpdModuleIdentification, ToolChainMap> moduleToolChainFamilyOption = new HashMap<FpdModuleIdentification, ToolChainMap>();
-
- private static Map<ModuleIdentification, ToolChainMap> msaBuildOption = new HashMap<ModuleIdentification, ToolChainMap>();
- private static Map<ModuleIdentification, ToolChainMap> msaFamilyBuildOption = new HashMap<ModuleIdentification, ToolChainMap>();
-
- /**
- Parse framework database (DB) and all SPD files listed in DB to initialize
- the environment for next build. This method will only be executed only once
- in the whole build process.
-
- @param workspaceDatabaseFile the file name of framework database
- @param workspaceDir current workspace directory path
- @throws BuildException
- Framework Dababase or SPD or MSA file is not valid
- **/
- public synchronized static void initInfo(Project prj, String workspaceDatabaseFile, String workspaceDir, String toolsDefFilename ) throws EdkException {
- //
- // ensure this method will be revoked only once
- //
- if (globalFlag) {
- return;
- }
- globalFlag = true;
-
- //
- // Backup workspace directory. It will be used by other method
- //
- GlobalData.workspaceDir = workspaceDir.replaceAll("(\\\\)", "/");
-
- //
- // Parse tools definition file
- //
- //
- // If ToolChain has been set up before, do nothing.
- // CONF dir + tools definition file name
- //
- File toolsDefFile = new File(workspaceDir + File.separatorChar + toolsDefFilename);
- EdkLog.log("Init", EdkLog.EDK_ALWAYS, "Using tool definition file [" + toolsDefFile.getPath() + "].");
- toolsDef = new ToolChainConfig(prj, toolsDefFile);
-
- //
- // Parse Framework Database
- //
- File dbFile = new File(workspaceDir + File.separatorChar + workspaceDatabaseFile);
- FrameworkDatabaseDocument db = null;
- try {
- db = (FrameworkDatabaseDocument)parseXmlFile(dbFile);
- //
- // Get package list
- //
- if (db.getFrameworkDatabase().getPackageList() != null ) {
- List<DbPathAndFilename> packages = db.getFrameworkDatabase().getPackageList().getFilenameList();
- Iterator<DbPathAndFilename> iter = packages.iterator();
- while (iter.hasNext()) {
- String fileName = iter.next().getStringValue().trim();
- Spd spd = new Spd(new File(workspaceDir + File.separatorChar + fileName));
- packageList.add(spd.getPackageId());
- //
- // Report warning if existing two packages with same GUID and Version
- //
- if (spdTable.containsKey(spd.getPackageId())) {
- //
- // BUGBUG
- //
- EdkLog.log("Init", EdkLog.EDK_WARNING, "Warning: Existing two packages with same GUID and Version. They are ... " + spd.getPackageId().getSpdFile().getPath());
- }
- spdTable.put(spd.getPackageId(), spd);
- }
- }
- } catch(IOException ex) {
- EdkException edkException = new EdkException("Parse of WORKSPACE Database file [" + dbFile.getPath() + "] failed!\n" + ex.getMessage());
- edkException.setStackTrace(ex.getStackTrace());
- throw edkException;
- } catch(XmlException ex) {
- EdkException edkException = new EdkException("Parse of WORKSPACE Database file [" + dbFile.getPath() + "] failed!\n" + ex.getMessage());
- edkException.setStackTrace(ex.getStackTrace());
- throw edkException;
- }
-
- File fpdFile = null;
- try {
- //
- // Get platform list
- //
- if (db.getFrameworkDatabase().getPlatformList() != null) {
- List<DbPathAndFilename> platforms = db.getFrameworkDatabase().getPlatformList().getFilenameList();
- Iterator<DbPathAndFilename> iter = platforms.iterator();
- while (iter.hasNext()) {
- String fileName = iter.next().getStringValue().trim();
- fpdFile = new File(workspaceDir + File.separatorChar + fileName);
- if ( !fpdFile.exists() ) {
- throw new EdkException("Platform file [" + fpdFile.getPath() + "] not exists. ");
- }
- XmlObject fpdDoc = parseXmlFile(fpdFile);
- //
- // We can change Map to XmlObject
- //
- Map<String, XmlObject> fpdDocMap = new HashMap<String, XmlObject>();
- fpdDocMap.put("PlatformSurfaceArea", fpdDoc);
- SurfaceAreaQuery saq = new SurfaceAreaQuery(fpdDocMap);
- PlatformIdentification platformId = saq.getFpdHeader();
- platformId.setFpdFile(fpdFile);
- //
- // Report warning if existing two platfrom with same GUID and Version
- //
- if (platformList.contains(platformId)) {
- //
- // BUGBUG
- //
- EdkLog.log("Init", EdkLog.EDK_WARNING, "Warning: Existing two platforms with same GUID and Version. They are ... " + fpdFile.getPath());
- }
- platformList.add(platformId);
- }
- }
- } catch(IOException ex) {
- EdkException edkException = new EdkException("Parse of platform definition file [" + fpdFile.getPath() + "] failed!\n" + ex.getMessage());
- edkException.setStackTrace(ex.getStackTrace());
- throw edkException;
- } catch(XmlException ex) {
- EdkException edkException = new EdkException("Parse of platform definition file [" + fpdFile.getPath() + "] failed!\n" + ex.getMessage());
- edkException.setStackTrace(ex.getStackTrace());
- throw edkException;
- }
- }
-
- /**
- Get the current WORKSPACE Directory.
-
- @return current workspace directory
- **/
- public synchronized static String getWorkspacePath() {
- return workspaceDir;
- }
-
-
- /**
- Get the MSA file name with absolute path
- */
- public synchronized static File getMsaFile(ModuleIdentification moduleId) throws EdkException {
- File msaFile = null;
- //
- // TBD. Do only when package is null.
- //
- Iterator iter = packageList.iterator();
- while (iter.hasNext()) {
- PackageIdentification packageId = (PackageIdentification)iter.next();
- Spd spd = spdTable.get(packageId);
- msaFile = spd.getModuleFile(moduleId);
- if (msaFile != null ) {
- break ;
- }
- }
- if (msaFile == null){
- throw new EdkException("Can't find Module [" + moduleId.getName() + "] in any SPD package!");
- } else {
- return msaFile;
- }
- }
-
- public synchronized static PackageIdentification getPackageForModule(ModuleIdentification moduleId) throws EdkException {
- //
- // If package already defined in module
- //
- if (moduleId.getPackage() != null) {
- return moduleId.getPackage();
- }
-
- PackageIdentification packageId = null;
- Iterator iter = packageList.iterator();
- while (iter.hasNext()) {
- PackageIdentification pid = (PackageIdentification)iter.next();
- moduleId.setPackage(pid);
- Spd spd = spdTable.get(pid);
- File tempMsaFile = null;
- if ((tempMsaFile = spd.getModuleFile(moduleId)) != null ) {
- if (tempMsaFile.getParent().equalsIgnoreCase(moduleId.getMsaFile().getParent())) {
- packageId = pid;
- break ;
- }
- tempMsaFile = null;
- }
- }
- if (packageId == null){
- throw new EdkException("Can't find Module [" + moduleId.getName() + "] in any package!");
- } else {
- return packageId;
- }
- }
-
- /**
- Difference between build and parse: ToolChain and Target
- **/
- public synchronized static boolean isModuleBuilt(FpdModuleIdentification moduleId) {
- return builtModules.contains(moduleId);
- }
-
- public synchronized static void registerBuiltModule(FpdModuleIdentification fpdModuleId) {
- builtModules.add(fpdModuleId);
- }
-
-
- public synchronized static void registerFpdModuleSA(FpdModuleIdentification fpdModuleId, Map<String, XmlObject> doc) throws EdkException{
- Map<String, XmlObject> result = new HashMap<String, XmlObject>();
- Set keySet = doc.keySet();
- Iterator iter = keySet.iterator();
- while (iter.hasNext()){
- String key = (String)iter.next();
- XmlObject item = cloneXmlObject(doc.get(key), true);
- result.put(key, item);
- }
- fpdModuleSA.put(fpdModuleId, result);
- }
-
- public synchronized static boolean hasFpdModuleSA(FpdModuleIdentification fpdModuleId) {
- return fpdModuleSA.containsKey(fpdModuleId);
- }
-
- /**
- Query module surface area information.
-
- <p>Note that surface area parsing is incremental. That means the method will
- only parse the MSA files if necessary. </p>
-
- @param fpdModuleId Module ID with arch
- @return ModuleSA info and MSA info for fpdModuleId
- @throws BuildException Can't find MSA
- **/
- public synchronized static Map<String, XmlObject> getDoc(FpdModuleIdentification fpdModuleId) throws EdkException{
- if (parsedModules.containsKey(fpdModuleId)) {
- return parsedModules.get(fpdModuleId);
- }
- Map<String, XmlObject> doc = new HashMap<String, XmlObject>();
- ModuleIdentification moduleId = fpdModuleId.getModule();
- //
- // First part: get the MSA files info
- //
- doc.putAll(getNativeMsa(moduleId));
-
- //
- // Second part: put build options
- //
- doc.put("BuildOptions", fpdBuildOptions);
-
- //
- // Third part: get Module info from FPD, such as Library instances, PCDs
- //
- if (fpdModuleSA.containsKey(fpdModuleId)){
- //
- // merge module info in FPD to final Doc
- // For Library Module, do nothing here
- //
- doc.putAll(fpdModuleSA.get(fpdModuleId));
- }
- parsedModules.put(fpdModuleId, doc);
- return doc;
- }
-
- public synchronized static Map<String, XmlObject> getDoc(ModuleIdentification moduleId, String arch) throws EdkException{
- FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, arch);
- return getDoc(fpdModuleId);
- }
-
- /**
- Query the native MSA information with module base name.
-
- <p>Note that MSA parsing is incremental. That means the method will
- only to parse the MSA files when never parsed before. </p>
-
- @param moduleName the base name of the module
- @return the native MSA information
- @throws BuildException
- MSA file is not valid
- **/
- public synchronized static Map<String, XmlObject> getNativeMsa(ModuleIdentification moduleId) throws EdkException {
- if (nativeMsa.containsKey(moduleId)) {
- return nativeMsa.get(moduleId);
- }
- File msaFile = getMsaFile(moduleId);
- Map<String, XmlObject> msaMap = getNativeMsa(msaFile);
- nativeMsa.put(moduleId, msaMap);
- return msaMap;
- }
-
- public synchronized static Map<String, XmlObject> getNativeMsa(File msaFile) throws EdkException {
- if (!msaFile.exists()) {
- throw new EdkException("Module Surface Area file [" + msaFile.getPath() + "] can't be found!");
- }
- try {
- ModuleSurfaceAreaDocument doc = (ModuleSurfaceAreaDocument)parseXmlFile(msaFile);
- //
- // parse MSA file
- //
- ModuleSurfaceArea msa= doc.getModuleSurfaceArea();
- Map<String, XmlObject> msaMap = new HashMap<String, XmlObject>();
- msaMap.put("MsaHeader", cloneXmlObject(msa.getMsaHeader(), true));
- msaMap.put("ModuleDefinitions", cloneXmlObject(msa.getModuleDefinitions(), true));
- msaMap.put("LibraryClassDefinitions", cloneXmlObject(msa.getLibraryClassDefinitions(), true));
- msaMap.put("SourceFiles", cloneXmlObject(msa.getSourceFiles(), true));
- msaMap.put("PackageDependencies", cloneXmlObject(msa.getPackageDependencies(), true));
- msaMap.put("Protocols", cloneXmlObject(msa.getProtocols(), true));
- msaMap.put("PPIs", cloneXmlObject(msa.getPPIs(), true));
- msaMap.put("Guids", cloneXmlObject(msa.getGuids(), true));
- msaMap.put("Events", cloneXmlObject(msa.getEvents(), true));
- msaMap.put("Hobs", cloneXmlObject(msa.getHobs(), true));
- msaMap.put("Variables", cloneXmlObject(msa.getVariables(), true));
- msaMap.put("SystemTables", cloneXmlObject(msa.getSystemTables(), true));
- msaMap.put("DataHubs", cloneXmlObject(msa.getDataHubs(), true));
- msaMap.put("HiiPackages", cloneXmlObject(msa.getHiiPackages(), true));
- msaMap.put("Externs", cloneXmlObject(msa.getExterns(), true));
- msaMap.put("PcdCoded", cloneXmlObject(msa.getPcdCoded(), true));
- msaMap.put("ModuleBuildOptions", cloneXmlObject(msa.getModuleBuildOptions(), true));
- return msaMap;
- } catch(IOException ex) {
- EdkException edkException = new EdkException("Parse of MSA file [" + msaFile.getPath() + "] failed!\n" + ex.getMessage());
- edkException.setStackTrace(ex.getStackTrace());
- throw edkException;
- } catch(XmlException ex) {
- EdkException edkException = new EdkException("Parse of MSA file [" + msaFile.getPath() + "] failed!\n" + ex.getMessage());
- edkException.setStackTrace(ex.getStackTrace());
- throw edkException;
- }
- }
-
- public static Map<String, XmlObject> getFpdBuildOptionsMap() {
- return fpdBuildOptionsMap;
- }
-
- public static void setFpdBuildOptions(XmlObject fpdBuildOptions) throws EdkException {
- GlobalData.fpdBuildOptions = cloneXmlObject(fpdBuildOptions, true);
- fpdBuildOptionsMap.put("BuildOptions", GlobalData.fpdBuildOptions);
- }
-
- public static XmlObject getFpdDynamicPcds() {
- return fpdDynamicPcds;
- }
-
- public static void setFpdDynamicPcds(XmlObject fpdDynamicPcds) {
- GlobalData.fpdDynamicPcds = fpdDynamicPcds;
- }
-
- public static Set<ModuleIdentification> getModules(PackageIdentification packageId){
- Spd spd = spdTable.get(packageId);
- if (spd == null ) {
- Set<ModuleIdentification> dummy = new HashSet<ModuleIdentification>();
- return dummy;
- } else {
- return spd.getModules();
- }
- }
-
- /**
- * The header file path is relative to workspace dir
- */
- public static String[] getLibraryClassHeaderFiles(
- PackageIdentification[] packages, String name) throws EdkException{
- if (packages == null) {
- // throw Exception or not????
- return new String[0];
- }
- String[] result = null;
- for (int i = 0; i < packages.length; i++) {
- Spd spd = spdTable.get(packages[i]);
- //
- // If find one package defined the library class
- //
- if ((result = spd.getLibClassIncluder(name)) != null) {
- return result;
- }
- }
- //
- // If can't find library class declaration in every package
- //
- throw new EdkException("Can not find library class [" + name
- + "] declaration in any SPD package!");
- }
-
- /**
- * The header file path is relative to workspace dir
- */
- public static String getPackageHeaderFiles(PackageIdentification packages,
- String moduleType) {
- if (packages == null) {
- return new String("");
- }
- Spd spd = spdTable.get(packages);
- //
- // If can't find package header file, skip it
- //
- String temp = null;
- if (spd != null) {
- if ((temp = spd.getPackageIncluder(moduleType)) != null) {
- return temp;
- } else {
- temp = "";
- return temp;
- }
- } else {
- return null;
- }
- }
-
- /**
- * return two values: {cName, GuidValue}
- */
- public static String[] getGuid(List<PackageIdentification> packages, String name) {
- if (packages == null) {
- // throw Exception or not????
- return new String[0];
- }
- String[] result = null;
- Iterator item = packages.iterator();
- while (item.hasNext()){
- Spd spd = spdTable.get(item.next());
- //
- // If find one package defined the GUID
- //
- if ((result = spd.getGuid(name)) != null) {
- return result;
- }
- }
-
- return null;
- }
-
- /**
- * return two values: {cName, GuidValue}
- */
- public static String[] getPpiGuid(List<PackageIdentification> packages,
- String name) {
- if (packages == null) {
- return new String[0];
- }
- String[] result = null;
- Iterator item = packages.iterator();
- while (item.hasNext()){
- Spd spd = spdTable.get(item.next());
- //
- // If find one package defined the Ppi GUID
- //
- if ((result = spd.getPpi(name)) != null) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * return two values: {cName, GuidValue}
- */
- public static String[] getProtocolGuid(List<PackageIdentification> packages,
- String name) {
- if (packages == null) {
- return new String[0];
- }
- String[] result = null;
- Iterator item = packages.iterator();
- while (item.hasNext()){
- Spd spd = spdTable.get(item.next());
- //
- // If find one package defined the protocol GUID
- //
- if ((result = spd.getProtocol(name))!= null){
- return result;
- }
- }
- return null;
-
- }
-
- public synchronized static PlatformIdentification getPlatformByName(String name) throws EdkException {
- Iterator iter = platformList.iterator();
- while(iter.hasNext()){
- PlatformIdentification platformId = (PlatformIdentification)iter.next();
- if (platformId.getName().equalsIgnoreCase(name)) {
- return platformId;
- }
- }
- throw new EdkException("Can't find platform [" + name + "] in the current WORKSPACE database!");
- }
-
- public synchronized static PlatformIdentification getPlatform(String filename) throws EdkException {
- File file = new File(workspaceDir + File.separatorChar + filename);
- Iterator iter = platformList.iterator();
- while(iter.hasNext()){
- PlatformIdentification platformId = (PlatformIdentification)iter.next();
- if (platformId.getFpdFile().getPath().equalsIgnoreCase(file.getPath())) {
- return platformId;
- }
- }
- throw new EdkException("Can't find platform file [" + filename + "] in the current WORKSPACE database!");
- }
-
- public synchronized static PackageIdentification refreshPackageIdentification(PackageIdentification packageId) throws EdkException {
- Iterator iter = packageList.iterator();
- while(iter.hasNext()){
- PackageIdentification packageItem = (PackageIdentification)iter.next();
- if (packageItem.equals(packageId)) {
- packageId.setName(packageItem.getName());
- packageId.setSpdFile(packageItem.getSpdFile());
- return packageId;
- }
- }
- throw new EdkException("Can't find package GUID value " + packageId.toGuidString() + " in the current workspace!");
- }
-
- public synchronized static ModuleIdentification refreshModuleIdentification(ModuleIdentification moduleId) throws EdkException {
- PackageIdentification packageId = getPackageForModule(moduleId);
- moduleId.setPackage(packageId);
- Spd spd = spdTable.get(packageId);
- if (spd == null) {
- throw new EdkException("Can't find package GUID value " + packageId.toGuidString() + " in the current workspace!");
- }
- Set<ModuleIdentification> modules = spd.getModules();
- Iterator<ModuleIdentification> iter = modules.iterator();
- while (iter.hasNext()) {
- ModuleIdentification item = iter.next();
- if (item.equals(moduleId)) {
- moduleId.setName(item.getName());
- moduleId.setModuleType(item.getModuleType());
- moduleId.setMsaFile(item.getMsaFile());
- return moduleId;
- }
- }
- throw new EdkException("Can't find " + moduleId + " under the current workspace!");
- }
-
- public synchronized static Set<PackageIdentification> getPackageList(){
- return packageList;
- }
-
- /**
- BUGBUG: It is a walk around method. If do not clone, can't query info with
- XPath correctly.
-
- @param object XmlObject
- @param deep flag for deep clone
- @return XmlObject after clone
- @throws BuildException parse original XmlObject error.
- **/
- private static XmlObject cloneXmlObject(XmlObject object, boolean deep) throws EdkException {
- if ( object == null) {
- return null;
- }
- XmlObject result = null;
- try {
- result = XmlObject.Factory.parse(object.getDomNode()
- .cloneNode(deep));
- } catch (XmlException ex) {
- EdkException edkException = new EdkException(ex.getMessage());
- edkException.setStackTrace(ex.getStackTrace());
- throw edkException;
- }
- return result;
- }
-
- ///
- /// Tool Chain Related, try to refine and put some logic process to ToolChainFactory
- ///
- public synchronized static ToolChainInfo getToolChainInfo() {
- if (toolChainInfo == null) {
- toolChainInfo = toolsDef.getConfigInfo().intersection(toolChainEnvInfo);
- if (toolChainPlatformInfo != null) {
- toolChainInfo = toolChainInfo.intersection(toolChainPlatformInfo);
- }
- toolChainInfo.addCommands(toolsDef.getConfigInfo().getCommands());
- toolChainInfo.normalize();
-
- EdkLog.log("Init", EdkLog.EDK_ALWAYS, "Current build tool chain information summary: ");
- EdkLog.log("Init", EdkLog.EDK_ALWAYS, toolChainInfo + "");
- }
- return toolChainInfo;
- }
-
- public static void setPlatformToolChainFamilyOption(ToolChainMap map) {
- platformToolChainFamilyOption = map;
- }
-
- public static void setPlatformToolChainOption(ToolChainMap map) {
- platformToolChainOption = map;
- }
-
- public static void addModuleToolChainOption(FpdModuleIdentification fpdModuleId,
- ToolChainMap toolChainOption) {
- moduleToolChainOption.put(fpdModuleId, toolChainOption);
- }
-
- public static void addModuleToolChainFamilyOption(FpdModuleIdentification fpdModuleId,
- ToolChainMap toolChainOption) {
- moduleToolChainFamilyOption.put(fpdModuleId, toolChainOption);
- }
-
- public static void addMsaBuildOption(ModuleIdentification moduleId,
- ToolChainMap toolChainOption) {
- msaBuildOption.put(moduleId, toolChainOption);
- }
-
- public static void addMsaFamilyBuildOption(ModuleIdentification moduleId,
- ToolChainMap toolChainOption) {
- msaFamilyBuildOption.put(moduleId, toolChainOption);
- }
-
- public static boolean isCommandSet(String target, String toolchain, String arch) throws EdkException {
- String[] commands = getToolChainInfo().getCommands();
-
- for (int i = 0; i < commands.length; ++i) {
- String cmdName = toolsDef.getConfig().get(new String[] {target, toolchain, arch, commands[i], ToolDefinitions.TOOLS_DEF_ATTRIBUTE_NAME});
- if (cmdName != null && cmdName.length() != 0) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- Except FLAGS, all attribute are from TOOLS_DEF file.
-
- For FLAGS, information from four places, they are:
- <pre>
- 1. tools_def.txt
- 2. MSA &lt;BuildOptions&gt;/&lt;Options&gt;
- 3. FPD &lt;BuildOptions&gt;/&lt;Options&gt;
- 4. FPD &lt;FrameworkModules&gt;/&lt;ModuleSaBuildOptions&gt;/&lt;Options&gt;
- </pre>
-
- @param commandDescription Key: TARGET, TAGNAME, ARCH, COMMANDTYPE, ATTRIBUTE
- @param fpdModuleId Module Identification with Arch
- @return The corresponding String
- @throws EdkException If build option definition error
- **/
- public synchronized static String getCommandSetting(String[] commandDescription, FpdModuleIdentification fpdModuleId) throws EdkException {
- ToolChainKey toolChainKey = new ToolChainKey(commandDescription);
- ToolChainMap toolChainConfig = toolsDef.getConfig();
- String setting = null;
-
- //
- // Default in tools_def.txt
- //
- setting = toolChainConfig.get(toolChainKey);
- if (setting == null) {
- setting = "";
- }
- if (!commandDescription[ToolChainElement.ATTRIBUTE.value].equals(ToolDefinitions.TOOLS_DEF_ATTRIBUTE_FLAGS)) {
- return setting;
- }
-
- Set<String> flagSet = new LinkedHashSet<String>();
- flagSet.add(setting);
-
- //
- // Tool's option can be in .fpd and/or .msa file
- //
- String optionString;
- ToolChainMap option = null;
- ToolChainKey toolChainFamilyKey = new ToolChainKey(commandDescription);
-
- toolChainFamilyKey.setKey(ToolDefinitions.TOOLS_DEF_ATTRIBUTE_FAMILY, ToolChainElement.ATTRIBUTE.value);
- String family = toolChainConfig.get(toolChainFamilyKey);
- toolChainFamilyKey.setKey(family, ToolChainElement.TOOLCHAIN.value);
- toolChainFamilyKey.setKey(ToolDefinitions.TOOLS_DEF_ATTRIBUTE_FLAGS, ToolChainElement.ATTRIBUTE.value);
-
- //
- // MSA's tool chain family option
- //
- option = msaFamilyBuildOption.get(fpdModuleId.getModule());
- if (option != null && (optionString = option.get(toolChainFamilyKey)) != null) {
- flagSet.add(optionString);
- }
-
- //
- // MSA's tool chain option
- //
- option = msaBuildOption.get(fpdModuleId.getModule());
- if (option != null && (optionString = option.get(toolChainKey)) != null) {
- flagSet.add(optionString);
- }
-
- //
- // Platform's tool chain family option
- //
- optionString = platformToolChainFamilyOption.get(toolChainFamilyKey);
- if (optionString != null) {
- flagSet.add(optionString);
- }
-
- //
- // Platform's tool chain tag option
- //
- optionString = platformToolChainOption.get(toolChainKey);
- if (optionString != null) {
- flagSet.add(optionString);
- }
-
- //
- // Module's tool chain family option
- //
- option = moduleToolChainFamilyOption.get(fpdModuleId);
- if (option != null && (optionString = option.get(toolChainFamilyKey)) != null) {
- flagSet.add(optionString);
- }
-
- //
- // Module's tool chain tag option
- //
- option = moduleToolChainOption.get(fpdModuleId);
- if (option != null && (optionString = option.get(toolChainKey)) != null) {
- flagSet.add(optionString);
- }
-
- setting = "";
- for(Iterator<String> iter = flagSet.iterator(); iter.hasNext();) {
- setting += iter.next() +" ";
- }
- return setting;
- }
-
- public static void setToolChainEnvInfo(ToolChainInfo envInfo) {
- toolChainEnvInfo = envInfo;
- }
- public static void setToolChainPlatformInfo(ToolChainInfo platformInfo) {
- toolChainPlatformInfo = platformInfo;
- }
-
- //
- // for PCD
- //
- public synchronized static MemoryDatabaseManager getPCDMemoryDBManager() {
- return pcdDbManager;
- }
-
- //
- // For PCD get tokenSpaceGUid
- //
- public synchronized static String getGuidInfoFromCname(String cName){
- String cNameGuid = null;
- String guid = null;
- Set set = spdTable.keySet();
- Iterator iter = set.iterator();
-
- if (iter == null) {
- return null;
- }
-
- while (iter.hasNext()){
- Spd spd = (Spd) spdTable.get(iter.next());
- guid = spd.getGuidFromCname(cName);
- if (guid != null){
- cNameGuid = guid;
- break;
- }
- }
- return cNameGuid;
- }
-
- //
- // For PCD
- //
- public synchronized static Map<FpdModuleIdentification, XmlObject>
- getFpdModuleSaXmlObject(String xmlObjectName) {
- Set<FpdModuleIdentification> fpdModuleSASet = fpdModuleSA.keySet();
- Iterator item = fpdModuleSASet.iterator();
-
-
- Map<FpdModuleIdentification, XmlObject> SAPcdBuildDef = new HashMap<FpdModuleIdentification, XmlObject>();
- Map<String, XmlObject> SANode = new HashMap<String, XmlObject>();
- FpdModuleIdentification moduleId;
- while (item.hasNext()) {
-
- moduleId = (FpdModuleIdentification) item.next();
- SANode = fpdModuleSA.get(moduleId);
- try{
- if (SANode.get(xmlObjectName)!= null){
- SAPcdBuildDef.put(moduleId,
- (XmlObject) SANode.get(xmlObjectName));
-
- }
- } catch (Exception e){
- EdkLog.log(EdkLog.EDK_INFO, e.getMessage());
- }
- }
- return SAPcdBuildDef;
- }
-
- public synchronized static Map<FpdModuleIdentification,XmlObject> getFpdPcdBuildDefinitions() {
- Map<FpdModuleIdentification,XmlObject> pcdBuildDef = getFpdModuleSaXmlObject ("PcdBuildDefinition");
-
- return pcdBuildDef;
- }
-
- public static XmlObject parseXmlFile(File xmlFile) throws IOException, XmlException {
- Collection errors = new ArrayList();
- XmlOptions opt = new XmlOptions();
-
- opt.setLoadLineNumbers();
- opt.setLoadMessageDigest();
- opt.setErrorListener(errors);
-
- XmlObject doc = XmlObject.Factory.parse(xmlFile, opt);
- //
- // Validate File if they accord with XML Schema
- //
- if (!doc.validate(opt)){
- StringBuilder errorMessage = new StringBuilder(1024);
- for (Iterator it = errors.iterator(); it.hasNext(); ) {
- errorMessage.append(it.next());
- errorMessage.append("\n");
- }
- throw new XmlException(errorMessage.toString());
- }
-
- return doc;
- }
-}
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/OnDependency.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/OnDependency.java
deleted file mode 100644
index 678bfb869b..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/OnDependency.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/** @file
-This file is to define OnDependency class.
-
-Copyright (c) 2006, 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.
-
---*/
-package org.tianocore.build.global;
-
-import java.io.File;
-import java.util.Iterator;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Sequential;
-import org.tianocore.common.logger.EdkLog;
-import org.tianocore.common.cache.FileTimeStamp;
-
-/**
- Class OnDepdendency is used to check the timestamp between source files and
- target files, which can be used to determine if the target files are needed to
- be re-generated from source files.
- **/
-public class OnDependency extends Task {
- //
- // source files list
- //
- private DpFileList sources = null;
-
- //
- // target files list
- //
- private DpFileList targets = null;
-
- //
- // tasks to be performed to generate target files
- //
- private Sequential task = null;
-
- /**
- An empty constructor for an ANT task can avoid some potential issues
- **/
- public OnDependency(){
- }
-
- /**
- Standard execute method of ANT task
- **/
- public void execute() throws BuildException {
- if (isOutOfDate() && task != null) {
- task.perform();
- }
-
- //
- // Update the time stamp of target files since they are just re-generated
- //
- for (Iterator dstIt = targets.nameList.iterator(); dstIt.hasNext();) {
- FileTimeStamp.update((String)dstIt.next());
- }
- }
-
- //
- // check if the target files are outofdate
- //
- private boolean isOutOfDate() {
- ///
- /// if no source files specified, take it as a fresh start
- ///
- if (sources.nameList.size() == 0) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "No source file spcified!");
- return true;
- }
-
- if (targets.nameList.size() == 0) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "No target file found!");
- return true;
- }
-
- Iterator dstIt = targets.nameList.iterator();
- while (dstIt.hasNext()) {
- String dstFileName = (String)dstIt.next();
- File dstFile = new File(dstFileName);
- if (!dstFile.exists()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "Target file [" + dstFileName + "] doesn't exist!");
- return true;
- }
-
- long dstTimeStamp = FileTimeStamp.get(dstFileName);
- Iterator srcIt = sources.nameList.iterator();
- while (srcIt.hasNext()) {
- String srcFileName = (String)srcIt.next();
- long srcTimeStamp = FileTimeStamp.get(srcFileName);
-
- if (srcTimeStamp == 0) {
- //
- // time stamp 0 means that the file doesn't exist
- //
- throw new BuildException("Source File name: " + srcFileName + " doesn't exist!!!");
- }
-
- if (dstTimeStamp < srcTimeStamp) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "Source file [" + srcFileName + "] has been changed since last build!");
- return true;
- }
- }
- }
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "Target files are up-to-date!");
- return false;
- }
-
- /**
- Add method of ANT task for nested element with Sequential type
-
- @param task Sequential object which contains tasks for generating target files
- **/
- public void addSequential(Sequential task) {
- this.task = task;
- }
-
- /**
- Add method of ANT task for nested element with DpFileList type
-
- @param sources DpFileList object which contains the list of source files
- **/
- public void addSourcefiles(DpFileList sources) {
- this.sources = sources;
- }
-
- /**
- Add method of ANT task for nested element with DpFileList type
-
- @param targets DpFileList object which contains the list of target files
- **/
- public void addTargetfiles(DpFileList targets) {
- this.targets = targets;
- }
-}
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/OutputManager.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/OutputManager.java
deleted file mode 100644
index 2c70326202..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/OutputManager.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/** @file
- OutputManager class.
-
- OutputManager class set output directories for every module by BUILD_MODE.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.build.global;
-
-import org.apache.tools.ant.Project;
-import java.io.File;
-
-/**
- OutputManager class is used to setup output directories (BIN_DIR, DEST_DIR_OUTPUT,
- DEST_DIR_DEBUG).
-
- @since GenBuild 1.0
-**/
-public class OutputManager {
-
- ///
- /// means intermediate files will put under Module's dir
- ///
- private String MODULE = "MODULE";
-
- ///
- /// mean intermediate files will put under a unify dir
- ///
- private String UNIFIED = "UNIFIED";
-
-
- private String userdir;
-
- private String type;
- ///
- /// Singleton Design Pattern
- ///
- private static OutputManager object;
-
- public synchronized static OutputManager getInstance() {
- if ( object == null ) {
- object = new OutputManager();
- }
- return object;
- }
-
- public void setup(String userdir, String type) {
- this.userdir = userdir;
- this.type = type;
- }
-
- /**
- Setup BIN_DIR, DEST_DIR_OUTPUT and DEST_DIR_OUTPUT, following are the rules:
-
- <p>Divide all output files into two types: one is final files, such as FFS
- file for driver module while LIB file for library module; another is
- intermediate files, such AutoGen.c, OBJ files, Section files and so on.
-
- <p>In FPD, OutputDirectory element is used to specify where to put the output
- files to. There are two mode (MODULE | UNIFIED). MODULE mode means that all
- output files will put to the module directory while UNIFIED mode means that
- all output files will put together. Default is UNIFIED mode.
-
- <p>BUILD_DIR is the base directory for current module build. By default,
- BUILD_DIR is PLATFORM_DIR/Build in UNIFIED mode while is MODULE_DIR/Build
- in MODULE mode. Of course, user can customize BUILD_DIR. If user-defined
- BUILD_DIR is relative path, then look as related to WORKSPACE_DIR.
-
- <p>Then, BIN_DIR is BUILD_DIR/TARGET/TOOLCHAIN/ARCH;
-
- <p>FV_DIR is BUILD_DIR/TARGET/TOOLCHAIN/FV;
-
- <p>DEST_DIR_DEBUG | DEST_DIR_OUTPUT is:
- BIN_DIR/PACKAGE_RELATIVE_DIR/MODULE_RELATIVE_DIR/DEBUG | OUTPUT
-
-
- @param project current ANT build Project
- @param userdir user-defined directory
- @param type the module build type (MODULE or UNIFIED)
- **/
- public void update(Project project) {
- //
- // Default mode is UNIFIED.
- //
- if (type != null && type.equalsIgnoreCase(MODULE)) {
- type = MODULE;
- }
- else {
- type = UNIFIED;
- }
-
- //
- // default BUILD_DIR value
- //
- String buildDir;
- if(type.equals(MODULE)){
- buildDir = project.getProperty("MODULE_DIR") + File.separatorChar + "Build";
- }
- else {
- buildDir = project.getProperty("PLATFORM_DIR") + File.separatorChar + "Build";
- }
-
- //
- // If user define BUILD_DIR
- //
- if (userdir != null && ! userdir.equals("")) {
- File buildFile = new File(userdir);
- if (buildFile.isAbsolute()){
- buildDir = userdir;
- }
- //
- // If path is not absolute, then look as related to WORKSPACE_DIR
- //
- else {
- buildDir = GlobalData.getWorkspacePath() + File.separatorChar + userdir;
- }
- }
-
- //
- // Define TARGET_DIR
- //
- String targetDir = buildDir + File.separatorChar + project.getProperty("TARGET")
- + "_" + project.getProperty("TOOLCHAIN");
-
- //
- // Define BIN_DIR and FV_DIR
- //
- String binDir = targetDir + File.separatorChar + project.getProperty("ARCH") ;
-
- String fvDir = targetDir + File.separatorChar + "FV";
-
- //
- // Define DEST_DIR_OUTPUT and DEST_DIR_DEBUG
- //
- String destDir = binDir + File.separatorChar + project.getProperty("PACKAGE_RELATIVE_DIR")
- + File.separatorChar + project.getProperty("MODULE_RELATIVE_DIR");
-
- //
- // Set properties
- //
- project.setProperty("BUILD_DIR", buildDir.replaceAll("(\\\\)", "/"));
- project.setProperty("TARGET_DIR", targetDir.replaceAll("(\\\\)", "/"));
- project.setProperty("FV_DIR", fvDir.replaceAll("(\\\\)", "/"));
- project.setProperty("BIN_DIR", binDir.replaceAll("(\\\\)", "/"));
- project.setProperty("DEST_DIR_DEBUG", (destDir + File.separatorChar + "DEBUG").replaceAll("(\\\\)", "/"));
- project.setProperty("DEST_DIR_OUTPUT", (destDir + File.separatorChar + "OUTPUT").replaceAll("(\\\\)", "/"));
-
- //
- // Create all directory if necessary
- //
- (new File(buildDir)).mkdirs();
- (new File(fvDir)).mkdirs();
- (new File(binDir)).mkdirs();
- (new File(destDir + File.separatorChar + "DEBUG")).mkdirs();
- (new File(destDir + File.separatorChar + "OUTPUT")).mkdirs();
- }
-
- public boolean prepareBuildDir(Project project){
- boolean isUnified = true;
-
- if (type.equalsIgnoreCase("MODULE")) {
- isUnified = false;
- }
-
- String buildDir = project.getProperty("PLATFORM_DIR") + File.separatorChar + "Build";
- //
- // If user define BUILD_DIR
- //
- if (userdir != null && ! userdir.equals("")) {
- File buildFile = new File(userdir);
- if (buildFile.isAbsolute()){
- buildDir = userdir;
- }
- //
- // If path is not absolute, then look as related to WORKSPACE_DIR
- //
- else {
- buildDir = GlobalData.getWorkspacePath() + File.separatorChar + userdir;
- }
- }
-
- //
- // Set to property
- //
- project.setProperty("BUILD_DIR", buildDir.replaceAll("(\\\\)", "/"));
-
- //
- // Create all directory if necessary
- //
- (new File(buildDir)).mkdirs();
- return isUnified;
- }
-
-} \ No newline at end of file
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/Spd.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/Spd.java
deleted file mode 100644
index 951817f64c..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/Spd.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/** @file
- Spd class.
-
- This class is to generate a global table for the content of spd file.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.build.global;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.id.PackageIdentification;
-import org.tianocore.common.exception.EdkException;
-
-/**
-
- This class is to generate a global table for the content of spd file.
-
-**/
-public class Spd {
- ///
- ///
- ///
- Map<ModuleIdentification, File> msaInfo = new HashMap<ModuleIdentification, File>();
-
- ///
- /// Map of module info.
- /// Key : moduletype
- /// Value: moduletype related include file
- ///
- Map<String, String> packageHeaderInfo = new HashMap<String, String>();
-
- ///
- /// Map of PPI info.
- /// Key : PPI name
- /// value: String[] a. PPI C_NAME; b. PPI GUID;
- ///
- Map<String, String[]> ppiInfo = new HashMap<String, String[]>();
-
- ///
- /// Map of Protocol info.
- /// Key : Protocol name
- /// value: String[] a. Protocol C_NAME; b. Protocol GUID;
- ///
- Map<String, String[]> protocolInfo = new HashMap<String, String[]>();
-
- ///
- /// Map of Guid info.
- /// Key : Guid name
- /// value: String[] a. Guid C_NAME; b. Guid's GUID;
- ///
- Map<String, String[]> guidInfo = new HashMap<String, String[]>();
-
- ///
- /// Map of Guid info
- /// Key: GuidCName
- /// value: String Guid's GUID
- ///
- Map<String, String> guidCnameInfo = new HashMap<String, String>();
-
- /// Map of library class and its exposed header file.
- /// Key : library class name
- /// value : library class corresponding header file
- ///
- Map<String, String[]> libClassHeaderList = new HashMap<String, String[]>();
-
- ///
- /// Package path.
- ///
- PackageIdentification packageId;
-
- /**
- Constructor function
-
- This function mainly initialize some member variables.
- **/
- Spd(File packageFile) throws EdkException {
- //
- // If specified package file not exists
- //
- if ( ! packageFile.exists()) {
- throw new EdkException("Package file [" + packageFile.getPath() + "] does not exist!");
- }
- try {
- XmlObject spdDoc = GlobalData.parseXmlFile(packageFile);
- //
- // We can change Map to XmlObject
- //
- Map<String, XmlObject> spdDocMap = new HashMap<String, XmlObject>();
- spdDocMap.put("PackageSurfaceArea", spdDoc);
- SurfaceAreaQuery saq = new SurfaceAreaQuery(spdDocMap);
-
- packageId = saq.getSpdHeader();
- packageId.setSpdFile(packageFile);
-
- //
- // initialize Msa Files
- // MSA file is absolute file path
- //
- String[] msaFilenames = saq.getSpdMsaFile();
- for (int i = 0; i < msaFilenames.length; i++){
- File msaFile = new File(packageId.getPackageDir() + File.separatorChar + msaFilenames[i]);
- Map<String, XmlObject> msaDoc = GlobalData.getNativeMsa( msaFile );
- saq.push(msaDoc);
- ModuleIdentification moduleId = saq.getMsaHeader();
- saq.pop();
- moduleId.setPackage(packageId);
- moduleId.setMsaFile(msaFile);
- if (msaInfo.containsKey(moduleId)) {
- throw new EdkException("Found two modules with the same GUID and Version in package " + packageId + ".\nThey are module [" + msaInfo.get(moduleId) + "] and MSA file [" + msaFile + "]!");
- }
- msaInfo.put(moduleId, msaFile);
- }
-
- //
- // initialize Package header files
- //
- Map<String, String> packageHeaders = saq.getSpdPackageHeaderFiles();
- Set keys = packageHeaders.keySet();
- Iterator iter = keys.iterator();
- while (iter.hasNext()){
- String moduleType = (String)iter.next();
- String header = packageId.getPackageRelativeDir() + File.separatorChar + packageHeaders.get(moduleType);
-
- //
- // Change path seperator to system-dependent path separator
- //
- File file = new File (header);
- header = file.getPath();
- packageHeaderInfo.put(moduleType, header);
- }
-
- //
- // initialize Guid Info
- //
- guidInfo.putAll(saq.getSpdGuid());
-
- //
- // For Pcd get TokenSpaceGuid
- //
- Set<String> key = guidInfo.keySet();
- Iterator item = key.iterator();
- String [] nameValue = new String[2];
- while(item.hasNext()){
- nameValue = guidInfo.get(item.next());
- guidCnameInfo.put(nameValue[0], nameValue[1]);
- }
-
- //
- // initialize PPI info
- //
- ppiInfo.putAll(saq.getSpdPpi());
-
- //
- // initialize Protocol info
- //
- protocolInfo.putAll(saq.getSpdProtocol());
-
- //
- // initialize library class declaration
- //
- Map<String, String[]> libraryClassHeaders = saq.getSpdLibraryClasses();
- keys = libraryClassHeaders.keySet();
- iter = keys.iterator();
- while (iter.hasNext()){
- String libraryClassName = (String)iter.next();
- String[] headerFiles = libraryClassHeaders.get(libraryClassName);
- for (int i = 0; i < headerFiles.length; i++){
- headerFiles[i] = packageId.getPackageRelativeDir() + File.separatorChar + headerFiles[i];
-
- //
- // Change path separator to system system-dependent path separator.
- //
- File file = new File (headerFiles[i]);
- headerFiles[i] = file.getPath();
- }
- libClassHeaderList.put(libraryClassName, headerFiles);
- }
- } catch (IOException ex) {
- EdkException edkException = new EdkException("Parse of the package description file [" + packageFile.getPath() + "] failed!\n" + ex.getMessage());
- edkException.setStackTrace(ex.getStackTrace());
- throw edkException;
- } catch (XmlException ex) {
- EdkException edkException = new EdkException("Parse of the package description file [" + packageFile.getPath() + "] failed!\n" + ex.getMessage());
- edkException.setStackTrace(ex.getStackTrace());
- throw edkException;
- }
- }
-
- public PackageIdentification getPackageId() {
- return packageId;
- }
-
- public File getModuleFile(ModuleIdentification moduleId) {
- return msaInfo.get(moduleId);
- }
-
- public Set<ModuleIdentification> getModules(){
- return msaInfo.keySet();
- }
-
- /**
- return two value {CName, Guid}. If not found, return null.
- **/
- public String[] getPpi(String ppiName) {
- return ppiInfo.get(ppiName);
- }
-
- /**
- return two value {CName, Guid}. If not found, return null.
- **/
- public String[] getProtocol(String protocolName) {
- return protocolInfo.get(protocolName);
- }
-
- /**
- return two value {CName, Guid}. If not found, return null.
- **/
- public String[] getGuid(String guidName) {
- return guidInfo.get(guidName);
- }
-
- /**
- * return Guid Value.
- */
- public String getGuidFromCname(String cName){
- return guidCnameInfo.get(cName);
- }
-
- /**
- getLibClassInclude
-
- This function is to get the library exposed header file name according
- library class name.
-
- @param libName Name of library class
- @return Name of header file
- **/
- String[] getLibClassIncluder(String libName) {
- return libClassHeaderList.get(libName);
- }
-
- /**
- getModuleTypeIncluder
-
- This function is to get the header file name from module info map
- according to module type.
-
- @param moduleType Module type.
- @return Name of header file.
- **/
- String getPackageIncluder(String moduleType) {
- return packageHeaderInfo.get(moduleType);
- }
-
-
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java
deleted file mode 100644
index acd8182d3b..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java
+++ /dev/null
@@ -1,2356 +0,0 @@
-/** @file
- This file is for surface area information retrieval.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.build.global;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlString;
-import org.tianocore.*;
-import org.tianocore.ExternsDocument.Externs.Extern;
-import org.tianocore.FilenameDocument.Filename;
-import org.tianocore.ModuleDefinitionsDocument.ModuleDefinitions;
-import org.tianocore.MsaHeaderDocument.MsaHeader;
-import org.tianocore.ProtocolsDocument.Protocols.Protocol;
-import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
-import org.tianocore.build.autogen.CommonDefinition;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.id.PackageIdentification;
-import org.tianocore.build.id.PlatformIdentification;
-import org.tianocore.build.toolchain.ToolChainInfo;
-import org.tianocore.common.definitions.EdkDefinitions;
-import org.tianocore.common.exception.EdkException;
-import org.w3c.dom.Node;
-
-/**
- * SurfaceAreaQuery class is used to query Surface Area information from msa,
- * mbd, spd and fpd files.
- *
- * This class should not instantiated. All the public interfaces is static.
- *
- * @since GenBuild 1.0
- */
-public class SurfaceAreaQuery {
-
- public String prefix = "http://www.TianoCore.org/2006/Edk2.0";
-
- //
- // Contains name/value pairs of Surface Area document object. The name is
- // always the top level element name.
- //
- private Map<String, XmlObject> map = null;
-
- //
- // mapStack is used to do nested query
- //
- private Stack<Map<String, XmlObject>> mapStack = new Stack<Map<String, XmlObject>>();
-
- //
- // prefix of name space
- //
- private String nsPrefix = "sans";
-
- //
- // xmlbeans needs a name space for each Xpath element
- //
- private String ns = null;
-
- //
- // keep the namep declaration for xmlbeans Xpath query
- //
- private String queryDeclaration = null;
- private StringBuffer normQueryString = new StringBuffer(4096);
- private Pattern xPathPattern = Pattern.compile("([^/]*)(/|//)([^/]+)");
-
- /**
- * Set a Surface Area document for query later
- *
- * @param map
- * A Surface Area document in TopLevelElementName/XmlObject
- * format.
- */
- public SurfaceAreaQuery(Map<String, XmlObject> map) {
- ns = prefix;
- queryDeclaration = "declare namespace " + nsPrefix + "='" + ns + "'; ";
- this.map = map;
- }
-
- /**
- * Push current used Surface Area document into query stack. The given new
- * document will be used for any immediately followed getXXX() callings,
- * untill pop() is called.
- *
- * @param newMap
- * The TopLevelElementName/XmlObject format of a Surface Area
- * document.
- */
- public void push(Map<String, XmlObject> newMap) {
- mapStack.push(this.map);
- this.map = newMap;
- }
-
- /**
- * Discard current used Surface Area document and use the top document in
- * stack instead.
- */
- public void pop() {
- this.map = mapStack.pop();
- }
-
- // /
- // / Convert xPath to be namespace qualified, which is necessary for
- // XmlBeans
- // / selectPath(). For example, converting /MsaHeader/ModuleType to
- // / /ns:MsaHeader/ns:ModuleType
- // /
- private String normalizeQueryString(String[] exp, String from) {
- normQueryString.setLength(0);
-
- int i = 0;
- while (i < exp.length) {
- String newExp = from + exp[i];
- Matcher matcher = xPathPattern.matcher(newExp);
-
- while (matcher.find()) {
- String starter = newExp.substring(matcher.start(1), matcher
- .end(1));
- String seperator = newExp.substring(matcher.start(2), matcher
- .end(2));
- String token = newExp.substring(matcher.start(3), matcher
- .end(3));
-
- normQueryString.append(starter);
- normQueryString.append(seperator);
- normQueryString.append(nsPrefix);
- normQueryString.append(":");
- normQueryString.append(token);
- }
-
- ++i;
- if (i < exp.length) {
- normQueryString.append(" | ");
- }
- }
-
- return normQueryString.toString();
- }
-
- /**
- * Search all XML documents stored in "map" for the specified xPath, using
- * relative path (starting with '$this')
- *
- * @param xPath
- * xpath query string array
- * @returns An array of XmlObject if elements are found at the specified
- * xpath
- * @returns NULL if nothing is at the specified xpath
- */
- public Object[] get(String[] xPath) {
- if (map == null) {
- return null;
- }
-
- String[] keys = (String[]) map.keySet().toArray(new String[map.size()]);
- List<Object> result = new ArrayList<Object>();
- for (int i = 0; i < keys.length; ++i) {
- XmlObject rootNode = (XmlObject) map.get(keys[i]);
- if (rootNode == null) {
- continue;
- }
-
- String query = queryDeclaration
- + normalizeQueryString(xPath, "$this/" + keys[i]);
- XmlObject[] tmp = rootNode.selectPath(query);
- for (int j = 0; j < tmp.length; ++j) {
- result.add((Object)tmp[j]);
- }
- }
-
- int size = result.size();
- if (size <= 0) {
- return null;
- }
-
- return (Object[]) result.toArray(new Object[size]);
- }
-
- /**
- * Search XML documents named by "rootName" for the given xPath, using
- * relative path (starting with '$this')
- *
- * @param rootName
- * The top level element name
- * @param xPath
- * The xpath query string array
- * @returns An array of XmlObject if elements are found at the given xpath
- * @returns NULL if nothing is found at the given xpath
- */
- public Object[] get(String rootName, String[] xPath) {
- if (map == null) {
- return null;
- }
-
- XmlObject root = (XmlObject) map.get(rootName);
- if (root == null) {
- return null;
- }
-
- String query = queryDeclaration
- + normalizeQueryString(xPath, "$this/" + rootName);
- XmlObject[] result = root.selectPath(query);
- if (result.length > 0) {
- return (Object[])result;
- }
-
- query = queryDeclaration + normalizeQueryString(xPath, "/" + rootName);
- result = root.selectPath(query);
- if (result.length > 0) {
- return (Object[])result;
- }
-
- return null;
- }
-
- /**
- * Retrieve SourceFiles/Filename for specified ARCH type
- *
- * @param arch
- * architecture name
- * @returns An 2 dimension string array if elements are found at the known
- * xpath
- * @returns NULL if nothing is found at the known xpath
- */
- public String[][] getSourceFiles(String arch) {
- String[] xPath;
- Object[] returns;
-
- xPath = new String[] { "/Filename" };
-
- returns = get("SourceFiles", xPath);
-
- if (returns == null || returns.length == 0) {
- return new String[0][3];
- }
-
- Filename[] sourceFileNames = (Filename[]) returns;
- List<String[]> outputList = new ArrayList<String[]>();
- for (int i = 0; i < sourceFileNames.length; i++) {
- List archList = sourceFileNames[i].getSupArchList();
- if (arch == null || arch.trim().equalsIgnoreCase("") || archList == null || contains(archList, arch)) {
- outputList.add(new String[] {sourceFileNames[i].getToolCode(), sourceFileNames[i].getStringValue(), sourceFileNames[i].getToolChainFamily()});
- }
- }
-
- String[][] outputString = new String[outputList.size()][3];
- for (int index = 0; index < outputList.size(); index++) {
- //
- // ToolCode (FileType)
- //
- outputString[index][0] = outputList.get(index)[0];
- //
- // File name (relative to MODULE_DIR)
- //
- outputString[index][1] = outputList.get(index)[1];
- //
- // Tool chain family
- //
- outputString[index][2] = outputList.get(index)[2];
- }
- return outputString;
- }
-
- /**
- * Retrieve /PlatformDefinitions/OutputDirectory from FPD
- *
- * @returns Directory names array if elements are found at the known xpath
- * @returns Empty if nothing is found at the known xpath
- */
- public String getFpdOutputDirectory() {
- String[] xPath = new String[] { "/PlatformDefinitions" };
-
- Object[] returns = get("PlatformSurfaceArea", xPath);
- if (returns == null || returns.length == 0) {
- return null;
- }
- PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];
- return item.getOutputDirectory();
- }
-
- public String getFpdIntermediateDirectories() {
- String[] xPath = new String[] { "/PlatformDefinitions" };
-
- Object[] returns = get("PlatformSurfaceArea", xPath);
- if (returns == null || returns.length == 0) {
- return "UNIFIED";
- }
- PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];
- if(item.getIntermediateDirectories() == null) {
- return null;
- }
- else {
- return item.getIntermediateDirectories().toString();
- }
- }
-
- public String getModuleFfsKeyword() {
- String[] xPath = new String[] { "/" };
-
- Object[] returns = get("ModuleSaBuildOptions", xPath);
- if (returns == null || returns.length == 0) {
- return null;
- }
- ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0];
- return item.getFfsFormatKey();
- }
-
- public String getModuleFvBindingKeyword() {
- String[] xPath = new String[] { "/" };
-
- Object[] returns = get("ModuleSaBuildOptions", xPath);
- if (returns == null || returns.length == 0) {
- return null;
- }
- ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0];
- return item.getFvBinding();
- }
-
- public List getModuleSupportedArchs() {
- String[] xPath = new String[] { "/" };
-
- Object[] returns = get("ModuleDefinitions", xPath);
- if (returns == null || returns.length == 0) {
- return null;
- }
- ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];
- return item.getSupportedArchitectures();
- }
-
- public BuildOptionsDocument.BuildOptions.Ffs[] getFpdFfs() {
- String[] xPath = new String[] {"/Ffs"};
-
- Object[] returns = get("BuildOptions", xPath);
- if (returns == null || returns.length == 0) {
- return new BuildOptionsDocument.BuildOptions.Ffs[0];
- }
- return (BuildOptionsDocument.BuildOptions.Ffs[])returns;
- }
-
- public String getModuleOutputFileBasename() {
- String[] xPath = new String[] { "/" };
-
- Object[] returns = get("ModuleDefinitions", xPath);
- if (returns == null || returns.length == 0) {
- return null;
- }
- ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];
- return item.getOutputFileBasename();
- }
-
- /**
- * Retrieve BuildOptions/Option or Arch/Option
- *
- * @param toolChainFamilyFlag
- * if true, retrieve options for toolchain family; otherwise for
- * toolchain
- *
- * @returns String[][5] name, target, toolchain, arch, coommand of options
- * if elements are found at the known xpath. String[0][] if dont
- * find element.
- *
- * @returns Empty array if nothing is there
- */
- public String[][] getOptions(String from, String[] xPath, boolean toolChainFamilyFlag) {
- String target = null;
- String toolchain = null;
- String toolchainFamily = null;
- List<String> archList = null;
- String cmd = null;
- String optionName = null;
-
- Object[] returns = get(from, xPath);
- if (returns == null) {
- return new String[0][5];
- }
-
- List<String[]> optionList = new ArrayList<String[]>();
- OptionDocument.Option option;
-
- for (int i = 0; i < returns.length; i++) {
- option = (OptionDocument.Option) returns[i];
-
- //
- // Get Target, ToolChain(Family), Arch, Cmd, and Option from Option,
- // then
- // put to result[][5] array in above order.
- //
- String[] targetList;
- if (option.getBuildTargets() == null) {
- target = null;
- }
- else {
- target = option.getBuildTargets().toString();
- }
- if (target != null) {
- targetList = target.split(" ");
- } else {
- targetList = new String[1];
- targetList[0] = null;
- }
-
- if (toolChainFamilyFlag) {
- toolchainFamily = option.getToolChainFamily();
- if (toolchainFamily != null) {
- toolchain = toolchainFamily.toString();
- } else {
- toolchain = null;
- }
- } else {
- toolchain = option.getTagName();
- }
-
- archList = new ArrayList<String>();
- List archEnumList = option.getSupArchList();
- if (archEnumList == null) {
- archList.add(null);
- } else {
- //archList.addAll(archEnumList);
- Iterator it = archEnumList.iterator();
- while (it.hasNext()) {
- String archType = (String)it.next();
- archList.add(archType);
- }
- }
-
- cmd = option.getToolCode();
-
- optionName = option.getStringValue();
- for (int t = 0; t < targetList.length; t++) {
- for (int j = 0; j < archList.size(); j++) {
- optionList.add(new String[] { targetList[t],
- toolchain, archList.get(j), cmd, optionName});
- }
- }
- }
-
- String[][] result = new String[optionList.size()][5];
- for (int i = 0; i < optionList.size(); i++) {
- result[i][0] = optionList.get(i)[0];
- result[i][1] = optionList.get(i)[1];
- result[i][2] = optionList.get(i)[2];
- result[i][3] = optionList.get(i)[3];
- result[i][4] = optionList.get(i)[4];
- }
- return result;
- }
-
- public String[][] getModuleBuildOptions(boolean toolChainFamilyFlag) {
- String[] xPath;
-
- if (toolChainFamilyFlag == true) {
- xPath = new String[] {
- "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
- "/Options/Option[@ToolChainFamily]", };
- } else {
- xPath = new String[] {
- "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
- "/Options/Option[@TagName]", };
- }
- return getOptions("ModuleSaBuildOptions", xPath, toolChainFamilyFlag);
- }
-
- public String[][] getPlatformBuildOptions(boolean toolChainFamilyFlag) {
- String[] xPath;
-
- if (toolChainFamilyFlag == true) {
- xPath = new String[] {
- "/BuildOptions/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
- "/BuildOptions/Options/Option[@ToolChainFamily]", };
- } else {
- xPath = new String[] {
- "/BuildOptions/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
- "/BuildOptions/Options/Option[@TagName]", };
- }
-
- return getOptions("PlatformSurfaceArea", xPath, toolChainFamilyFlag);
- }
-
- public String[][] getMsaBuildOptions(boolean toolChainFamilyFlag) {
- String[] xPath;
-
- if (toolChainFamilyFlag == true) {
- xPath = new String[] {
- "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
- "/Options/Option[@ToolChainFamily]", };
- } else {
- xPath = new String[] {
- "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
- "/Options/Option[@TagName]", };
- }
-
- return getOptions("ModuleBuildOptions", xPath, toolChainFamilyFlag);
- }
-
- public ToolChainInfo getFpdToolChainInfo() {
- String[] xPath = new String[] { "/PlatformDefinitions" };
-
- Object[] returns = get("PlatformSurfaceArea", xPath);
- if (returns == null || returns.length == 0) {
- return null;
- }
-
- PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];
- ToolChainInfo toolChainInfo = new ToolChainInfo();
- toolChainInfo.addTargets(item.getBuildTargets().toString());
- toolChainInfo.addArchs(item.getSupportedArchitectures().toString());
- toolChainInfo.addTagnames((String)null);
- return toolChainInfo;
- }
-
- /**
- * Retrieve <xxxHeader>/ModuleType
- *
- * @returns The module type name if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String getModuleType() {
- String[] xPath = new String[] { "/ModuleType" };
-
- Object[] returns = get(xPath);
- if (returns != null && returns.length > 0) {
- ModuleTypeDef type = (ModuleTypeDef) returns[0];
- return type.enumValue().toString();
- }
-
- return null;
- }
-
- /**
- * Retrieve <ModuleDefinitions>/<BinaryModule>
- *
- * @returns The module type name if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public boolean getBinaryModule() {
- String[] xPath = new String[] { "/" };
-
- Object[] returns = get("ModuleDefinitions", xPath);
- if (returns != null && returns.length > 0) {
- ModuleDefinitionsDocument.ModuleDefinitions def = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];
- return def.getBinaryModule();
- }
-
- return false;
- }
-
- /**
- * Retrieve PackageDependencies/Package
- *
- * @param arch
- * Architecture name
- *
- * @returns package name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public PackageIdentification[] getDependencePkg(String arch) throws EdkException {
- String[] xPath;
- String packageGuid = null;
- String packageVersion = null;
-
-
- xPath = new String[] { "/Package" };
-
- Object[] returns = get("PackageDependencies", xPath);
- if (returns == null) {
- return new PackageIdentification[0];
- }
-
- //
- // Get packageIdentification
- //
- List<PackageIdentification> packageIdList = new ArrayList<PackageIdentification>();
- for (int i = 0; i < returns.length; i++) {
- PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];
- List archList = item.getSupArchList();
- if (arch == null || archList == null || contains(archList, arch)) {
- packageGuid = item.getPackageGuid();
- packageVersion = item.getPackageVersion();
- PackageIdentification pkgId = new PackageIdentification(null, packageGuid, packageVersion);
- GlobalData.refreshPackageIdentification(pkgId);
- packageIdList.add(pkgId);
- }
- }
-
- return packageIdList.toArray(new PackageIdentification[packageIdList.size()]);
- }
-
- /**
- * Retrieve LibraryClassDefinitions/LibraryClass for specified usage
- *
- * @param usage
- * Library class usage
- *
- * @returns LibraryClass objects list if elements are found at the known
- * xpath
- * @returns null if nothing is there
- */
- public String[] getLibraryClasses(String usage, String arch, String moduleType) {
- String[] xPath;
- if (usage == null || usage.equals("")) {
- xPath = new String[] { "/LibraryClass" };
- } else {
- xPath = new String[] { "/LibraryClass[@Usage='" + usage + "']" };
- }
-
- Object[] returns = get("LibraryClassDefinitions", xPath);
- if (returns == null || returns.length == 0) {
- return new String[0];
- }
-
- LibraryClassDocument.LibraryClass[] libraryClassList = (LibraryClassDocument.LibraryClass[]) returns;
- List<String> libraryClassName = new ArrayList<String>();
- for (int i = 0; i < libraryClassList.length; i++) {
- List archList = libraryClassList[i].getSupArchList();
- List moduleTypeList = libraryClassList[i].getSupModuleList();
- if ((arch == null || contains(archList, arch))
- && (moduleType == null || contains(moduleTypeList, moduleType))) {
- libraryClassName.add(libraryClassList[i].getKeyword());
- }
- }
-
- String[] libraryArray = new String[libraryClassName.size()];
- libraryClassName.toArray(libraryArray);
- return libraryArray;
- }
-
- /**
- * Retrieve ModuleEntryPoint names
- *
- * @returns ModuleEntryPoint name list if elements are found at the known
- * xpath
- * @returns null if nothing is there
- */
- public String[] getModuleEntryPointArray() {
- String[] xPath = new String[] { "/Extern/ModuleEntryPoint" };
-
- Object[] returns = get("Externs", xPath);
-
- if (returns != null && returns.length > 0) {
- String[] entryPoints = new String[returns.length];
-
- for (int i = 0; i < returns.length; ++i) {
- entryPoints[i] = ((CNameType) returns[i]).getStringValue();
- }
-
- return entryPoints;
- }
-
- return null;
- }
-
- /**
- * retrieve Protocol for specified usage
- *
- * @param usage
- * Protocol usage arch Architecture
- *
- * @returns Protocol String list if elements are found at the known xpath
- * @returns String[0] if nothing is there
- */
- public String[] getProtocolArray(String arch, String usage) {
- String[] xPath;
- String usageXpath = "";
- String archXpath = "";
-
- if (arch == null || arch.equals("")) {
- return new String[0];
- } else {
- archXpath = "/Protocol";
- if (usage != null && !usage.equals("")) {
- usageXpath = "/Protocol[@Usage='" + usage + "']";
- xPath = new String[] { usageXpath, archXpath };
- } else {
- return getProtocolArray(arch);
- }
-
- }
-
- Object[] returns = get("Protocols", xPath);
- if (returns == null) {
- return new String[0];
- }
- Protocol[] protocolList = (Protocol[]) returns;
-
- String[] protocolArray = new String[returns.length];
- for (int i = 0; i < returns.length; i++) {
- protocolArray[i] = protocolList[i].getProtocolCName();
- }
- return protocolArray;
- }
-
- /**
- * retrieve Protocol for specified usage
- *
- * @param arch
- * Architecture
- *
- * @returns Protocol String list if elements are found at the known xpath
- * @returns String[0] if nothing is there
- */
- public String[] getProtocolArray(String arch) {
- String[] xPath;
-
- if (arch == null || arch.equals("")) {
- return new String[0];
- } else {
- xPath = new String[] { "/Protocol" };
- }
-
- Object[] returns = get("Protocols", xPath);
- if (returns == null) {
- return new String[0];
- }
- Protocol[] returnlList = (Protocol[]) returns;
-
- List<String> protocolList = new ArrayList<String>();
-
- for (int i = 0; i < returns.length; i++) {
- List archList = returnlList[i].getSupArchList();
- if (archList == null || contains(archList, arch)){
- protocolList.add(returnlList[i].getProtocolCName());
- }
- }
- String[] protocolArray = new String[protocolList.size()];
- for (int i = 0; i < protocolList.size(); i++) {
- protocolArray[i] = protocolList.get(i);
- }
- return protocolArray;
- }
-
- /**
- * Retrieve ProtocolNotify for specified usage
- *
- * @param usage
- * ProtocolNotify usage
- *
- * @returns String[] if elements are found at the known xpath
- * @returns String[0] if nothing is there
- */
- public String[] getProtocolNotifyArray(String arch) {
- String[] xPath;
-
- if (arch == null || arch.equals("")) {
- return new String[0];
- } else {
- xPath = new String[] { "/ProtocolNotify" };
- }
-
- Object[] returns = get("Protocols", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- List<String> protocolNotifyList = new ArrayList<String>();
-
- for (int i = 0; i < returns.length; i++) {
- List archList = ((ProtocolNotify) returns[i]).getSupArchList();
- if (archList == null || contains(archList, arch)){
- protocolNotifyList.add(((ProtocolNotify) returns[i]).getProtocolNotifyCName());
- }
-
- }
- String[] protocolNotifyArray = new String[protocolNotifyList.size()];
- for (int i = 0; i < protocolNotifyList.size(); i++) {
- protocolNotifyArray[i] = protocolNotifyList.get(i);
- }
- return protocolNotifyArray;
- }
-
- /**
- * Retrieve ProtocolNotify for specified usage
- *
- * @param usage
- * ProtocolNotify usage
- *
- * @returns String[] if elements are found at the known xpath
- * @returns String[0] if nothing is there
- */
- public String[] getProtocolNotifyArray(String arch, String usage) {
-
- String[] xPath;
- String usageXpath;
- String archXpath;
-
- if (arch == null || arch.equals("")) {
- return new String[0];
- } else {
- archXpath = "/ProtocolNotify";
- if (usage != null && !usage.equals("")) {
- usageXpath = "/ProtocolNotify[@Usage='" + arch + "']";
- xPath = new String[] { archXpath, usageXpath };
- } else {
- return getProtocolNotifyArray(arch);
- }
- }
-
- Object[] returns = get("Protocols", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] protocolNotifyList = new String[returns.length];
-
- for (int i = 0; i < returns.length; i++) {
- protocolNotifyList[i] = ((ProtocolNotify) returns[i]).getProtocolNotifyCName();
- }
- return protocolNotifyList;
- }
-
- /**
- * Retrieve ModuleUnloadImage names
- *
- * @returns ModuleUnloadImage name list if elements are found at the known
- * xpath
- * @returns null if nothing is there
- */
- public String[] getModuleUnloadImageArray() {
- String[] xPath = new String[] { "/Extern/ModuleUnloadImage" };
-
- Object[] returns = get("Externs", xPath);
- if (returns != null && returns.length > 0) {
- String[] stringArray = new String[returns.length];
- CNameType[] doc = (CNameType[]) returns;
-
- for (int i = 0; i < returns.length; ++i) {
- stringArray[i] = doc[i].getStringValue();
- }
-
- return stringArray;
- }
-
- return null;
- }
-
- /**
- * Retrieve Extern
- *
- * @returns Extern objects list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public ExternsDocument.Externs.Extern[] getExternArray() {
- String[] xPath = new String[] { "/Extern" };
-
- Object[] returns = get("Externs", xPath);
- if (returns != null && returns.length > 0) {
- return (ExternsDocument.Externs.Extern[]) returns;
- }
-
- return null;
- }
-
- /**
- * Retrieve PpiNotify for specified arch
- *
- * @param arch
- * PpiNotify arch
- *
- * @returns String[] if elements are found at the known xpath
- * @returns String[0] if nothing is there
- */
- public String[] getPpiNotifyArray(String arch) {
- String[] xPath;
-
- if (arch == null || arch.equals("")) {
- return new String[0];
- } else {
- xPath = new String[] { "/PpiNotify" };
- }
-
- Object[] returns = get("PPIs", xPath);
- if (returns == null) {
- return new String[0];
- }
-
-
- List<String> ppiNotifyList = new ArrayList<String>();
- for (int i = 0; i < returns.length; i++) {
- List archList = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getSupArchList();
- if (archList == null || contains(archList, arch)){
- ppiNotifyList.add(((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName());
- }
-
- }
- String[] ppiNotifyArray = new String[ppiNotifyList.size()];
- for (int i = 0; i < ppiNotifyList.size(); i++) {
- ppiNotifyArray[i] = ppiNotifyList.get(i);
- }
-
- return ppiNotifyArray;
- }
-
- /**
- * Retrieve PpiNotify for specified usage and arch
- *
- * @param arch
- * PpiNotify arch usage PpiNotify usage
- *
- *
- * @returns String[] if elements are found at the known xpath
- * @returns String[0] if nothing is there
- */
- public String[] getPpiNotifyArray(String arch, String usage) {
-
- String[] xPath;
- String usageXpath;
- String archXpath;
-
- if (arch == null || arch.equals("")) {
- return new String[0];
- } else {
- archXpath = "/PpiNotify";
- if (usage != null && !usage.equals("")) {
- usageXpath = "/PpiNotify[@Usage='" + arch + "']";
- xPath = new String[] { archXpath, usageXpath };
- } else {
- return getProtocolNotifyArray(arch);
- }
- }
-
- Object[] returns = get("PPIs", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] ppiNotifyList = new String[returns.length];
-
- for (int i = 0; i < returns.length; i++) {
- ppiNotifyList[i] = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName();
- }
- return ppiNotifyList;
- }
-
- /**
- * Retrieve Ppi for specified arch
- *
- * @param arch
- * Ppi arch
- *
- * @returns String[] if elements are found at the known xpath
- * @returns String[0] if nothing is there
- */
- public String[] getPpiArray(String arch) {
- String[] xPath;
-
- if (arch == null || arch.equals("")) {
- return new String[0];
- } else {
- xPath = new String[] { "/Ppi" };
- }
-
- Object[] returns = get("PPIs", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- List<String> ppiList = new ArrayList<String>();
- for (int i = 0; i < returns.length; i++) {
- List archList = ((PPIsDocument.PPIs.Ppi) returns[i]).getSupArchList();
- if (archList == null || contains(archList, arch)){
- ppiList.add(((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName());
- }
-
- }
- String[] ppiArray = new String[ppiList.size()];
- for (int i = 0; i < ppiList.size(); i++) {
- ppiArray[i] = ppiList.get(i);
- }
- return ppiArray;
- }
-
- /**
- * Retrieve PpiNotify for specified usage and arch
- *
- * @param arch
- * PpiNotify arch usage PpiNotify usage
- *
- *
- * @returns String[] if elements are found at the known xpath
- * @returns String[0] if nothing is there
- */
- public String[] getPpiArray(String arch, String usage) {
-
- String[] xPath;
- String usageXpath;
- String archXpath;
-
- if (arch == null || arch.equals("")) {
- return new String[0];
- } else {
- archXpath = "/Ppi";
- if (usage != null && !usage.equals("")) {
- usageXpath = "/Ppi[@Usage='" + arch + "']";
- xPath = new String[] { archXpath, usageXpath };
- } else {
- return getProtocolNotifyArray(arch);
- }
- }
-
- Object[] returns = get("PPIs", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] ppiList = new String[returns.length];
-
- for (int i = 0; i < returns.length; i++) {
- ppiList[i] = ((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName();
- }
- return ppiList;
- }
-
- /**
- * Retrieve GuidEntry information for specified usage
- *
- * @param arch
- * GuidEntry arch
- *
- * @returns GuidEntry objects list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String[] getGuidEntryArray(String arch) {
- String[] xPath;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[] { "/GuidCNames" };
- } else {
- xPath = new String[] { "/GuidCNames" };
- }
-
- Object[] returns = get("Guids", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- List<String> guidList = new ArrayList<String>();
- for (int i = 0; i < returns.length; i++) {
- List archList = ((GuidsDocument.Guids.GuidCNames) returns[i]).getSupArchList();
- if (archList == null || contains(archList, arch)){
- guidList.add(((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName());
- }
-
- }
- String[] guidArray = new String[guidList.size()];
- for (int i = 0; i < guidList.size(); i++) {
- guidArray[i] = guidList.get(i);
- }
- return guidArray;
-
- }
-
- /**
- * Retrieve GuidEntry information for specified usage
- *
- * @param arch
- * GuidEntry arch usage GuidEntry usage
- *
- * @returns GuidEntry objects list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String[] getGuidEntryArray(String arch, String usage) {
- String[] xPath;
- String archXpath;
- String usageXpath;
-
- if (arch == null || arch.equals("")) {
- return new String[0];
- } else {
- archXpath = "/GuidEntry";
- if (usage != null && !usage.equals("")) {
- usageXpath = "/GuidEntry[@Usage='" + arch + "']";
- xPath = new String[] { archXpath, usageXpath };
- } else {
- return getGuidEntryArray(arch);
- }
- }
-
- Object[] returns = get("Guids", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] guidList = new String[returns.length];
-
- for (int i = 0; i < returns.length; i++) {
- guidList[i] = ((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName();
- }
- return guidList;
- }
-
- public String[] getEventCNameArray(String arch) {
- String[] xPath = null;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[]{
- "/CreateEvents/EventTypes[@EventGuidCName]",
- "/SignalEvents/EventTypes[@EventGuidCName]",
- };
- } else {
- xPath = new String[]{
- "/CreateEvents/EventTypes[@EventGuidCName and not(@SupArchList)]",
- "/SignalEvents/EventTypes[@EventGuidCName and not(@SupArchList)]",
- "/CreateEvents/EventTypes[@EventGuidCName and contains(@SupArchList,'" + arch + "')]",
- "/SignalEvents/EventTypes[@EventGuidCName and contains(@SupArchList,'" + arch + "')]",
- };
- }
-
- Object[] returns = get("Events", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] cnameList = new String[returns.length];
- for (int i = 0; i < returns.length; i++) {
- if (returns[i] instanceof EventsDocument.Events.CreateEvents.EventTypes) {
- cnameList[i] = ((EventsDocument.Events.CreateEvents.EventTypes) returns[i]).getEventGuidCName();
- } else {
- cnameList[i] = ((EventsDocument.Events.SignalEvents.EventTypes) returns[i]).getEventGuidCName();
- }
- }
- return cnameList;
- }
-
- public String[] getHobCNameArray(String arch) {
- String[] xPath = null;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[]{"/HobTypes[@HobGuidCName]"};
- } else {
- xPath = new String[]{
- "/HobTypes[@HobGuidCName and not(@SupArchList)]",
- "/HobTypes[@HobGuidCName and contains(@SupArchList,'" + arch + "')]",
- };
- }
-
- Object[] returns = get("Hobs", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] cnameList = new String[returns.length];
- for (int i = 0; i < returns.length; i++) {
- cnameList[i] = ((HobsDocument.Hobs.HobTypes) returns[i]).getHobGuidCName();
- }
- return cnameList;
- }
-
- public String[] getVariableCNameArray(String arch) {
- String[] xPath = null;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[]{"/Variable"};
- } else {
- xPath = new String[]{"/Variable[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"};
- }
-
- Object[] returns = get("Variables", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] cnameList = new String[returns.length];
- for (int i = 0; i < returns.length; i++) {
- cnameList[i] = ((VariablesDocument.Variables.Variable) returns[i]).getGuidCName();
- }
- return cnameList;
- }
-
- public String[] getSystemTableCNameArray(String arch) {
- String[] xPath = null;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[]{"/SystemTableCNames"};
- } else {
- xPath = new String[]{
- "/SystemTableCNames[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"
- };
- }
-
- Object[] returns = get("SystemTables", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] cnameList = new String[returns.length];
- for (int i = 0; i < returns.length; i++) {
- cnameList[i] = ((SystemTablesDocument.SystemTables.SystemTableCNames) returns[i]).getSystemTableCName();
- }
- return cnameList;
- }
-
- public String[] getDataHubCNameArray(String arch) {
- String[] xPath = null;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[]{"/DataHubRecord"};
- } else {
- xPath = new String[]{"/DataHubRecord[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"};
- }
-
- Object[] returns = get("DataHubs", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] cnameList = new String[returns.length];
- for (int i = 0; i < returns.length; i++) {
- cnameList[i] = ((DataHubsDocument.DataHubs.DataHubRecord) returns[i]).getDataHubCName();
- }
- return cnameList;
- }
-
- public String[] getHiiPackageCNameArray(String arch) {
- String[] xPath = null;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[]{"/HiiPackage"};
- } else {
- xPath = new String[]{"/HiiPackage[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"};
- }
-
- Object[] returns = get("HiiPackages", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- String[] cnameList = new String[returns.length];
- for (int i = 0; i < returns.length; i++) {
- cnameList[i] = ((HiiPackagesDocument.HiiPackages.HiiPackage) returns[i]).getHiiCName();
- }
- return cnameList;
- }
-
- public String[] getCNameArray(String arch) {
- List<String> cnameList = new ArrayList<String>(100);
- String[] result = null;
- //
- // "/Guids/GuidCNames/GuidCName",
- //
- result = getGuidEntryArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/Protocols/Protocol/ProtocolCName",
- //
- result = getProtocolArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/Protocols/ProtocolNotify/ProtocolNotifyCName",
- //
- result = getProtocolNotifyArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/Events/CreateEvents/EventTypes[@EventGuidCName]",
- // "/Events/SignalEvents/EventTypes[@EventGuidCName]",
- //
- result = getEventCNameArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/Hobs/HobTypes[@HobGuidCName]",
- //
- result = getHobCNameArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/PPIs/Ppi/PpiCName",
- //
- result = getPpiArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/PPIs/PpiNotify/PpiNotifyCName",
- //
- result = getPpiNotifyArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/Variables/Variable/GuidC_Name",
- //
- result = getVariableCNameArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/SystemTables/SystemTableCNames/SystemTableCName",
- //
- result = getSystemTableCNameArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/DataHubs/DataHubRecord/DataHubCName",
- //
- result = getDataHubCNameArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
- //
- // "/HiiPackages/HiiPackage/HiiCName",
- //
- result = getHiiPackageCNameArray(arch);
- for (int i = 0; i < result.length; ++i) {
- cnameList.add(result[i]);
- }
-
- return cnameList.toArray(new String[cnameList.size()]);
- }
-
- /**
- * Retrieve Library instance information
- *
- * @param arch
- * Architecture name
- * @param usage
- * Library instance usage
- *
- * @returns library instance name list if elements are found at the known
- * xpath
- * @returns null if nothing is there
- */
- public ModuleIdentification[] getLibraryInstance(String arch) throws EdkException {
- String[] xPath;
- String saGuid = null;
- String saVersion = null;
- String pkgGuid = null;
- String pkgVersion = null;
-
- if (arch == null || arch.equalsIgnoreCase("")) {
- xPath = new String[] { "/Instance" };
- } else {
- //
- // Since Schema don't have SupArchList now, so the follow Xpath is
- // equal to "/Instance" and [not(@SupArchList) or @SupArchList= arch]
- // don't have effect.
- //
- xPath = new String[] { "/Instance[not(@SupArchList) or @SupArchList='"
- + arch + "']" };
- }
-
- Object[] returns = get("Libraries", xPath);
- if (returns == null || returns.length == 0) {
- return new ModuleIdentification[0];
- }
-
- ModuleIdentification[] saIdList = new ModuleIdentification[returns.length];
- for (int i = 0; i < returns.length; i++) {
- LibrariesDocument.Libraries.Instance library = (LibrariesDocument.Libraries.Instance) returns[i];
- saGuid = library.getModuleGuid();
- saVersion = library.getModuleVersion();
-
- pkgGuid = library.getPackageGuid();
- pkgVersion = library.getPackageVersion();
-
- ModuleIdentification saId = new ModuleIdentification(null, saGuid,
- saVersion);
- PackageIdentification pkgId = new PackageIdentification(null,
- pkgGuid, pkgVersion);
- GlobalData.refreshPackageIdentification(pkgId);
- saId.setPackage(pkgId);
- GlobalData.refreshModuleIdentification(saId);
-
- saIdList[i] = saId;
-
- }
- return saIdList;
- }
-
- // /
- // / This method is used for retrieving the elements information which has
- // / CName sub-element
- // /
- private String[] getCNames(String from, String xPath[]) {
- Object[] returns = get(from, xPath);
- if (returns == null || returns.length == 0) {
- return null;
- }
-
- String[] strings = new String[returns.length];
- for (int i = 0; i < returns.length; ++i) {
- // TBD
- strings[i] = ((CNameType) returns[i]).getStringValue();
- }
-
- return strings;
- }
-
- /**
- * Retrive library's constructor name
- *
- * @returns constructor name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String getLibConstructorName() {
- String[] xPath = new String[] { "/Extern/Constructor" };
-
- Object[] returns = get("Externs", xPath);
- if (returns != null && returns.length > 0) {
- CNameType constructor = ((CNameType) returns[0]);
- return constructor.getStringValue();
- }
-
- return null;
- }
-
- /**
- * Retrive library's destructor name
- *
- * @returns destructor name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String getLibDestructorName() {
- String[] xPath = new String[] { "/Extern/Destructor" };
-
- Object[] returns = get("Externs", xPath);
- if (returns != null && returns.length > 0) {
- //
- // Only support one Destructor function.
- //
- CNameType destructor = (CNameType) returns[0];
- return destructor.getStringValue();
- }
-
- return null;
- }
-
- /**
- * Retrive DriverBinding names
- *
- * @returns DriverBinding name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String[] getDriverBindingArray() {
- String[] xPath = new String[] { "/Extern/DriverBinding" };
- return getCNames("Externs", xPath);
- }
-
- /**
- * Retrive ComponentName names
- *
- * @returns ComponentName name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String[] getComponentNameArray() {
- String[] xPath = new String[] { "/Extern/ComponentName" };
- return getCNames("Externs", xPath);
- }
-
- /**
- * Retrive DriverConfig names
- *
- * @returns DriverConfig name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String[] getDriverConfigArray() {
- String[] xPath = new String[] { "/Extern/DriverConfig" };
- return getCNames("Externs", xPath);
- }
-
- /**
- * Retrive DriverDiag names
- *
- * @returns DriverDiag name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String[] getDriverDiagArray() {
- String[] xPath = new String[] { "/Extern/DriverDiag" };
- return getCNames("Externs", xPath);
- }
-
- /**
- * Retrive DriverBinding, ComponentName, DriverConfig,
- * DriverDiag group array
- *
- * @returns DriverBinding group name list if elements are found
- * at the known xpath
- * @returns null if nothing is there
- */
- public String[][] getExternProtocolGroup() {
- String[] xPath = new String[] {"/Extern"};
- Object[] returns = get("Externs",xPath);
-
- if (returns == null) {
- return new String[0][4];
- }
- List<Extern> externList = new ArrayList<Extern>();
- for (int i = 0; i < returns.length; i++) {
- org.tianocore.ExternsDocument.Externs.Extern extern = (org.tianocore.ExternsDocument.Externs.Extern)returns[i];
- if (extern.getDriverBinding() != null) {
- externList.add(extern);
- }
- }
-
- String[][] externGroup = new String[externList.size()][4];
- for (int i = 0; i < externList.size(); i++) {
- String driverBindingStr = externList.get(i).getDriverBinding();
- if ( driverBindingStr != null){
- externGroup[i][0] = driverBindingStr;
- } else {
- externGroup[i][0] = null;
- }
-
- String componentNameStr = externList.get(i).getComponentName();
- if (componentNameStr != null) {
- externGroup[i][1] = componentNameStr;
- } else {
- externGroup[i][1] = null;
- }
-
- String driverConfigStr = externList.get(i).getDriverConfig();
- if (driverConfigStr != null) {
- externGroup[i][2] = driverConfigStr;
- } else {
- externGroup[i][2] = null;
- }
-
- String driverDiagStr = externList.get(i).getDriverDiag();
- if (driverDiagStr != null) {
- externGroup[i][3] = driverDiagStr;
- } else {
- externGroup[i][3] = null;
- }
- }
- return externGroup;
- }
-
- /**
- * Retrive SetVirtualAddressMapCallBack names
- *
- * @returns SetVirtualAddressMapCallBack name list if elements are found at
- * the known xpath
- * @returns null if nothing is there
- */
- public String[] getSetVirtualAddressMapCallBackArray() {
- String[] xPath = new String[] { "/Extern/SetVirtualAddressMapCallBack" };
- return getCNames("Externs", xPath);
- }
-
- /**
- * Retrive ExitBootServicesCallBack names
- *
- * @returns ExitBootServicesCallBack name list if elements are found at the
- * known xpath
- * @returns null if nothing is there
- */
- public String[] getExitBootServicesCallBackArray() {
- String[] xPath = new String[] { "/Extern/ExitBootServicesCallBack" };
- return getCNames("Externs", xPath);
- }
-
- /**
- Judge whether current driver is PEI_PCD_DRIVER or DXE_PCD_DRIVER or
- NOT_PCD_DRIVER.
-
- @return CommonDefinition.PCD_DRIVER_TYPE the type of current driver
- **/
- public CommonDefinition.PCD_DRIVER_TYPE getPcdDriverType() {
- String[] xPath = new String[] {"/PcdIsDriver"};
- Object[] results = get ("Externs", xPath);
-
- if (results != null && results.length != 0) {
- PcdDriverTypes type = (PcdDriverTypes) results[0];
- String typeStr = type.enumValue().toString();
- if (typeStr.equals(CommonDefinition.PCD_DRIVER_TYPE.PEI_PCD_DRIVER.toString())) {
- return CommonDefinition.PCD_DRIVER_TYPE.PEI_PCD_DRIVER;
- } else if (typeStr.equals(CommonDefinition.PCD_DRIVER_TYPE.DXE_PCD_DRIVER.toString())) {
- return CommonDefinition.PCD_DRIVER_TYPE.DXE_PCD_DRIVER;
- }
- return CommonDefinition.PCD_DRIVER_TYPE.UNKNOWN_PCD_DRIVER;
- }
-
- return CommonDefinition.PCD_DRIVER_TYPE.NOT_PCD_DRIVER;
- }
-
- /**
- * Retrieve module surface area file information
- *
- * @returns ModuleSA objects list if elements are found at the known xpath
- * @returns Empty ModuleSA list if nothing is there
- */
- public Map<FpdModuleIdentification, Map<String, XmlObject>> getFpdModules() throws EdkException {
- String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };
- Object[] result = get("PlatformSurfaceArea", xPath);
- String arch = null;
- String fvBinding = null;
- String saGuid = null;
- String saVersion = null;
- String pkgGuid = null;
- String pkgVersion = null;
-
- Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleMap = new LinkedHashMap<FpdModuleIdentification, Map<String, XmlObject>>();
-
- if (result == null) {
- return fpdModuleMap;
- }
-
- for (int i = 0; i < result.length; i++) {
- //
- // Get Fpd SA Module element node and add to ObjectMap.
- //
- Map<String, XmlObject> ObjectMap = new HashMap<String, XmlObject>();
- ModuleSADocument.ModuleSA moduleSA = (ModuleSADocument.ModuleSA) result[i];
- if (((ModuleSADocument.ModuleSA) result[i]).getLibraries() != null) {
- ObjectMap.put("Libraries", moduleSA.getLibraries());
- }
- if (((ModuleSADocument.ModuleSA) result[i]).getPcdBuildDefinition() != null) {
- ObjectMap.put("PcdBuildDefinition", moduleSA.getPcdBuildDefinition());
- }
- if (((ModuleSADocument.ModuleSA) result[i]).getModuleSaBuildOptions() != null) {
- ObjectMap.put("ModuleSaBuildOptions", moduleSA.getModuleSaBuildOptions());
- }
-
- //
- // Get Fpd SA Module attribute and create FpdMoudleIdentification.
- //
- if (moduleSA.isSetSupArchList()) {
- arch = moduleSA.getSupArchList().toString();
- } else {
- arch = null;
- }
-
- // TBD
- fvBinding = null;
- saVersion = ((ModuleSADocument.ModuleSA) result[i]).getModuleVersion();
-
- saGuid = moduleSA.getModuleGuid();
- pkgGuid = moduleSA.getPackageGuid();
- pkgVersion = moduleSA.getPackageVersion();
-
- //
- // Create Module Identification which have class member of package
- // identification.
- //
- PackageIdentification pkgId = new PackageIdentification(null, pkgGuid, pkgVersion);
- GlobalData.refreshPackageIdentification(pkgId);
-
- ModuleIdentification saId = new ModuleIdentification(null, saGuid, saVersion);
- saId.setPackage(pkgId);
- GlobalData.refreshModuleIdentification(saId);
-
-
-
- //
- // Create FpdModule Identification which have class member of module
- // identification
- //
- String[] archList = new String[0];
- if (arch == null || arch.trim().length() == 0) {
- archList = GlobalData.getToolChainInfo().getArchs();
- } else {
- archList = arch.split(" ");
- }
- for (int j = 0; j < archList.length; j++) {
- FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId, archList[j]);
-
- if (fvBinding != null) {
- fpdSaId.setFvBinding(fvBinding);
- }
-
- //
- // Put element to Map<FpdModuleIdentification, Map<String,
- // Object>>.
- //
- fpdModuleMap.put(fpdSaId, ObjectMap);
- }
- }
- return fpdModuleMap;
- }
-
- /**
- * Retrieve valid image names
- *
- * @returns valid iamges name list if elements are found at the known xpath
- * @returns empty list if nothing is there
- */
- public String[] getFpdValidImageNames() {
- String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='ImageName']/FvImageNames" };
-
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null) {
- return new String[0];
- }
-
- String[] result = new String[queryResult.length];
- for (int i = 0; i < queryResult.length; i++) {
- result[i] = ((XmlString) queryResult[i]).getStringValue();
- }
-
- return result;
- }
-
- public Node getFpdUserExtensionPreBuild() {
- String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" };
-
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null || queryResult.length == 0) {
- return null;
- }
- UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0];
-
- return a.getDomNode();
- }
-
- public Node getFpdUserExtensionPostBuild() {
- String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" };
-
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null || queryResult.length == 0) {
- return null;
- }
- UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0];
-
- return a.getDomNode();
- }
-
- public Node[] getFpdUserExtensions() {
- String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and not(@Identifier='1') and not(@Identifier='0')]" };
-
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null || queryResult.length == 0) {
- return new Node[0];
- }
-
- Node[] nodeList = new Node[queryResult.length];
- for (int i = 0; i < queryResult.length; ++i) {
- UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[i];
- nodeList[i] = a.getDomNode();
- }
-
- return nodeList;
- }
- /**
- * Retrieve FV image option information
- *
- * @param fvName
- * FV image name
- *
- * @returns option name/value list if elements are found at the known xpath
- * @returns empty list if nothing is there
- */
- public String[][] getFpdOptions(String fvName) {
- String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Options' and ./FvImageNames='"
- + fvName + "']/FvImageOptions" };
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null) {
- return new String[0][];
- }
- ArrayList<String[]> list = new ArrayList<String[]>();
- for (int i = 0; i < queryResult.length; i++) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions item = (FvImagesDocument.FvImages.FvImage.FvImageOptions) queryResult[i];
- List<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> namevalues = item
- .getNameValueList();
- Iterator iter = namevalues.iterator();
- while (iter.hasNext()) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nvItem = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue) iter
- .next();
- list.add(new String[] { nvItem.getName(), nvItem.getValue() });
- }
- }
- String[][] result = new String[list.size()][2];
- for (int i = 0; i < list.size(); i++) {
- result[i][0] = list.get(i)[0];
- result[i][1] = list.get(i)[1];
- }
- return result;
-
- }
-
- public XmlObject getFpdBuildOptions() {
- String[] xPath = new String[] { "/BuildOptions" };
-
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
-
- if (queryResult == null || queryResult.length == 0) {
- return null;
- }
- return (XmlObject)queryResult[0];
- }
-
- public PlatformIdentification getFpdHeader() {
- String[] xPath = new String[] { "/PlatformHeader" };
-
- Object[] returns = get("PlatformSurfaceArea", xPath);
-
- if (returns == null || returns.length == 0) {
- return null;
- }
- PlatformHeaderDocument.PlatformHeader header = (PlatformHeaderDocument.PlatformHeader) returns[0];
-
- String name = header.getPlatformName();
-
- String guid = header.getGuidValue();
-
- String version = header.getVersion();
-
- return new PlatformIdentification(name, guid, version);
- }
-
- /**
- * Retrieve FV image attributes information
- *
- * @param fvName
- * FV image name
- *
- * @returns attribute name/value list if elements are found at the known
- * xpath
- * @returns empty list if nothing is there
- */
- public String[][] getFpdAttributes(String fvName) {
- String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Attributes' and ./FvImageNames='"
- + fvName + "']/FvImageOptions" };
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null) {
- return new String[0][];
- }
- ArrayList<String[]> list = new ArrayList<String[]>();
- for (int i = 0; i < queryResult.length; i++) {
-
- FvImagesDocument.FvImages.FvImage.FvImageOptions item = (FvImagesDocument.FvImages.FvImage.FvImageOptions) queryResult[i];
- List<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> namevalues = item.getNameValueList();
- Iterator iter = namevalues.iterator();
- while (iter.hasNext()) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nvItem = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue) iter
- .next();
- list.add(new String[] { nvItem.getName(), nvItem.getValue() });
- }
- }
- String[][] result = new String[list.size()][2];
- for (int i = 0; i < list.size(); i++) {
- result[i][0] = list.get(i)[0];
- result[i][1] = list.get(i)[1];
- }
- return result;
- }
-
- /**
- * Retrieve flash definition file name
- *
- * @returns file name if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String getFlashDefinitionFile() {
- String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FlashDefinitionFile" };
-
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null || queryResult.length == 0) {
- return null;
- }
-
- FileNameConvention filename = (FileNameConvention) queryResult[queryResult.length - 1];
- return filename.getStringValue();
- }
-
- public String[][] getFpdGlobalVariable() {
- String[] xPath = new String[] { "/Flash/FvImages/NameValue" };
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null) {
- return new String[0][];
- }
-
- String[][] result = new String[queryResult.length][2];
-
- for (int i = 0; i < queryResult.length; i++) {
- FvImagesDocument.FvImages.NameValue item = (FvImagesDocument.FvImages.NameValue)queryResult[i];
- result[i][0] = item.getName();
- result[i][1] = item.getValue();
- }
- return result;
- }
-
- /**
- * Retrieve FV image component options
- *
- * @param fvName
- * FV image name
- *
- * @returns name/value pairs list if elements are found at the known xpath
- * @returns empty list if nothing is there
- */
- public String[][] getFpdComponents(String fvName) {
- String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName + "']/FvImageOptions" };
- Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null) {
- return new String[0][];
- }
-
- ArrayList<String[]> list = new ArrayList<String[]>();
- for (int i = 0; i < queryResult.length; i++) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions item = (FvImagesDocument.FvImages.FvImage.FvImageOptions) queryResult[i];
- List<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> namevalues = item.getNameValueList();
- Iterator iter = namevalues.iterator();
- while (iter.hasNext()) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nvItem = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue) iter
- .next();
- list.add(new String[] { nvItem.getName(), nvItem.getValue() });
- }
- }
- String[][] result = new String[list.size()][2];
- for (int i = 0; i < list.size(); i++) {
- result[i][0] = list.get(i)[0];
- result[i][1] = list.get(i)[1];
- }
- return result;
- }
-
- /**
- * Retrieve PCD tokens
- *
- * @returns CName/ItemType pairs list if elements are found at the known
- * xpath
- * @returns null if nothing is there
- */
- public String[][] getPcdTokenArray() {
- String[] xPath = new String[] { "/PcdData" };
-
- Object[] returns = get("PCDs", xPath);
- if (returns == null || returns.length == 0) {
- return null;
- }
-
- return null;
- }
-
- /**
- * Retrieve MAS header
- *
- * @return
- * @return
- */
- public ModuleIdentification getMsaHeader() {
- String[] xPath = new String[] { "/" };
- Object[] returns = get("MsaHeader", xPath);
-
- if (returns == null || returns.length == 0) {
- return null;
- }
-
- MsaHeader msaHeader = (MsaHeader) returns[0];
- //
- // Get BaseName, ModuleType, GuidValue, Version
- // which in MsaHeader.
- //
- String name = msaHeader.getModuleName();
- String moduleType = msaHeader.getModuleType().toString();
- String guid = msaHeader.getGuidValue();
- String version = msaHeader.getVersion();
-
- ModuleIdentification moduleId = new ModuleIdentification(name, guid,
- version);
-
- moduleId.setModuleType(moduleType);
-
- return moduleId;
- }
-
- /**
- * Retrieve Extern Specification
- *
- * @param
- *
- * @return String[] If have specification element in the <extern> String[0]
- * If no specification element in the <extern>
- *
- */
-
- public String[] getExternSpecificaiton() {
- String[] xPath = new String[] { "/Specification" };
-
- Object[] queryResult = get("Externs", xPath);
- if (queryResult == null) {
- return new String[0];
- }
-
- String[] specificationList = new String[queryResult.length];
- for (int i = 0; i < queryResult.length; i++) {
- specificationList[i] = ((Sentence)queryResult[i])
- .getStringValue();
- }
- return specificationList;
- }
-
- /**
- * Retreive MsaFile which in SPD
- *
- * @param
- * @return String[][3] The string sequence is ModuleName, ModuleGuid,
- * ModuleVersion, MsaFile String[0][] If no msafile in SPD
- */
- public String[] getSpdMsaFile() {
- String[] xPath = new String[] { "/MsaFiles" };
-
- Object[] returns = get("PackageSurfaceArea", xPath);
- if (returns == null) {
- return new String[0];
- }
-
- List<String> filenameList = ((MsaFilesDocument.MsaFiles) returns[0])
- .getFilenameList();
- return filenameList.toArray(new String[filenameList.size()]);
- }
-
- /**
- * Reteive
- */
- public Map<String, String[]> getSpdLibraryClasses() {
- String[] xPath = new String[] { "/LibraryClassDeclarations/LibraryClass" };
-
- Object[] returns = get("PackageSurfaceArea", xPath);
-
- //
- // Create Map, Key - LibraryClass, String[] - LibraryClass Header file.
- //
- Map<String, String[]> libClassHeaderMap = new HashMap<String, String[]>();
-
- if (returns == null) {
- return libClassHeaderMap;
- }
-
- for (int i = 0; i < returns.length; i++) {
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass library = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) returns[i];
- libClassHeaderMap.put(library.getName(), new String[] { library
- .getIncludeHeader() });
- }
- return libClassHeaderMap;
- }
-
- /**
- * Reteive
- */
- public Map<String, String> getSpdPackageHeaderFiles() {
- String[] xPath = new String[] { "/PackageHeaders/IncludePkgHeader" };
-
- Object[] returns = get("PackageSurfaceArea", xPath);
-
- //
- // Create Map, Key - ModuleType, String - PackageInclude Header file.
- //
- Map<String, String> packageIncludeMap = new HashMap<String, String>();
-
- if (returns == null) {
- return packageIncludeMap;
- }
-
- for (int i = 0; i < returns.length; i++) {
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader includeHeader = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) returns[i];
- packageIncludeMap.put(includeHeader.getModuleType().toString(),
- includeHeader.getStringValue());
- }
- return packageIncludeMap;
- }
-
- public PackageIdentification getSpdHeader() {
- String[] xPath = new String[] { "/SpdHeader" };
-
- Object[] returns = get("PackageSurfaceArea", xPath);
-
- if (returns == null || returns.length == 0) {
- return null;
- }
-
- SpdHeaderDocument.SpdHeader header = (SpdHeaderDocument.SpdHeader) returns[0];
-
- String name = header.getPackageName();
-
- String guid = header.getGuidValue();
-
- String version = header.getVersion();
-
- return new PackageIdentification(name, guid, version);
- }
-
- /**
- * Reteive
- */
- public Map<String, String[]> getSpdGuid() {
- String[] xPath = new String[] { "/GuidDeclarations/Entry" };
-
- Object[] returns = get("PackageSurfaceArea", xPath);
-
- //
- // Create Map, Key - GuidName, String[] - C_NAME & GUID value.
- //
- Map<String, String[]> guidDeclMap = new HashMap<String, String[]>();
- if (returns == null) {
- return guidDeclMap;
- }
-
- for (int i = 0; i < returns.length; i++) {
- GuidDeclarationsDocument.GuidDeclarations.Entry entry = (GuidDeclarationsDocument.GuidDeclarations.Entry) returns[i];
- String[] guidPair = new String[2];
- guidPair[0] = entry.getCName();
- guidPair[1] = entry.getGuidValue();
- guidDeclMap.put(entry.getCName(), guidPair);
- }
- return guidDeclMap;
- }
-
- /**
- * Reteive
- */
- public Map<String, String[]> getSpdProtocol() {
- String[] xPath = new String[] { "/ProtocolDeclarations/Entry" };
-
- Object[] returns = get("PackageSurfaceArea", xPath);
-
- //
- // Create Map, Key - protocolName, String[] - C_NAME & GUID value.
- //
- Map<String, String[]> protoclMap = new HashMap<String, String[]>();
-
- if (returns == null) {
- return protoclMap;
- }
-
- for (int i = 0; i < returns.length; i++) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry entry = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) returns[i];
- String[] protocolPair = new String[2];
-
- protocolPair[0] = entry.getCName();
- protocolPair[1] = entry.getGuidValue();
- protoclMap.put(entry.getCName(), protocolPair);
- }
- return protoclMap;
- }
-
- /**
- * getSpdPpi() Retrieve the SPD PPI Entry
- *
- * @param
- * @return Map<String, String[2]> if get the PPI entry from SPD. Key - PPI
- * Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI
- * entry in SPD.
- */
- public Map<String, String[]> getSpdPpi() {
- String[] xPath = new String[] { "/PpiDeclarations/Entry" };
-
- Object[] returns = get("PackageSurfaceArea", xPath);
-
- //
- // Create Map, Key - protocolName, String[] - C_NAME & GUID value.
- //
- Map<String, String[]> ppiMap = new HashMap<String, String[]>();
-
- if (returns == null) {
- return ppiMap;
- }
-
- for (int i = 0; i < returns.length; i++) {
- PpiDeclarationsDocument.PpiDeclarations.Entry entry = (PpiDeclarationsDocument.PpiDeclarations.Entry) returns[i];
- String[] ppiPair = new String[2];
- ppiPair[0] = entry.getCName();
- ppiPair[1] = entry.getGuidValue();
- ppiMap.put(entry.getCName(), ppiPair);
- }
- return ppiMap;
- }
-
- /**
- * Retrieve module Guid string
- *
- * @returns GUILD string if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public String getModuleGuid() {
- String[] xPath = new String[] { "" };
-
- Object[] returns = get("MsaHeader", xPath);
- if (returns != null && returns.length > 0) {
- String guid = ((MsaHeaderDocument.MsaHeader) returns[0])
- .getGuidValue();
- return guid;
- }
-
- return null;
- }
-
- //
- // For new Pcd
- //
- public ModuleSADocument.ModuleSA[] getFpdModuleSAs() {
- String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };
- Object[] result = get("PlatformSurfaceArea", xPath);
- if (result != null) {
- return (ModuleSADocument.ModuleSA[]) result;
- }
- return new ModuleSADocument.ModuleSA[0];
-
- }
-
- /**
- Get name array who contains all PCDs in a module according to specified arch.
-
- @param arch The specified architecture type.
-
- @return String[] return all PCDs name into array, if no any PCD used by
- this module, a String[0] array is returned.
- **/
- public String[] getModulePcdEntryNameArray(String arch) {
- PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries = null;
- java.util.List archList = null;
- java.util.List<String> results = new java.util.ArrayList<String> ();
- int index;
- String[] xPath = new String[] {"/PcdEntry"};
- Object[] returns = get ("PcdCoded", xPath);
-
- if (returns == null) {
- return new String[0];
- }
-
- pcdEntries = (PcdCodedDocument.PcdCoded.PcdEntry[])returns;
-
- for (index = 0; index < pcdEntries.length; index ++) {
- archList = pcdEntries[index].getSupArchList();
- //
- // If the ArchList is specified in MSA for this PCD, need check
- // current arch whether can support by this PCD.
- //
- if (archList != null) {
- if (archList.contains(arch)) {
- results.add(new String(pcdEntries[index].getCName()));
- }
- } else {
- //
- // If no ArchList is specificied in MSA for this PCD, that means
- // this PCD support all architectures.
- //
- results.add(new String(pcdEntries[index].getCName()));
- }
- }
-
- if (results.size() == 0) {
- return new String[0];
- }
-
- String[] retArray = new String[results.size()];
- results.toArray(retArray);
-
- return retArray;
- }
-
- /**
- Search in a List for a given string
-
- @return boolean
- **/
- public boolean contains(List list, String str) {
- if (list == null || list.size()== 0) {
- return true;
- }
-
- return list.contains(str);
- }
-
- public boolean isHaveTianoR8FlashMap(){
- String[] xPath = new String[] {"/"};
- Object[] returns = get ("Externs", xPath);
-
- if (returns == null) {
- return false;
- }
-
- ExternsDocument.Externs ext = (ExternsDocument.Externs)returns[0];
-
- if (ext.getTianoR8FlashMapH()){
- return true;
- }else {
- return false;
- }
- }
-
- public Node getPeiApriori(String fvName) {
- String[] xPath = new String[] { "/BuildOptions/UserExtensions[@UserID='APRIORI' and @Identifier='0' and ./FvName='" + fvName + "']" };
- Object[] result = get("PlatformSurfaceArea", xPath);
-
- if (result == null || result.length == 0) {
- return null;
- }
-
- UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)result[0];
-
- return a.getDomNode();
- }
-
- public Node getDxeApriori(String fvName) {
- String[] xPath = new String[] { "/BuildOptions/UserExtensions[@UserID='APRIORI' and @Identifier='1' and ./FvName='" + fvName + "']" };
- Object[] result = get("PlatformSurfaceArea", xPath);
-
- if (result == null || result.length == 0) {
- return null;
- }
-
- UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)result[0];
-
- return a.getDomNode();
- }
-
- public Node getFpdModuleSequence(String fvName) {
- String[] xPath = new String[] { "/BuildOptions/UserExtensions[@UserID='IMAGES' and @Identifier='1' and ./FvName='" + fvName + "']" };
- Object[] result = get("PlatformSurfaceArea", xPath);
-
- if (result == null || result.length == 0) {
- return null;
- }
-
- UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)result[0];
-
- return a.getDomNode();
- }
-
- /**
- Get the value of PCD by PCD cName
-
- @return PcdValue String of PcdComponentName
- null If don't find ComponentName Pcd
- **/
- public String getPcdValueBycName(String cName){
- String[] xPath = new String[] { "/PcdData" };
- Object[] returns = get("PcdBuildDefinition", xPath);
- if (returns == null || returns.length == 0) {
- return null;
- }
- for (int i = 0; i < returns.length; i++) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)returns[i];
- if (pcdData.getCName().equalsIgnoreCase(cName)){
- return pcdData.getValue();
- }
- }
- return null;
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/VariableTask.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/VariableTask.java
deleted file mode 100644
index 021b8d5b00..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/VariableTask.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/** @file
- * This file is ANT task VariableTask.
- *
- * VariableTask task implements part of ANT property task. The difference is
- * this task will override variable with same name, but ANT property task do not.
- *
- * Copyright (c) 2006, 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.
- */
-package org.tianocore.build.global;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-/**
- * VariableTask task implements part of ANT property task. The difference is
- * this task will override variable with same name, but ANT property task do not.
- *
- * @since GenBuild 1.0
- */
-public class VariableTask extends Task {
-
- /**
- * property value
- */
- private String value;
-
- /**
- * property name
- */
- private String name;
-
- /**
- * Set property name.
- *
- * @param name property name
- */
- public void setName( String name ) {
- this.name = name;
- }
-
-
- /**
- * Set property value.
- *
- * @param value property value
- */
- public void setValue( String value ) {
- this.value = value;
- }
-
- /**
- * ANT task's entry point, will be called after init().
- *
- * @exception BuildException
- * If name or value is null
- */
- public void execute() throws BuildException {
- if (name == null || value == null) {
- throw new BuildException("Name or value cannot be null.");
- }
- getProject().setProperty(name, value);
- }
-}
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/id/FpdModuleIdentification.java b/Tools/Java/Source/GenBuild/org/tianocore/build/id/FpdModuleIdentification.java
deleted file mode 100644
index c9bb7109d5..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/id/FpdModuleIdentification.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/** @file
- Java class FpdModuleIdentification is used to present a module identification
- from BaseName, GUID, Version, PackageName, and ARCH.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.build.id;
-
-
-/**
- This class is used to identify a module with Module Guid, Module Version,
- Package Guid, Package Version and Arch.
-
- @since GenBuild 1.0
-**/
-public class FpdModuleIdentification {
-
- private String arch;
-
- private String fvBinding = "NULL"; // Optional
-
- private ModuleIdentification module;
-
- /**
- Constructor Method.
-
- @param arch Build Arch
- @param fvBinding Belong to what FVs
- @param module ModuleIdentification
- **/
- public FpdModuleIdentification(String arch, String fvBinding, ModuleIdentification module){
- this.arch = arch;
- this.fvBinding = fvBinding;
- this.module = module;
- }
-
- /**
- Constructor Method.
-
- @param arch Build Arch
- @param module ModuleIdentification
- **/
- public FpdModuleIdentification(ModuleIdentification module, String arch){
- this.arch = arch;
- this.module = module;
- }
- /**
- Override java.lang.Object#equals.
-
- <p>Currently, use BaseName and ARCH to identify a module. It will enhance
- in the next version. </p>
-
- @see java.lang.Object#equals(java.lang.Object)
- **/
- public boolean equals(Object obj) {
- if (obj instanceof FpdModuleIdentification) {
- FpdModuleIdentification moduleIdObj = (FpdModuleIdentification)obj;
- if ( module.equals(moduleIdObj.module) && arch.equalsIgnoreCase(moduleIdObj.arch)) {
- return true;
- }
- return false;
- }
- else {
- return false;
- }
- }
-
- /**
- @param fvBinding
- **/
- public void setFvBinding(String fvBinding) {
- this.fvBinding = fvBinding;
- }
-
- /* (non-Javadoc)
- @see java.lang.Object#toString()
- **/
- public String toString(){
- return arch + ":" + module;
- }
-
- /**
- @return String fvBinding
- **/
- public String getFvBinding() {
- return fvBinding;
- }
-
- /**
- @return ModuleIdentification module ID
- **/
- public ModuleIdentification getModule() {
- return module;
- }
-
- /**
- @param module Module Identification
- **/
- public void setModule(ModuleIdentification module) {
- this.module = module;
- }
-
- /**
- @return String arch
- **/
- public String getArch() {
- return arch;
- }
-
- /**
- @param arch build ARCH
- **/
- public void setArch(String arch) {
- this.arch = arch;
- }
-
- /* (non-Javadoc)
- @see java.lang.Object#hashCode()
- **/
- public int hashCode(){
- return module.hashCode();
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/id/Identification.java b/Tools/Java/Source/GenBuild/org/tianocore/build/id/Identification.java
deleted file mode 100644
index 677d096274..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/id/Identification.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/** @file
-This file is to define Identification class.
-
-Copyright (c) 2006, 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.
-**/
-
-package org.tianocore.build.id;
-
-
-/**
- This class is used to identify with its GUID and Version.
-
- @since GenBuild 1.0
-**/
-public class Identification {
-
- String name;
-
- String guid;
-
- String version;
-
- /**
- @param name Name
- @param guid Guid
- @param version Version
- **/
- Identification(String name, String guid, String version){
- this.name = name;
- this.guid = guid;
- this.version = version;
- }
-
- /**
- @param guid Guid
- @param version Version
- **/
- Identification(String guid, String version){
- this.guid = guid;
- this.version = version;
- }
-
- /* (non-Javadoc)
- @see java.lang.Object#equals(java.lang.Object)
- **/
- public boolean equals(Object obj) {
- if (obj instanceof Identification) {
- Identification id = (Identification)obj;
- if ( guid.equalsIgnoreCase(id.guid)) {
- if (version == null || id.version == null) {
- return true;
- }
- else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")){
- return true;
- }
- else if (version.equalsIgnoreCase(id.version)) {
- return true;
- }
- }
- return false;
- }
- else {
- return super.equals(obj);
- }
- }
-
- /**
- @param name Name
- **/
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- @param guid Guid
- **/
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- /**
- @param version Version
- **/
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getGuid() {
- return guid;
- }
-
- /**
- @return String Name
- **/
- public String getName() {
- return name;
- }
-
- /**
- @return String Version
- **/
- public String getVersion() {
- return version;
- }
-
- public String toGuidString() {
- if (version == null || version.trim().equalsIgnoreCase("")) {
- return "[" + guid + "]";
- }
- else {
- return "[" + guid + "] and version [" + version + "]";
- }
- }
-
- /* (non-Javadoc)
- @see java.lang.Object#hashCode()
- **/
- public int hashCode(){
- return guid.toLowerCase().hashCode();
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/id/ModuleIdentification.java b/Tools/Java/Source/GenBuild/org/tianocore/build/id/ModuleIdentification.java
deleted file mode 100644
index 7082184dfd..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/id/ModuleIdentification.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/** @file
-This file is to define ModuleIdentification class.
-
-Copyright (c) 2006, 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.
-**/
-
-package org.tianocore.build.id;
-
-import java.io.File;
-
-/**
- This class is used to identify a module with Module Guid, Module Version,
- Package Guid, Package Version.
-
- @since GenBuild 1.0
-**/
-public class ModuleIdentification extends Identification {
-
- private PackageIdentification packageId;
-
- private File msaFile;
-
- private String moduleType;
-
- private boolean isLibrary = false;
-
- private boolean isBinary = false;
-
- private String constructor = "";
-
- private String destructor = "";
-
- /**
- @param guid Guid
- @param version Version
- **/
- public ModuleIdentification(String guid, String version){
- super(guid, version);
- }
-
- /**
- @param guid Guid
- @param version Version
- @param packageId Package Identification
- **/
- public ModuleIdentification(String guid, String version, PackageIdentification packageId){
- super(guid, version);
- this.packageId = packageId;
- }
-
- /**
- @param name Name
- @param guid Guid
- @param version Version
- **/
- public ModuleIdentification(String name, String guid, String version){
- super(name, guid, version);
- }
-
- /**
- @param name Name
- @param guid Guid
- @param version Version
- @param packageId PackageIdentification
- **/
- public ModuleIdentification(String name, String guid, String version, PackageIdentification packageId){
- super(name, guid, version);
- this.packageId = packageId;
- }
-
- /**
- @return boolean is this module is library
- **/
- public boolean isLibrary() {
- return isLibrary;
- }
-
- /**
- @param isLibrary
- **/
- public void setLibrary(boolean isLibrary) {
- this.isLibrary = isLibrary;
- }
-
- /**
- @return boolean is this module is binary
- **/
- public boolean isBinary() {
- return isBinary;
- }
-
- /**
- @param isBinary
- **/
- public void setBinary(boolean isBinary) {
- this.isBinary = isBinary;
- }
-
- /**
- @return MSA File
- **/
- public File getMsaFile() {
- return msaFile;
- }
-
- /**
- @return Module relative path to package
- **/
- public String getModuleRelativePath() {
- if (msaFile.getParent().length() == packageId.getPackageDir().length()) {
- return ".";
- }
- return msaFile.getParent().substring(packageId.getPackageDir().length() + 1);
- }
-
- /**
- @param msaFile Set Msa File
- **/
- public void setMsaFile(File msaFile) {
- this.msaFile = msaFile;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof ModuleIdentification) {
- ModuleIdentification id = (ModuleIdentification)obj;
- if (guid.equalsIgnoreCase(id.getGuid()) && packageId.equals(id.getPackage())) {
- if (version == null || id.version == null) {
- return true;
- }
- else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")){
- return true;
- }
- else if (version.equalsIgnoreCase(id.version)) {
- return true;
- }
- }
- return false;
- }
- else {
- return super.equals(obj);
- }
- }
-
- public String toString() {
- String nameString;
- String versionString;
- String packageString;
-
- if (name != null && name != "") {
- nameString = name;
- } else {
- if (guid != null && guid != "") {
- nameString = guid;
- } else {
- nameString = "UNKNOWN";
- }
- }
-
- if (version != null) {
- versionString = version;
- } else {
- versionString = "";
- }
-
- if (packageId != null) {
- packageString = packageId.toString();
- } else {
- packageString = "Package [UNKNOWN]";
- }
-
- return "Module [" + nameString + versionString + "] in " + packageString;
- }
-
- /**
- @param packageId set package identification
- **/
- public void setPackage(PackageIdentification packageId) {
- this.packageId = packageId;
- }
-
- /**
- @return get package identification
- **/
- public PackageIdentification getPackage() {
- return packageId;
- }
-
- /**
- @return get module type
- **/
- public String getModuleType() {
- return moduleType;
- }
-
- /**
- @param moduleType set module type
- **/
- public void setModuleType(String moduleType) {
- this.moduleType = moduleType;
- }
-
- /**
- @return String The module name
- **/
- public String getName() {
- return name;
- }
-
- /**
- @return boolean
- **/
- public boolean hasConstructor() {
- return constructor != "";
- }
-
- /**
- @return boolean
- */
- public boolean hasDestructor() {
- return destructor != "";
- }
-
- /**
- Set the constructor function name if this module is a library
-
- @param name
- */
- public void setConstructor(String name) {
- if (name != null) {
- constructor = name;
- }
- }
-
- /**
- Set the destructor function name if this module is a library
-
- @param name
- */
- public void setDestructor(String name) {
- if (name != null) {
- destructor = name;
- }
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java b/Tools/Java/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java
deleted file mode 100644
index 9371f6afda..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/** @file
-This file is to define PackageIdentification class.
-
-Copyright (c) 2006, 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.
-**/
-
-package org.tianocore.build.id;
-import java.io.File;
-
-import org.tianocore.build.global.GlobalData;
-
-/**
- This class is used to identify a package.
-
- @since GenBuild 1.0
-**/
-public class PackageIdentification extends Identification{
-
- //
- // SPD file
- //
- private File spdFile;
-
- /**
- @param guid Guid
- @param version Version
- **/
- public PackageIdentification(String guid, String version){
- super(guid, version);
- }
-
- /**
- @param name Name
- @param guid Guid
- @param version Version
- **/
- public PackageIdentification(String name, String guid, String version){
- super(name, guid, version);
- }
-
- /**
- @param name Name
- @param guid Guid
- @param version Version
- @param spdFilename SPD file name
- **/
- public PackageIdentification(String name, String guid, String version, String spdFilename){
- super(name, guid, version);
- this.spdFile = new File(spdFilename);
- }
-
- /**
- @param name Name
- @param guid Guid
- @param version Version
- @param spdFile SPD file
- **/
- public PackageIdentification(String name, String guid, String version, File spdFile){
- super(name, guid, version);
- this.spdFile = spdFile;
- }
-
- /**
- set SPD file.
- @param spdFile SPD file
- **/
- public void setSpdFile(File spdFile) {
- this.spdFile = spdFile;
- }
-
- /**
- get SPD file
- @return SPD file
- **/
- public File getSpdFile() {
- return spdFile;
- }
-
- public String toString(){
- if (version == null || version.trim().equalsIgnoreCase("")) {
- return "package [" + name + "]";
- }
- else {
- return "package [" + name + " " + version + "]";
- }
- }
-
- /**
- get package directory
- @return Package Directory
- **/
- public String getPackageDir(){
- return spdFile.getParent();
- }
-
- /**
- get package relative directory.
- @return package relative directory
- **/
- public String getPackageRelativeDir(){
- String relativeDir =spdFile.getParent().substring(GlobalData.getWorkspacePath().length());
- if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {
- relativeDir = relativeDir.substring(1);
- }
- return relativeDir;
- }
-
- public String getName() {
- return name;
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java b/Tools/Java/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java
deleted file mode 100644
index 7c669652b8..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/** @file
-This file is to define PlatformIdentification class.
-
-Copyright (c) 2006, 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.
-**/
-
-package org.tianocore.build.id;
-import java.io.File;
-
-import org.tianocore.build.global.GlobalData;
-
-/**
- This class is used to identify a platform.
-
- @since GenBuild 1.0
-**/
-public class PlatformIdentification extends Identification{
-
- ///
- /// FPD file
- ///
- private File fpdFile;
-
- /**
- @param guid Guid
- @param version Version
- **/
- public PlatformIdentification(String guid, String version){
- super(guid, version);
- }
-
- /**
- @param name Name
- @param guid Guid
- @param version Version
- **/
- public PlatformIdentification(String name, String guid, String version){
- super(name, guid, version);
- }
-
- /**
- @param name Name
- @param guid Guid
- @param version Version
- @param fpdFilename Fpd File Name
- **/
- public PlatformIdentification(String name, String guid, String version, String fpdFilename){
- super(name, guid, version);
- this.fpdFile = new File(fpdFilename);
- }
-
- /**
- @param name Name
- @param guid Guid
- @param version Version
- @param fpdFile Fpd File
- **/
- public PlatformIdentification(String name, String guid, String version, File fpdFile){
- super(name, guid, version);
- this.fpdFile = fpdFile;
- }
-
- public String toString(){
- return "Platform " + name + "["+guid+"]";
- }
-
- /**
- Set FPD file.
- @param fpdFile FPD File
- **/
- public void setFpdFile(File fpdFile) {
- this.fpdFile = fpdFile;
- }
-
- /**
- Get FPD file.
- @return Fpd File
- **/
- public File getFpdFile() {
- return fpdFile;
- }
-
- /**
- Get FPD relative file to workspace.
- @return Fpd Relative file.
- **/
- public String getRelativeFpdFile (){
- String relativeDir = fpdFile.getPath().substring(GlobalData.getWorkspacePath().length());
- if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {
- relativeDir = relativeDir.substring(1);
- }
- return relativeDir;
- }
-
- /**
- Get Platform relative directory to workspace.
- @return Platform relative directory
- **/
- public String getPlatformRelativeDir(){
- String relativeDir = fpdFile.getParent().substring(GlobalData.getWorkspacePath().length());
- if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {
- relativeDir = relativeDir.substring(1);
- }
- return relativeDir;
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java b/Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
deleted file mode 100644
index a2f1c6a1bf..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/** @file
- PCDAutoGenAction class.
-
- This class is to manage how to generate the PCD information into Autogen.c and
- Autogen.h.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.pcd.action;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.tianocore.build.FrameworkBuildTask;
-import org.tianocore.build.autogen.CommonDefinition;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.common.logger.EdkLog;
-import org.tianocore.pcd.action.BuildAction;
-import org.tianocore.pcd.entity.MemoryDatabaseManager;
-import org.tianocore.pcd.entity.Token;
-import org.tianocore.pcd.entity.UsageIdentification;
-import org.tianocore.pcd.entity.UsageInstance;
-import org.tianocore.pcd.exception.BuildActionException;
-
-/**
- This class is to manage how to generate the PCD information into Autogen.c
- and Autogen.h.
-**/
-public class PCDAutoGenAction extends BuildAction {
- ///
- /// The reference of DBManager in GlobalData class.
- ///
- private MemoryDatabaseManager dbManager;
-
- ///
- /// The identification for a UsageInstance.
- ///
- private UsageIdentification usageId;
-
- ///
- /// Whether current autogen is for building library used by current module.
- ///
- private boolean isBuildUsedLibrary;
-
- ///
- /// One of PEI_PCD_DRIVER, DXE_PCD_DRIVER, NOT_PCD_DRIVER
- ///
- private CommonDefinition.PCD_DRIVER_TYPE pcdDriverType;
-
- ///
- /// The generated string for header file.
- ///
- private String hAutoGenString;
-
- ///
- /// The generated string for C code file.
- ///
- private String cAutoGenString;
-
- ///
- /// The name array of <PcdCoded> in a module.
- ///
- private String[] pcdNameArrayInMsa;
-
- private UsageIdentification parentId = null;
- /**
- Set parameter moduleId
-
- @param moduleName the module name parameter.
- **/
- public void setUsageId(UsageIdentification usageId) {
- this.usageId = usageId;
- }
-
- /**
- Set paramter pcdDriverType
-
- @param pcdDriverType the driver type for PCD
- **/
- public void setPcdDriverType(CommonDefinition.PCD_DRIVER_TYPE pcdDriverType) {
- this.pcdDriverType = pcdDriverType;
- }
- /**
- set isBuildUsedLibrary parameter.
-
- @param isBuildUsedLibrary
- **/
- public void setIsBuildUsedLibrary(boolean isBuildUsedLibrary) {
- this.isBuildUsedLibrary = isBuildUsedLibrary;
- }
-
- /**
- set pcdNameArrayInMsa parameter.
-
- @param pcdNameArrayInMsa
- */
- public void setPcdNameArrayInMsa(String[] pcdNameArrayInMsa) {
- this.pcdNameArrayInMsa = pcdNameArrayInMsa;
- }
-
- /**
- Get the output of generated string for header file.
-
- @return the string of header file for PCD
- **/
- public String getHAutoGenString() {
- return hAutoGenString;
- }
-
- /**
- Get the output of generated string for C Code file.
-
- @return the string of C code file for PCD
- **/
- public String getCAutoGenString() {
- return cAutoGenString;
- }
-
-
- /**
- Construct function
-
- This function mainly initialize some member variable.
-
- @param moduleId the identification for module
- @param arch the architecture for module
- @param isBuildUsedLibary Is the current module library.
- @param pcdNameArrayInMsa the pcd name array got from MSA file.
- @param pcdDriverType one of PEI_PCD_DRIVER, DXE_PCD_DRIVER,
- NOT_PCD_DRIVER
- **/
- public PCDAutoGenAction(ModuleIdentification moduleId,
- String arch,
- boolean isBuildUsedLibrary,
- String[] pcdNameArrayInMsa,
- CommonDefinition.PCD_DRIVER_TYPE pcdDriverType,
- ModuleIdentification parentId) {
- dbManager = null;
- hAutoGenString = "";
- cAutoGenString = "";
-
- setUsageId(new UsageIdentification(moduleId.getName(),
- moduleId.getGuid(),
- moduleId.getPackage().getName(),
- moduleId.getPackage().getGuid(),
- arch,
- moduleId.getVersion(),
- moduleId.getModuleType()));
- if (parentId != null) {
- this.parentId = new UsageIdentification(parentId.getName(),
- parentId.getGuid(),
- parentId.getPackage().getName(),
- parentId.getPackage().getGuid(),
- arch,
- parentId.getVersion(),
- parentId.getModuleType());
- }
- setIsBuildUsedLibrary(isBuildUsedLibrary);
- setPcdNameArrayInMsa(pcdNameArrayInMsa);
- setPcdDriverType(pcdDriverType);
- }
-
- /**
- Override function: check the parameter for action class.
-
- @throws BuildActionException Bad parameter.
- **/
- public void checkParameter() {
- }
-
- /**
- Core execution function for this action class.
-
- All PCD information of this module comes from memory dabase. The collection
- work should be done before this action execution.
- Currently, we should generated all PCD information(maybe all dynamic) as array
- in Pei emulated driver for simulating PCD runtime database.
-
- @throws BuildActionException Failed to execute this aciton class.
- **/
- public void performAction() {
- EdkLog.log(EdkLog.EDK_DEBUG, "Starting PCDAutoGenAction to generate autogen.h and autogen.c!...");
-
- dbManager = GlobalData.getPCDMemoryDBManager();
-
- if(dbManager.getDBSize() == 0) {
- return;
- }
-
- EdkLog.log(EdkLog.EDK_DEBUG, "PCD memory database contains " + dbManager.getDBSize() + " PCD tokens.");
-
- generateAutogenForModule();
- }
-
- /**
- Generate the autogen string for a common module.
-
- All PCD information of this module comes from memory dabase. The collection
- work should be done before this action execution.
- **/
- private void generateAutogenForModule()
- {
- int index, index2;
- List<UsageInstance> usageInstanceArray, usageContext;
- String[] guidStringArray = null;
- String guidStringCName = null;
- String guidString = null;
- String moduleName = usageId.moduleName;
- UsageInstance usageInstance = null;
- boolean found = false;
-
- usageInstanceArray = null;
-
- if (FrameworkBuildTask.multithread) {
- if (parentId == null) {
- usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
- } else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {
- usageContext = dbManager.getUsageInstanceArrayById(parentId);
- //
- // For building library package, although all module are library, but PCD entries of
- // these library should be used to autogen.
- //
- if (usageContext == null) {
- usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
- } else {
- usageInstanceArray = new ArrayList<UsageInstance>();
-
- //
- // Try to find all PCD defined in library's PCD in all <PcdEntry> in module's
- // <ModuleSA> in FPD file.
- //
- for (index = 0; index < pcdNameArrayInMsa.length; index++) {
- found = false;
- for (index2 = 0; index2 < usageContext.size(); index2 ++) {
- if (pcdNameArrayInMsa[index].equalsIgnoreCase(usageContext.get(index2).parentToken.cName)) {
- usageInstanceArray.add(usageContext.get(index2));
- found = true;
- break;
- }
- }
-
- if (!found) {
- //
- // All library's PCD should instanted in module's <ModuleSA> who
- // use this library instance. If not, give errors.
- //
- throw new BuildActionException (String.format("Module %s using library instance %s; the PCD %s " +
- "is required by this library instance, but can not be found " +
- "in the %s's <ModuleSA> in the FPD file!",
- MemoryDatabaseManager.CurrentModuleName,
- moduleName,
- pcdNameArrayInMsa[index],
- MemoryDatabaseManager.CurrentModuleName
- ));
- }
- }
- }
- }
- } else {
- if (!isBuildUsedLibrary) {
- usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
- MemoryDatabaseManager.UsageInstanceContext = usageInstanceArray;
- MemoryDatabaseManager.CurrentModuleName = moduleName;
- } else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {
- usageContext = MemoryDatabaseManager.UsageInstanceContext;
- //
- // For building library package, although all module are library, but PCD entries of
- // these library should be used to autogen.
- //
- if (usageContext == null) {
- usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
- } else {
- usageInstanceArray = new ArrayList<UsageInstance>();
-
- //
- // Try to find all PCD defined in library's PCD in all <PcdEntry> in module's
- // <ModuleSA> in FPD file.
- //
- for (index = 0; index < pcdNameArrayInMsa.length; index++) {
- found = false;
- for (index2 = 0; index2 < usageContext.size(); index2 ++) {
- if (pcdNameArrayInMsa[index].equalsIgnoreCase(usageContext.get(index2).parentToken.cName)) {
- usageInstanceArray.add(usageContext.get(index2));
- found = true;
- break;
- }
- }
-
- if (!found) {
- //
- // All library's PCD should instanted in module's <ModuleSA> who
- // use this library instance. If not, give errors.
- //
- throw new BuildActionException (String.format("Module %s using library instance %s; the PCD %s " +
- "is required by this library instance, but can not be found " +
- "in the %s's <ModuleSA> in the FPD file!",
- MemoryDatabaseManager.CurrentModuleName,
- moduleName,
- pcdNameArrayInMsa[index],
- MemoryDatabaseManager.CurrentModuleName
- ));
- }
- }
- }
- }
- }
- if (usageInstanceArray == null) {
- return;
- }
-
- //
- // Generate all PCD entry for a module.
- //
- for(index = 0; index < usageInstanceArray.size(); index ++) {
- usageInstance = usageInstanceArray.get(index);
- //
- // Before generate any PCD information into autogen.h/autogen.c for a module,
- // generate TokenSpaceGuid array variable firstly. For every dynamicEx type
- // PCD in this module the token, they are all reference to TokenSpaceGuid
- // array.
- //
- if (usageInstanceArray.get(index).modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {
- guidStringArray = usageInstance.parentToken.tokenSpaceName.split("-");
- guidStringCName = "_gPcd_TokenSpaceGuid_" +
- usageInstance.parentToken.tokenSpaceName.replaceAll("-", "_");
- guidString = String.format("{ 0x%s, 0x%s, 0x%s, {0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s}}",
- guidStringArray[0],
- guidStringArray[1],
- guidStringArray[2],
- (guidStringArray[3].substring(0, 2)),
- (guidStringArray[3].substring(2, 4)),
- (guidStringArray[4].substring(0, 2)),
- (guidStringArray[4].substring(2, 4)),
- (guidStringArray[4].substring(4, 6)),
- (guidStringArray[4].substring(6, 8)),
- (guidStringArray[4].substring(8, 10)),
- (guidStringArray[4].substring(10, 12)));
-
- Pattern pattern = Pattern.compile("(" + guidStringCName + ")+?");
- Matcher matcher = pattern.matcher(cAutoGenString + " ");
- //
- // Find whether this guid array variable has been generated into autogen.c
- // For different DyanmicEx pcd token who use same token space guid, the token space
- // guid array should be only generated once.
- //
- if (!matcher.find()) {
- hAutoGenString += String.format("extern EFI_GUID %s;\r\n", guidStringCName);
- if (!isBuildUsedLibrary) {
- cAutoGenString += String.format("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID %s = %s;\r\n",
- guidStringCName,
- guidString);
- }
- }
- }
-
- usageInstance.generateAutoGen(isBuildUsedLibrary);
- //
- // For every PCD entry for this module(usage instance), autogen string would
- // be appand.
- //
- hAutoGenString += usageInstance.getHAutogenStr() + "\r\n";
- cAutoGenString += usageInstance.getCAutogenStr();
- }
-
- if (pcdDriverType == CommonDefinition.PCD_DRIVER_TYPE.PEI_PCD_DRIVER) {
- hAutoGenString += MemoryDatabaseManager.PcdPeimHString;
- cAutoGenString += MemoryDatabaseManager.PcdPeimCString;
- } else if (pcdDriverType == CommonDefinition.PCD_DRIVER_TYPE.DXE_PCD_DRIVER) {
- hAutoGenString += MemoryDatabaseManager.PcdDxeHString;
- cAutoGenString += MemoryDatabaseManager.PcdDxeCString;
- }
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java b/Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java
deleted file mode 100644
index d848d1f561..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java
+++ /dev/null
@@ -1,1740 +0,0 @@
-/** @file
- PcdDatabase class.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.pcd.action;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.tianocore.pcd.entity.DynamicTokenValue;
-import org.tianocore.pcd.entity.Token;
-import org.tianocore.pcd.exception.EntityException;
-
-/**
- CStructTypeDeclaration
-
- This class is used to store the declaration string, such as
- "UINT32 PcdPlatformFlashBaseAddress", of
- each memember in the C structure, which is a standard C language
- feature used to implement a simple and efficient database for
- dynamic(ex) type PCD entry.
-**/
-class CStructTypeDeclaration {
- String key;
- int alignmentSize;
- String cCode;
- boolean initTable;
-
- public CStructTypeDeclaration (String key, int alignmentSize, String cCode, boolean initTable) {
- this.key = key;
- this.alignmentSize = alignmentSize;
- this.cCode = cCode;
- this.initTable = initTable;
- }
-}
-
-/**
- StringTable
-
- This class is used to store the String in a PCD database.
-
-**/
-class StringTable {
- class UnicodeString {
- //
- // In Schema, we define VariableName in DynamicPcdBuildDefinitions in FPD
- // file to be HexWordArrayType. For example, Unicode String L"Setup" is
- // <VariableName>0x0053 0x0065 0x0074 0x0075 0x0070</VariableName>.
- // We use raw to differentiate if the String is in form of L"Setup" (raw is false) or
- // in form of {0x0053, 0x0065, 0x0074, 0x0075, 0x0070}
- //
- // This str is the string that can be pasted directly into the C structure.
- // For example, this str can be two forms:
- //
- // L"Setup",
- // {0x0053, 0065, 0x0074, 0x0075, 0x0070, 0x0000}, //This is another form of L"Setup"
- //
- public String str;
- //
- // This len includes the NULL character at the end of the String.
- //
- public int len;
-
- public UnicodeString (String str, int len) {
- this.str = str;
- this.len = len;
- }
- }
-
- private ArrayList<UnicodeString> al;
- private ArrayList<String> alComments;
- private String phase;
- int stringTableCharNum;
-
- public StringTable (String phase) {
- this.phase = phase;
- al = new ArrayList<UnicodeString>();
- alComments = new ArrayList<String>();
- stringTableCharNum = 0;
- }
-
- public String getSizeMacro () {
- return String.format(PcdDatabase.StringTableSizeMacro, phase, getSize());
- }
-
- private int getSize () {
- //
- // We have at least one Unicode Character in the table.
- //
- return stringTableCharNum == 0 ? 1 : stringTableCharNum;
- }
-
- public String getExistanceMacro () {
- return String.format(PcdDatabase.StringTableExistenceMacro, phase, (al.size() == 0)? "TRUE":"FALSE");
- }
-
- public void genCode (ArrayList<CStructTypeDeclaration> declaList, HashMap<String, String> instTable) {
- final String stringTable = "StringTable";
- final String tab = "\t";
- final String newLine = "\r\n";
- final String commaNewLine = ",\r\n";
-
- CStructTypeDeclaration decl;
-
- String cDeclCode = "";
- String cInstCode = "";
-
- //
- // If we have a empty StringTable
- //
- if (al.size() == 0) {
- cDeclCode += String.format("%-20s%s[1]; /* StringTable is empty */", "UINT16", stringTable) + newLine;
- decl = new CStructTypeDeclaration (
- stringTable,
- 2,
- cDeclCode,
- true
- );
- declaList.add(decl);
-
- cInstCode = String.format("/* %s */", stringTable) + newLine + tab + "{ 0 }";
- instTable.put(stringTable, cInstCode);
- } else {
-
- //
- // If there is any String in the StringTable
- //
- for (int i = 0; i < al.size(); i++) {
- UnicodeString uStr = al.get(i);
- String stringTableName;
-
- if (i == 0) {
- //
- // StringTable is a well-known name in the PCD DXE driver
- //
- stringTableName = stringTable;
-
- } else {
- stringTableName = String.format("%s_%d", stringTable, i);
- cDeclCode += tab;
- }
- cDeclCode += String.format("%-20s%s[%d]; /* %s */", "UINT16",
- stringTableName, uStr.len,
- alComments.get(i))
- + newLine;
-
- if (i == 0) {
- cInstCode = "/* StringTable */" + newLine;
- }
-
- cInstCode += tab + String.format("%s /* %s */", uStr.str, alComments.get(i));
- if (i != al.size() - 1) {
- cInstCode += commaNewLine;
- }
- }
-
- decl = new CStructTypeDeclaration (
- stringTable,
- 2,
- cDeclCode,
- true
- );
- declaList.add(decl);
-
- instTable.put(stringTable, cInstCode);
- }
- }
-
- public int add (List inputStr, Token token) {
- String str;
-
- str = "{";
-
- for (int i = 0; i < inputStr.size(); i++) {
- str += " " + inputStr.get(i) + ",";
- }
-
- str += " 0x0000";
-
- str += "}";
- //
- // This is a raw Unicode String
- //
- return addToTable (str, inputStr.size() + 1, token);
- }
-
- public int add (String inputStr, Token token) {
-
- int len;
- String str = inputStr;
-
- //
- // The input can be two types:
- // "L\"Bootmode\"" or "Bootmode".
- // We drop the L\" and \" for the first type.
- if (str.startsWith("L\"") && str.endsWith("\"")) {
- //
- // Substract the character of "L", """, """.
- // and add in the NULL character. So it is 2.
- //
- len = str.length() - 2;
- } else {
- //
- // Include the NULL character.
- //
- len = str.length() + 1;
- str = "L\"" + str + "\"";
- }
-
- //
- // After processing, this is L"A String Sample" type of string.
- //
- return addToTable (str, len, token);
- }
-
- private int addToTable (String inputStr, int len, Token token) {
- int i;
- int pos;
-
- //
- // Check if StringTable has this String already.
- // If so, return the current pos.
- //
- for (i = 0, pos = 0; i < al.size(); i++) {
- UnicodeString s = al.get(i);;
-
- if (inputStr.equals(s.str)) {
- return pos;
- }
- pos += s.len;
- }
-
- i = stringTableCharNum;
- //
- // Include the NULL character at the end of String
- //
- stringTableCharNum += len;
- al.add(new UnicodeString(inputStr, len));
- alComments.add(token.getPrimaryKeyString());
-
- return i;
- }
-}
-
-/**
- SizeTable
-
- This class is used to store the Size information for
- POINTER TYPE PCD entry in a PCD database.
-
-**/
-class SizeTable {
- private ArrayList<ArrayList<Integer>> al;
- private ArrayList<String> alComments;
- private int len;
- private String phase;
-
- public SizeTable (String phase) {
- al = new ArrayList<ArrayList<Integer>>();
- alComments = new ArrayList<String>();
- len = 0;
- this.phase = phase;
- }
-
- public String getSizeMacro () {
- return String.format(PcdDatabase.SizeTableSizeMacro, phase, getSize());
- }
-
- private int getSize() {
- return len == 0 ? 1 : len;
- }
-
- public void genCode (ArrayList<CStructTypeDeclaration> declaList, HashMap<String, String> instTable, String phase) {
- final String name = "SizeTable";
-
- CStructTypeDeclaration decl;
- String cCode;
-
- cCode = String.format(PcdDatabase.SizeTableDeclaration, phase);
- decl = new CStructTypeDeclaration (
- name,
- 2,
- cCode,
- true
- );
- declaList.add(decl);
-
-
- cCode = PcdDatabase.genInstantiationStr(getInstantiation());
- instTable.put(name, cCode);
- }
-
- private ArrayList<String> getInstantiation () {
- final String comma = ",";
- ArrayList<String> Output = new ArrayList<String>();
-
- Output.add("/* SizeTable */");
- Output.add("{");
- if (al.size() == 0) {
- Output.add("\t0");
- } else {
- for (int index = 0; index < al.size(); index++) {
- ArrayList<Integer> ial = al.get(index);
-
- String str = "\t";
-
- for (int index2 = 0; index2 < ial.size(); index2++) {
- str += " " + ial.get(index2).toString();
- if (index2 != ial.size() - 1) {
- str += comma;
- }
- }
-
- str += " /* " + alComments.get(index) + " */";
-
- if (index != (al.size() - 1)) {
- str += comma;
- }
-
- Output.add(str);
-
- }
- }
- Output.add("}");
-
- return Output;
- }
-
- public void add (Token token) {
-
- //
- // We only have size information for POINTER type PCD entry.
- //
- if (token.datumType != Token.DATUM_TYPE.POINTER) {
- return;
- }
-
- ArrayList<Integer> ial = token.getPointerTypeSize();
-
- len+= ial.size();
-
- al.add(ial);
- alComments.add(token.getPrimaryKeyString());
-
- return;
- }
-
-}
-
-/**
- GuidTable
-
- This class is used to store the GUIDs in a PCD database.
-**/
-class GuidTable {
- private ArrayList<UUID> al;
- private ArrayList<String> alComments;
- private String phase;
- private int len;
- private int bodyLineNum;
-
- public GuidTable (String phase) {
- this.phase = phase;
- al = new ArrayList<UUID>();
- alComments = new ArrayList<String>();
- len = 0;
- bodyLineNum = 0;
- }
-
- public String getSizeMacro () {
- return String.format(PcdDatabase.GuidTableSizeMacro, phase, getSize());
- }
-
- private int getSize () {
- return (al.size() == 0)? 1 : al.size();
- }
-
- public String getExistanceMacro () {
- return String.format(PcdDatabase.GuidTableExistenceMacro, phase, (al.size() == 0)? "TRUE":"FALSE");
- }
-
- public void genCode (ArrayList<CStructTypeDeclaration> declaList, HashMap<String, String> instTable, String phase) {
- final String name = "GuidTable";
-
- CStructTypeDeclaration decl;
- String cCode = "";
-
- cCode += String.format(PcdDatabase.GuidTableDeclaration, phase);
- decl = new CStructTypeDeclaration (
- name,
- 4,
- cCode,
- true
- );
- declaList.add(decl);
-
-
- cCode = PcdDatabase.genInstantiationStr(getInstantiation());
- instTable.put(name, cCode);
- }
-
- private String getUuidCString (UUID uuid) {
- String[] guidStrArray;
-
- guidStrArray =(uuid.toString()).split("-");
-
- return String.format("{0x%s, 0x%s, 0x%s, {0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s}}",
- guidStrArray[0],
- guidStrArray[1],
- guidStrArray[2],
- (guidStrArray[3].substring(0, 2)),
- (guidStrArray[3].substring(2, 4)),
- (guidStrArray[4].substring(0, 2)),
- (guidStrArray[4].substring(2, 4)),
- (guidStrArray[4].substring(4, 6)),
- (guidStrArray[4].substring(6, 8)),
- (guidStrArray[4].substring(8, 10)),
- (guidStrArray[4].substring(10, 12))
- );
- }
-
- private ArrayList<String> getInstantiation () {
- ArrayList<String> Output = new ArrayList<String>();
-
- Output.add("/* GuidTable */");
- Output.add("{");
-
- if (al.size() == 0) {
- Output.add("\t" + getUuidCString(new UUID(0, 0)));
- }
-
- for (int i = 0; i < al.size(); i++) {
- String str = "\t" + getUuidCString(al.get(i));
-
- str += "/* " + alComments.get(i) + " */";
- if (i != (al.size() - 1)) {
- str += ",";
- }
- Output.add(str);
- bodyLineNum++;
-
- }
- Output.add("}");
-
- return Output;
- }
-
- public int add (UUID uuid, String name) {
- //
- // Check if GuidTable has this entry already.
- // If so, return the GuidTable index.
- //
- for (int i = 0; i < al.size(); i++) {
- if (al.get(i).compareTo(uuid) == 0) {
- return i;
- }
- }
-
- len++;
- al.add(uuid);
- alComments.add(name);
-
- //
- // Return the previous Table Index
- //
- return len - 1;
- }
-
-}
-
-/**
- SkuIdTable
-
- This class is used to store the SKU IDs in a PCD database.
-
-**/
-class SkuIdTable {
- private ArrayList<Integer[]> al;
- private ArrayList<String> alComment;
- private String phase;
- private int len;
-
- public SkuIdTable (String phase) {
- this.phase = phase;
- al = new ArrayList<Integer[]>();
- alComment = new ArrayList<String>();
- len = 0;
- }
-
- public String getSizeMacro () {
- return String.format(PcdDatabase.SkuIdTableSizeMacro, phase, getSize());
- }
-
- private int getSize () {
- return (len == 0)? 1 : len;
- }
-
- public String getExistanceMacro () {
- return String.format(PcdDatabase.SkuTableExistenceMacro, phase, (al.size() == 0)? "TRUE":"FALSE");
- }
-
- public void genCode (ArrayList<CStructTypeDeclaration> declaList, HashMap<String, String> instTable, String phase) {
- final String name = "SkuIdTable";
-
- CStructTypeDeclaration decl;
- String cCode = "";
-
- cCode += String.format(PcdDatabase.SkuIdTableDeclaration, phase);
- decl = new CStructTypeDeclaration (
- name,
- 1,
- cCode,
- true
- );
- declaList.add(decl);
-
-
- cCode = PcdDatabase.genInstantiationStr(getInstantiation());
- instTable.put(name, cCode);
-
- //
- // SystemSkuId is in PEI phase PCD Database
- //
- if (phase.equalsIgnoreCase("PEI")) {
- decl = new CStructTypeDeclaration (
- "SystemSkuId",
- 1,
- String.format("%-20sSystemSkuId;\r\n", "SKU_ID"),
- true
- );
- declaList.add(decl);
-
- instTable.put("SystemSkuId", "0");
- }
-
- }
-
- private ArrayList<String> getInstantiation () {
- ArrayList<String> Output = new ArrayList<String> ();
-
- Output.add("/* SkuIdTable */");
- Output.add("{");
-
- if (al.size() == 0) {
- Output.add("\t0");
- }
-
- for (int index = 0; index < al.size(); index++) {
- String str;
-
- str = "/* " + alComment.get(index) + "*/ ";
- str += "/* MaxSku */ ";
-
-
- Integer[] ia = al.get(index);
-
- str += "\t" + ia[0].toString() + ", ";
- for (int index2 = 1; index2 < ia.length; index2++) {
- str += ia[index2].toString();
- if (!((index2 == ia.length - 1) && (index == al.size() - 1))) {
- str += ", ";
- }
- }
-
- Output.add(str);
-
- }
-
- Output.add("}");
-
- return Output;
- }
-
- public int add (Token token) {
-
- int index;
- int pos;
-
- //
- // Check if this SKU_ID Array is already in the table
- //
- pos = 0;
- for (Object o: al) {
- Integer [] s = (Integer[]) o;
- boolean different = false;
- if (s[0] == token.getSkuIdCount()) {
- for (index = 1; index < s.length; index++) {
- if (s[index] != token.skuData.get(index-1).id) {
- different = true;
- break;
- }
- }
- } else {
- different = true;
- }
- if (different) {
- pos += s[0] + 1;
- } else {
- return pos;
- }
- }
-
- Integer [] skuIds = new Integer[token.skuData.size() + 1];
- skuIds[0] = new Integer(token.skuData.size());
- for (index = 1; index < skuIds.length; index++) {
- skuIds[index] = new Integer(token.skuData.get(index - 1).id);
- }
-
- index = len;
-
- len += skuIds.length;
- al.add(skuIds);
- alComment.add(token.getPrimaryKeyString());
-
- return index;
- }
-
-}
-
-class LocalTokenNumberTable {
- private ArrayList<String> al;
- private ArrayList<String> alComment;
- private String phase;
- private int len;
-
- public LocalTokenNumberTable (String phase) {
- this.phase = phase;
- al = new ArrayList<String>();
- alComment = new ArrayList<String>();
-
- len = 0;
- }
-
- public String getSizeMacro () {
- return String.format(PcdDatabase.LocalTokenNumberTableSizeMacro, phase, getSize())
- + String.format(PcdDatabase.LocalTokenNumberSizeMacro, phase, al.size());
- }
-
- public int getSize () {
- return (al.size() == 0)? 1 : al.size();
- }
-
- public String getExistanceMacro () {
- return String.format(PcdDatabase.DatabaseExistenceMacro, phase, (al.size() == 0)? "TRUE":"FALSE");
- }
-
- public void genCode (ArrayList<CStructTypeDeclaration> declaList, HashMap<String, String> instTable, String phase) {
- final String name = "LocalTokenNumberTable";
-
- CStructTypeDeclaration decl;
- String cCode = "";
-
- cCode += String.format(PcdDatabase.LocalTokenNumberTableDeclaration, phase);
- decl = new CStructTypeDeclaration (
- name,
- 4,
- cCode,
- true
- );
- declaList.add(decl);
-
- cCode = PcdDatabase.genInstantiationStr(getInstantiation());
- instTable.put(name, cCode);
- }
-
- private ArrayList<String> getInstantiation () {
- ArrayList<String> output = new ArrayList<String>();
-
- output.add("/* LocalTokenNumberTable */");
- output.add("{");
-
- if (al.size() == 0) {
- output.add("\t0");
- }
-
- for (int index = 0; index < al.size(); index++) {
- String str;
-
- str = "\t" + (String)al.get(index);
-
- str += " /* " + alComment.get(index) + " */ ";
-
-
- if (index != (al.size() - 1)) {
- str += ",";
- }
-
- output.add(str);
-
- }
-
- output.add("}");
-
- return output;
- }
-
- public int add (Token token) {
- int index = len;
- String str;
-
- len++;
-
- str = String.format(PcdDatabase.offsetOfStrTemplate, phase, token.hasDefaultValue() ? "Init" : "Uninit", token.getPrimaryKeyString());
-
- if (token.isUnicodeStringType()) {
- str += " | PCD_TYPE_STRING";
- }
-
- if (token.isSkuEnable()) {
- str += " | PCD_TYPE_SKU_ENABLED";
- }
-
- if (token.getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.HII_TYPE) {
- str += " | PCD_TYPE_HII";
- }
-
- if (token.getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.VPD_TYPE) {
- str += " | PCD_TYPE_VPD";
- }
-
- switch (token.datumType) {
- case UINT8:
- case BOOLEAN:
- str += " | PCD_DATUM_TYPE_UINT8";
- break;
- case UINT16:
- str += " | PCD_DATUM_TYPE_UINT16";
- break;
- case UINT32:
- str += " | PCD_DATUM_TYPE_UINT32";
- break;
- case UINT64:
- str += " | PCD_DATUM_TYPE_UINT64";
- break;
- case POINTER:
- str += " | PCD_DATUM_TYPE_POINTER";
- break;
- }
-
- al.add(str);
- alComment.add(token.getPrimaryKeyString());
-
- return index;
- }
-}
-
-/**
- ExMapTable
-
- This class is used to store the table of mapping information
- between DynamicEX ID pair(Guid, TokenNumber) and
- the local token number assigned by PcdDatabase class.
-**/
-class ExMapTable {
-
- /**
- ExTriplet
-
- This class is used to store the mapping information
- between DynamicEX ID pair(Guid, TokenNumber) and
- the local token number assigned by PcdDatabase class.
- **/
- class ExTriplet {
- public Integer guidTableIdx;
- public Long exTokenNumber;
- public Long localTokenIdx;
-
- public ExTriplet (int guidTableIdx, long exTokenNumber, long localTokenIdx) {
- this.guidTableIdx = new Integer(guidTableIdx);
- this.exTokenNumber = new Long(exTokenNumber);
- this.localTokenIdx = new Long(localTokenIdx);
- }
- }
-
- private ArrayList<ExTriplet> al;
- private Map<ExTriplet, String> alComment;
- private String phase;
- private int len;
- private int bodyLineNum;
-
- public ExMapTable (String phase) {
- this.phase = phase;
- al = new ArrayList<ExTriplet>();
- alComment = new HashMap<ExTriplet, String>();
- bodyLineNum = 0;
- len = 0;
- }
-
- public String getSizeMacro () {
- return String.format(PcdDatabase.ExMapTableSizeMacro, phase, getTableLen())
- + String.format(PcdDatabase.ExTokenNumber, phase, al.size());
- }
-
- public String getExistanceMacro () {
- return String.format(PcdDatabase.ExMapTableExistenceMacro, phase, (al.size() == 0)? "TRUE":"FALSE");
- }
-
- public void genCode (ArrayList<CStructTypeDeclaration> declaList, HashMap<String, String> instTable, String phase) {
- final String exMapTableName = "ExMapTable";
-
- sortTable();
-
- CStructTypeDeclaration decl;
- String cCode = "";
-
- cCode += String.format(PcdDatabase.ExMapTableDeclaration, phase);
- decl = new CStructTypeDeclaration (
- exMapTableName,
- 4,
- cCode,
- true
- );
- declaList.add(decl);
-
-
- cCode = PcdDatabase.genInstantiationStr(getInstantiation());
- instTable.put(exMapTableName, cCode);
- }
-
- private ArrayList<String> getInstantiation () {
- ArrayList<String> Output = new ArrayList<String>();
-
- Output.add("/* ExMapTable */");
- Output.add("{");
- if (al.size() == 0) {
- Output.add("\t{0, 0, 0}");
- }
-
- int index;
- for (index = 0; index < al.size(); index++) {
- String str;
-
- ExTriplet e = (ExTriplet)al.get(index);
-
- str = "\t" + "{ " + String.format("0x%08X", e.exTokenNumber) + ", ";
- str += e.localTokenIdx.toString() + ", ";
- str += e.guidTableIdx.toString();
-
- str += "}" + " /* " + alComment.get(e) + " */" ;
-
- if (index != al.size() - 1) {
- str += ",";
- }
-
- Output.add(str);
- bodyLineNum++;
-
- }
-
- Output.add("}");
-
- return Output;
- }
-
- public int add (int localTokenIdx, long exTokenNum, int guidTableIdx, String name) {
- int index = len;
-
- len++;
- ExTriplet et = new ExTriplet(guidTableIdx, exTokenNum, localTokenIdx);
-
- al.add(et);
- alComment.put(et, name);
-
- return index;
- }
-
- private int getTableLen () {
- return al.size() == 0 ? 1 : al.size();
- }
-
- //
- // To simplify the algorithm for GetNextToken and GetNextTokenSpace in
- // PCD PEIM/Driver, we need to sort the ExMapTable according to the
- // following order:
- // 1) ExGuid
- // 2) ExTokenNumber
- //
- class ExTripletComp implements Comparator<ExTriplet> {
- public int compare (ExTriplet a, ExTriplet b) {
- if (a.guidTableIdx == b.guidTableIdx ) {
- //
- // exTokenNumber is long, we can't use simple substraction.
- //
- if (a.exTokenNumber > b.exTokenNumber) {
- return 1;
- } else if (a.exTokenNumber == b.exTokenNumber) {
- return 0;
- } else {
- return -1;
- }
- }
-
- return a.guidTableIdx - b.guidTableIdx;
- }
- }
-
- private void sortTable () {
- java.util.Comparator<ExTriplet> comparator = new ExTripletComp();
- java.util.Collections.sort(al, comparator);
- }
-}
-
-/**
- PcdDatabase
-
- This class is used to generate C code for Autogen.h and Autogen.c of
- a PCD service DXE driver and PCD service PEIM.
-**/
-public class PcdDatabase {
-
- private final static int SkuHeadAlignmentSize = 4;
- private final String newLine = "\r\n";
- private final String commaNewLine = ",\r\n";
- private final String tab = "\t";
- public final static String ExMapTableDeclaration = "DYNAMICEX_MAPPING ExMapTable[%s_EXMAPPING_TABLE_SIZE];\r\n";
- public final static String GuidTableDeclaration = "EFI_GUID GuidTable[%s_GUID_TABLE_SIZE];\r\n";
- public final static String LocalTokenNumberTableDeclaration = "UINT32 LocalTokenNumberTable[%s_LOCAL_TOKEN_NUMBER_TABLE_SIZE];\r\n";
- public final static String StringTableDeclaration = "UINT16 StringTable[%s_STRING_TABLE_SIZE];\r\n";
- public final static String SizeTableDeclaration = "SIZE_INFO SizeTable[%s_SIZE_TABLE_SIZE];\r\n";
- public final static String SkuIdTableDeclaration = "UINT8 SkuIdTable[%s_SKUID_TABLE_SIZE];\r\n";
-
-
- public final static String ExMapTableSizeMacro = "#define %s_EXMAPPING_TABLE_SIZE %d\r\n";
- public final static String ExTokenNumber = "#define %s_EX_TOKEN_NUMBER %d\r\n";
- public final static String GuidTableSizeMacro = "#define %s_GUID_TABLE_SIZE %d\r\n";
- public final static String LocalTokenNumberTableSizeMacro = "#define %s_LOCAL_TOKEN_NUMBER_TABLE_SIZE %d\r\n";
- public final static String LocalTokenNumberSizeMacro = "#define %s_LOCAL_TOKEN_NUMBER %d\r\n";
- public final static String SizeTableSizeMacro = "#define %s_SIZE_TABLE_SIZE %d\r\n";
- public final static String StringTableSizeMacro = "#define %s_STRING_TABLE_SIZE %d\r\n";
- public final static String SkuIdTableSizeMacro = "#define %s_SKUID_TABLE_SIZE %d\r\n";
-
-
- public final static String ExMapTableExistenceMacro = "#define %s_EXMAP_TABLE_EMPTY %s\r\n";
- public final static String GuidTableExistenceMacro = "#define %s_GUID_TABLE_EMPTY %s\r\n";
- public final static String DatabaseExistenceMacro = "#define %s_DATABASE_EMPTY %s\r\n";
- public final static String StringTableExistenceMacro = "#define %s_STRING_TABLE_EMPTY %s\r\n";
- public final static String SkuTableExistenceMacro = "#define %s_SKUID_TABLE_EMPTY %s\r\n";
-
- public final static String offsetOfSkuHeadStrTemplate = "offsetof(%s_PCD_DATABASE, %s.%s_SkuDataTable)";
- public final static String offsetOfVariableEnabledDefault = "offsetof(%s_PCD_DATABASE, %s.%s_VariableDefault_%d)";
- public final static String offsetOfStrTemplate = "offsetof(%s_PCD_DATABASE, %s.%s)";
-
- private final static String skuDataTableTemplate = "SkuDataTable";
-
-
- private StringTable stringTable;
- private GuidTable guidTable;
- private LocalTokenNumberTable localTokenNumberTable;
- private SkuIdTable skuIdTable;
- private SizeTable sizeTable;
- private ExMapTable exMapTable;
-
- private ArrayList<Token> alTokens;
- private String phase;
- private int assignedTokenNumber;
-
- //
- // Use two class global variable to store
- // temperary
- //
- private String privateGlobalName;
- private String privateGlobalCCode;
- //
- // After Major changes done to the PCD
- // database generation class PcdDatabase
- // Please increment the version and please
- // also update the version number in PCD
- // service PEIM and DXE driver accordingly.
- //
- private final int version = 2;
-
- private String hString;
- private String cString;
-
- /**
- Constructor for PcdDatabase class.
-
- <p>We have two PCD dynamic(ex) database for the Framework implementation. One
- for PEI phase and the other for DXE phase. </p>
-
- @param alTokens A ArrayList of Dynamic(EX) PCD entry.
- @param exePhase The phase to generate PCD database for: valid input
- is "PEI" or "DXE".
- @param startLen The starting Local Token Number for the PCD database. For
- PEI phase, the starting Local Token Number starts from 0.
- For DXE phase, the starting Local Token Number starts
- from the total number of PCD entry of PEI phase.
- @return void
- **/
- public PcdDatabase (ArrayList<Token> alTokens, String exePhase, int startLen) {
- phase = exePhase;
-
- stringTable = new StringTable(phase);
- guidTable = new GuidTable(phase);
- localTokenNumberTable = new LocalTokenNumberTable(phase);
- skuIdTable = new SkuIdTable(phase);
- sizeTable = new SizeTable(phase);
- exMapTable = new ExMapTable(phase);
-
- //
- // Local token number 0 is reserved for INVALID_TOKEN_NUMBER.
- // So we will increment 1 for the startLen passed from the
- // constructor.
- //
- assignedTokenNumber = startLen + 1;
- this.alTokens = alTokens;
- }
-
- private void getNonExAndExTokens (ArrayList<Token> alTokens, List<Token> nexTokens, List<Token> exTokens) {
- for (int i = 0; i < alTokens.size(); i++) {
- Token t = (Token)alTokens.get(i);
- if (t.isDynamicEx()) {
- exTokens.add(t);
- } else {
- nexTokens.add(t);
- }
- }
-
- return;
- }
-
- private int getDataTypeAlignmentSize (Token token) {
- switch (token.datumType) {
- case UINT8:
- return 1;
- case UINT16:
- return 2;
- case UINT32:
- return 4;
- case UINT64:
- return 8;
- case POINTER:
- return 1;
- case BOOLEAN:
- return 1;
- default:
- return 1;
- }
- }
-
- private int getHiiPtrTypeAlignmentSize(Token token) {
- switch (token.datumType) {
- case UINT8:
- return 1;
- case UINT16:
- return 2;
- case UINT32:
- return 4;
- case UINT64:
- return 8;
- case POINTER:
- if (token.isHiiEnable()) {
- if (token.isHiiDefaultValueUnicodeStringType()) {
- return 2;
- }
- }
- return 1;
- case BOOLEAN:
- return 1;
- default:
- return 1;
- }
- }
-
- private int getAlignmentSize (Token token) {
- if (token.getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.HII_TYPE) {
- return 2;
- }
-
- if (token.getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.VPD_TYPE) {
- return 4;
- }
-
- if (token.isUnicodeStringType()) {
- return 2;
- }
-
- return getDataTypeAlignmentSize(token);
- }
-
- public String getCString () {
- return cString;
- }
-
- public String getHString () {
- return hString;
- }
-
- private void genCodeWorker(Token t,
- ArrayList<CStructTypeDeclaration> declaList,
- HashMap<String, String> instTable, String phase)
- throws EntityException {
-
- CStructTypeDeclaration decl;
-
- //
- // Insert SKU_HEAD if isSkuEnable is true
- //
- if (t.isSkuEnable()) {
- int tableIdx;
- tableIdx = skuIdTable.add(t);
- decl = new CStructTypeDeclaration(t.getPrimaryKeyString(),
- SkuHeadAlignmentSize, getSkuEnabledTypeDeclaration(t), true);
- declaList.add(decl);
- instTable.put(t.getPrimaryKeyString(),
- getSkuEnabledTypeInstantiaion(t, tableIdx));
- }
-
- //
- // Insert PCD_ENTRY declaration and instantiation
- //
- getCDeclarationString(t);
-
- decl = new CStructTypeDeclaration(privateGlobalName,
- getAlignmentSize(t), privateGlobalCCode, t.hasDefaultValue());
- declaList.add(decl);
-
- if (t.hasDefaultValue()) {
- instTable.put(privateGlobalName,
- getTypeInstantiation(t, declaList, instTable, phase)
- );
- }
-
- }
-
- private void ProcessTokens (List<Token> tokens,
- ArrayList<CStructTypeDeclaration> cStructDeclList,
- HashMap<String, String> cStructInstTable,
- String phase
- )
- throws EntityException {
-
- for (int idx = 0; idx < tokens.size(); idx++) {
- Token t = tokens.get(idx);
-
- genCodeWorker (t, cStructDeclList, cStructInstTable, phase);
-
- sizeTable.add(t);
- localTokenNumberTable.add(t);
- t.tokenNumber = assignedTokenNumber++;
-
- //
- // Add a mapping if this dynamic PCD entry is a EX type
- //
- if (t.isDynamicEx()) {
- exMapTable.add((int)t.tokenNumber,
- t.dynamicExTokenNumber,
- guidTable.add(translateSchemaStringToUUID(t.tokenSpaceName), t.getPrimaryKeyString()),
- t.getPrimaryKeyString()
- );
- }
- }
-
- }
-
- public void genCode () throws EntityException {
-
- ArrayList<CStructTypeDeclaration> cStructDeclList = new ArrayList<CStructTypeDeclaration>();
- HashMap<String, String> cStructInstTable = new HashMap<String, String>();
-
- List<Token> nexTokens = new ArrayList<Token> ();
- List<Token> exTokens = new ArrayList<Token> ();
-
- getNonExAndExTokens (alTokens, nexTokens, exTokens);
-
- //
- // We have to process Non-Ex type PCD entry first. The reason is
- // that our optimization assumes that the Token Number of Non-Ex
- // PCD entry start from 1 (for PEI phase) and grows continously upwards.
- //
- // EX type token number starts from the last Non-EX PCD entry and
- // grows continously upwards.
- //
- ProcessTokens (nexTokens, cStructDeclList, cStructInstTable, phase);
- ProcessTokens (exTokens, cStructDeclList, cStructInstTable, phase);
-
- stringTable.genCode(cStructDeclList, cStructInstTable);
- skuIdTable.genCode(cStructDeclList, cStructInstTable, phase);
- exMapTable.genCode(cStructDeclList, cStructInstTable, phase);
- localTokenNumberTable.genCode(cStructDeclList, cStructInstTable, phase);
- sizeTable.genCode(cStructDeclList, cStructInstTable, phase);
- guidTable.genCode(cStructDeclList, cStructInstTable, phase);
-
- hString = genCMacroCode ();
-
- HashMap <String, String> result;
-
- result = genCStructCode(cStructDeclList,
- cStructInstTable,
- phase
- );
-
- hString += result.get("initDeclStr");
- hString += result.get("uninitDeclStr");
-
- hString += String.format("#define PCD_%s_SERVICE_DRIVER_AUTOGEN_VERSION %d", phase, version);
-
- cString = newLine + newLine + result.get("initInstStr");
-
- }
-
- private String genCMacroCode () {
- String macroStr = "";
-
- //
- // Generate size info Macro for all Tables
- //
- macroStr += guidTable.getSizeMacro();
- macroStr += stringTable.getSizeMacro();
- macroStr += skuIdTable.getSizeMacro();
- macroStr += localTokenNumberTable.getSizeMacro();
- macroStr += exMapTable.getSizeMacro();
- macroStr += sizeTable.getSizeMacro();
-
- //
- // Generate existance info Macro for all Tables
- //
- macroStr += guidTable.getExistanceMacro();
- macroStr += stringTable.getExistanceMacro();
- macroStr += skuIdTable.getExistanceMacro();
- macroStr += localTokenNumberTable.getExistanceMacro();
- macroStr += exMapTable.getExistanceMacro();
-
- macroStr += newLine;
-
- return macroStr;
- }
-
- private HashMap <String, String> genCStructCode(
- ArrayList<CStructTypeDeclaration> declaList,
- HashMap<String, String> instTable,
- String phase
- ) {
-
- int i;
- HashMap <String, String> result = new HashMap<String, String>();
- HashMap <Integer, ArrayList<String>> alignmentInitDecl = new HashMap<Integer, ArrayList<String>>();
- HashMap <Integer, ArrayList<String>> alignmentUninitDecl = new HashMap<Integer, ArrayList<String>>();
- HashMap <Integer, ArrayList<String>> alignmentInitInst = new HashMap<Integer, ArrayList<String>>();
-
- //
- // Initialize the storage for each alignment
- //
- for (i = 8; i > 0; i>>=1) {
- alignmentInitDecl.put(new Integer(i), new ArrayList<String>());
- alignmentInitInst.put(new Integer(i), new ArrayList<String>());
- alignmentUninitDecl.put(new Integer(i), new ArrayList<String>());
- }
-
- String initDeclStr = "typedef struct {" + newLine;
- String initInstStr = String.format("%s_PCD_DATABASE_INIT g%sPcdDbInit = { ", phase.toUpperCase(), phase.toUpperCase()) + newLine;
- String uninitDeclStr = "typedef struct {" + newLine;
-
- //
- // Sort all C declaration and instantiation base on Alignment Size
- //
- for (Object d : declaList) {
- CStructTypeDeclaration decl = (CStructTypeDeclaration) d;
-
- if (decl.initTable) {
- alignmentInitDecl.get(new Integer(decl.alignmentSize)).add(decl.cCode);
- alignmentInitInst.get(new Integer(decl.alignmentSize)).add(instTable.get(decl.key));
- } else {
- alignmentUninitDecl.get(new Integer(decl.alignmentSize)).add(decl.cCode);
- }
- }
-
- //
- // Generate code for every alignment size
- //
- boolean uinitDatabaseEmpty = true;
- for (int align = 8; align > 0; align >>= 1) {
- ArrayList<String> declaListBasedOnAlignment = alignmentInitDecl.get(new Integer(align));
- ArrayList<String> instListBasedOnAlignment = alignmentInitInst.get(new Integer(align));
- for (i = 0; i < declaListBasedOnAlignment.size(); i++) {
- initDeclStr += tab + declaListBasedOnAlignment.get(i);
- initInstStr += tab + instListBasedOnAlignment.get(i);
-
- //
- // We made a assumption that both PEI_PCD_DATABASE and DXE_PCD_DATABASE
- // has a least one data memember with alignment size of 1. So we can
- // remove the last "," in the C structure instantiation string. Luckily,
- // this is true as both data structure has SKUID_TABLE anyway.
- //
- if ((align == 1) && (i == declaListBasedOnAlignment.size() - 1)) {
- initInstStr += newLine;
- } else {
- initInstStr += commaNewLine;
- }
- }
-
- declaListBasedOnAlignment = alignmentUninitDecl.get(new Integer(align));
-
- if (declaListBasedOnAlignment.size() != 0) {
- uinitDatabaseEmpty = false;
- }
-
- for (Object d : declaListBasedOnAlignment) {
- String s = (String)d;
- uninitDeclStr += tab + s;
- }
- }
-
- if (uinitDatabaseEmpty) {
- uninitDeclStr += tab + String.format("%-20sdummy; /* PCD_DATABASE_UNINIT is emptry */\r\n", "UINT8");
- }
-
- initDeclStr += String.format("} %s_PCD_DATABASE_INIT;", phase) + newLine + newLine;
- initInstStr += "};" + newLine;
- uninitDeclStr += String.format("} %s_PCD_DATABASE_UNINIT;", phase) + newLine + newLine;
-
- result.put("initDeclStr", initDeclStr);
- result.put("initInstStr", initInstStr);
- result.put("uninitDeclStr", uninitDeclStr);
-
- return result;
- }
-
- public static String genInstantiationStr (ArrayList<String> alStr) {
- String str = "";
- for (int i = 0; i< alStr.size(); i++) {
- if (i != 0) {
- str += "\t";
- }
- str += alStr.get(i);
- if (i != alStr.size() - 1) {
- str += "\r\n";
- }
- }
-
- return str;
- }
-
- private String getSkuEnabledTypeDeclaration (Token token) {
- return String.format("%-20s%s;\r\n", "SKU_HEAD", token.getPrimaryKeyString());
- }
-
- private String getSkuEnabledTypeInstantiaion (Token token, int SkuTableIdx) {
-
- String offsetof = String.format(PcdDatabase.offsetOfSkuHeadStrTemplate, phase, token.hasDefaultValue()? "Init" : "Uninit", token.getPrimaryKeyString());
- return String.format("{ %s, %d } /* SKU_ENABLED: %s */", offsetof, SkuTableIdx, token.getPrimaryKeyString());
- }
-
- private String getDataTypeInstantiationForVariableDefault (Token token, String cName, int skuId) {
- return String.format("%s /* %s */", token.skuData.get(skuId).value.hiiDefaultValue, cName);
- }
-
- private String getCType (Token t)
- throws EntityException {
-
- if (t.isHiiEnable()) {
- return "VARIABLE_HEAD";
- }
-
- if (t.isVpdEnable()) {
- return "VPD_HEAD";
- }
-
- if (t.isUnicodeStringType()) {
- return "STRING_HEAD";
- }
-
- switch (t.datumType) {
- case UINT64:
- return "UINT64";
- case UINT32:
- return "UINT32";
- case UINT16:
- return "UINT16";
- case UINT8:
- return "UINT8";
- case BOOLEAN:
- return "BOOLEAN";
- case POINTER:
- return "UINT8";
- default:
- throw new EntityException("Unknown DatumType in getDataTypeCDeclaration");
- }
- }
-
- //
- // privateGlobalName and privateGlobalCCode is used to pass output to caller of getCDeclarationString
- //
- private void getCDeclarationString(Token t)
- throws EntityException {
-
- if (t.isSkuEnable()) {
- privateGlobalName = String.format("%s_%s", t.getPrimaryKeyString(), skuDataTableTemplate);
- } else {
- privateGlobalName = t.getPrimaryKeyString();
- }
-
- String type = getCType(t);
- if ((t.datumType == Token.DATUM_TYPE.POINTER) && (!t.isHiiEnable()) && (!t.isUnicodeStringType())) {
- int bufferSize;
- if (t.isASCIIStringType()) {
- //
- // Build tool will add a NULL string at the end of the ASCII string
- //
- bufferSize = t.datumSize + 1;
- } else {
- bufferSize = t.datumSize;
- }
- privateGlobalCCode = String.format("%-20s%s[%d][%d];\r\n", type, privateGlobalName, t.getSkuIdCount(), bufferSize);
- } else {
- privateGlobalCCode = String.format("%-20s%s[%d];\r\n", type, privateGlobalName, t.getSkuIdCount());
- }
- }
-
- private String getDataTypeDeclarationForVariableDefault (Token token, String cName, int skuId)
- throws EntityException {
-
- String typeStr;
-
- if (token.datumType == Token.DATUM_TYPE.UINT8) {
- typeStr = "UINT8";
- } else if (token.datumType == Token.DATUM_TYPE.UINT16) {
- typeStr = "UINT16";
- } else if (token.datumType == Token.DATUM_TYPE.UINT32) {
- typeStr = "UINT32";
- } else if (token.datumType == Token.DATUM_TYPE.UINT64) {
- typeStr = "UINT64";
- } else if (token.datumType == Token.DATUM_TYPE.BOOLEAN) {
- typeStr = "BOOLEAN";
- } else if (token.datumType == Token.DATUM_TYPE.POINTER) {
- int size;
- if (token.isHiiDefaultValueUnicodeStringType()) {
- typeStr = "UINT16";
- //
- // Include the NULL charactor
- //
- size = token.datumSize / 2 + 1;
- } else {
- typeStr = "UINT8";
- if (token.isHiiDefaultValueASCIIStringType()) {
- //
- // Include the NULL charactor
- //
- size = token.datumSize + 1;
- } else {
- size = token.datumSize;
- }
- }
- return String.format("%-20s%s[%d];\r\n", typeStr, cName, size);
- } else {
- throw new EntityException("Unknown DATUM_TYPE type in when generating code for VARIABLE_ENABLED PCD entry");
- }
-
- return String.format("%-20s%s;\r\n", typeStr, cName);
- }
-
- private String getTypeInstantiation (Token t, ArrayList<CStructTypeDeclaration> declaList, HashMap<String, String> instTable, String phase) throws EntityException {
-
- int i;
-
- String s;
- s = String.format("/* %s */", t.getPrimaryKeyString()) + newLine;
- s += tab + "{" + newLine;
-
- for (i = 0; i < t.skuData.size(); i++) {
- if (t.isUnicodeStringType()) {
- s += tab + tab + String.format(" %d ", stringTable.add(t.skuData.get(i).value.value, t));
- } else if (t.isHiiEnable()) {
- /* VPD_HEAD definition
- typedef struct {
- UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.
- UINT16 StringIndex; // Offset in String Table in units of UINT16.
- UINT16 Offset; // Offset in Variable
- UINT16 DefaultValueOffset; // Offset of the Default Value
- } VARIABLE_HEAD ;
- */
- String variableDefaultName = String.format("%s_VariableDefault_%d", t.getPrimaryKeyString(), i);
-
- s += tab + tab + String.format("{ %d, %d, %s, %s }", guidTable.add(t.skuData.get(i).value.variableGuid, t.getPrimaryKeyString()),
- stringTable.add(t.skuData.get(i).value.getStringOfVariableName(), t),
- t.skuData.get(i).value.variableOffset,
- String.format("offsetof(%s_PCD_DATABASE, Init.%s)", phase, variableDefaultName)
- );
- //
- // We need to support the default value, so we add the declaration and
- // the instantiation for the default value.
- //
- CStructTypeDeclaration decl = new CStructTypeDeclaration (variableDefaultName,
- getHiiPtrTypeAlignmentSize(t),
- getDataTypeDeclarationForVariableDefault(t, variableDefaultName, i),
- true
- );
- declaList.add(decl);
- instTable.put(variableDefaultName, getDataTypeInstantiationForVariableDefault (t, variableDefaultName, i));
- } else if (t.isVpdEnable()) {
- /* typedef struct {
- UINT32 Offset;
- } VPD_HEAD;
- */
- s += tab + tab + String.format("{ %s }", t.skuData.get(i).value.vpdOffset);
- } else {
- if (t.isByteStreamType()) {
- //
- // Byte stream type input has their own "{" "}", so we won't help to insert.
- //
- s += tab + tab + String.format(" %s ", t.skuData.get(i).value.value);
- } else {
- s += tab + tab + String.format("{ %s }", t.skuData.get(i).value.value);
- }
- }
-
- if (i != t.skuData.size() - 1) {
- s += commaNewLine;
- } else {
- s += newLine;
- }
-
- }
-
- s += tab + "}";
-
- return s;
- }
-
- public static String getPcdDatabaseCommonDefinitions () {
-
- String retStr;
-
- retStr = "//\r\n";
- retStr += "// The following definition will be generated by build tool\r\n";
- retStr += "//\r\n";
- retStr += "\r\n";
- retStr += "//\r\n";
- retStr += "// Common definitions\r\n";
- retStr += "//\r\n";
- retStr += "typedef UINT8 SKU_ID;\r\n";
- retStr += "\r\n";
- retStr += "#define PCD_TYPE_SHIFT 28\r\n";
- retStr += "\r\n";
- retStr += "#define PCD_TYPE_DATA (0x0 << PCD_TYPE_SHIFT)\r\n";
- retStr += "#define PCD_TYPE_HII (0x8 << PCD_TYPE_SHIFT)\r\n";
- retStr += "#define PCD_TYPE_VPD (0x4 << PCD_TYPE_SHIFT)\r\n";
- retStr += "#define PCD_TYPE_SKU_ENABLED (0x2 << PCD_TYPE_SHIFT)\r\n";
- retStr += "#define PCD_TYPE_STRING (0x1 << PCD_TYPE_SHIFT)\r\n";
- retStr += "\r\n";
- retStr += "#define PCD_TYPE_ALL_SET (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED | PCD_TYPE_STRING)\r\n";
- retStr += "\r\n";
- retStr += "#define PCD_DATUM_TYPE_SHIFT 24\r\n";
- retStr += "\r\n";
- retStr += "#define PCD_DATUM_TYPE_POINTER (0x0 << PCD_DATUM_TYPE_SHIFT)\r\n";
- retStr += "#define PCD_DATUM_TYPE_UINT8 (0x1 << PCD_DATUM_TYPE_SHIFT)\r\n";
- retStr += "#define PCD_DATUM_TYPE_UINT16 (0x2 << PCD_DATUM_TYPE_SHIFT)\r\n";
- retStr += "#define PCD_DATUM_TYPE_UINT32 (0x4 << PCD_DATUM_TYPE_SHIFT)\r\n";
- retStr += "#define PCD_DATUM_TYPE_UINT64 (0x8 << PCD_DATUM_TYPE_SHIFT)\r\n";
- retStr += "\r\n";
- retStr += "#define PCD_DATUM_TYPE_ALL_SET (PCD_DATUM_TYPE_POINTER | \\\r\n";
- retStr += " PCD_DATUM_TYPE_UINT8 | \\\r\n";
- retStr += " PCD_DATUM_TYPE_UINT16 | \\\r\n";
- retStr += " PCD_DATUM_TYPE_UINT32 | \\\r\n";
- retStr += " PCD_DATUM_TYPE_UINT64)\r\n";
- retStr += "\r\n";
- retStr += "\r\n";
- retStr += "#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET | PCD_DATUM_TYPE_ALL_SET))\r\n";
- retStr += "\r\n";
- retStr += "typedef struct {\r\n";
- retStr += " UINT32 ExTokenNumber;\r\n";
- retStr += " UINT16 LocalTokenNumber; // PCD Number of this particular platform build\r\n";
- retStr += " UINT16 ExGuidIndex; // Index of GuidTable\r\n";
- retStr += "} DYNAMICEX_MAPPING;\r\n";
- retStr += "\r\n";
- retStr += "\r\n";
- retStr += "typedef struct {\r\n";
- retStr += " UINT32 SkuDataStartOffset; //We have to use offsetof MACRO as we don't know padding done by compiler\r\n";
- retStr += " UINT32 SkuIdTableOffset; //Offset from the PCD_DB\r\n";
- retStr += "} SKU_HEAD;\r\n";
- retStr += "\r\n";
- retStr += "\r\n";
- retStr += "typedef struct {\r\n";
- retStr += " UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.\r\n";
- retStr += " UINT16 StringIndex; // Offset in String Table in units of UINT16.\r\n";
- retStr += " UINT16 Offset; // Offset in Variable\r\n";
- retStr += " UINT16 DefaultValueOffset; // Offset of the Default Value\r\n";
- retStr += "} VARIABLE_HEAD ;\r\n";
- retStr += "\r\n";
- retStr += "\r\n";
- retStr += "typedef struct {\r\n";
- retStr += " UINT32 Offset;\r\n";
- retStr += "} VPD_HEAD;\r\n";
- retStr += "\r\n";
- retStr += "typedef UINT16 STRING_HEAD;\r\n";
- retStr += "\r\n";
- retStr += "typedef UINT16 SIZE_INFO;\r\n";
- retStr += "\r\n";
- retStr += "#define offsetof(s,m) (UINT32) (UINTN) &(((s *)0)->m)\r\n";
- retStr += "\r\n";
- retStr += "\r\n";
- retStr += "\r\n";
-
- return retStr;
- }
-
- public static String getPcdDxeDatabaseDefinitions ()
- throws EntityException {
-
- String retStr = "";
-
- retStr += "\r\n";
- retStr += "typedef struct {\r\n";
- retStr += " DXE_PCD_DATABASE_INIT Init;\r\n";
- retStr += " DXE_PCD_DATABASE_UNINIT Uninit;\r\n";
- retStr += "} DXE_PCD_DATABASE;\r\n";
- retStr += "\r\n";
- retStr += "\r\n";
- retStr += "typedef struct {\r\n";
- retStr += " PEI_PCD_DATABASE PeiDb;\r\n";
- retStr += " DXE_PCD_DATABASE DxeDb;\r\n";
- retStr += "} PCD_DATABASE;\r\n";
- retStr += "\r\n";
- retStr += "#define DXE_NEX_TOKEN_NUMBER (DXE_LOCAL_TOKEN_NUMBER - DXE_EX_TOKEN_NUMBER)\r\n";
- retStr += "\r\n";
- retStr += "#define PCD_TOTAL_TOKEN_NUMBER (PEI_LOCAL_TOKEN_NUMBER + DXE_LOCAL_TOKEN_NUMBER)\r\n";
- retStr += "\r\n";
- retStr += "\r\n";
-
- return retStr;
- }
-
- public static String getPcdPeiDatabaseDefinitions ()
- throws EntityException {
-
- String retStr = "";
-
- retStr += "\r\n";
- retStr += "typedef struct {\r\n";
- retStr += " PEI_PCD_DATABASE_INIT Init;\r\n";
- retStr += " PEI_PCD_DATABASE_UNINIT Uninit;\r\n";
- retStr += "} PEI_PCD_DATABASE;\r\n";
- retStr += "\r\n";
- retStr += "#define PEI_NEX_TOKEN_NUMBER (PEI_LOCAL_TOKEN_NUMBER - PEI_EX_TOKEN_NUMBER)\r\n";
- retStr += "\r\n";
-
- return retStr;
- }
-
- /**
- Translate the schema string to UUID instance.
-
- In schema, the string of UUID is defined as following two types string:
- 1) GuidArrayType: pattern = 0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},(
- )*0x[a-fA-F0-9]{1,4}(,( )*\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\})?
-
- 2) GuidNamingConvention: pattern =
- [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}
-
- This function will convert string and create uuid instance.
-
- @param uuidString UUID string in XML file
-
- @return UUID UUID instance
- **/
- private UUID translateSchemaStringToUUID(String uuidString)
- throws EntityException {
- String temp;
- String[] splitStringArray;
- int index;
- int chIndex;
- int chLen;
-
- if (uuidString == null) {
- return null;
- }
-
- if (uuidString.length() == 0) {
- return null;
- }
-
- if (uuidString.equals("0") ||
- uuidString.equalsIgnoreCase("0x0")) {
- return new UUID(0, 0);
- }
-
- uuidString = uuidString.replaceAll("\\{", "");
- uuidString = uuidString.replaceAll("\\}", "");
-
- //
- // If the UUID schema string is GuidArrayType type then need translate
- // to GuidNamingConvention type at first.
- //
- if ((uuidString.charAt(0) == '0') && ((uuidString.charAt(1) == 'x') || (uuidString.charAt(1) == 'X'))) {
- splitStringArray = uuidString.split("," );
- if (splitStringArray.length != 11) {
- throw new EntityException ("[FPD file error] Wrong format for GUID string: " + uuidString);
- }
-
- //
- // Remove blank space from these string and remove header string "0x"
- //
- for (index = 0; index < 11; index ++) {
- splitStringArray[index] = splitStringArray[index].trim();
- splitStringArray[index] = splitStringArray[index].substring(2, splitStringArray[index].length());
- }
-
- //
- // Add heading '0' to normalize the string length
- //
- for (index = 3; index < 11; index ++) {
- chLen = splitStringArray[index].length();
- for (chIndex = 0; chIndex < 2 - chLen; chIndex ++) {
- splitStringArray[index] = "0" + splitStringArray[index];
- }
- }
-
- //
- // construct the final GuidNamingConvention string
- //
- temp = String.format("%s-%s-%s-%s%s-%s%s%s%s%s%s",
- splitStringArray[0],
- splitStringArray[1],
- splitStringArray[2],
- splitStringArray[3],
- splitStringArray[4],
- splitStringArray[5],
- splitStringArray[6],
- splitStringArray[7],
- splitStringArray[8],
- splitStringArray[9],
- splitStringArray[10]);
- uuidString = temp;
- }
-
- return UUID.fromString(uuidString);
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PlatformPcdPreprocessActionForBuilding.java b/Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PlatformPcdPreprocessActionForBuilding.java
deleted file mode 100644
index 234fbff5fa..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/pcd/action/PlatformPcdPreprocessActionForBuilding.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/** @file
- PlatformPcdPreprocessActionForBuilding class.
-
- This action class is to collect PCD information from MSA, SPD, FPD xml file.
- This class will be used for wizard and build tools, So it can *not* inherit
- from buildAction or wizardAction.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.pcd.action;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;
-import org.tianocore.PcdBuildDefinitionDocument;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.id.FpdModuleIdentification;
-import org.tianocore.pcd.action.PlatformPcdPreprocessAction;
-import org.tianocore.pcd.entity.MemoryDatabaseManager;
-import org.tianocore.pcd.entity.ModulePcdInfoFromFpd;
-import org.tianocore.pcd.entity.Token;
-import org.tianocore.pcd.entity.UsageIdentification;
-import org.tianocore.pcd.exception.EntityException;
-import org.tianocore.pcd.exception.PlatformPcdPreprocessException;
-
-/**
- This action class is to collect PCD information from MSA, SPD, FPD xml file.
- This class will be used for wizard and build tools, So it can *not* inherit
- from buildAction or UIAction.
-**/
-public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreprocessAction {
- ///
- /// FPD file path.
- ///
- private String fpdFilePath;
-
- ///
- /// Cache the fpd docment instance for private usage.
- ///
- private PlatformSurfaceAreaDocument fpdDocInstance;
-
- /**
- Set FPDFileName parameter for this action class.
-
- @param fpdFilePath fpd file path
- **/
- public void setFPDFilePath(String fpdFilePath) {
- this.fpdFilePath = fpdFilePath;
- }
-
- /**
- Common function interface for outer.
-
- @param fpdFilePath The fpd file path of current build or processing.
-
- @throws PlatformPreprocessBuildException
- The exception of this function. Because it can *not* be predict
- where the action class will be used. So only Exception can be throw.
-
- **/
- public void perform(String fpdFilePath)
- throws PlatformPcdPreprocessBuildException {
- this.fpdFilePath = fpdFilePath;
- checkParameter();
- execute();
- }
-
- /**
- Core execution function for this action class.
-
- This function work flows will be:
- 1) Collect and prepocess PCD information from FPD file, all PCD
- information will be stored into memory database.
- 2) Generate 3 strings for
- a) All modules using Dynamic(Ex) PCD entry.(Token Number)
- b) PEI PCDDatabase (C Structure) for PCD Service PEIM.
- c) DXE PCD Database (C structure) for PCD Service DXE.
-
-
- @throws EntityException Exception indicate failed to execute this action.
-
- **/
- public void execute() throws PlatformPcdPreprocessBuildException {
- String errorMessageHeader = "Failed to initialize the Pcd memory database because: ";
- String errorsForPreprocess = null;
-
- //
- // Get memoryDatabaseManager instance from GlobalData.
- // The memoryDatabaseManager should be initialized as static variable
- // in some Pre-process class.
- //
- setPcdDbManager(GlobalData.getPCDMemoryDBManager());
-
- //
- // Collect all PCD information defined in FPD file.
- // Evenry token defind in FPD will be created as an token into
- // memory database.
- //
- try {
- initPcdMemoryDbWithPlatformInfo();
- } catch (PlatformPcdPreprocessException exp) {
- throw new PlatformPcdPreprocessBuildException(errorMessageHeader + exp.getMessage());
- }
- errorsForPreprocess = this.getErrorString();
- if (errorsForPreprocess != null) {
- throw new PlatformPcdPreprocessBuildException(errorMessageHeader + "\r\n" + errorsForPreprocess);
- }
-
- //
- // Generate for PEI, DXE PCD DATABASE's definition and initialization.
- //
- try {
- genPcdDatabaseSourceCode ();
- } catch (EntityException exp) {
- throw new PlatformPcdPreprocessBuildException(errorMessageHeader + "\r\n" + exp.getMessage());
- }
- }
-
- /**
- Override function: implementate the method of get Guid string information from SPD file.
-
- @param guidCName Guid CName string.
-
- @return String Guid information from SPD file.
- **/
- public String getGuidInfoFromSpd(String guidCName) {
- return GlobalData.getGuidInfoFromCname(guidCName);
- }
-
- /**
- This function generates source code for PCD Database.
-
- @throws EntityException If the token does *not* exist in memory database.
-
- **/
- private void genPcdDatabaseSourceCode()
- throws EntityException {
- String PcdCommonHeaderString = PcdDatabase.getPcdDatabaseCommonDefinitions();
-
- ArrayList<Token> alPei = new ArrayList<Token> ();
- ArrayList<Token> alDxe = new ArrayList<Token> ();
-
- getPcdDbManager().getTwoPhaseDynamicRecordArray(alPei, alDxe);
- PcdDatabase pcdPeiDatabase = new PcdDatabase (alPei, "PEI", 0);
- pcdPeiDatabase.genCode();
- MemoryDatabaseManager.PcdPeimHString = PcdCommonHeaderString + pcdPeiDatabase.getHString() +
- PcdDatabase.getPcdPeiDatabaseDefinitions();
- MemoryDatabaseManager.PcdPeimCString = pcdPeiDatabase.getCString();
-
- PcdDatabase pcdDxeDatabase = new PcdDatabase(alDxe, "DXE", alPei.size());
- pcdDxeDatabase.genCode();
- MemoryDatabaseManager.PcdDxeHString = MemoryDatabaseManager.PcdPeimHString + pcdDxeDatabase.getHString() +
- PcdDatabase.getPcdDxeDatabaseDefinitions();
- MemoryDatabaseManager.PcdDxeCString = pcdDxeDatabase.getCString();
- }
-
- /**
- Override function: Get component array from FPD.
-
- This function maybe provided by some Global class.
-
- @return List<ModuleInfo> the component array.
- @throws PlatformPcdPreprocessException get all modules in <ModuleSA> in FPD file.
-
- **/
- public List<ModulePcdInfoFromFpd> getComponentsFromFpd()
- throws PlatformPcdPreprocessException {
- List<ModulePcdInfoFromFpd> allModules = new ArrayList<ModulePcdInfoFromFpd>();
- Map<FpdModuleIdentification, XmlObject> pcdBuildDefinitions = null;
- UsageIdentification usageId = null;
-
- pcdBuildDefinitions = GlobalData.getFpdPcdBuildDefinitions();
- if (pcdBuildDefinitions == null) {
- return null;
- }
-
- //
- // Loop map to retrieve all PCD build definition and Module id
- //
- Iterator item = pcdBuildDefinitions.keySet().iterator();
- while (item.hasNext()){
- FpdModuleIdentification id = (FpdModuleIdentification) item.next();
- usageId = new UsageIdentification(id.getModule().getName(),
- id.getModule().getGuid(),
- id.getModule().getPackage().getName(),
- id.getModule().getPackage().getGuid(),
- id.getArch(),
- id.getModule().getVersion(),
- id.getModule().getModuleType());
- allModules.add(
- new ModulePcdInfoFromFpd(
- usageId,
- ((PcdBuildDefinitionDocument)pcdBuildDefinitions.get(id)).getPcdBuildDefinition()));
- }
- return allModules;
- }
-
- /**
- Override function: Verify the datum value according its datum size and datum type, this
- function maybe moved to FPD verification tools in future.
-
- @param cName The token name
- @param moduleName The module who use this PCD token
- @param datum The PCD's datum
- @param datumType The PCD's datum type
- @param maxDatumSize The max size for PCD's Datum.
-
- @return String exception strings.
- */
- public String verifyDatum(String cName,
- String moduleName,
- String datum,
- Token.DATUM_TYPE datumType,
- int maxDatumSize) {
- //
- // In building system, datum should not be checked, the checking work
- // should be done by wizard tools or PCD verification tools.
- //
- return null;
- }
-
- /**
- Override function: Get dynamic information for a dynamic PCD from <DynamicPcdBuildDefinition> seciton in FPD file.
-
- This function should be implemented in GlobalData in future.
-
- @param token The token instance which has hold module's PCD information
- @param moduleName The name of module who will use this Dynamic PCD.
-
- @return DynamicPcdBuildDefinitions.PcdBuildData
- **/
- public DynamicPcdBuildDefinitions.PcdBuildData getDynamicInfoFromFpd(Token token,
- String moduleName)
- throws PlatformPcdPreprocessException {
- int index = 0;
- String exceptionString = null;
- String dynamicPrimaryKey = null;
- DynamicPcdBuildDefinitions dynamicPcdBuildDefinitions = null;
- List<DynamicPcdBuildDefinitions.PcdBuildData> dynamicPcdBuildDataArray = null;
- String tokenSpaceStrRet = null;
-
- //
- // If FPD document is not be opened, open and initialize it.
- // BUGBUG: The code should be moved into GlobalData in future.
- //
- if (fpdDocInstance == null) {
- try {
- fpdDocInstance = (PlatformSurfaceAreaDocument)XmlObject.Factory.parse(new File(fpdFilePath));
- } catch(IOException ioE) {
- throw new PlatformPcdPreprocessException("File IO error for xml file:" + fpdFilePath + "\n" + ioE.getMessage());
- } catch(XmlException xmlE) {
- throw new PlatformPcdPreprocessException("Can't parse the FPD xml fle:" + fpdFilePath + "\n" + xmlE.getMessage());
- }
- }
-
- dynamicPcdBuildDefinitions = fpdDocInstance.getPlatformSurfaceArea().getDynamicPcdBuildDefinitions();
- if (dynamicPcdBuildDefinitions == null) {
- exceptionString = String.format("[FPD file error] There are no <PcdDynamicBuildDescriptions> elements in FPD file but there are Dynamic type "+
- "PCD entries %s in module %s!",
- token.cName,
- moduleName);
- putError(exceptionString);
- return null;
- }
-
- dynamicPcdBuildDataArray = dynamicPcdBuildDefinitions.getPcdBuildDataList();
- for (index = 0; index < dynamicPcdBuildDataArray.size(); index ++) {
- tokenSpaceStrRet = getGuidInfoFromSpd(dynamicPcdBuildDataArray.get(index).getTokenSpaceGuidCName());
-
- if (tokenSpaceStrRet == null) {
- exceptionString = "Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName();
- putError(exceptionString);
- continue;
- }
-
- dynamicPrimaryKey = Token.getPrimaryKeyString(dynamicPcdBuildDataArray.get(index).getCName(),
- tokenSpaceStrRet);
- if (dynamicPrimaryKey.equals(token.getPrimaryKeyString())) {
- return dynamicPcdBuildDataArray.get(index);
- }
- }
-
- return null;
- }
-
- /**
- Override function: get all <DynamicPcdBuildDefinition> from FPD file.
-
- @return List<DynamicPcdBuildDefinitions.PcdBuildData> All DYNAMIC PCD list in <DynamicPcdBuildDefinitions> in FPD file.
- @throws PlatformPcdPreprocessBuildException Failure to get dynamic information list.
-
- **/
- public List<DynamicPcdBuildDefinitions.PcdBuildData>
- getAllDynamicPcdInfoFromFpd()
- throws PlatformPcdPreprocessException {
- DynamicPcdBuildDefinitions dynamicPcdBuildDefinitions = null;
-
- //
- // Open fpd document to get <DynamicPcdBuildDefinition> Section.
- // BUGBUG: the function should be move GlobalData in furture.
- //
- if (fpdDocInstance == null) {
- try {
- fpdDocInstance = (PlatformSurfaceAreaDocument)XmlObject.Factory.parse(new File(fpdFilePath));
- } catch(IOException ioE) {
- throw new PlatformPcdPreprocessException("File IO error for xml file:" + fpdFilePath + "\n" + ioE.getMessage());
- } catch(XmlException xmlE) {
- throw new PlatformPcdPreprocessException("Can't parse the FPD xml fle:" + fpdFilePath + "\n" + xmlE.getMessage());
- }
- }
-
- dynamicPcdBuildDefinitions = fpdDocInstance.getPlatformSurfaceArea().getDynamicPcdBuildDefinitions();
- if (dynamicPcdBuildDefinitions == null) {
- return null;
- }
-
- return dynamicPcdBuildDefinitions.getPcdBuildDataList();
- }
-
- /**
- check parameter for this action.
-
- @throws PlatformPcdPreprocessBuildException Bad parameter.
- **/
- private void checkParameter() throws PlatformPcdPreprocessBuildException {
- File file = null;
-
- if (fpdFilePath == null) {
- throw new PlatformPcdPreprocessBuildException("FPDFileName should be empty for CollectPCDAtion!");
- }
-
- if (fpdFilePath.length() == 0) {
- throw new PlatformPcdPreprocessBuildException("FPDFileName should be empty for CollectPCDAtion!");
- }
-
- file = new File(fpdFilePath);
-
- if(!file.exists()) {
- throw new PlatformPcdPreprocessBuildException("FPD File " + fpdFilePath + " does not exist!");
- }
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ConfigReader.java b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ConfigReader.java
deleted file mode 100644
index 4275f8eb78..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ConfigReader.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/** @file
- ConfigReader class.
-
- ConfigReader is used to read tool chain config file with flat format.
-
-Copyright (c) 2006, 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.
-**/
-package org.tianocore.build.toolchain;
-
-import org.apache.tools.ant.Project;
-
-import org.tianocore.build.exception.GenBuildException;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
-
- ConfigReader is used to read tool chain config file with flat format. Comments
- is line starting with character '#'.
-
- @since GenBuild 1.0
-**/
-public class ConfigReader {
-
- /**
- Parse specified tool chain definition file.
-
- @param filename The config file name with full path
-
- @return String[][] The definition array
- **/
- public static synchronized String[][] parse(Project prj, String filename) throws GenBuildException {
- return parse(prj, new File(filename));
- }
-
- /**
- Get all definitions in config file. the config file format is flat
- with "A=B". If line started with '#' looks as comments.
-
- @param configFile The config file
-
- @return String[][] The variables defined in the config file
-
- @throws GenBuildException
- Config file's format is not valid
- **/
- public static synchronized String[][] parse(Project prj, File configFile) throws GenBuildException {
- List<String> keyList = new ArrayList<String>(256);
- List<String> valueList = new ArrayList<String>(256);
- int lines = 0;
-
- try {
- FileReader reader = new FileReader(configFile);
- BufferedReader in = new BufferedReader(reader);
- String str;
-
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with '#')
- //
- if (str.length() == 0 || str.startsWith("#")) {
- continue;
- }
-
- //
- // stop if the definition line is not in "name=value" form
- //
- int index;
- if ((index = str.indexOf('=')) <= 0) {
- throw new GenBuildException("ERROR Processing file ["
- + configFile.getAbsolutePath()
- + "] (line " + lines + ").\n");
- }
-
- //
- // look as line "A = B"
- //
- keyList.add(str.substring(0, index).trim());
- if (prj != null) {
- valueList.add(prj.replaceProperties(str.substring(index + 1).trim()));
- } else {
- valueList.add(str.substring(index + 1).trim());
- }
- }
- } catch (Exception ex) {
- GenBuildException e = new GenBuildException("ERROR Processing file ["
- + configFile.getAbsolutePath()
- + "] (line " + lines + ").\n" + ex.getMessage());
- e.setStackTrace(ex.getStackTrace());
- throw e;
- }
-
- String[][] definitions = new String[2][keyList.size()];
- definitions[0] = (String[])keyList.toArray(definitions[0]);
- definitions[1] = (String[])valueList.toArray(definitions[1]);
-
- return definitions;
- }
-}
-
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java
deleted file mode 100644
index 9989ab65f8..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/** @file
- ToolChainConfig class.
-
- ToolChainConfig class parse all config files and get tool chain information.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.toolchain;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.tools.ant.Project;
-import org.tianocore.build.exception.GenBuildException;
-import org.tianocore.build.toolchain.ToolChainKey;
-import org.tianocore.build.toolchain.ToolChainMap;
-
-
-/**
-
- ToolChainConfig class parse all config files and get tool chain information.
-
- **/
-public class ToolChainConfig {
- //
- // tool chain definitions
- //
- private ToolChainMap config = null;
- //
- // tool chain information (how many targets, archs, etc.)
- //
- private ToolChainInfo info = new ToolChainInfo();
-
- /**
- Public construct method.
-
- @param toolChainFile File object representing the tool chain configuration file
- **/
- public ToolChainConfig (Project prj, File toolChainFile) throws GenBuildException {
- config = getToolChainConfig(prj, toolChainFile);
- parseToolChainDefKey(config.keySet());
- }
-
- /**
- Read tool chain definitions from specified file and put them in
- ToolChainMap class.
-
- @param ConfigFile The file containing tool chain definitions
-
- @return ToolChainMap
- **/
- private ToolChainMap getToolChainConfig(Project prj, File ConfigFile) throws GenBuildException {
- ToolChainMap map = new ToolChainMap();
- String[][] toolChainDef = ConfigReader.parse(prj, ConfigFile);
-
- for (int i = 0; i < toolChainDef[0].length; ++i) {
- map.put(toolChainDef[0][i], toolChainDef[1][i]);
- }
-
- return map;
- }
-
- /**
- Collect target, tool chain tag, arch and command information from key part
- of configuration
-
- @param toolChainDefKey The set of keys in tool chain configuration
- **/
- private void parseToolChainDefKey (Set<ToolChainKey> toolChainDefKey) {
- Iterator it = toolChainDefKey.iterator();
- while (it.hasNext()) {
- ToolChainKey key = (ToolChainKey)it.next();
- String[] keySet = key.getKeySet();
- info.addTargets(keySet[ToolChainElement.TARGET.value]);
- info.addTagnames(keySet[ToolChainElement.TOOLCHAIN.value]);
- info.addArchs(keySet[ToolChainElement.ARCH.value]);
- info.addCommands(keySet[ToolChainElement.TOOLCODE.value]);
- info.normalize();
- }
- }
-
- /**
- Return the tool chain configuration information in a Map form
-
- @return ToolChainMap Tool chain configurations in a ToolChainMap
- **/
- public ToolChainMap getConfig() {
- return config;
- }
-
- /**
- Return the tool chain's target, arch, tag and commands information
-
- @return ToolChainInfo Tool chain information summary
- **/
- public ToolChainInfo getConfigInfo() {
- return info;
- }
-
- /**
- override toString()
-
- @return String The converted configuration string in name=value form
- **/
- public String toString() {
- StringBuffer ts = new StringBuffer(10240);
-
- Iterator it = config.keySet().iterator();
- while (it.hasNext()) {
- ToolChainKey key = (ToolChainKey)it.next();
- ts.append(key.toString() + " = ");
- ts.append(config.get(key) + "\n");
- }
-
- return ts.toString();
- }
-}
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainElement.java b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainElement.java
deleted file mode 100644
index 103b3a6362..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainElement.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/** @file
-ToolChainElement class
-
-ToolChainElement class is defining enumeration value of key part names.
-
-Copyright (c) 2006, 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.
-**/
-
-package org.tianocore.build.toolchain;
-
-/**
-
- This class is an enumeration definition for key elements in tool chain definition
- file.
-
- **/
-public class ToolChainElement {
- private static int nextValue = 0;
-
- //
- // "TARGET", "TOOLCHAIN", "ARCH", "TOOLCODE", "ATTRIBUTE"
- //
- public final static ToolChainElement TARGET = new ToolChainElement("TARGET");
- public final static ToolChainElement TOOLCHAIN = new ToolChainElement("TOOLCHAIN");
- public final static ToolChainElement ARCH = new ToolChainElement("ARCH");
- public final static ToolChainElement TOOLCODE = new ToolChainElement("TOOLCODE");
- public final static ToolChainElement ATTRIBUTE = new ToolChainElement("ATTRIBUTE");
-
- private final String name;
- public final int value = nextValue++;
-
- /**
- * Default constructor
- */
- private ToolChainElement(String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-}
-
-
-
-
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainInfo.java b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainInfo.java
deleted file mode 100644
index 9952c0beda..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainInfo.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/** @file
-ToolChainInfo class
-
-This file is to define ToolChainInfo class.
-
-Copyright (c) 2006, 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.
-**/
-
-package org.tianocore.build.toolchain;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- ToolChainInfo collects valid build targets, tool chain tag, ARCHs and commands
- information for real build use.
- **/
-public class ToolChainInfo {
- //
- // build target set
- //
- private Set<String> targets = new LinkedHashSet<String>();
- //
- // tool chain tag name set
- //
- private Set<String> tagnames = new LinkedHashSet<String>();
- //
- // build archs set
- //
- private Set<String> archs = new LinkedHashSet<String>();
- //
- // build commands set
- //
- private Set<String> commands = new LinkedHashSet<String>();
-
- /**
- Add a list of targets in the form of string separated by space
-
- @param targetList target list string
- **/
- public void addTargets(String targetList) {
- //
- // targetList some targets separated by space " "
- //
- if (targetList == null || targetList.length() == 0) {
- targets.add("*");
- } else {
- addTargets(targetList.split(" "));
- }
- }
-
- /**
- Add a list of targets in the form of string array
-
- @param targetArray target string array
- **/
- public void addTargets(String[] targetArray) {
- if (targetArray != null ) {
- for (int i = 0; i < targetArray.length; i++) {
- targets.add(targetArray[i]);
- }
- }
- }
-
- /**
- Add a list of target in the form of set
-
- @param targetSet target string set
- **/
- public void addTargets(Set<String> targetSet) {
- if (targetSet != null) {
- targets.addAll(targetSet);
- }
- }
-
- /**
- Add a list of tool chain tag name in the form of string separated by space
-
- @param tagnameList Tool chain tag name list string
- **/
- public void addTagnames(String tagnameList) {
- //
- // tagnameList some tagnames separated by space " "
- //
- if (tagnameList == null || tagnameList.length() == 0) {
- tagnames.add("*");
- } else {
- addTagnames(tagnameList.split(" "));
- }
- }
-
- /**
- Add a list of tool chain tag name in the form of string array
-
- @param tagnameArray Tool chain tag names array
- **/
- public void addTagnames(String[] tagnameArray) {
- if (tagnameArray != null ) {
- for (int i = 0; i < tagnameArray.length; i++) {
- tagnames.add(tagnameArray[i]);
- }
- }
- }
-
- /**
- Add a list of tool chain tag name in the form of Set
-
- @param tagnameSet Tool chain tag names set
- **/
- public void addTagnames(Set<String> tagnameSet) {
- if (tagnameSet != null) {
- tagnames.addAll(tagnameSet);
- }
- }
-
- /**
- Add a list of ARCH in the form of string
-
- @param archList ARCH string
- **/
- public void addArchs(String archList) {
- //
- // archList some archs separated by space " "
- //
- if (archList == null || archList.length() == 0) {
- archs.add("*");
- } else {
- addArchs(archList.split(" "));
- }
- }
-
- /**
- Add a list of ARCH in the form of string array
-
- @param archArray ARCH array
- **/
- public void addArchs(String[] archArray) {
- if (archArray != null ) {
- for (int i = 0; i < archArray.length; i++) {
- archs.add(archArray[i]);
- }
- }
- }
-
- /**
- Add a list of ARCH in the form of set
-
- @param archSet ARCH set
- **/
- public void addArchs(Set<String> archSet) {
- if (archSet != null) {
- archs.addAll(archSet);
- }
- }
-
- /**
- Add a list of command in the form of string
-
- @param commandList Command list string
- **/
- public void addCommands(String commandList) {
- //
- // archList some archs separated by space " "
- //
- if (commandList == null || commandList.length() == 0) {
- commands.add("*");
- } else {
- addCommands(commandList.split(" "));
- }
- }
-
- /**
- Add a list of ARCH in the form of array
-
- @param commandArray Commands array
- **/
- public void addCommands(String[] commandArray) {
- if (commandArray != null ) {
- for (int i = 0; i < commandArray.length; i++) {
- commands.add(commandArray[i]);
- }
- }
- }
-
- /**
- Add a list of ARCH in the form of set
-
- @param commandSet Commands set
- **/
- public void addCommands(Set<String> commandSet) {
- if (commandSet != null) {
- commands.addAll(commandSet);
- }
- }
-
- /**
- Make a union operation on this ToolChainInfo and the given one.
-
- @param info Another ToolChainInfo object to merge with
-
- @return ToolChainInfo Merged ToolChainInfo object
- **/
- public ToolChainInfo union(ToolChainInfo info) {
- ToolChainInfo result = new ToolChainInfo();
- result.addTargets(union(this.targets, info.targets));
- result.addTagnames(union(this.tagnames, info.tagnames));
- result.addArchs(union(this.archs, info.archs));
- return result;
- }
-
- /**
- Make a intersection operation on this ToolChainInfo and the given one
-
- @param info Another ToolChainInfo object to intersect with
-
- @return ToolChainInfo Intersected ToolChainInfo object
- **/
- public ToolChainInfo intersection(ToolChainInfo info) {
- ToolChainInfo result = new ToolChainInfo();
- result.addTargets(intersection(this.targets, info.targets));
- result.addTagnames(intersection(this.tagnames, info.tagnames));
- result.addArchs(intersection(this.archs, info.archs));
- return result;
- }
-
- /**
- Make a union operation on two Sets
-
- @param set1 One Set
- @param set2 Another Set
-
- @return Set<String> Merged Set object
- **/
- private Set<String> union(Set<String> set1, Set<String> set2) {
- Set<String> result = new LinkedHashSet<String>();
- result.addAll(set1);
- result.addAll(set2);
- result.remove("*");
- return result;
- }
-
- /**
- Make a intersection operation on two Sets with the consideration of wildcard.
-
- @param set1 One Set
- @param set2 Another Set
-
- @return Set<String> The intersected Set object
- **/
- private Set<String> intersection(Set<String> set1, Set<String> set2) {
- Set<String> result = new LinkedHashSet<String>();
- boolean set1HasWildcard = set1.contains("*");
- boolean set2HasWildcard = set2.contains("*");
-
- if (set1HasWildcard && set2HasWildcard) {
- //
- // Both Sets have wildcard, the result will have all elements in them
- //
- result.addAll(set1);
- result.addAll(set2);
- } else if (set1HasWildcard) {
- //
- // Only set1 has wildcard, then result will have only set2 elements.
- //
- result.addAll(set2);
- } else if (set2HasWildcard) {
- //
- // Only set2 has wildcard, then result will have only set1 elements.
- //
- result.addAll(set1);
- } else {
- //
- // No wildcard in both Sets, the result will have the elements in both Sets.
- //
- result.addAll(set1);
- result.retainAll(set2);
- }
-
- return result;
- }
-
- /**
- Get target array.
-
- @return String[]
- **/
- public String[] getTargets() {
- return (String[])targets.toArray(new String[targets.size()]);
- }
-
- /**
- Get tool chain tag name array.
-
- @return String[]
- **/
- public String[] getTagnames() {
- return (String[])tagnames.toArray(new String[tagnames.size()]);
- }
-
- /**
- Get ARCH array.
-
- @return String[]
- **/
- public String[] getArchs() {
- return (String[])archs.toArray(new String[archs.size()]);
- }
-
- /**
- Get command name array.
-
- @return String[]
- **/
- public String[] getCommands() {
- return (String[])commands.toArray(new String[commands.size()]);
- }
-
- /**
- Override the Object's toString().
-
- @return String
- **/
- public String toString() {
- return " TARGET :" + targets + "\n" +
- " TAGNAME:" + tagnames + "\n" +
- " ARCH :" + archs + "\n" +
- " COMMAND:" + commands;
- }
-
- /**
- Remove the wildcard element in the tool chain information because they
- are useless when retrieved.
- **/
- public void normalize() {
- targets.remove("*");
- tagnames.remove("*");
- archs.remove("*");
- commands.remove("*");
- }
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainKey.java b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainKey.java
deleted file mode 100644
index 1bedf3c685..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainKey.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/** @file
-ToolChainKey class
-
-ToolChainKey class is representing the "name" part of tool chain definition.
-
-Copyright (c) 2006, 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.
-
-**/
-
-package org.tianocore.build.toolchain;
-
-import org.tianocore.build.exception.GenBuildException;
-
-/**
- ToolChainKey class is the java class form of the "name" of tool chain definition.
- It's primarily for the key of a Map data structure.
- **/
-public class ToolChainKey implements java.io.Serializable, Comparable<ToolChainKey> {
- static final long serialVersionUID = -8034897190740066933L;
-
- ///
- /// The part number of key. Currently we only support fixed five parts.
- ///
- public final static int keyLength = 5;
-
- //
- // Default delimiter which is used for concatenating the parts of key
- //
- private String delimiter = "_";
-
- //
- // Key value in string array form
- //
- private String[] keySet = null;
-
- //
- // Key value in one string form
- //
- private String keyString = null;
-
- //
- // Key hash value used for hash table
- //
- private int hashValue = 0;
-
- /**
- Public constructor which can override default delimiter.
-
- @param keyString The key string value
- @param delimiter Delimiter charater concatenating the key parts
- **/
- public ToolChainKey(String keyString, String delimiter) throws GenBuildException {
- setKey(keyString, delimiter);
- }
-
- /**
- Public constructor which uses default delimiter.
-
- @param keyString The key string value
- **/
- public ToolChainKey(String keyString) throws GenBuildException {
- setKey(keyString);
- }
-
- /**
- Public constructor which doesn't use any delimiter.
-
- @param keySet
- **/
- public ToolChainKey(String[] keySet) throws GenBuildException {
- setKey(keySet);
- }
-
- /**
- Calculate hash value of the key string (without the delimiter). It's used
- for Hash Table kind of Map.
-
- @return int The hash value
- **/
- public int hashCode() {
- if (hashValue != 0) {
- return hashValue;
- }
-
- for (int i = 0; i < keySet.length; ++i) {
- char[] keyStringValue = new char[keySet[i].length()];
- this.keySet[i].getChars(0, keyStringValue.length, keyStringValue, 0);
-
- for (int j = 0; j < keyStringValue.length; ++j) {
- hashValue = keyStringValue[j] + hashValue * 31;
- }
- }
-
- return hashValue;
- }
-
- /**
- Compare the string value of two keys . It's used for Tree kind of Map.
-
- @param dstKey Another key to compare to.
-
- @retval 0 Two keys are equal
- @retval >0 This key is after the given key
- @retval <0 This key is before the given key
- **/
- public int compareTo(ToolChainKey dstKey) {
- String[] dstKeySet = dstKey.getKeySet();
- int result = 0;
- for (int i = 0; i < ToolChainKey.keyLength; ++i) {
- result = this.keySet[i].compareToIgnoreCase(dstKeySet[i]);
- if (result != 0) {
- break;
- }
- }
-
- return result;
- }
-
- /**
- Check if this key is the same as the given key.
-
- @param o Another key to compare to
-
- @return boolean
- **/
- public boolean equals(Object o) {
- ToolChainKey dstKey = (ToolChainKey)o;
- String[] dstKeySet = dstKey.getKeySet();
-
- if (this == dstKey) {
- return true;
- }
-
- if (dstKeySet.length != ToolChainKey.keyLength) {
- return false;
- }
-
- for (int i = 0; i < ToolChainKey.keyLength; ++i) {
- if (!this.keySet[i].equalsIgnoreCase(dstKeySet[i])) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- Set the key value in form of string array.
-
- @param keySet The string array of key value
- **/
- public void setKey(String[] keySet) throws GenBuildException {
- if (keySet.length != ToolChainKey.keyLength) {
- throw new GenBuildException("Invalid ToolChain key");
- }
-
- //
- // Clone the string array because we don't want to change original one
- //
- this.keySet = new String[ToolChainKey.keyLength];
- System.arraycopy(keySet, 0, this.keySet, 0, ToolChainKey.keyLength);
- for (int i = 0; i < ToolChainKey.keyLength; ++i) {
- if (this.keySet[i] == null || this.keySet[i].length() == 0) {
- this.keySet[i] = "*";
- }
- }
-
- //
- // We need to re-generate the single key string and hash value.
- //
- this.keyString = null;
- this.hashValue = 0;
- }
-
- /**
- Set key value at the specified key part .
-
- @param keySetString The new value of "index" part of key
- @param index The key part index
- **/
- public void setKey(String keySetString, int index) throws GenBuildException {
- if (index >= ToolChainKey.keyLength) {
- throw new GenBuildException("Invalid ToolChain key index");
- }
-
- //
- // Allow wildcard in key string
- //
- if (keySetString == null || keySetString.length() == 0) {
- keySetString = "*";
- }
- this.keySet[index] = keySetString;
-
- //
- // We need to re-generate the single key string and hash value.
- //
- this.keyString = null;
- this.hashValue = 0;
- }
-
- /**
- Set key value in the form of single string.
-
- @param keyString The key value string
- **/
- public void setKey(String keyString) throws GenBuildException {
- this.keySet = keyString.split(this.delimiter);
-
- if (this.keySet.length != ToolChainKey.keyLength) {
- throw new GenBuildException("Invalid ToolChain key");
- }
-
- this.keyString = keyString;
- //
- // We need to re-generate hash value.
- //
- this.hashValue = 0;
- }
-
- /**
- Set key value in the form of single string with specified delimiter.
-
- @param keyString The key value string
- @param delimiter The delimiter concatenating the key string
- **/
- public void setKey(String keyString, String delimiter) throws GenBuildException {
- this.keySet = keyString.split(delimiter);
-
- if (this.keySet.length != ToolChainKey.keyLength) {
- throw new GenBuildException("Invalid ToolChain key");
- }
-
- this.keyString = keyString;
- this.delimiter = delimiter;
- //
- // We need to re-generate hash value.
- //
- this.hashValue = 0;
- }
-
- /**
- Return the string array form of key
-
- @return String[]
- **/
- public String[] getKeySet() {
- return keySet;
- }
-
- /**
- Return the single string form of key.
-
- @return String
- **/
- public String toString() {
- if (this.keyString == null) {
- StringBuffer keyStringBuf = new StringBuffer(64);
-
- keyStringBuf.append(this.keySet[0]);
- for (int i = 1; i < ToolChainKey.keyLength; ++i) {
- keyStringBuf.append(this.delimiter);
- keyStringBuf.append(this.keySet[i]);
- }
-
- this.keyString = keyStringBuf.toString();
- }
-
- return this.keyString;
- }
-}
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainMap.java b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainMap.java
deleted file mode 100644
index 18e664ccf8..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainMap.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/** @file
-ToolChainMap class
-
-ToolChainMap class is used for storing tool chain configurations.
-
-Copyright (c) 2006, 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.
-
-**/
-
-package org.tianocore.build.toolchain;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- ToolChainMap is a wrapper class for a generic Map class which uses ToolChainKey
- class as its key. It's used to store and retrieve tool chain configuration
- information.
- **/
-public class ToolChainMap {
- //
- // From which part of key can be used to match "*"
- //
- private int matchLevel = ToolChainKey.keyLength - 1;
-
- //
- // A Map object in which tool chain configuration information will be stored
- //
- private Map<ToolChainKey, String> map = null;
-
- /**
- Public constructor. It just initializes the private Map object.
- **/
- public ToolChainMap() {
- this.map = new HashMap<ToolChainKey, String>();
- }
-
- /**
- Wrapper function for Map.put(). It's used when default delimiter of
- ToolChainKey is not wanted and will be overrided by "delimiter" parameter.
-
- @param key Key string which is concatenated with "delimiter"
- @param delimiter The delimiter string in the key string
- @param value Value string associated with the "key"
-
- @retval String The "value" string if the "key" is valid.
- @retval null if the "key" is invalid
- **/
- public String put(String key, String delimiter, String value) {
- ToolChainKey toolChainKey;
-
- try {
- toolChainKey = new ToolChainKey(key, delimiter);
- } catch (Exception e) {
- return null;
- }
- return (String)map.put(toolChainKey, value);
- }
-
- /**
- Wrapper function for Map.put().
-
- @param key Key string which is concatenated with default "delimiter"
- @param value Value string associated with the "key"
-
- @retval String The "value" string if the "key" is valid.
- @retval null if the "key" is invalid
- **/
- public String put(String key, String value) {
- ToolChainKey toolChainKey;
-
- try {
- toolChainKey = new ToolChainKey(key);
- } catch (Exception e) {
- return null;
- }
- return (String)map.put(toolChainKey, value);
- }
-
- /**
- Wrapper function for Map.put(). The key is given in the form of string
- array.
-
- @param key Key string array
- @param value Value string associated with the "key"
-
- @retval String The "value" string if the "key" is valid.
- @retval null if the "key" is invalid
- **/
- public String put(String[] key, String value) {
- ToolChainKey toolChainKey;
-
- try {
- toolChainKey = new ToolChainKey(key);
- } catch (Exception e) {
- return null;
- }
- return (String)map.put(toolChainKey, value);
- }
-
- /**
- Wrapper function for Map.put(). The key is given in ToolChainKey class.
-
- @param key ToolChainKey class
- @param value Value string associated with the "key"
-
- @retval String The "value" string if the "key" is valid.
- @retval null if the "key" is invalid
- **/
- public String put(ToolChainKey key, String value) {
- return (String)map.put(key, value);
- }
-
- /**
- Wrapper function for Map.get().
-
- @param key Key string which is concatenated with default "delimiter"
-
- @return String
- **/
- public String get(String key) {
- ToolChainKey toolChainKey;
-
- try {
- toolChainKey = new ToolChainKey(key);
- } catch (Exception e) {
- return null;
- }
- return get(toolChainKey);
- }
-
- /**
- Wrapper function for Map.get(). It's used when default delimiter of
- ToolChainKey is not wanted and will be overrided by "delimiter" parameter.
-
- @param key Key string which is concatenated with "delimiter"
- @param delimiter The delimiter string in the key string
-
- @return String
- **/
- public String get(String key, String delimiter) {
- ToolChainKey toolChainKey;
-
- try {
- toolChainKey = new ToolChainKey(key, delimiter);
- } catch (Exception e) {
- return null;
- }
- return get(toolChainKey);
- }
-
- /**
- Wrapper function for Map.get(). The key is given in the form of string
- array.
-
- @param key Key string array
-
- @return String
- **/
- public String get(String[] key) {
- ToolChainKey toolChainKey;
-
- try {
- toolChainKey = new ToolChainKey(key);
- } catch (Exception e) {
- return null;
- }
- return get(toolChainKey);
- }
-
- /**
- Wrapper function for Map.get(). The key is given in ToolChainKey class.
- All other form of get() method will eventually call this form of get. It
- will do real job of finding the value associated with the given key. Most
- of the job is to try to match the key with "wildcard".
-
- @param key ToolChainKey class
-
- @return String The value associated with the key
- **/
- public String get(ToolChainKey key) {
- ///
- /// First, we'll try to get the value through the exact given key
- ///
- String result = map.get(key);
- if (result != null || map.containsKey(key)) {
- return result;
- }
-
- ///
- /// If nothing is found, then, we'll try all possible keys combined with
- /// wildcard "*". In order not to change the original key value, we have
- /// to clone one for later use.
- ///
- String[] keySet = key.getKeySet();
- ToolChainKey tmpKey;
- try {
- tmpKey = new ToolChainKey(keySet);
- } catch (Exception e) {
- return null;
- }
-
- ///
- /// In the current tool chain definition format (in name/value pair),
- /// there're five parts in the "name". The last part of the "name" must
- /// not be "wildcard". We should start combining "*" from left to right.
- /// We'll try all the possible combinations until the value can be fetched.
- ///
- /// The following code implements the logic which will try to use, for example,
- /// following key parts combinations sequentially to get the value.
- ///
- /// TARGET_TOOLCHAIN_ARCH_TOOLCODE_ATTRIBUTE
- /// ******_TOOLCHAIN_ARCH_TOOLCODE_ATTRIBUTE
- /// TARGET_*********_ARCH_TOOLCODE_ATTRIBUTE
- /// ******_*********_ARCH_TOOLCODE_ATTRIBUTE
- /// TARGET_TOOLCHAIN_****_TOOLCODE_ATTRIBUTE
- /// ******_TOOLCHAIN_****_TOOLCODE_ATTRIBUTE
- /// TARGET_*********_****_TOOLCODE_ATTRIBUTE
- /// ******_*********_****_TOOLCODE_ATTRIBUTE
- /// TARGET_TOOLCHAIN_ARCH_********_ATTRIBUTE
- /// ******_TOOLCHAIN_ARCH_********_ATTRIBUTE
- /// TARGET_*********_ARCH_********_ATTRIBUTE
- /// ******_*********_ARCH_********_ATTRIBUTE
- /// TARGET_TOOLCHAIN_****_********_ATTRIBUTE
- /// ******_TOOLCHAIN_****_********_ATTRIBUTE
- /// TARGET_*********_****_********_ATTRIBUTE
- /// ******_*********_****_********_ATTRIBUTE
- ///
-
- //
- // The wildcard "*" appears regularly (2^n). "*" in TARGET appears 2^0
- // times at every 2^0 TARGET, "*" in TOOLCHAIN appears 2^1 times at
- // every 2^1 TOOLCHAIN, and "*" in TOOLCODE appears 2^3 times at every
- // 2^3 TOOLCODE. We're going to use this to form all the combinations of key.
- //
- int[] combinations = new int[matchLevel];
- for (int i = 0; i < matchLevel; ++i) {
- //
- // initialize the array with 2^n
- //
- combinations[i] = 1 << (i + 1);
- }
-
- //
- // when last part goes down to zero, we tried all combinations of key
- //
- int lastIndex = matchLevel - 1;
- while (combinations[lastIndex] > 0) {
- //
- // form the key which has "*" in it
- //
- for (int i = 0; i < matchLevel; ++i) {
- //
- // start again if not finished
- //
- if (combinations[i] == 0) {
- combinations[i] = 1 << (i + 1);
- }
-
- //
- // half of 2^n is "*", the rest is non-*
- //
- try {
- if (combinations[i] > (1 << i)) {
- tmpKey.setKey(keySet[i], i);
- } else {
- tmpKey.setKey("*", i);
- }
- } catch (Exception e) {
- return null;
- }
-
- combinations[i] -= 1;
- }
-
- //
- // Try get the value from the map
- //
- result = map.get(tmpKey);
- if (result != null) {
- //
- // The map actually has no exact key as the given "key",
- // putting it back into map can speed up the get() next time
- //
- map.put(key, result);
- return result;
- }
- }
-
- //
- // The map actually has no exact key as the given "key", putting it back
- // into map can speed up the get() next time even we got nothing.
- //
- map.put(key, null);
- return null;
- }
-
- /**
- Wrapper function for Map.size().
-
- @return int The size of map
- **/
- public int size() {
- return map.size();
- }
-
- /**
- Wrapper function for Map.keySet().
-
- @return Set<ToolChainKey> A set of ToolChainKey objects
- */
- public Set<ToolChainKey> keySet() {
- return (Set<ToolChainKey>)map.keySet();
- }
-
- public String toString() {
- return map + "";
- }
-}
-
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/tools/ModuleItem.java b/Tools/Java/Source/GenBuild/org/tianocore/build/tools/ModuleItem.java
deleted file mode 100644
index 04223cd8fd..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/tools/ModuleItem.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/** @file
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.tools;
-
-import org.apache.tools.ant.BuildException;
-/**
- Ant element for module.
-
- @since GenBuild 1.0
-**/
-public class ModuleItem {
-
- private String moduleName = null;
-
- private String moduleGuid = null;
-
- private String moduleVersion = null;
-
- private String packageName = null;
-
- private String packageGuid = null;
-
- private String packageVersion = null;
-
- public ModuleItem(){
-
- }
-
- public void execute() throws BuildException {
-
- }
-
- /**
- Get module Guid.
- @return Module Guid
- **/
- public String getModuleGuid() {
- return moduleGuid;
- }
-
- /**
- Set module Guid
- @param moduleGuid Module Guid
- **/
- public void setModuleGuid(String moduleGuid) {
- this.moduleGuid = moduleGuid;
- }
-
- /**
- Get Module Name.
- @return Module Name
- **/
- public String getModuleName() {
- return moduleName;
- }
-
- /**
- Set Module Name.
- @param moduleName Module Name
- **/
- public void setModuleName(String moduleName) {
- this.moduleName = moduleName;
- }
-
- /**
- Get Module Version.
- @return Module Version
- **/
- public String getModuleVersion() {
- return moduleVersion;
- }
-
- /**
- Set Module Version.
- @param moduleVersion Module version
- **/
- public void setModuleVersion(String moduleVersion) {
- this.moduleVersion = moduleVersion;
- }
-
- /**
- Get Package Guid.
- @return Package Guid
- **/
- public String getPackageGuid() {
- return packageGuid;
- }
-
- /**
- Set Package Guid.
- @param packageGuid Package Guid
- **/
- public void setPackageGuid(String packageGuid) {
- this.packageGuid = packageGuid;
- }
-
- /**
- Get Package Name.
- @return Package Name
- **/
- public String getPackageName() {
- return packageName;
- }
-
- /**
- Set Package Name.
- @param packageName Package Name
- **/
- public void setPackageName(String packageName) {
- this.packageName = packageName;
- }
-
- /**
- Get Package Version.
- @return Package Version
- **/
- public String getPackageVersion() {
- return packageVersion;
- }
-
- /**
- Set Package Version.
- @param packageVersion Package Version
- **/
- public void setPackageVersion(String packageVersion) {
- this.packageVersion = packageVersion;
- }
-
-
-}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/tools/PackageItem.java b/Tools/Java/Source/GenBuild/org/tianocore/build/tools/PackageItem.java
deleted file mode 100644
index f61782ddbd..0000000000
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/tools/PackageItem.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.build.tools;
-
-import org.apache.tools.ant.BuildException;
-
-/**
- Ant element for Package.
-
- @since GenBuild 1.0
-**/
-public class PackageItem {
-
- private String packageName = null;
-
- private String packageGuid = null;
-
- private String packageVersion = null;
-
- public PackageItem(){
-
- }
-
- public void execute() throws BuildException {
-
- }
-
- public String toString(){
- return "[" + packageName + packageGuid + "]";
- }
- /**
- Get Package Guid.
- @return Package Guid
- **/
- public String getPackageGuid() {
- return packageGuid;
- }
-
- /**
- Set Package Guid.
- @param packageGuid Package Guid
- **/
- public void setPackageGuid(String packageGuid) {
- this.packageGuid = packageGuid;
- }
-
- /**
- Get Package Name.
- @return Package Name
- **/
- public String getPackageName() {
- return packageName;
- }
-
- /**
- Set Package Name.
- @param packageName Package Name
- **/
- public void setPackageName(String packageName) {
- this.packageName = packageName;
- }
-
- /**
- Get Package Version.
- @return Package Version
- **/
- public String getPackageVersion() {
- return packageVersion;
- }
-
- /**
- Set Package Version.
- @param packageVersion Package Version
- **/
- public void setPackageVersion(String packageVersion) {
- this.packageVersion = packageVersion;
- }
-}
diff --git a/Tools/Java/Source/Merge/Merge.msa b/Tools/Java/Source/Merge/Merge.msa
deleted file mode 100644
index b394d7a90a..0000000000
--- a/Tools/Java/Source/Merge/Merge.msa
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Merge Tool</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>fbb48848-4776-44a1-8458-1e84701fb62f</GuidValue>
- <Version>0.1</Version>
- <Abstract>The tool merges multiple MSA files (of the same ModuleType) into a single module</Abstract>
- <Description>Merging multiple modules into a single module is useful for size reduction of the binary images.
-This tool will create an MSA file, based on the content of "leaf" MSA files. It is written so that it can be executed from a command line, or later, incorporated into the Wizard.
-USAGE:
-merge [-v] -t target [-u UiName] [-p PackageFile] [-o OutputFileBasename] dir1\mod1.msa ... dirN\modN.msa</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation All rights reserved.</Copyright>
- <License URL="http://opensource.org/licenses/bsd-license.php">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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>EBC IA32 X64 IPF ARM PPC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Merge</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>src/org/tianocore/Merge/CombineMsa.java</Filename>
- <Filename>src/org/tianocore/Merge/Merge.java</Filename>
- <Filename>src/org/tianocore/Merge/MergeCmd.java</Filename>
- <Filename>build.xml</Filename>
- <Filename>readme.txt</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/Merge/build.xml b/Tools/Java/Source/Merge/build.xml
deleted file mode 100644
index 709c9e8fe9..0000000000
--- a/Tools/Java/Source/Merge/build.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="Merge" default="Merge" basedir=".">
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
- </path>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/bin"/>
- <target name="Merge" depends="install"/>
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="src" destdir="${buildDir}">
- <classpath refid="classpath"/>
- <!-- <compilerarg value="-Xlint"/> -->
- </javac>
- </target>
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false" quiet="true">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/Merge" includes="${buildDir}"/>
- </delete>
- </target>
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: Merge.jar"/>
- <delete file="${installLocation}/Merge.jar"/>
- </target>
- <target name="install" depends="source">
- <jar destfile="${installLocation}/Merge.jar">
- <fileset dir="${buildDir}"/>
- </jar>
- </target>
-</project>
diff --git a/Tools/Java/Source/Merge/readme.txt b/Tools/Java/Source/Merge/readme.txt
deleted file mode 100644
index cf423c3be8..0000000000
--- a/Tools/Java/Source/Merge/readme.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-
-Overview
---------
-The Merge program is designed to merge the contents of similar modules into a
-single module for size reduction. The combined module will link in one copy of
-the libraries, rather than have multiple copies of the libraries linked in to
-each individual driver.
-
-Rules:
- The ModuleType must be identical for each of the (leaf) modules.
- At least one architecture type must be common for all modules, and the merged
-module will only support the common architecture types.
- ALL modules to be merged must be in a directory structure below the location
-of the merged module.
- The package must be within a directly directory line with the merged module's
-MSA file. (Parent directories.)
- The copying of the files from the "leaf" directory into the merge module's
-directory structure must be handled by an external program.
- The merge program must be run everytime a leaf module is modified.
- The external copy program must also be run everytime a leaf module is modified.
- Two or more leaf modules must be specified.
- The merged module must be added to a package (SPD) file before it can be used.
- PCD Driver Modules cannot be merged, nor combined with other modules.
- Leaf Module Global BuildOptions and UserExtensions are not merged.
-
-
-merge Usage:
- merge [-v] -t target [-u UiName] [-p PackageFile] dir1\leaf1 ... dirN\leafN [-h | -? | --help]
- where:
- -h | -? | --help OPTIONAL - This Help Text
- -t Target REQUIRED - The Name of the new Merge Module MSA file
- -p Package OPTIONAL - The Name of the Package (SPD) file to add the target
- -u UiName OPTIONAL - The User Interface Name for the Target Module
- -v OPTIONAL - Verbose, print information messages.
- -o OutputFileBasename OPTIONAL - Set the Output Filename for this module to Basename
- dir1\leaf1 ... dirN\leafN REQUIRED The path to two or more MSA files that will be merged
-
-
diff --git a/Tools/Java/Source/Merge/src/org/tianocore/Merge/CombineMsa.java b/Tools/Java/Source/Merge/src/org/tianocore/Merge/CombineMsa.java
deleted file mode 100644
index 4d4b215267..0000000000
--- a/Tools/Java/Source/Merge/src/org/tianocore/Merge/CombineMsa.java
+++ /dev/null
@@ -1,2007 +0,0 @@
-// @file
-// This Class processes multiple MSA files and merges them into a single,
-// merged MSA file. It will optionally add the merged MSA file into a package.
-//
-//
-// Copyright (c) 2006, 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.
-//
-//
-
-package org.tianocore.Merge;
-
-import java.io.*;
-import java.util.*;
-// import java.lang.*;
-// import java.lang.ExceptionInInitializerError;
-
-// import org.apache.xmlbeans.*;
-import org.apache.xmlbeans.XmlCursor;
-// import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.*;
-
-// import org.tianocore.*;
-import org.tianocore.ModuleSurfaceAreaDocument.*;
-import org.tianocore.MsaHeaderDocument.*;
-import org.tianocore.LicenseDocument.*;
-import org.tianocore.ModuleDefinitionsDocument.*;
-import org.tianocore.LibraryClassDefinitionsDocument.*;
-import org.tianocore.SourceFilesDocument.*;
-import org.tianocore.PackageDependenciesDocument.*;
-import org.tianocore.ProtocolsDocument.*;
-import org.tianocore.EventsDocument.*;
-import org.tianocore.HobsDocument.*;
-import org.tianocore.PPIsDocument.*;
-import org.tianocore.VariablesDocument.*;
-import org.tianocore.BootModesDocument.*;
-import org.tianocore.SystemTablesDocument.*;
-import org.tianocore.DataHubsDocument.*;
-import org.tianocore.HiiPackagesDocument.*;
-import org.tianocore.GuidsDocument.*;
-import org.tianocore.ExternsDocument.*;
-import org.tianocore.PcdCodedDocument.*;
-import org.tianocore.ModuleBuildOptionsDocument.*;
-import org.tianocore.UserExtensionsDocument.*;
-
-import org.tianocore.PackageSurfaceAreaDocument.*;
-
-public class CombineMsa {
-
- private final int DEBUG = 0;
-
- private final int PASS = 0;
-
- private final int FAIL = 1;
-
- private final int FOUND = 0;
-
- private final int NOTFOUND = 1;
-
- private int result = PASS;
-
- private String licenseTxt = "";
-
- private ArrayList<String> aLicenses = new ArrayList<String>();
-
- private String Copyright = "";
-
- private ArrayList<String> aCopyright = new ArrayList<String>();
-
- private String Abstract = "\n Merged Modules: \n";
-
- private String Description = "\n Merging Modules: \n";
-
- private String sArchitectures = "";
-
- private MsaHeader header = null;
-
- private final String Specification = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
-
- private ModuleSurfaceArea mergeMsaFile = null;
-
- private ModuleSurfaceArea leafMsa = null;
-
- private ModuleDefinitions moduleDefs = null;
-
- private LibraryClassDefinitions libClassDefs = null;
-
- private ArrayList<String> aLibClassDefs = new ArrayList<String>();
-
- private int libraryClassIndex = 0;
-
- private SourceFiles mergeSourceFiles = null;
-
- private int sourceFileIndex = 0;
-
- private PackageDependencies mergePackageDependencies = null;
-
- private ArrayList<String> aPackageList = new ArrayList<String>();
-
- private int packageDependenciesIndex = 0;
-
- private Protocols mergeProtocols = null;
-
- private ArrayList<String> aProtocolList = new ArrayList<String>();
-
- private ArrayList<String> aProtocolNotifyList = new ArrayList<String>();
-
- private int protocolIndex = 0;
-
- private int protocolNotifyIndex = 0;
-
- private Events mergeEvents = null;
-
- private Events.CreateEvents mergeCreateEvents = null;
-
- private Events.SignalEvents mergeSignalEvents = null;
-
- private ArrayList<String> aCreateEventsList = new ArrayList<String>();
-
- private ArrayList<String> aSignalEventsList = new ArrayList<String>();
-
- private int createEventIndex = 0;
-
- private int signalEventIndex = 0;
-
- private Hobs mergeHobs = null;
-
- private ArrayList<String> aHobsList = new ArrayList<String>();
-
- private int hobsIndex = 0;
-
- private PPIs mergePpis = null;
-
- private ArrayList<String> aPpiList = new ArrayList<String>();
-
- private ArrayList<String> aPpiNotifyList = new ArrayList<String>();
-
- private int ppiIndex = 0;
-
- private int ppiNotifyIndex = 0;
-
- private Variables mergeVariables = null;
-
- private ArrayList<String> aVariablesList = new ArrayList<String>();
-
- private int variablesIndex = 0;
-
- private BootModes mergeBootModes = null;
-
- private ArrayList<String> aBootModesList = new ArrayList<String>();
-
- private int bootModesIndex = 0;
-
- private SystemTables mergeSystemTables = null;
-
- private ArrayList<String> aSystemTablesList = new ArrayList<String>();
-
- private int systemTableIndex = 0;
-
- private DataHubs mergeDataHubs = null;
-
- private ArrayList<String> aDataHubsList = new ArrayList<String>();
-
- private int dataHubsIndex = 0;
-
- private HiiPackages mergeHiiPackages = null;
-
- private ArrayList<String> aHiiPackagesList = new ArrayList<String>();
-
- private int hiiPackageIndex = 0;
-
- private Guids mergeGuids = null;
-
- private ArrayList<String> aGuidsList = new ArrayList<String>();
-
- private int guidsIndex = 0;
-
- private Externs mergeExterns = null;
-
- private ArrayList<String> aEntryPointList = new ArrayList<String>();
-
- private ArrayList<String> aUnloadImageList = new ArrayList<String>();
-
- private ArrayList<String> aDriverBindingList = new ArrayList<String>();
-
- private ArrayList<String> aConstructorList = new ArrayList<String>();
-
- private ArrayList<String> aDestructorList = new ArrayList<String>();
-
- private ArrayList<String> aVirtualAddressMapList = new ArrayList<String>();
-
- private ArrayList<String> aExitBootServicesList = new ArrayList<String>();
-
- private int externsIndex = 0;
-
- private ArrayList<String> aSpecArray = new ArrayList<String>();
-
- private int specIndex = 0;
-
- private PcdCoded mergePcdCoded = null;
-
- private ArrayList<String> aPcdCNameList = new ArrayList<String>();
-
- private ArrayList<String> aPcdItemTypeList = new ArrayList<String>();
-
- private int pcdIndex = 0;
-
- private ModuleBuildOptions mergeBuildOptions = null;
-
- private UserExtensions mergeUserExtensions = null;
-
- private String mergeUsage = "";
-
- private String leafUsage = "";
-
- private int VERBOSE = 0;
-
- // The combineMsaFiles routine is the primary routine for creating a
- // Merged MSA file.
-
- public int combineMsaFiles(String msaFilename, ArrayList<String> msaFiles, String uiName, String spdFilename,
- String baseName, int Flags) {
- // msaFile has been verified to either not exist, or, if it does exist,
- // it will be over written.
- // All files in the msaFiles ArrayList have been verifed to exist.
- // If the uiName is not null, we will have a new UI Name for the merged
- // module.
- // If the uiName is null, we will use the module name from the first
- // Leaf module.
- // If the spdFile is not null, the Package (SPD) file has been verified
- // to exist.
- // If the spdFile is null, don't attempt to add the new msa file.
-
- if (Flags > 0)
- VERBOSE = 1;
- if (mergeMsaFile == null) {
- //
- // create the data structure for the merged Module
- //
- mergeMsaFile = ModuleSurfaceArea.Factory.newInstance();
-
- System.out.println("Merging " + msaFiles.size() + " Modules");
- //
- // we always require a Header and a Module Definition section.
- // These will be added to the mergeMsaFile after we have completed
- // all processing of the Leaf MSA files.
- //
- header = MsaHeaderDocument.Factory.newInstance().addNewMsaHeader();
- moduleDefs = ModuleDefinitionsDocument.Factory.newInstance().addNewModuleDefinitions();
- //
- // A merged module cannot be created from binary modules - we force
- // the new module to be source here, however we will test every
- // module to make sure that none are binary; exiting the program if
- // a module is binary
- //
- moduleDefs.setBinaryModule(false);
-
- for (int i = 0; i < msaFiles.size(); i++) {
- String leafFilename = msaFiles.get(i).toString();
- leafMsa = getLeafFile(leafFilename);
- if (leafMsa == null) {
- System.out.println("Could not read Leaf MSA file: " + leafFilename);
- System.exit(FAIL);
- }
- if (i == 0) {
- //
- // Special code for first file, since this file is used
- // to initialize some of the data in the mergeMsaFile.
- // Set the Merge module's ModuleName to the name in the
- // first Leaf Module. If a new module name is given,
- // over write it later, just before writing the Merge
- // Module MSA file.
- header.setModuleName(leafMsa.getMsaHeader().getModuleName().toString());
- //
- // All modules must be of the same module type, we set it
- // here, and test the other Leaf modules' type later.
- header.setModuleType(leafMsa.getMsaHeader().getModuleType());
- //
- // This is a new Module, so we need a new GUID
- header.setGuidValue(UUID.randomUUID().toString());
- //
- // Use the version from the first Leaf module as the
- // Merge Module version number.
- header.setVersion(leafMsa.getMsaHeader().getVersion().toString());
- //
- // There is no special requirement for processing the
- // following, so we just fall through on these elements
- // of the header.
- // Abstract will be added after parsing all leaf MSA files.
- // Description will be added after parsing all leaf MSA files.
- // Copyright will be added after parsing all leaf MSA files.
- // License will be added after parsing all leaf MSA files.
- //
- // Force the specification to match this tool's spec version.
- header.setSpecification(Specification);
- //
- // Set the Merged Module's Output Basename to match the first
- // leaf module
- String OutputFileName = leafMsa.getModuleDefinitions().getOutputFileBasename().toString();
- //
- // Just in case someone put a space character in the first
- // leaf module's output filename, replace the spaces with
- // an underscore.
- OutputFileName.replace(" ", "_");
- moduleDefs.setOutputFileBasename(OutputFileName);
- //
- // We start with the first module's list of supported
- // architectures. As we process the additional leaf modules,
- // we may have to remove some supported architectures from
- // the list, as we can only build for the "least common
- // denominator" subset of architectures.
- sArchitectures = leafMsa.getModuleDefinitions().getSupportedArchitectures().toString();
- if ((DEBUG > 5) || (VERBOSE > 5))
- System.out.println("New Header: \"" + header.getModuleName().toString() + "\"");
- }
- //
- // We test the license in each leaf module, and will only print
- // licenses that are may be different in wording (white spaces
- // and line feeds are ignored in this test.)
- if (leafMsa.getMsaHeader().getLicense() != null)
- licenseTxt += checkDuplicateStrings(leafMsa.getMsaHeader().getLicense().getStringValue().trim(),
- aLicenses);
- if ((DEBUG > 10) || (VERBOSE > 10))
- System.out.println("License: " + licenseTxt);
- //
- // We test the copyright line from each leaf module, and will
- // add additional copyright lines only if they are different
- // in wording (white spaces and line feeds are ignored in this
- // test.)
- if (leafMsa.getMsaHeader().getCopyright() != null)
- Copyright += checkDuplicateStrings(leafMsa.getMsaHeader().getCopyright().toString().trim(),
- aCopyright);
- if ((DEBUG > 10) || (VERBOSE > 10))
- System.out.println("Copyright: " + Copyright);
- //
- // ALL leaf modules must be of the same Module Type, if not,
- // print an error and exit.
- if (header.getModuleType() != leafMsa.getMsaHeader().getModuleType()) {
- System.out.println("ERROR: Module Types different!");
- System.out.println(" Expected: " + header.getModuleType());
- System.out.println(" " + leafFilename + " ModuleType: " + leafMsa.getMsaHeader().getModuleType());
- System.out.println("Merge ABORTED!");
- System.exit(FAIL);
- }
- //
- // Combine the Abstract and Descriptions into a single
- // description entry, prefixing each with the Leaf MSA filename,
- // so you know which description is from which Leaf module.
- Description += " -- " + leafFilename + " -- \n Abstract: "
- + leafMsa.getMsaHeader().getAbstract().toString() + "\n Description: "
- + leafMsa.getMsaHeader().getDescription().toString() + "\n";
- //
- // Use the Abstract of the Merged Module to list the Leaf
- // Module's MSA files.
- Abstract += " -- " + leafFilename + " -- \n";
- //
- // Ignore ClonedFrom right now
- //
-
- // Process Supported Architectures
- // A merged module supports the lowest common set of
- // architectures
- String testArch = "";
- if (leafMsa.getModuleDefinitions().getSupportedArchitectures() == null) {
- System.out
- .println("Module " + leafFilename + " does not have the Supported Architectures defined!");
- System.out.println("Supported Architectures is a required element!");
- System.out.println("Merge ABORTED!");
- System.exit(FAIL);
- }
- testArch = leafMsa.getModuleDefinitions().getSupportedArchitectures().toString();
- String aArch[] = sArchitectures.split(" ");
- for (int ictr = 0; ictr < aArch.length; ictr++) {
- if (!testArch.contains(aArch[ictr])) {
- sArchitectures = sArchitectures.replace(aArch[ictr], "");
- }
- }
- if (sArchitectures.length() < 2) {
- System.out.println("ERROR: The Leaf Modules' Supported Architectures are mutually exclusive.");
- System.out.println("At least one architecture must be common to all Leaf Modules!");
- System.out.println("Merge Aborting!");
- System.exit(FAIL);
- }
- //
- // Now start to process the rest of the Leaf Module's MSA files.
- // We will only test a Leaf module's section if it has data, skipping
- // empty sections
- // As part of this process, we will only create a Library Class Definition
- // if one was defined, and we will only do it one time.
- if (leafMsa.isSetLibraryClassDefinitions()) {
- //
- // If libClassDefs == null, create a new libClassDefs and add
- // this module's libClassDefs to the merge Module's
- // If libClassDefs != null, check that we have only unique LibraryClass entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the LibraryClass as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the LibraryClass as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // The RecommendedInstance attributes can be ignored!
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // The SupModuleList must be identical for all Leaf Modules!
- // Probable Enhancement
- // The SupModuleList should be combined to include all possible supported module types.
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each LibraryClass, otherwize fail the Merge
- //
- // Create the working copy if one does not exist!
- if (libClassDefs == null)
- libClassDefs = LibraryClassDefinitionsDocument.Factory.newInstance()
- .addNewLibraryClassDefinitions();
- //
- // Get the Leaf LibraryClassDefinitions Section
- LibraryClassDefinitions leafLibClassDef = leafMsa.getLibraryClassDefinitions();
- //
- // We only need to test there are entries in the Leaf LibraryClassDefinitions section!
- if (leafLibClassDef.getLibraryClassList().size() > 0) {
- for (int index = 0; index < leafLibClassDef.getLibraryClassList().size(); index++) {
- //
- // We can use the Keyword to search to see if the Leaf's Library Class was already
- // added to the Merge Module.
- String test = "";
- String leafKeyword = leafLibClassDef.getLibraryClassList().get(index).getKeyword()
- .toString().trim();
-
- leafUsage = "";
- if (leafLibClassDef.getLibraryClassList().get(index).getUsage() != null)
- leafUsage = leafLibClassDef.getLibraryClassList().get(index).getUsage().toString()
- .trim();
-
- String leafSupArchList = "";
- if (leafLibClassDef.getLibraryClassList().get(index).getSupArchList() != null)
- leafSupArchList = leafLibClassDef.getLibraryClassList().get(index).getSupArchList()
- .toString().trim();
-
- String leafSupModuleList = "";
- if (leafLibClassDef.getLibraryClassList().get(index).getSupModuleList() != null)
- leafSupModuleList = leafLibClassDef.getLibraryClassList().get(index).getSupModuleList()
- .toString().trim();
-
- test = checkDuplicateStrings(leafKeyword, aLibClassDefs);
- if (test.length() > 0) {
- // The checkDuplicateStrings returns "" if a duplicate was found.
- // Here, the Leaf LibraryClass gets entered because the Keyword was not found.
- // No more testing is required, since this is the first instance of the LibraryClass
- libClassDefs.addNewLibraryClass();
- libClassDefs.setLibraryClassArray(libraryClassIndex++,
- leafLibClassDef.getLibraryClassList().get(index));
- } else {
- // The Merged Module has already specified the Library Class
- // Check ATTRIBUTES, following the rules above.
- // Since we cannot get the LibraryClass entry using the Keyword, we have to search
- // all of the Merged Module's LibraryClass statements until we find a match.
- // Also, we may have more than one LibraryClass with the same Keyword, but different
- // Usage, SupArchList, FeatureFlag or SupModuleList
- for (int nidx = 0; nidx < libraryClassIndex; nidx++) {
- String mergeKeyword = libClassDefs.getLibraryClassList().get(nidx).getKeyword()
- .trim();
-
- if (leafKeyword.contentEquals(mergeKeyword)) {
- // We have the FIRST match, let's check usage, remember, we can have more than one LibraryClass Keyword.
- mergeUsage = libClassDefs.getLibraryClassList().get(nidx).getUsage().toString()
- .trim();
- // If the usage is identical, check the SupArchList next
- if (!leafUsage.contentEquals(mergeUsage)) {
- if (checkUsage().trim().contains("DIFFERENT")) {
- // See if there is another entry for PRODUCED or CONSUME
- int anotherLC = NOTFOUND;
- for (int iidx = nidx + 1; iidx < libraryClassIndex; iidx++) {
- String innerTestKeyword = libClassDefs.getLibraryClassList()
- .get(iidx).getKeyword()
- .toString().trim();
- if (leafKeyword.contentEquals(innerTestKeyword)) {
- anotherLC = FOUND;
- mergeUsage = libClassDefs.getLibraryClassList().get(iidx)
- .getUsage().toString().trim();
- if (checkProduced()) {
- libClassDefs
- .getLibraryClassList()
- .get(iidx)
- .setUsage(
- org.tianocore.UsageTypes.ALWAYS_PRODUCED);
- }
- // Both Usage types are CONSUMED
- if (checkConsumed()) {
- libClassDefs
- .getLibraryClassList()
- .get(iidx)
- .setUsage(
- org.tianocore.UsageTypes.ALWAYS_CONSUMED);
- }
- if (((mergeUsage.contains("TO_START")) && (leafUsage
- .contains("TO_START"))))
- anotherLC = FOUND;
- if (((mergeUsage.contains("BY_START")) && (leafUsage
- .contains("BY_START"))))
- anotherLC = FOUND;
- }
- }
- if (anotherLC == NOTFOUND) {
- // we need to add the leaf Library Class
- libClassDefs.addNewLibraryClass();
- libClassDefs
- .setLibraryClassArray(
- libraryClassIndex++,
- leafLibClassDef
- .getLibraryClassList()
- .get(index));
- }
- }
-
- // Both Usage types are PRODUCED
- if (checkUsage().trim().contains("PRODUCED")) {
- libClassDefs.getLibraryClassList().get(nidx)
- .setUsage(org.tianocore.UsageTypes.ALWAYS_PRODUCED);
- }
- // Both Usage types are CONSUMED
- if (checkUsage().trim().contains("CONSUMED")) {
- libClassDefs.getLibraryClassList().get(nidx)
- .setUsage(org.tianocore.UsageTypes.ALWAYS_CONSUMED);
- }
- }
- // Usage testing completed
- // Check SupArchList
- String mergeSupArchList = "";
- if (libClassDefs.getLibraryClassList().get(nidx).getSupArchList() != null)
- mergeSupArchList = libClassDefs.getLibraryClassList().get(nidx)
- .getSupArchList().toString().trim();
- if (!mergeSupArchList.equalsIgnoreCase(leafSupArchList)) {
- System.out
- .println("ERROR: Library Class, keyword: " + leafKeyword
- + " defines a different set of supported architectures.");
- System.out
- .println("Version 0.1 of the merge tool requires that they must be identical!");
- System.out.println("First instance of the Library used: "
- + mergeSupArchList);
- System.out.println("While this module, " + leafFilename + " uses: "
- + leafSupArchList);
- System.out.println("Merge ABORTED!");
- System.exit(FAIL);
- }
- // Architecture Testing completed
- // Check SupModuleType
- String mergeSupModuleList = "";
- if (libClassDefs.getLibraryClassList().get(nidx).getSupModuleList() != null)
- mergeSupModuleList = libClassDefs.getLibraryClassList().get(nidx)
- .getSupModuleList().toString().trim();
- if (!mergeSupModuleList.equalsIgnoreCase(leafSupModuleList)) {
- System.out.println("ERROR: Library Class, keyword: " + leafKeyword
- + " defines a different set of supported modules.");
- System.out
- .println("Version 0.1 of the merge tool requires that they must be identical!");
- System.out.println("First instance of the Library used: "
- + mergeSupModuleList);
- System.out.println("While this module, " + leafFilename + " uses: "
- + leafSupModuleList);
- System.out.println("Merge ABORTED!");
- System.exit(FAIL);
- }
- // Supported Module Testing completed
- // Check FeatureFlage
- // Next version, not this one.
- }
- } // end of processing of duplicate Library Class entries
- } // end duplicate entry
- } // end of test loop for duplicates
- } // endif Merge Module LibraryModuleDefinitions existed
- } // endif of LibraryModuleDefinition Tests
-
- if (leafMsa.isSetSourceFiles()) {
- // TODO: test for NULL settings
- // Add Sourcefiles to the Merge Module. NOTE: ONLY MODIFY THE Filename, prepending the path to the MSA file.
- // First get the path portion of the leafMSA file, which will be prepended to the filename
- // everything else stays intact.
- if (mergeSourceFiles == null)
- mergeSourceFiles = SourceFilesDocument.Factory.newInstance().addNewSourceFiles();
-
- String pathToMsa = getPathPartOfLeafMsa(leafFilename);
- if (DEBUG > 10)
- System.out.println("PATH TO SOURCE FILES: " + pathToMsa);
- if (leafMsa.getSourceFiles().getFilenameList() != null) {
- List<FilenameDocument.Filename> leafSourceFiles = leafMsa.getSourceFiles().getFilenameList();
- for (int index = 0; index < leafSourceFiles.size(); index++) {
- String leafFile = leafSourceFiles.get(index).getStringValue().toString();
- leafFile = pathToMsa + leafFile;
- leafSourceFiles.get(index).setStringValue(leafFile);
- mergeSourceFiles.addNewFilename();
- mergeSourceFiles.setFilenameArray(sourceFileIndex++, leafSourceFiles.get(index));
- }
- }
- }
-
- if (leafMsa.isSetPackageDependencies()) {
- //
- // If mergePackageDependencies == null, create a new mergePackageDependencies and
- // add the leaf module's Package Dependencies section to the merge Module's
- // If mergePackageDependencies != null, test the leaf Package entries against
- // what has already been added to the mergePackageDependencies data structure.
- //
- // Add Unique Package entries.
- // For this Merge Tool a Package is defined as PackageGuid
- //
- // ABORT THE MERGE WITH FAIL if the PACKAGE VERSION NUMBERS ARE DIFFERENT
- // between Leaf modules
- //
- // Version 0.1 of the tool
- // SupArchList, if it exists, must be identical for all Leaf Modules
- // Probable Enhancement
- // Just specify the lowest common denominator
- //
- // Create the working copy if one does not exist!
- // TODO: CODE GOES HERE
- if (mergePackageDependencies == null)
- mergePackageDependencies = PackageDependenciesDocument.Factory.newInstance()
- .addNewPackageDependencies();
-
- PackageDependencies leafPackageDependencies = leafMsa.getPackageDependencies();
- if (leafPackageDependencies.sizeOfPackageArray() > 0) {
- for (int index = 0; index < leafPackageDependencies.sizeOfPackageArray(); index++) {
- String packageGuid = leafPackageDependencies.getPackageArray(index).getPackageGuid();
- String test = checkDuplicateStrings(packageGuid, aPackageList);
- if (test.length() > 0) {
- mergePackageDependencies.addNewPackage();
- mergePackageDependencies
- .setPackageArray(packageDependenciesIndex++,
- leafPackageDependencies.getPackageArray(index));
- }
- }
- }
- } // endif PackageDependencies
-
- if (leafMsa.isSetProtocols()) {
- // TODO:
- // TEST FOR NULL SETTINGS so we don't get an error!
- // Add Usage Merging routines
- //
- // If mergeProtocols == null, create a new mergeProtocols and add
- // leaf module's Protocols section to the merge Module's
- //
- // Keep ALL Protocol entries before ProtocolNotify entries!
- //
- // If mergeProtocols != null, check that we have only unique Protocol and ProtocolNotify entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the Protocol or ProtocolNotify as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the Protocol or ProtocolNotify as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique Protocol or ProtocolNotify Entry, otherwise fail the Merge
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
-
- if (mergeProtocols == null)
- mergeProtocols = ProtocolsDocument.Factory.newInstance().addNewProtocols();
-
- Protocols leafProtocols = leafMsa.getProtocols();
- // Handle Protocol Entries First
- if (leafProtocols.sizeOfProtocolArray() > 0) {
- for (int index = 0; index < leafProtocols.sizeOfProtocolArray(); index++) {
- String protocolCName = leafProtocols.getProtocolArray(index).getProtocolCName();
- String test = checkDuplicateStrings(protocolCName, aProtocolList);
- if (test.length() > 0) {
- // new Protocol
- mergeProtocols.addNewProtocol();
- mergeProtocols.setProtocolArray(protocolIndex++, leafProtocols.getProtocolArray(index));
- } else {
- // Found an existing protocol
- leafUsage = leafProtocols.getProtocolArray(index).getUsage().toString().trim();
- for (int nidx = 0; nidx < protocolIndex; nidx++) {
- if (mergeProtocols.getProtocolArray(nidx).getProtocolCName()
- .contains(protocolCName)) {
- // Found one entry that matches.
- mergeUsage = mergeProtocols.getProtocolArray(nidx).getUsage().toString().trim();
- if (!mergeUsage.contentEquals(leafUsage)) {
- // Usages are different
- if (checkUsage().trim().contains("DIFFERENT")) {
- // We need to check to see if there's another entry
- int anotherProtocol = NOTFOUND;
- for (int iidx = nidx + 1; iidx < protocolIndex; iidx++) {
-
- if (mergeProtocols.getProtocolArray(iidx).getUsage().toString()
- .trim().contains(protocolCName)) {
- anotherProtocol = FOUND;
- mergeUsage = libClassDefs.getLibraryClassList().get(iidx)
- .getUsage().toString().trim();
- if (checkProduced()) {
- mergeProtocols
- .getProtocolArray(nidx)
- .setUsage(
- org.tianocore.UsageTypes.ALWAYS_PRODUCED);
- anotherProtocol = FOUND;
- }
- // Both Usage types are CONSUMED
- if (checkConsumed()) {
- mergeProtocols
- .getProtocolArray(nidx)
- .setUsage(
- org.tianocore.UsageTypes.ALWAYS_CONSUMED);
- anotherProtocol = FOUND;
- }
- if (((mergeUsage.contains("TO_START")) && (leafUsage
- .contains("TO_START"))))
- anotherProtocol = FOUND;
- if (((mergeUsage.contains("BY_START")) && (leafUsage
- .contains("BY_START"))))
- anotherProtocol = FOUND;
- }
- }
- if (anotherProtocol == NOTFOUND) {
- mergeProtocols.addNewProtocol();
- mergeProtocols
- .setProtocolArray(
- protocolIndex++,
- leafProtocols
- .getProtocolArray(index));
- }
- } else {
- // usage types are either both PRODUCED or CONSUMED
- if (checkProduced())
- mergeProtocols.getProtocolArray(nidx)
- .setUsage(org.tianocore.UsageTypes.ALWAYS_PRODUCED);
- if (checkConsumed())
- mergeProtocols.getProtocolArray(nidx)
- .setUsage(org.tianocore.UsageTypes.ALWAYS_CONSUMED);
- }
- }
- }
- } // end of Usage Test
- }
- }
- }
-
- // Handle ProtocolNotify Entries Second
- if (leafProtocols.sizeOfProtocolNotifyArray() > 0) {
- for (int index = 0; index < leafProtocols.sizeOfProtocolNotifyArray(); index++) {
- String protocolNotifyCName = leafProtocols.getProtocolNotifyArray(index)
- .getProtocolNotifyCName();
- String test = checkDuplicateStrings(protocolNotifyCName, aProtocolNotifyList);
- if (test.length() > 0) {
- mergeProtocols.addNewProtocolNotify();
- mergeProtocols.setProtocolNotifyArray(protocolNotifyIndex++,
- leafProtocols.getProtocolNotifyArray(index));
- } else {
- // We have an existing ProtocolNotify Entry
- leafUsage = leafProtocols.getProtocolNotifyArray(index).getUsage().toString().trim();
- for (int nidx = 0; nidx < protocolIndex; nidx++) {
- if (mergeProtocols.getProtocolNotifyArray(nidx).getProtocolNotifyCName()
- .contains(protocolNotifyCName)) {
- // Found one entry that matches.
- mergeUsage = mergeProtocols.getProtocolNotifyArray(nidx).getUsage().toString().trim();
- if (!mergeUsage.contentEquals(leafUsage)) {
- // Usages are different
- if (checkUsage().trim().contains("DIFFERENT")) {
- // We need to check to see if there's another entry
- int anotherProtocol = NOTFOUND;
- for (int iidx = nidx + 1; iidx < protocolIndex; iidx++) {
-
- if (mergeProtocols.getProtocolNotifyArray(iidx).getUsage().toString()
- .trim().contains(protocolNotifyCName)) {
- anotherProtocol = FOUND;
- mergeUsage = libClassDefs.getLibraryClassList().get(iidx)
- .getUsage().toString().trim();
- if (checkProduced()) {
- mergeProtocols
- .getProtocolNotifyArray(nidx)
- .setUsage(
- org.tianocore.UsageTypes.ALWAYS_PRODUCED);
- anotherProtocol = FOUND;
- }
- // Both Usage types are CONSUMED
- if (checkConsumed()) {
- mergeProtocols
- .getProtocolNotifyArray(nidx)
- .setUsage(
- org.tianocore.UsageTypes.ALWAYS_CONSUMED);
- anotherProtocol = FOUND;
- }
- if (((mergeUsage.contains("TO_START")) && (leafUsage
- .contains("TO_START"))))
- anotherProtocol = FOUND;
- if (((mergeUsage.contains("BY_START")) && (leafUsage
- .contains("BY_START"))))
- anotherProtocol = FOUND;
- }
- }
- if (anotherProtocol == NOTFOUND) {
- mergeProtocols.addNewProtocolNotify();
- mergeProtocols
- .setProtocolNotifyArray(
- protocolNotifyIndex++,
- leafProtocols
- .getProtocolNotifyArray(index));
- }
- } else {
- // usage types are either both PRODUCED or CONSUMED
- if (checkProduced())
- mergeProtocols.getProtocolNotifyArray(nidx)
- .setUsage(org.tianocore.UsageTypes.ALWAYS_PRODUCED);
- if (checkConsumed())
- mergeProtocols.getProtocolNotifyArray(nidx)
- .setUsage(org.tianocore.UsageTypes.ALWAYS_CONSUMED);
- }
- }
- }
- } // end of Usage Test
- } // end of Usage test
- }
- }
-
- } // endif Protocols
-
- if (leafMsa.isSetEvents()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // "Unique" Entries are based on EventsTypes:EventGuidCName attributes
- // NOTE: The EventGuidCName can appear once and only once in a CreateEvents Section
- // The SAME EventGuidCName can appear once and only once in the SignalEvents Section
- // Two EventGuidCName entries, one in CreateEvents the other in SignalEvents IS PERMITTED!
- //
- // If mergeEvents == null, create a new mergeEvents and add
- // leaf module's Events section to the merge Module's
- //
- // Keep ALL CreateEvents entries before SignalEvents entries!
- //
- // If mergeEvents != null, check that we have only unique CreateEvents and SignalEvents entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the CreateEvents.EventTypes or SignalEvents.EventTypes as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the CreateEvents.EventTypes or SignalEvents.EventTypes as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique EventTypes, otherwise fail the Merge
- //
- // The EventTypes.EventType elements must be identical for all instances of
- // the EventGuidCName FAIL THE MERGE WITH ERROR indicating the Leaf file name that
- // was different.
- //
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code goes here
-
- if (mergeCreateEvents == null)
- mergeCreateEvents = EventsDocument.Events.CreateEvents.Factory.newInstance();
-
- Events leafEvents = leafMsa.getEvents();
- if (leafEvents.getCreateEvents() != null) {
- Events.CreateEvents leafCreateEvents = leafEvents.getCreateEvents();
- if (leafCreateEvents.sizeOfEventTypesArray() > 0) {
- for (int index = 0; index < leafCreateEvents.sizeOfEventTypesArray(); index++) {
- String EventGuidCName = leafCreateEvents.getEventTypesArray(index).getEventGuidCName();
- String test = checkDuplicateStrings(EventGuidCName, aCreateEventsList);
- if (test.length() > 0) {
- mergeCreateEvents.addNewEventTypes();
- mergeCreateEvents.setEventTypesArray(createEventIndex++,
- leafEvents.getCreateEvents()
- .getEventTypesArray(index));
-
- }
- }
- }
- }
-
- if (mergeSignalEvents == null)
- mergeSignalEvents = EventsDocument.Events.SignalEvents.Factory.newInstance();
-
- if (leafEvents.getSignalEvents() != null) {
- Events.SignalEvents leafSignalEvents = leafEvents.getSignalEvents();
- if (leafSignalEvents.sizeOfEventTypesArray() > 0) {
- for (int index = 0; index < leafSignalEvents.sizeOfEventTypesArray(); index++) {
- String EventGuidCName = leafSignalEvents.getEventTypesArray(index).getEventGuidCName();
- String test = checkDuplicateStrings(EventGuidCName, aSignalEventsList);
- if (test.length() > 0) {
- mergeSignalEvents.addNewEventTypes();
- mergeSignalEvents.setEventTypesArray(signalEventIndex++,
- leafEvents.getSignalEvents()
- .getEventTypesArray(index));
- }
- }
- }
- }
- } // endif Events
-
- if (leafMsa.isSetHobs()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // "Unique" Entries are based on Hobs.HobTypes:HobGuidCName attribute
- //
- // If mergeHobs == null, create a new mergeHobs and add
- // leaf module's Hobs section to the merge Module's
- //
- //
- // If mergeHobs != null, check that we have only unique Hobs.HobTypes entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the Hobs.HobTypes as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the Hobs.HobTypes as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique HobTypes element, otherwise fail the Merge
- //
- // The HobTypes.HobType elements must be identical for all instances of
- // the HobGuidCName FAIL THE MERGE WITH ERROR indicating the Leaf file name that
- // was different.
- //
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code goes here
- if (mergeHobs == null)
- mergeHobs = HobsDocument.Factory.newInstance().addNewHobs();
-
- Hobs leafHobs = leafMsa.getHobs();
- if (leafHobs.sizeOfHobTypesArray() > 0) {
- for (int index = 0; index < leafHobs.sizeOfHobTypesArray(); index++) {
- String hobGuidCName = leafHobs.getHobTypesArray(index).getHobType().toString();
- String test = checkDuplicateStrings(hobGuidCName, aHobsList);
- if (test.length() > 0) {
- mergeHobs.addNewHobTypes();
- mergeHobs.setHobTypesArray(hobsIndex++, leafHobs.getHobTypesArray(index));
- }
- }
- }
- } // endif Hobs
-
- if (leafMsa.isSetPPIs()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // Keep only Unique Ppi or PpiNotify elements, based on the PpiCName and PpiNotifyCName respectively.
-
- // If mergePpi == null, create a new mergePpi and add
- // leaf module's PPIs section to the merge Module's
- //
- // Keep ALL Ppi entries before PpiNotify entries!
- //
- // If mergePpi != null, check that we have only unique Ppi and PpiNotify entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the Ppi or PpiNotify as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the Ppi or PpiNotify as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique Ppi or PpiNotify Entry, otherwise fail the Merge
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code Goes Here!
- if (mergePpis == null)
- mergePpis = PPIsDocument.Factory.newInstance().addNewPPIs();
-
- PPIs leafPPIs = leafMsa.getPPIs();
- // Handle the PPI Entries First
- if (leafPPIs.sizeOfPpiArray() > 0) {
- for (int index = 0; index < leafPPIs.sizeOfPpiArray(); index++) {
- String ppiCName = leafPPIs.getPpiArray(index).getPpiCName();
- String test = checkDuplicateStrings(ppiCName, aPpiList);
- if (test.length() > 0) {
- mergePpis.addNewPpi();
- mergePpis.setPpiArray(ppiIndex++, leafPPIs.getPpiArray(index));
- }
- }
- }
-
- // Handle the PpiNotify Second
- if (leafPPIs.sizeOfPpiNotifyArray() > 0) {
- for (int index = 0; index < leafPPIs.sizeOfPpiNotifyArray(); index++) {
- String ppiNotifyCName = leafPPIs.getPpiNotifyArray(index).getPpiNotifyCName();
- String test = checkDuplicateStrings(ppiNotifyCName, aPpiNotifyList);
- if (test.length() > 0) {
- mergePpis.addNewPpiNotify();
- mergePpis.setPpiNotifyArray(ppiNotifyIndex++, leafPPIs.getPpiNotifyArray(index));
- }
- }
- }
-
- } // endif Ppis
-
- if (leafMsa.isSetVariables()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // Keep only Unique Variable elements, based on the VariableName element.
- //
- // If mergeVariables == null, create a new mergeVariables and add
- // leaf module's Variables section to the merge Module's
- //
- // If mergeVariables != null, check that we have only unique Variable entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the Variable as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the Variable as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique Variable entry, otherwise fail the Merge
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code Goes Here!
- if (mergeVariables == null)
- mergeVariables = VariablesDocument.Factory.newInstance().addNewVariables();
-
- Variables leafVariables = leafMsa.getVariables();
- if (leafVariables.sizeOfVariableArray() > 0) {
- for (int index = 0; index < leafVariables.sizeOfVariableArray(); index++) {
- String variableGuidCName = leafVariables.getVariableArray(index).getGuidCName();
- String test = checkDuplicateStrings(variableGuidCName, aVariablesList);
- if (test.length() > 0) {
- mergeVariables.addNewVariable();
- mergeVariables
- .setVariableArray(variablesIndex++, leafVariables.getVariableArray(index));
- }
- }
- }
-
- }// endif Variables
-
- if (leafMsa.isSetBootModes()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // Keep only Unique BootMode elements, based on the BootModeName Attribute.
- //
- // If mergeBootModes == null, create a new mergeBootModes and add
- // leaf module's BootModes section to the merge Module's
- //
- // If mergeBootModes != null, check that we have only unique BootMode entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the BootMode as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the BootMode as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique BootMode entry, otherwise fail the Merge
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code Goes Here!
- if (mergeBootModes == null)
- mergeBootModes = BootModesDocument.Factory.newInstance().addNewBootModes();
-
- BootModes leafBootModes = leafMsa.getBootModes();
- if (leafBootModes.sizeOfBootModeArray() > 0) {
- for (int index = 0; index < leafBootModes.sizeOfBootModeArray(); index++) {
- String bootModeName = leafBootModes.getBootModeArray(index).getBootModeName().toString();
- String test = checkDuplicateStrings(bootModeName, aBootModesList);
- if (test.length() > 0) {
- mergeBootModes.addNewBootMode();
- mergeBootModes
- .setBootModeArray(bootModesIndex++, leafBootModes.getBootModeArray(index));
- }
- }
- }
-
- }// endif BootMode
-
- if (leafMsa.isSetSystemTables()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // Keep only Unique SystemTableCNames elements, based on the SystemTableCName element.
- //
- // If mergeSystemTables == null, create a new mergeSystemTables and add
- // leaf module's Variables section to the merge Module's
- //
- // If mergeSystemTables != null, check that we have only unique SystemTableCNames entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the SystemTableCName as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the SystemTableCName as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique SystemTableCNames entry, otherwise fail the Merge
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code Goes Here!
- if (mergeSystemTables == null)
- mergeSystemTables = SystemTablesDocument.Factory.newInstance().addNewSystemTables();
-
- SystemTables leafSystemTables = leafMsa.getSystemTables();
- if (leafSystemTables.sizeOfSystemTableCNamesArray() > 0) {
- for (int index = 0; index < leafSystemTables.sizeOfSystemTableCNamesArray(); index++) {
- String systemTableCName = leafSystemTables.getSystemTableCNamesArray(index)
- .getSystemTableCName();
- String test = checkDuplicateStrings(systemTableCName, aSystemTablesList);
- if (test.length() > 0) {
- mergeSystemTables.addNewSystemTableCNames();
- mergeSystemTables
- .setSystemTableCNamesArray(
- systemTableIndex++,
- leafSystemTables
- .getSystemTableCNamesArray(index));
- }
- }
- }
-
- }// endif SystemTables
-
- if (leafMsa.isSetDataHubs()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // Keep only Unique DataHubs elements, based on the DataHubRecord.DataHubCName element.
- //
- // If mergeDataHubs == null, create a new mergeDataHubs and add
- // leaf module's DataHubs section to the merge Module's
- //
- // If mergeDataHubs != null, check that we have only unique DataHubRecord entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the DataHubCName as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the DataHubCName as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique DataHubRecord entry, otherwise fail the Merge
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code Goes Here!
- if (mergeDataHubs == null)
- mergeDataHubs = DataHubsDocument.Factory.newInstance().addNewDataHubs();
-
- DataHubs leafDataHubs = leafMsa.getDataHubs();
- if (leafDataHubs.sizeOfDataHubRecordArray() > 0) {
- for (int index = 0; index < leafDataHubs.sizeOfDataHubRecordArray(); index++) {
- String dataHubCName = leafDataHubs.getDataHubRecordArray(index).getDataHubCName();
- String test = checkDuplicateStrings(dataHubCName, aDataHubsList);
- if (test.length() > 0) {
- mergeDataHubs.addNewDataHubRecord();
- mergeDataHubs.setDataHubRecordArray(dataHubsIndex++,
- leafDataHubs.getDataHubRecordArray(index));
- }
- }
- }
-
- }// endif DataHubs
-
- if (leafMsa.isSetHiiPackages()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // Keep only Unique HiiPackage elements, based on the HiiPackage.HiiCName element.
- //
- // If mergeHiiPackages == null, create a new mergeHiiPackages and add
- // leaf module's DataHubs section to the merge Module's
- //
- // If mergeHiiPackages != null, check that we have only unique HiiPackage entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the HiiPackage as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the HiiPackage as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique HiiPackage entry, otherwise fail the Merge
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code Goes Here!
- if (mergeHiiPackages == null)
- mergeHiiPackages = HiiPackagesDocument.Factory.newInstance().addNewHiiPackages();
-
- HiiPackages leafHiiPackages = leafMsa.getHiiPackages();
- if (leafHiiPackages.sizeOfHiiPackageArray() > 0) {
- for (int index = 0; index < leafHiiPackages.sizeOfHiiPackageArray(); index++) {
- String hiiCName = leafHiiPackages.getHiiPackageArray(index).getHiiCName();
- String test = checkDuplicateStrings(hiiCName, aHiiPackagesList);
- if (test.length() > 0) {
- mergeHiiPackages.addNewHiiPackage();
- mergeHiiPackages.setHiiPackageArray(hiiPackageIndex++,
- leafHiiPackages.getHiiPackageArray(index));
- }
- }
- }
-
- }// endif HiiPackage
-
- if (leafMsa.isSetGuids()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // Keep only Unique Guids elements, based on the GuidCNames.GuidCName element.
- //
- // If mergeGuids == null, create a new mergeGuids and add
- // leaf module's Guids section to the merge Module's
- //
- // If mergeGuids != null, check that we have only unique GuidCNames entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the GuidCNames as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the GuidCNames as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique GuidCNames entry, otherwise fail the Merge
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code Goes Here!
- if (mergeGuids == null)
- mergeGuids = GuidsDocument.Factory.newInstance().addNewGuids();
-
- Guids leafGuids = leafMsa.getGuids();
- if (leafGuids.sizeOfGuidCNamesArray() > 0) {
- for (int index = 0; index < leafGuids.sizeOfGuidCNamesArray(); index++) {
- String hiiCName = leafGuids.getGuidCNamesArray(index).getGuidCName();
- String test = checkDuplicateStrings(hiiCName, aGuidsList);
- if (test.length() > 0) {
- mergeGuids.addNewGuidCNames();
- mergeGuids.setGuidCNamesArray(guidsIndex++, leafGuids.getGuidCNamesArray(index));
- }
- }
- }
-
- }// endif GuidCNames
-
- if (leafMsa.isSetExterns()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // FAIL THE MERGE if Externs.PcdIsDriver is present
- // FAIL THE MERGE if Externs.TianoR8FlashMap_h is TRUE
- //
- // Keep only Unique Extern elements, based on the Extern.* elements.
- //
- // If mergeExterns == null, create a new mergeExterns and add
- // leaf module's Extern section to the merge Module's
- //
- // If mergeExterns != null, check that we have only unique Extern.* entries
- //
- // After storing the initial LEAF MODULE'S SPECIFICATION SECTION
- // ALL other Leaf Modules must declare the exact same specifications
- // If they do not, FAIL the MERGE with an error message, printing the
- // name of the leaf MSA that did not match, along with
- // Expected: from the merge module's specification list
- // Got: from the leaf file that fails!
- //
- // For Each <Extern>
- // For each pair of <ModuleEntryPoint> and/or <ModuleUnloadImage>
- // The ModuleUnloadImage value must be identical for an identical pair of ModuleEntryPoint values
- // If not, FAIL THE MERGE, giving the current leaf MSA filename as the failure, along with the
- // additional error information as follows:
- // -- leafFilename --
- // ModuleEntryPoint:
- // Expected ModuleUnloadImage: fromMergeModule
- // Got ModuleUnloadImage: fromLeaf
- // Merge Aborted!
- // More than one <Extern> Section with a pair of <ModuleEntryPoint><ModuleUnloadImage> is allowed
- //
- // For each pair of one <Constructor> and/or one <Destructor> elements
- // The <Extern> section containing the <Constructor> <Destructor> pairs
- // The Destructor value in all leaf modules must be identical for all Constructor elements that are identical.
- // More than one <Extern> Section with Constructor/Destructor pair is permitted.
- //
- // For each Set four elements, DriverBinding, ComponentName, DriverConfig and DriverDiag,
- // 1 DriverBinding and
- // 0 or 1 ComponentName and/or
- // 0 or 1 DriverConfig and/or
- // 0 or 1 DriverDiag
- // elements must appear in 1 <Extern> Section.
- //
- // A ComponentName cannot be used without a DriverBinding element.
- // A DriverConfig element cannot appear without a DriverBinding element.
- // A DriverDiag element cannot appear without a DriverBinding element
- // These elements are matched within a single <Extern> Section uniquely defined by the DriverBinding element.
- // Multiple <Extern> sections of this type are permitted.
- //
- // Each pair of SetVirtualAddressMapCallBack and ExitBootServiceCallBack elements MUST
- // BE in one Extern Section. ONE AND ONLY ONE of this section is permitted.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique Extern entry, otherwise fail the Merge
- //
- // Create the working copy if one does not exist!
- // TODO: Code Goes Here!
- if (mergeExterns == null)
- mergeExterns = ExternsDocument.Factory.newInstance().addNewExterns();
-
- Externs leafExterns = leafMsa.getExterns();
- // PCD IS DRIVER NOT ALLOWED IN A MERGED Module
- if (leafExterns.isSetPcdIsDriver()) {
- System.out.println("The Module: " + leafFilename + " is a PCD Driver and CANNOT BE MERGED!");
- System.out.println("Merge Aborted");
- System.err.flush();
- System.exit(FAIL);
- }
-
- // TIANO R8 FLASHMAP.H NOT ALLOWED IN A MERGED Module
- if (leafExterns.isSetTianoR8FlashMapH()) {
- System.out.println("The Module: " + leafFilename
- + " set the Tiano R8 FlashMap.h Flag and CANNOT BE MERGED!");
- System.out.println("Merge Aborted");
- System.err.flush();
- System.exit(FAIL);
- }
-
- // Add the Specification Array, one time only.
- if (leafExterns.sizeOfSpecificationArray() > 0) {
- for (int index = 0; index < leafExterns.sizeOfSpecificationArray(); index++) {
- String spec = leafExterns.getSpecificationArray(index);
- String test = checkSpecs(spec, leafFilename, aSpecArray);
- if (test.length() > 0) {
- mergeExterns.addNewSpecification();
- mergeExterns.setSpecificationArray(specIndex++, test);
- }
- }
- }
-
- if (leafExterns.sizeOfExternArray() > 0) {
- for (int index = 0; index < leafExterns.sizeOfExternArray(); index++) {
- String test = "";
- if (leafExterns.getExternArray(index).isSetModuleEntryPoint()) {
- // ModuleEntryPoint, if an Unload Image is paired with
- // the Module Entry point, it will piggy back on the
- // Module Entry Point Extern
- String moduleEntryPoint = leafExterns.getExternArray(index).getModuleEntryPoint();
- test = checkDuplicateStrings(moduleEntryPoint, aEntryPointList);
-
- } else if (leafExterns.getExternArray(index).isSetModuleUnloadImage()) {
- // Module Unload Image is here in case there is no
- // Entry Point - not very typical
- String moduleUnloadImage = leafExterns.getExternArray(index).getModuleUnloadImage();
- test = checkDuplicateStrings(moduleUnloadImage, aUnloadImageList);
-
- } else if (leafExterns.getExternArray(index).isSetConstructor()) {
- // Constructors must be unique, if a Destructor is
- // paired with a constructor, it will pigback on
- // the constructor
- String constructor = leafExterns.getExternArray(index).getConstructor();
- test = checkDuplicateStrings(constructor, aConstructorList);
-
- } else if (leafExterns.getExternArray(index).isSetDestructor()) {
- // Destructors must be unique
- String destructor = leafExterns.getExternArray(index).getDestructor();
- test = checkDuplicateStrings(destructor, aDestructorList);
-
- } else if (leafExterns.getExternArray(index).isSetDriverBinding()) {
- // Driver Bindings must be unique
- // Fixed the MSA files - ComponentName, Driver Config and
- // Driver Diag statments must be inside of an Extern that
- // has a Driver Binding
- String driverBinding = leafExterns.getExternArray(index).getDriverBinding();
- test = checkDuplicateStrings(driverBinding, aDriverBindingList);
-
- } else if (leafExterns.getExternArray(index).isSetSetVirtualAddressMapCallBack()) {
- // Handle Virtual Address Map and Exit Boot Services Call Backs
- // in a single Extern if they are present
- String virtualAddressMap = leafExterns.getExternArray(index)
- .getSetVirtualAddressMapCallBack();
- test = checkDuplicateStrings(virtualAddressMap, aVirtualAddressMapList);
-
- } else if (leafExterns.getExternArray(index).isSetExitBootServicesCallBack()) {
- // Handle a stand alone Exit Boot Services Call Back
- String exitBootServices = leafExterns.getExternArray(index)
- .getExitBootServicesCallBack();
- test = checkDuplicateStrings(exitBootServices, aExitBootServicesList);
- } else {
- // Unknown Extern FAIL - May be an invalid Component Name in it's own Extern Statement
- System.out.println("Unknown EXTERN defined in Module: " + leafFilename);
- System.out.println("Value: " + leafExterns.getExternArray(index).toString());
- System.out.println("Merge Aborted!");
- System.err.flush();
- System.exit(FAIL);
- }
-
- if (test.length() > 0) {
- mergeExterns.addNewExtern();
- mergeExterns.setExternArray(externsIndex++, leafExterns.getExternArray(index));
- }
- }
- }
- }// endif mergeExterns
-
- if (leafMsa.isSetPcdCoded()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // Keep only Unique PcdCoded elements, based on the PcdCoded.PcdEntry.C_Name element.
- //
- // If mergePcdCoded == null, create a new mergePcdCoded and add
- // leaf module's PcdCoded section to the merge Module's
- //
- // If mergePcdCoded != null, check that we have only unique PcdEntry entries
- // IF one Leaf usage is SOMETIMES_PRODUCED, and another Leaf usage is ALWAYS_PRODUCED,
- // Mark the PcdEntry as ALWAYS_PRODUCED
- // IF one Leaf usage is SOMETIMES_CONSUMED, and another Leaf usage is ALWAYS_CONSUMED,
- // Mark the PcdEntry as ALWAYS_CONSUMED
- // It is permissable to have one PRODUCED and one CONSUMED entry
- // TO_START and BY_START cannot be combined in any fashion, if one Leaf uses TO_START
- // and another Leaf uses BY_START, create two entries, one for each.
- //
- // First PASS of the TOOL
- // SupArchList must be identical for all Leaf Modules! Fail the Merge if not, reporting
- // this as an error!
- // Probable Enhancement
- // The SupArchList, if set, must be for the "Lowest Common Denominator"
- //
- // First PASS of the TOOL
- // Ignore the FeatureFlag - we are not using it now.
- // Probable Enhancement
- // FeatureFlags must be identical for each unique HiiPackage entry, otherwise fail the Merge
- //
- // First PASS of the TOOL
- // Ignore the PcdEntry:Usage Attribute
- // Probable Enhancment
- // Have Usage Combined like was done for the Library Class
- //
- // First PASS of the TOOL
- // If Different PcdItemTypes, Abort The MERGE
- //
- // Probably Enhancement
- // The PcdItemType Should be checked using the following rules
- // Feature Flag MUST ALWAYS BE A FEATURE FLAG
- // If different Item Types occur, mark the PCD as DYNAMIC
- //
- // HelpText RULE:
- // HelpText should be concatenated with a line -- leafFilename -- separator, where leafFilename
- // is the leaf Module's path and filename to the MSA file!
- //
- // Create the working copy if one does not exist!
- // TODO: Code Goes Here!
- if (mergePcdCoded == null)
- mergePcdCoded = PcdCodedDocument.Factory.newInstance().addNewPcdCoded();
-
- PcdCoded leafPcdCoded = leafMsa.getPcdCoded();
- if (leafPcdCoded.sizeOfPcdEntryArray() > 0) {
- for (int index = 0; index < leafPcdCoded.sizeOfPcdEntryArray(); index++) {
- String pcdCName = leafPcdCoded.getPcdEntryArray(index).getCName();
- String pcdItemType = leafPcdCoded.getPcdEntryArray(index).getPcdItemType().toString();
- String test = checkPcd(pcdCName, pcdItemType, leafFilename, aPcdCNameList);
- if (test.length() > 0) {
- mergePcdCoded.addNewPcdEntry();
- mergePcdCoded.setPcdEntryArray(pcdIndex++, leafPcdCoded.getPcdEntryArray(index));
- }
- }
- }
-
- }// endif PcdCoded
-
- if (leafMsa.isSetModuleBuildOptions()) {
- // TODO: TEST FOR NULL SETTINGS so we don't get an error!
- //
- // Any element that appear within a leaf's ModuleBuildOptions should be appended to
- // the Merge Module's BuildOptions section.
- //
- // NO ATTEMPT IS MADE TO VERIFY UNIQUENESS ON ANYTHING WITHIN THIS SECTION!
- //
- // Create the working copy if one does not exist!
- // if (mergeBuildOptions == null)
- // mergeBuildOptions = ModuleBuildOptionsDocument.Factory.newInstance().addNewModuleBuildOptions();
-
- // ModuleBuildOptions leafModuleBuildOptions = leafMsa.getModuleBuildOptions();
-
- // mergeBuildOptions.addNewModuleBuildOptions();
- // mergeBuildOptions.setModuleBuildOptions(leafModuleBuildOptions);
-
- //
- // TODO: Code Goes Here!
- } // endif ModuleBuildOptions
-
- // Need to process any UserExtensions here too.
- if (leafMsa.getUserExtensionsList() != null) {
-
- if (mergeUserExtensions == null)
- mergeUserExtensions = UserExtensionsDocument.Factory.newInstance().addNewUserExtensions();
-
- // for (int index = 0; index < leafMsa.getUserExtensionsList().size(); index++)
-
- }
-
- } // Completed parsing all leaf files.
-
- header.setAbstract(Abstract);
- header.setCopyright(Copyright);
- header.setDescription(Description);
- License mLicense = License.Factory.newInstance();
- mLicense.setStringValue(licenseTxt);
- header.setLicense(mLicense);
- if ((DEBUG > 0) || (VERBOSE > 0))
- System.out.println("Merged Module supports: " + sArchitectures + " architectures.");
- List<String> lArchitectures = new ArrayList<String>();
- String s[] = sArchitectures.replace(" ", " ").trim().split(" ");
- for (int idx = 0; idx < s.length; idx++) {
- lArchitectures.add(s[idx]);
- if (DEBUG > 7)
- System.out.println("Adding architecture: " + s[idx]);
- }
- moduleDefs.setSupportedArchitectures(lArchitectures);
-
- } // endif mergeMsaFile == null
-
- if ((uiName != null) && (uiName.length() > 0) && (result == PASS)) {
- // TODO: Stub for replacing the msaFile UiName
- if ((DEBUG > 0) || (VERBOSE > 0))
- System.out.println("Updating the uiName: " + uiName);
- header.setModuleName(uiName);
- }
-
- if ((baseName != null) && (baseName.length() > 0) && (result == PASS)) {
- if ((DEBUG > 0) || (VERBOSE > 0))
- System.out.println("Setting the Output Filename:" + baseName);
- moduleDefs.setOutputFileBasename(baseName);
- }
-
- if (result == PASS) {
- // TODO: Stub to write out the new MSA file
- File outMsa = new File(msaFilename);
- try {
- if (DEBUG > 2)
- System.out.println("SAVING new MSA FILE: " + msaFilename);
-
- mergeMsaFile.setMsaHeader(header);
- mergeMsaFile.setModuleDefinitions(moduleDefs);
- // ALL THE REST OF THE SECTIONS ARE OPTIONAL
- // SO check that they are not null before adding them to the merged MSA file!
- if (libClassDefs != null)
- mergeMsaFile.setLibraryClassDefinitions(libClassDefs);
- if (mergeSourceFiles != null)
- mergeMsaFile.setSourceFiles(mergeSourceFiles);
- if (mergePackageDependencies != null)
- mergeMsaFile.setPackageDependencies(mergePackageDependencies);
- if (mergeProtocols != null)
- mergeMsaFile.setProtocols(mergeProtocols);
-
- if ((mergeCreateEvents != null) || (mergeSignalEvents != null)) {
- if (mergeEvents == null)
- mergeEvents = EventsDocument.Factory.newInstance().addNewEvents();
-
- if (mergeCreateEvents.getEventTypesList().size() > 0) {
- mergeEvents.addNewCreateEvents();
- mergeEvents.setCreateEvents(mergeCreateEvents);
- }
- if (mergeSignalEvents.getEventTypesList().size() > 0) {
- mergeEvents.addNewSignalEvents();
- mergeEvents.setSignalEvents(mergeSignalEvents);
- }
-
- mergeMsaFile.setEvents(mergeEvents);
- }
-
- if (mergeHobs != null)
- mergeMsaFile.setHobs(mergeHobs);
-
- if (mergePpis != null)
- mergeMsaFile.setPPIs(mergePpis);
-
- if (mergeVariables != null)
- mergeMsaFile.setVariables(mergeVariables);
-
- if (mergeBootModes != null)
- mergeMsaFile.setBootModes(mergeBootModes);
-
- if (mergeSystemTables != null)
- mergeMsaFile.setSystemTables(mergeSystemTables);
-
- if (mergeDataHubs != null)
- mergeMsaFile.setDataHubs(mergeDataHubs);
-
- if (mergeHiiPackages != null)
- mergeMsaFile.setHiiPackages(mergeHiiPackages);
-
- if (mergeGuids != null)
- mergeMsaFile.setGuids(mergeGuids);
-
- if (mergeExterns != null)
- mergeMsaFile.setExterns(mergeExterns);
-
- if (mergePcdCoded != null)
- mergeMsaFile.setPcdCoded(mergePcdCoded);
-
- XmlCursor cursor = XmlConfig.setupXmlCursor(mergeMsaFile.newCursor());
- XmlOptions options = XmlConfig.setupXmlOptions();
- ModuleSurfaceAreaDocument msaDoc = ModuleSurfaceAreaDocument.Factory.newInstance();
- msaDoc.addNewModuleSurfaceArea();
- msaDoc.setModuleSurfaceArea(mergeMsaFile);
- msaDoc.save(outMsa, options);
- System.out.println("The Merged MSA file: " + msaFilename + ", has been created!");
- } catch (IOException e) {
- System.out.println("Problem writing the output file: " + msaFilename + " " + e);
- result = FAIL;
- }
- }
-
- if ((spdFilename != null) && (result == PASS)) {
- // TODO: Stub for adding the msaFile to the <MsaFiles><Filename> in the spdFile
- String msaLine = getPathFromSpd(spdFilename, msaFilename);
- System.out.println("Updating the SPD file (" + spdFilename + ") with: " + msaLine);
- try {
- File spdFile = new File(spdFilename);
- PackageSurfaceAreaDocument spdDoc = PackageSurfaceAreaDocument.Factory.parse(spdFile);
- PackageSurfaceArea spd = spdDoc.getPackageSurfaceArea();
-
- List<String> msaFilenames = spd.getMsaFiles().getFilenameList();
- msaFilenames.add(msaLine);
- XmlCursor cursor = XmlConfig.setupXmlCursor(spd.newCursor());
- XmlOptions options = XmlConfig.setupXmlOptions();
- spdDoc.save(spdFile, options);
- } catch (IOException e) {
- System.out.println("I/O Exception on spd file: " + spdFilename + " " + e);
- } catch (XmlException x) {
- System.out.println("XML Exception on SPD file: " + spdFilename + " " + x);
- }
- } else if ((spdFilename == null) && (result == PASS)) {
-
- System.out.println("The file: " + msaFilename + ", must be added to a package file before it can be used!");
- }
- return result;
- }
-
- public ModuleSurfaceArea getLeafFile(String filename) {
- File leafMsaFile = new File(filename);
- if ((DEBUG > 1) || (VERBOSE > 1))
- System.out.println("Processing MSA File: " + filename);
- try {
- leafMsa = ModuleSurfaceAreaDocument.Factory.parse(leafMsaFile).getModuleSurfaceArea();
- if ((DEBUG > 4) || (VERBOSE > 4))
- System.out.println("Binary: " + leafMsa.getModuleDefinitions().getBinaryModule());
- if (leafMsa.getModuleDefinitions().getBinaryModule()) {
- System.out.println("ERROR: Binary Module was specified in MSA: " + filename);
- System.out.println("Merge Aborted!");
- System.err.flush();
- return null;
- }
- } catch (IOException e) {
- System.out.println("I/O Exception on filename: " + filename + " " + e);
- System.out.println("Merge Aborted!");
- System.err.flush();
- System.exit(FAIL);
- } catch (XmlException x) {
- System.out.println("XML Exception reading file: " + filename + " " + x);
- System.out.println("Merge Aborted!");
- System.err.flush();
- System.exit(FAIL);
- }
- return leafMsa;
- }
-
- private String getPathFromSpd(String spdFn, String msaFn) {
- String path2Msa = null;
-
- spdFn = spdFn.replace("\\", "/").trim();
- String s[] = spdFn.split("/");
- String justSpdFilename = s[s.length - 1];
-
- String Cwd = System.getProperty("user.dir");
- Cwd = Cwd.replace("\\", "/").trim();
- if ((DEBUG > 10) || (VERBOSE > 10)) {
- System.out.println("Current directory = " + Cwd);
- }
- String sp[] = Cwd.split("/");
- int theDirectory = sp.length - (s.length - 1);
- if (DEBUG > 10)
- System.out.println("The Directory length: " + theDirectory + " s.length: " + s.length + " sp.length: "
- + (sp.length - 1));
-
- String path2Spd = "";
- for (int ictr = 0; ictr < theDirectory; ictr++) {
- path2Spd += sp[ictr] + "/";
- if (DEBUG > 10)
- System.out.println("Creating path to SPD file: " + path2Spd);
- }
-
- String testPath2Spd = path2Spd + justSpdFilename;
-
- File tFile = new File(testPath2Spd);
- if (!tFile.exists()) {
- System.out.println("The specified SPD file, " + spdFn + " does not exist at: " + testPath2Spd);
- System.out.println("Please use the FrameworkWizard to add this MSA file to the package.");
- System.exit(FAIL);
- }
- if (path2Spd.equals(Cwd + "/"))
- {
- // .msa file and .spd in the same directory
- path2Msa = msaFn;
- }
- else
- {
- path2Msa = Cwd.replace(path2Spd, "");
- path2Msa = path2Msa + "/" + msaFn;
- }
-
- return path2Msa;
- }
-
- private String checkDuplicateStrings(String aString, ArrayList<String> aList) {
-
- for (int lctr = 0; lctr < aList.size(); lctr++) {
- if (DEBUG > 8)
- System.out.println("Comparing: \n" + aString.replace(" ", "").replace("\n", "") + "\nTo: \n"
- + aList.get(lctr).replace(" ", "").replace("\n", "").toString().trim());
- if (aString.replace(" ", "").replace("\n", "").contains(
- aList.get(lctr).replace(" ", "").replace("\n", "")
- .toString().trim())) {
- if ((DEBUG > 3) || (VERBOSE > 3))
- System.out.println("Found a duplicate String, skipping!");
- return "";
- }
- }
- if ((DEBUG > 3) || (VERBOSE > 3))
- System.out.println("Returning UNIQUE String!\n " + aString);
- aList.add(aString);
- return aString;
- }
-
- private String checkSpecs(String specName, String filename, ArrayList<String> aList) {
- // Check Specifications
- // Skip of Specs are identical
- String spec[] = new String[2];
- spec = specName.replace(" ", " ").trim().split(" ");
- String specInMem[] = new String[2];
- if ((DEBUG > 10) || (VERBOSE > 10))
- System.out.println("Specification: " + specName);
-
- for (int lctr = 0; lctr < aList.size(); lctr++) {
- if (DEBUG > 8)
- System.out.println("Comparing: \n" + specName.replace(" ", "").replace("\n", "") + "\nTo: \n"
- + aList.get(lctr).replace(" ", "").replace("\n", "").toString().trim());
- if (specName.replace(" ", "").replace("\n", "").contains(
- aList.get(lctr).replace(" ", "").replace("\n", "")
- .toString().trim())) {
- if ((DEBUG > 3) || (VERBOSE > 3))
- System.out.println("Found a duplicate String, skipping!");
- return "";
- }
- specInMem = aList.get(lctr).replace(" ", " ").trim().split(" ");
- if (spec[0].contentEquals(specInMem[0])) {
- if (!spec[1].contains(specInMem[1])) {
- System.out.println("Module: " + filename + " is coded to " + specName);
- System.out.println("Merge needs to be coded to: " + aList.get(lctr));
- System.out.println("Merge Aborted!");
- System.err.flush();
- System.exit(FAIL);
- }
- }
-
- }
- if ((DEBUG > 3) || (VERBOSE > 3))
- System.out.println("Returning Specification: " + specName);
- aList.add(specName);
- return specName;
- }
-
- private String checkPcd(String pcdName, String itemType, String filename, ArrayList<String> aList) {
-
- for (int lctr = 0; lctr < aList.size(); lctr++) {
- if (DEBUG > 8)
- System.out.println("Comparing: \n" + pcdName.replace(" ", "").replace("\n", "") + "\nTo: \n"
- + aList.get(lctr).replace(" ", "").replace("\n", "").toString().trim());
- if (pcdName.replace(" ", "").replace("\n", "").contains(
- aList.get(lctr).replace(" ", "").replace("\n", "")
- .toString().trim())) {
- if (!aPcdItemTypeList.get(lctr).contains(itemType)) {
- System.out
- .println("The Pcd Item Type for " + pcdName + " in file: " + filename + "does not match!");
- System.out.println("Expected: " + aPcdItemTypeList.get(lctr));
- System.out.println("Was set to: " + itemType);
- System.out.println("Merge Aborted!");
- System.err.flush();
- System.exit(FAIL);
- }
- if ((DEBUG > 3) || (VERBOSE > 3))
- System.out.println("Found a duplicate String, skipping!");
- return "";
- }
- }
- if ((DEBUG > 3) || (VERBOSE > 3))
- System.out.println("Returning UNIQUE String!\n " + pcdName);
- aPcdItemTypeList.add(itemType);
- aList.add(pcdName);
- return pcdName;
- }
-
- private String checkUsage() {
- String result = "";
- // Usage types are different
- if (((mergeUsage.contains("CONSUMED")) && (leafUsage.contains("PRODUCED")))
- || ((mergeUsage.contains("PRODUCED")) && (leafUsage.contains("CONSUMED")))
- || ((mergeUsage.contains("TO_START")) && (leafUsage.contains("BY_START")))
- || ((mergeUsage.contains("BY_START")) && (leafUsage.contains("TO_START")))) {
- result = "DIFFERENT";
- }
- // Both Usage types are PRODUCED
- if (((mergeUsage.contains("ALWAYS_PRODUCED")) && (leafUsage.contains("SOMETIMES_PRODUCED")))
- || ((mergeUsage.contains("SOMETIMES_PRODUCED")) && (leafUsage.contains("ALWAYS_PRODUCED")))) {
- result = "PRODUCED";
- }
-
- // Both Usage types are CONSUMED
- if (((mergeUsage.contains("ALWAYS_CONSUMED")) && (leafUsage.contains("SOMETIMES_CONSUMED")))
- || ((mergeUsage.contains("SOMETIMES_CONSUMED")) && (leafUsage.contains("ALWAYS_CONSUMED")))) {
- result = "CONSUMED";
- }
- return result;
- }
-
- private boolean checkProduced() {
- boolean result = false;
-
- if (((mergeUsage.contains("ALWAYS_PRODUCED")) && (leafUsage.contains("SOMETIMES_PRODUCED")))
- || ((mergeUsage.contains("SOMETIMES_PRODUCED")) && (leafUsage.contains("ALWAYS_PRODUCED")))) {
- result = true;
- }
- return result;
- }
-
- private boolean checkConsumed() {
- boolean result = false;
-
- if (((mergeUsage.contains("ALWAYS_CONSUMED")) && (leafUsage.contains("SOMETIMES_CONSUMED")))
- || ((mergeUsage.contains("SOMETIMES_CONSUMED")) && (leafUsage.contains("ALWAYS_CONSUMED")))) {
- result = true;
- }
- return result;
- }
-
- private String getPathPartOfLeafMsa(String sFilename) {
- String pathName = "";
- String s[] = sFilename.replace("\\", "/").trim().split("/");
- for (int j = 0; j < (s.length - 1); j++) {
- pathName += s[j] + "/";
- }
- return pathName;
- }
-
- private static class XmlConfig {
- public static XmlCursor setupXmlCursor(XmlCursor cursor) {
- String uri = "http://www.TianoCore.org/2006/Edk2.0";
- cursor.push();
- cursor.toNextToken();
- cursor.insertNamespace("", uri);
- cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
- cursor.pop();
- return cursor;
-
- }
-
- public static XmlOptions setupXmlOptions() {
- XmlOptions options = new XmlOptions();
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- return options;
- }
-
- }
-}
diff --git a/Tools/Java/Source/Merge/src/org/tianocore/Merge/Merge.java b/Tools/Java/Source/Merge/src/org/tianocore/Merge/Merge.java
deleted file mode 100644
index 6f727861dc..0000000000
--- a/Tools/Java/Source/Merge/src/org/tianocore/Merge/Merge.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// @file
-// Merge wrapper
-//
-// Copyright (c) 2006, 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.
-//
-
-package org.tianocore.Merge;
-
-public class Merge {
-
- public static void main(String[] args) {
- if (new MergeCmd().MergeCmdLine(args) != 0)
- System.exit(1);
- System.exit(0);
- }
-}
diff --git a/Tools/Java/Source/Merge/src/org/tianocore/Merge/MergeCmd.java b/Tools/Java/Source/Merge/src/org/tianocore/Merge/MergeCmd.java
deleted file mode 100644
index 1e44d2f8c9..0000000000
--- a/Tools/Java/Source/Merge/src/org/tianocore/Merge/MergeCmd.java
+++ /dev/null
@@ -1,211 +0,0 @@
-// @file
-// MergeCmd command-line interface to the classes that combine
-// multiple MSA files into a single MSA file.
-//
-// Copyright (c) 2006, 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.
-//
-// This program is the command line interface to the CombineMsa class, which
-// will take the following arguments:
-//
-// Input:
-// -t Target The MSA file that will be created
-// -u UiName The UiName for the merged MSA OPTIONAL
-// If not provided, the UiName will come from the
-// first leaf MSA file
-// -p Package The SPD file that the new MSA file will be added to. OPTIONAL
-// leaf.msa The path and filename of the MSA files to be merged into the Target.
-//
-// Output:
-// Target.msa
-//
-// Modifies - OPTIONAL
-// Package.spd
-//
-
-package org.tianocore.Merge;
-
-import java.io.*;
-import java.util.*;
-
-// import org.tianocore.Merge.CombineMsa;
-
-public class MergeCmd {
-
- private static int DEBUG = 1;
-
- private static final String copyright = "Copyright (c) 2006, Intel Corporation All rights reserved.";
-
- private static final String version = "Version 0.1";
-
- private int VERBOSE = 0;
-
- private String targetFile = null;
-
- private ArrayList<String> leafFiles = new ArrayList<String>();
-
- private String spdFile = null;
-
- private String uiName = null;
-
- private String fileBasename = null;
-
- private final int ESUCCESS = 0;
-
- private final int EFAILURE = 1;
-
- private final static int FOUND = 1;
-
- private final static int NOTFOUND = 0;
-
- private int result = ESUCCESS;
-
- public int MergeCmdLine(String[] args) {
- result = parseCmdLine(args);
- if (result == ESUCCESS) {
- if ((DEBUG > 7) || (VERBOSE > 5)) {
- System.out.println("Parse Succeeded!");
- System.out.println("CWD: " + System.getProperty("user.dir"));
- System.out.println("Merge Module Name: " + targetFile);
- System.out.println("Found Leaf Module: " + leafFiles.size());
- if (spdFile != null)
- System.out.println("Package Name: " + spdFile);
- if (uiName != null)
- System.out.println("User Interface Name: " + uiName);
- }
- CombineMsa newMsa = new CombineMsa();
- result = newMsa.combineMsaFiles(targetFile, leafFiles, uiName, spdFile, fileBasename, VERBOSE);
- }
- return result;
- }
-
- private int parseCmdLine(String[] args) {
-
- if (args.length == NOTFOUND) {
- outputUsage();
- System.exit(EFAILURE);
- }
-
- for (int i = 0; i < args.length; i++) {
- if (args[i].toLowerCase().contains("-t")) {
- i++;
- targetFile = args[i];
- targetFile.replace(" ", "_");
- if (!targetFile.toLowerCase().contains(".msa"))
- targetFile = targetFile + ".msa";
-
-
- } else if (args[i].toLowerCase().contains("-p")) {
- i++;
- spdFile = args[i];
- if (!spdFile.toLowerCase().contains(".spd"))
- spdFile = spdFile + ".spd";
- spdFile = spdFile.replace("\\", "/").trim();
- if (testFile(spdFile) == NOTFOUND) {
- System.out.println("WARNING: The Package file: " + spdFile + " does NOT exist!");
- System.out.print("Do you want to continue anyway [y|N]? ");
- String inputLine = null;
- try {
- BufferedReader inputString = new BufferedReader(new InputStreamReader(System.in));
- inputLine = inputString.readLine();
- if ((inputLine.length() == 0) || (!inputLine.toLowerCase().contains("y"))) {
- System.out.println("Merge Aborted at user request!");
- System.exit(EFAILURE);
- } else {
- spdFile = null;
- System.out
- .println("Continuing with the Merge. Don't forget to add the new MSA file to a Package.");
- }
- } catch (IOException e) {
- System.out.println("IOException: " + e);
- }
- }
- } else if (args[i].toLowerCase().contains("-u")) {
- i++;
- uiName = args[i];
- } else if (args[i].toLowerCase().contains("-o")) {
- i++;
- fileBasename = args[i];
- } else if (args[i].toLowerCase().contains("-v")) {
- VERBOSE++;
- } else if ((args[i].toLowerCase().contains("-h")) || (args[i].toLowerCase().contains("-?"))
- || (args[i].toLowerCase().contains("/h")) || (args[i].toLowerCase().contains("--help"))) {
- outputUsage();
- System.exit(EFAILURE);
- } else {
- if (args[i].startsWith("-")) {
- System.out.println("Invalid Argument: " + args[i]);
- outputUsage();
- System.out.println("Merge Aborted!");
- System.exit(EFAILURE);
- }
- String leafFile = args[i];
- if (!leafFile.toLowerCase().contains(".msa"))
- leafFile = leafFile + ".msa";
-
- if (testFile(leafFile) == NOTFOUND) {
- System.out.println("ERROR: The Leaf MSA File: " + leafFile + " was NOT FOUND!");
- System.out.println("Merge Aborted!");
- System.exit(EFAILURE);
- } else {
- if (DEBUG > 9)
- System.out.println("Found Leaf Module: " + leafFile);
- leafFiles.add(leafFile);
- }
- }
- }
- if (testFile(targetFile) == FOUND) {
- System.out.println("WARNING: The targetfile: " + targetFile + "Already Exists!");
- System.out.print("Do you want to over write it [y|N]? ");
- String inputLine = null;
- try {
- BufferedReader inputString = new BufferedReader(new InputStreamReader(System.in));
- inputLine = inputString.readLine();
- if ((inputLine.length() == 0) || (!inputLine.toLowerCase().contains("y"))) {
- System.out.println("Please correct the options, then try again.");
- System.out.println("Merge Aborted at user request!");
- System.exit(EFAILURE);
- }
- } catch (IOException e) {
- System.out.println("IOException: " + e);
- }
-
- }
- return ESUCCESS;
- }
-
- private static int testFile(String Filename) {
- File tFile = new File(Filename);
- if (DEBUG > 8)
- System.out.println("File is located: " + tFile.getPath());
- if (tFile.exists())
- return FOUND;
- else
- return NOTFOUND;
- }
-
- private static void outputUsage() {
-
-
- System.out.println("Merge, " + version);
- System.out.println(copyright);
- System.out.println("Usage:");
- System.out.println(" merge [-v] -t target [-u UiName] [-p PackageFile] dir1" + File.separator + "leaf1 ... dirN" + File.separator + "leafN [-h | -? | --help]");
- System.out.println(" where:");
- System.out.println(" -h | -? | --help OPTIONAL - This Help Text");
- System.out.println(" -t Target REQUIRED - The Name of the new Merge Module MSA file");
- System.out.println(" -p Package OPTIONAL - The Name of the Package (SPD) file to add the target");
- System.out.println(" -u UiName OPTIONAL - The User Interface Name for the Target Module");
- System.out.println(" -v OPTIONAL - Verbose, print information messages.");
- System.out.println(" -o OutputFileBasename OPTIONAL - Set the Output Filename for this module to Basename");
- System.out.println(" dir1" + File.separator + "leaf1 ... dirN" + File.separator + "leafN REQUIRED The path to two or more MSA files that will be merged");
- System.out.println("");
- }
-}
diff --git a/Tools/Java/Source/MigrationTools/MANIFEST.MF b/Tools/Java/Source/MigrationTools/MANIFEST.MF
deleted file mode 100644
index ae3092ebad..0000000000
--- a/Tools/Java/Source/MigrationTools/MANIFEST.MF
+++ /dev/null
@@ -1,2 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: org.tianocore.migration.MigrationTool
diff --git a/Tools/Java/Source/MigrationTools/MigrationTools.msa b/Tools/Java/Source/MigrationTools/MigrationTools.msa
deleted file mode 100644
index 8160bcc8ba..0000000000
--- a/Tools/Java/Source/MigrationTools/MigrationTools.msa
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
- <MsaHeader>
- <ModuleName>MigrationTools</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>09C77FAE-6374-408e-AB88-32822B92096E</GuidValue>
- <Version>1.0</Version>
- <Abstract>This is the EFI/Tiano Migration Tool Resources Module</Abstract>
- <Description>
- This Module provdes the entity, action and exception package for Migration
- tools, This package will be shared for building tools or wizard tools.
- </Description>
- <Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
- <License>
-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.
- </License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>build.xml</Filename>
- <Filename>org/tianocore/migration/Common.java</Filename>
- <Filename>org/tianocore/migration/Critic.java</Filename>
- <Filename>org/tianocore/migration/Database.java</Filename>
- <Filename>org/tianocore/migration/FirstPanel.java</Filename>
- <Filename>org/tianocore/migration/Func.java</Filename>
- <Filename>org/tianocore/migration/Guid.java</Filename>
- <Filename>org/tianocore/migration/Macro.java</Filename>
- <Filename>org/tianocore/migration/MigrationTool.java</Filename>
- <Filename>org/tianocore/migration/ModuleInfo.java</Filename>
- <Filename>org/tianocore/migration/ModuleReader.java</Filename>
- <Filename>org/tianocore/migration/MsaOwner.java</Filename>
- <Filename>org/tianocore/migration/MsaTreeEditor.java</Filename>
- <Filename>org/tianocore/migration/MsaWriter.java</Filename>
- <Filename>org/tianocore/migration/PathIterator.java</Filename>
- <Filename>org/tianocore/migration/SourceFileReplacer.java</Filename>
- <Filename>org/tianocore/migration/UI.java</Filename>
- </SourceFiles>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/Tools/Java/Source/MigrationTools/build.xml b/Tools/Java/Source/MigrationTools/build.xml
deleted file mode 100644
index ddb4979ea9..0000000000
--- a/Tools/Java/Source/MigrationTools/build.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="MigrationTools" default="MigrationTools" basedir=".">
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
- </path>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/bin"/>
- <target name="MigrationTools" depends="install"/>
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="." destdir="${buildDir}">
- <classpath refid="classpath"/>
- <compilerarg value="-Xlint"/>
- </javac>
- </target>
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false" quiet="true">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/MigrationTools" includes="${buildDir}"/>
- </delete>
- </target>
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: MigrationTools.jar"/>
- <delete file="${installLocation}/MigrationTools.jar"/>
- <if>
- <available file="${installLocation}/MigrationTools.jar"/>
- <then>
- <echo message="You must manually remove the file: ${installLocation}/MigrationTools.jar"/>
- <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
- </then>
- </if>
- </target>
- <target name="install" depends="source">
- <jar destfile="${installLocation}/MigrationTools.jar"
- basedir="${buildDir}"
- includes="**"
- manifest="MANIFEST.MF"
- />
- </target>
-</project>
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Common.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Common.java
deleted file mode 100644
index 3a6f179df8..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Common.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public final class Common {
- public static final int BOTH = 0;
-
- public static final int FILE = 1;
-
- public static final int DIR = 2;
-
- public static final String STRSEPARATER = "(.*)\\\\([^\\\\]*)";
-
- public static final Pattern PTNSEPARATER = Pattern
- .compile("(.*)\\\\([^\\\\]*)");
-
- // -------------------------------------regex------------------------------------------//
-
- public static final String replaceAll(String line, Pattern ptn, String des) {
- Matcher mtr = ptn.matcher(line);
-
- if (mtr.find()) {
- return mtr.replaceAll(des);
- }
-
- return line;
- }
-
- public static final boolean find(String line, String regex) {
- Pattern ptn = Pattern.compile(regex);
-
- return ptn.matcher(line).find();
- }
-
- // -------------------------------------regex------------------------------------------//
-
- // -----------------------------------file&string---------------------------------------//
-
- public static final String file2string(String filename) throws Exception {
- BufferedReader rd = new BufferedReader(new FileReader(filename));
- StringBuffer wholefile = new StringBuffer();
- String line;
- while ((line = rd.readLine()) != null) {
- wholefile.append(line + "\n");
- }
- rd.close();
- return wholefile.toString();
- }
-
- public static final void string2file(String content, String filename)
- throws Exception {
- ensureDir(filename);
- PrintWriter outfile = new PrintWriter(new BufferedWriter(
- new FileWriter(filename)));
- outfile.append(content);
- outfile.flush();
- outfile.close();
- }
-
- public static final void fileCopy(String src, String des) throws Exception {
- string2file(file2string(src), des);
- }
-
- // -----------------------------------file&string---------------------------------------//
-
- // --------------------------------------dir--------------------------------------------//
- /*
- * public static final HashSet<String> walkDir(String path, int mode)
- * throws Exception { HashSet<String> pathlist = new HashSet<String>();
- * Common.toDoAll(path, Common.class.getMethod("walkDir", String.class),
- * null, null, mode); return pathlist; }
- */
- public static final void ensureDir(String objFileWhole) {
- File tempdir;
- Matcher mtrseparate = PTNSEPARATER.matcher(objFileWhole);
- if (mtrseparate.find()) {
- tempdir = new File(mtrseparate.group(1));
- if (!tempdir.exists())
- tempdir.mkdirs();
- }
- }
-
- public static final void deleteDir(String objFileWhole) {
- String[] list = new File(objFileWhole).list();
- File temp;
- for (int i = 0; i < list.length; i++) {
- temp = new File(objFileWhole + File.separator + list[i]);
- if (temp.isDirectory()) {
- deleteDir(objFileWhole + File.separator + list[i]);
- } else {
- temp.delete();
- }
- }
- new File(objFileWhole).delete();
- }
-
- public static final String dirCopy_(String src) throws Exception {
- Matcher mtrseparate = Common.PTNSEPARATER.matcher(src);
- if (mtrseparate.find()) {
- dirCopy(src, mtrseparate.group(1) + File.separator + "_"
- + mtrseparate.group(2));
- }
- return mtrseparate.group(1) + File.separator + "_"
- + mtrseparate.group(2);
- }
-
- public static final void dirCopy(String src, String des) throws Exception {
- String[] list = new File(src).list();
- File test;
-
- ensureDir(des);
- for (int i = 0; i < list.length; i++) {
- test = new File(src + File.separator + list[i]);
- if (test.isDirectory()) {
- dirCopy(src + File.separator + list[i], des + File.separator
- + list[i]);
- } else {
- // ensureDir(des + File.separator + list[i]);
- string2file(file2string(src + File.separator + list[i]), des
- + File.separator + list[i]);
- }
- }
- }
-
- public static final void oneLevelDirCopy(String src, String des, String type)
- throws Exception {
- String[] list = new File(src).list();
-
- ensureDir(des);
- for (int i = 0; i < list.length; i++) {
- if (list[i].contains(type)) {
- string2file(file2string(src + File.separator + list[i]), des
- + File.separator + list[i]);
- }
- }
- }
-
- // --------------------------------------dir--------------------------------------------//
-
- // -------------------------------like python
- // walk-----------------------------------------//
-
- public static final void toDoAll(String path, Method md, Object obj,
- Object[] args, int type) throws Exception {
- String[] list = new File(path).list();
- ArrayList<Object> _args = new ArrayList<Object>();
-
- _args.add(path);
- if (args != null) {
- for (int i = 0; i < args.length; i++) {
- _args.add(args[i]);
- }
- }
-
- if (type == DIR || type == BOTH) {
- md.invoke(obj, _args.toArray());
- }
- for (int i = 0; i < list.length; i++) {
- if (new File(path + File.separator + list[i]).isDirectory()) {
- toDoAll(path + File.separator + list[i], md, obj, args, type);
- } else {
- if (type == FILE || type == BOTH) {
- _args.set(0, path + File.separator + list[i]);
- md.invoke(obj, _args.toArray());
- }
- }
- }
- }
-
- public static final void toDoAll(Set<String> set, ForDoAll fda)
- throws Exception {
- Iterator<String> di = set.iterator();
- while (di.hasNext()) {
- fda.run(di.next());
- }
- }
-
- public static final void toDoAll(String path, ForDoAll fda, int type)
- throws Exception { // filter of file type can be done in toDo
- String[] list = new File(path).list();
- File test;
-
- if (type == DIR || type == BOTH) {
- fda.run(path);
- }
- for (int i = 0; i < list.length; i++) {
- test = new File(path + File.separator + list[i]);
- if (test.isDirectory()) {
- if (fda.filter(test)) {
- toDoAll(path + File.separator + list[i], fda, type);
- }
- } else {
- if (type == FILE || type == BOTH) {
- fda.run(path + File.separator + list[i]);
- }
- }
- }
- }
-
- public static interface ForDoAll {
- public void run(String filepath) throws Exception;
-
- public boolean filter(File dir);
- }
-
- public static abstract class Laplace {
- public void transform(String src, String des) throws Exception {
- Common.string2file(operation(Common.file2string(src)), des);
- }
-
- public abstract String operation(String wholeline);
-
- public abstract boolean recognize(String filename);
-
- public abstract String namechange(String oldname);
- }
-
- public static interface Element {
-
- // public int replace = 0;
- // public int type = 1;
-
- public String getReplace(String key);
-
- // public void getType(String key);
- //
- // public void setReplace(int num);
- //
- // public void setType(int num);
-
- }
-}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Critic.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Critic.java
deleted file mode 100644
index e0e48a9671..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Critic.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.BufferedReader;
-import java.io.StringReader;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public final class Critic {
- public static final Pattern PTN_NEW_HEAD_COMMENT = Pattern.compile(
- "^\\/\\*\\*.*?\\*\\*\\/", Pattern.DOTALL);
-
- private static final Pattern ptnheadcomment = Pattern.compile(
- "^\\/\\*\\+\\+(.*?)\\-\\-\\*\\/", Pattern.DOTALL);
-
- private static final Pattern ptnfunccomment = Pattern
- .compile(
- "([\\};\\/\">]\\s*)([\\w\\s\\*]*?[_\\w][_\\w\\d]*\\s*\\([^\\)\\(]*\\)\\s*)\\/\\*\\+\\+(.*?)\\-\\-\\*\\/\\s*(.*?)(?=[\\{;])",
- Pattern.DOTALL); // find function with {;">/ , may be
- // unsafe
-
- // private static Pattern ptncommentstructure =
- // Pattern.compile("\\/\\*\\+\\+\\s*Routine
- // Description:\\s*(.*?)\\s*Arguments:\\s*(.*?)\\s*Returns:\\s*(.*?)\\s*\\-\\-\\*\\/",Pattern.DOTALL);
- private static final Pattern ptncommentequation = Pattern
- .compile("([^\\s]*)\\s+-\\s+(.*)\\s*");
-
- private static Matcher mtrcommentequation;
-
- private static final Pattern ptnnewcomment = Pattern
- .compile("(\\s*@(param|retval)\\s+[^\\s]+)\\s+(.*)");
-
- private static Matcher mtrnewcomment;
-
- private static final int totallinelength = 82;
-
- public static final void run(String filepath) throws Exception {
- if (MigrationTool.doCritic) { // this is left here to set an example
- // for future structure
- critic(filepath);
- }
- }
-
- private static final void critic(String filepath) throws Exception {
- if (filepath.contains(".c") || filepath.contains(".h")) {
- BufferedReader rd = null;
- String line = null;
- StringBuffer templine = new StringBuffer();
- boolean incomment = false;
-
- System.out.println("Criticing " + filepath);
- String wholeline = Common.file2string(filepath);
-
- wholeline = wholeline.replaceAll("\t", " ");
- wholeline = Common.replaceAll(wholeline, ptnheadcomment,
- "/** @file$1**/");
- wholeline = Common.replaceAll(wholeline, ptnfunccomment,
- "$1\n/**$3\n**/\n$4$2");
- // wholeline = Common.replaceAll(wholeline, ptncommentstructure,
- // "/**\n#%\n$1\n%#\n#%%\n$2\n%%#\n#%%%\n$3\n%%%#\n**/");
-
- // first scan
- boolean description = false;
- boolean arguments = false;
- boolean returns = false;
- boolean inequation = false;
- rd = new BufferedReader(new StringReader(wholeline));
- while ((line = rd.readLine()) != null) {
- if (line.matches("\\/\\*\\*")) {
- incomment = true;
- description = false;
- arguments = false;
- returns = false;
- templine.append(line + "\n");
- } else if (line.matches("\\*\\*\\/")) {
- incomment = false;
- templine.append("\n" + line + "\n");
- } else if (incomment) {
- if (line.contains("Routine Description:")) {
- description = true;
- arguments = false;
- returns = false;
- } else if (line.contains("Arguments:")) {
- description = false;
- arguments = true;
- returns = false;
- templine.append("\n");
- } else if (line.contains("Returns:")) {
- description = false;
- arguments = false;
- returns = true;
- templine.append("\n");
- } else if (description) {
- if (line.trim().length() != 0) {
- templine.append(" " + line.trim() + "\n");
- }
- } else if (arguments) {
- mtrcommentequation = ptncommentequation.matcher(line);
- if (mtrcommentequation.find()) {
- inequation = true;
- templine.append(" @param "
- + mtrcommentequation.group(1) + " "
- + mtrcommentequation.group(2) + "\n");
- } else if (inequation && line.trim().length() == 0) {
- inequation = false;
- } else if (inequation && line.trim().length() != 0) {
- templine.append("#%#%" + line + "\n");
- } else {
- if (line.trim().length() != 0) {
- templine.append(" " + line.trim() + "\n");
- }
- }
- } else if (returns) {
- mtrcommentequation = ptncommentequation.matcher(line);
- if (mtrcommentequation.find()) {
- inequation = true;
- templine.append(" @retval "
- + mtrcommentequation.group(1) + " "
- + mtrcommentequation.group(2) + "\n");
- } else if (inequation && line.trim().length() == 0) {
- inequation = false;
- } else if (inequation && line.trim().length() != 0) {
- templine.append("#%#%" + line + "\n");
- } else {
- if (line.trim().length() != 0) {
- templine.append(" @return " + line.trim()
- + "\n");
- }
- }
- }
- } else {
- templine.append(line + "\n");
- }
- }
- wholeline = templine.toString();
- wholeline = wholeline.replaceAll("\n#%#%\\s*", " ");
- //
-
- // secend scan
- int startmax = 0;
- rd = new BufferedReader(new StringReader(wholeline));
- while ((line = rd.readLine()) != null) {
- if (line.matches("\\/\\*\\*")) {
- incomment = true;
- templine.append(line + "\n");
- } else if (line.matches("\\*\\*\\/")) {
- incomment = false;
- templine.append(line + "\n");
- } else if (incomment) {
- mtrnewcomment = ptnnewcomment.matcher(line);
- if (mtrnewcomment.find()) {
- startmax = mtrnewcomment.group(1).length() > startmax ? mtrnewcomment
- .group(1).length()
- : startmax;
- }
- }
- }
- startmax++;
- //
-
- // third scan
- int n = 0;
- String temp = null;
- String[] tempcont = null;
- int count = 0;
- templine = new StringBuffer();
- rd = new BufferedReader(new StringReader(wholeline));
- while ((line = rd.readLine()) != null) {
- if (line.matches("\\/\\*\\*")) {
- incomment = true;
- templine.append(line + "\n");
- } else if (line.matches("\\*\\*\\/")) {
- incomment = false;
- templine.append(line + "\n");
- } else if (incomment) {
- mtrnewcomment = ptnnewcomment.matcher(line);
- if (mtrnewcomment.find()) {
- n = startmax - mtrnewcomment.group(1).length();
- templine.append(mtrnewcomment.group(1));
- while (n-- >= 0) {
- templine.append(" ");
- }
- temp = mtrnewcomment.group(3);
- tempcont = temp.split(" "); // use \\s+ ?
-
- count = 0;
- for (int i = 0; i < tempcont.length; i++) {
- count += tempcont[i].length();
- if (count <= (totallinelength - startmax)) {
- templine.append(tempcont[i] + " ");
- count += 1;
- } else {
- templine.append("\n");
- n = startmax;
- while (n-- >= 0) {
- templine.append(" ");
- }
- templine.append(tempcont[i] + " ");
- count = tempcont[i].length() + 1;
- }
- }
- templine.append("\n");
- } else {
- templine.append(line + "\n");
- }
- } else {
- templine.append(line + "\n");
- }
- }
- wholeline = templine.toString();
- //
- // Remove trailing blanks.
- //
- wholeline = wholeline.replaceAll(" +\n", "\n");
- Common.string2file(wholeline, filepath);
- }
- }
-
- public static final void fireAt(String path) throws Exception {
- // Common.toDoAll(Common.dirCopy_(path),
- // Critic.class.getMethod("critic", String.class), null, null,
- // Common.FILE);
- Common.toDoAll(path, Critic.class.getMethod("run", String.class), null,
- null, Common.FILE);
- // Common.toDoAll(Common.dirCopy_(path), critic, Common.FILE);
- System.out.println("Critic Done");
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java
deleted file mode 100644
index 5daae526f3..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java
+++ /dev/null
@@ -1,505 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.DbPathAndFilename;
-import org.tianocore.FrameworkDatabaseDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
-import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;
-import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations;
-import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PpiDeclarationsDocument.PpiDeclarations;
-import org.tianocore.ProtocolDeclarationsDocument.ProtocolDeclarations;
-
-public final class Database {
- private static final Database INSTANCE = Database.init();;
-
- Database(String path) {
- DatabasePath = path;
-
- try {
- // collectWorkSpaceDatabase();
- importPkgGuid("PkgGuid.csv");
- importDBLib("Library.csv");
- importDBGuid("Guid.csv", "Guid");
- importDBGuid("Ppi.csv", "Ppi");
- importDBGuid("Protocol.csv", "Protocol");
- importDBMacro("Macro.csv");
- importListR8Only();
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
-
- public String DatabasePath;
-
- public Set<String> error = new HashSet<String>();
-
- public Set<String> r8only = new HashSet<String>();
-
- private Map<String, Guid> hashguid = new HashMap<String, Guid>();
-
- private Map<String, Func> hashfunc = new HashMap<String, Func>();
-
- private Map<String, Macro> hashmacro = new HashMap<String, Macro>();
-
- private Map<String, String> hashPkgGuid = new HashMap<String, String>();
-
- // -------------------------------------import------------------------------------------//
- private void importPkgGuid(String filename) throws Exception {
- BufferedReader rd = new BufferedReader(new FileReader(DatabasePath
- + File.separator + filename));
- String line;
- String[] linecontext;
-
- if (rd.ready()) {
- System.out.println("Found " + filename
- + ", Importing Package Guid Database.");
- //
- // Skip the title row.
- //
- line = rd.readLine();
- while ((line = rd.readLine()) != null) {
- if (line.length() != 0) {
- linecontext = line.split(",");
- hashPkgGuid.put(linecontext[0], linecontext[1]);
- }
- }
- }
- }
-
- public Iterator<String> dumpAllPkgGuid() {
- return hashPkgGuid.values().iterator();
- }
-
- private void importDBLib(String filename) throws Exception {
- BufferedReader rd = new BufferedReader(new FileReader(DatabasePath
- + File.separator + filename));
- String line;
- String[] linecontext;
- Func lf;
-
- if (rd.ready()) {
- System.out.println("Found " + filename
- + ", Importing Library Database.");
- while ((line = rd.readLine()) != null) {
- if (line.length() != 0) {
- linecontext = line.split(",");
- lf = new Func(linecontext);
- hashfunc.put(lf.r8funcname, lf);
- }
- }
- }
- }
-
- private void importDBGuid(String filename, String type) throws Exception {
- BufferedReader rd = new BufferedReader(new FileReader(DatabasePath
- + File.separator + filename));
- String line;
- String[] linecontext;
- Guid gu;
-
- if (rd.ready()) {
- System.out.println("Found " + filename + ", Importing " + type
- + " Database.");
- while ((line = rd.readLine()) != null) {
- if (line.length() != 0) {
- linecontext = line.split(",");
- gu = new Guid(linecontext, type);
- hashguid.put(gu.r8name, gu);
- }
- }
- }
- }
-
- private void importDBMacro(String filename) throws Exception {
- BufferedReader rd = new BufferedReader(new FileReader(DatabasePath
- + File.separator + filename));
- String line;
- String[] linecontext;
- Macro mc;
-
- if (rd.ready()) {
- System.out.println("Found " + filename
- + ", Importing Macro Database.");
- while ((line = rd.readLine()) != null) {
- if (line.length() != 0) {
- linecontext = line.split(",");
- mc = new Macro(linecontext);
- hashmacro.put(mc.r8name, mc);
- }
- }
- }
- }
-
- private void importListR8Only() throws Exception {
- Pattern ptnr8only = Pattern.compile(
- "////#?(\\w*)?.*?R8_(.*?)\\s*\\(.*?////~", Pattern.DOTALL);
- String wholeline = Common.file2string(DatabasePath + File.separator
- + "R8Lib.c");
- System.out
- .println("Found " + "R8Lib.c" + ", Importing R8Lib Database.");
- Matcher mtrr8only = ptnr8only.matcher(wholeline);
- while (mtrr8only.find()) {
- r8only.add(mtrr8only.group(2));
- }
- }
-
- // -------------------------------------import------------------------------------------//
-
- // -------------------------------------get------------------------------------------//
-
- public String getR9Lib(String r8funcname) {
- String temp = null;
- if (hashfunc.containsKey(r8funcname)) {
- temp = hashfunc.get(r8funcname).r9libname;
- }
- return temp;
- }
-
- public String getR9Func(String r8funcname) {
- String temp = null;
- if (hashfunc.containsKey(r8funcname)) {
- temp = hashfunc.get(r8funcname).r9funcname;
- }
- return temp;
- }
-
- public String getR9Macro(String r8macro) {
- return hashmacro.get(r8macro).r9name; // the verification job of if
- // the macro exists in the
- // database is done when
- // registering it
- }
-
- public String getR9Guidname(String r8Guid) {
- String temp = null;
- try {
- temp = hashguid.get(r8Guid).r9name;
- } catch (NullPointerException e) {
- error.add("getR9Guidname :" + r8Guid);
- }
- return temp;
- }
-
- public String getGuidType(String r8Guid) {
- String temp = null;
- try {
- temp = hashguid.get(r8Guid).type;
- } catch (NullPointerException e) {
- error.add("getR9Guidname :" + r8Guid);
- }
- return temp;
- }
-
- // -------------------------------------get------------------------------------------//
-
- // -------------------------------------has------------------------------------------//
-
- public boolean hasFunc(String r8lib) {
- return hashfunc.containsKey(r8lib);
- }
-
- public boolean hasGuid(String r8guid) {
- return hashguid.containsKey(r8guid);
- }
-
- public boolean hasMacro(String r8macro) {
- return hashmacro.containsKey(r8macro);
- }
-
- // -------------------------------------has------------------------------------------//
-
- // -------------------------------------init------------------------------------------//
-
- private static final Database init() {
- if (System.getenv("WORKSPACE") == null) {
- return new Database("C:" + File.separator + "tianocore"
- + File.separator + "edk2" + File.separator + "Tools"
- + File.separator + "Conf" + File.separator + "Migration");
- } else {
- return new Database(System.getenv("WORKSPACE") + File.separator
- + "Tools" + File.separator + "Conf" + File.separator
- + "Migration");
- }
- }
-
- public static final Database getInstance() {
- return INSTANCE;
- }
-
- private String workspacePath;
-
- private HashMap<String, String> hashDbGuids = new HashMap<String, String>();
-
- private HashMap<String, String> hashDbPpis = new HashMap<String, String>();
-
- private HashMap<String, String> hashDbProtocols = new HashMap<String, String>();
-
- private HashMap<String, String> hashDbLibSymbols = new HashMap<String, String>();
-
- private HashMap<String, String> hashDbLibFunctions = new HashMap<String, String>();
-
- private HashMap<String, String> hashDbLibExterns = new HashMap<String, String>();
-
- private final String regLibClassName = ".*\\W(\\w[\\w\\d]*)\\.h";
-
- private final Pattern ptnLibClassName = Pattern.compile(regLibClassName);
-
- private final String regLibSymbol = "#define\\s+(\\w[\\w\\d]*)";
-
- private final Pattern ptnLibSymbol = Pattern.compile(regLibSymbol);
-
- private final String regLibDataType = "[A-Z][A-Z0-9_]*\\s*\\**";
-
- private final String regLibFunction = regLibDataType
- + "\\s*(?:EFIAPI)?\\s+" + "(\\w[\\w\\d]*)\\s*\\([^)]*\\)\\s*;";
-
- private Pattern ptnLibFunction = Pattern.compile(regLibFunction);
-
- private final String regLibExtern = "extern\\s+" + regLibDataType
- + "\\s*(\\w[\\w\\d]*)";
-
- private final Pattern ptnLibExtern = Pattern.compile(regLibExtern);
-
- private final String convertToOsFilePath(String filePath) {
- return filePath.replace("/", File.separator).replace("\\",
- File.separator);
- }
-
- private final void collectLibHeaderFileInfo(String libHeaderFile,
- String pkgGuid) throws Exception {
- String fileContents;
- String libClassName;
- String libContainer;
- Matcher mtrLibClass;
- Matcher mtrLibSymbol;
- Matcher mtrLibFunction;
- Matcher mtrLibExtern;
-
- System.out.println("Parsing: " + libHeaderFile);
- mtrLibClass = ptnLibClassName.matcher(libHeaderFile);
- if (!mtrLibClass.matches()) {
- throw new Exception("Illegal libary header file");
- }
- libClassName = mtrLibClass.group(1);
- libContainer = libClassName + "@" + pkgGuid;
-
- fileContents = Common.file2string(libHeaderFile);
- mtrLibSymbol = ptnLibSymbol.matcher(fileContents);
- while (mtrLibSymbol.find()) {
- String libSymbol;
- String oldLibContainer;
-
- libSymbol = mtrLibSymbol.group(1);
- oldLibContainer = hashDbLibSymbols.put(libSymbol, libContainer);
- if (oldLibContainer != null) {
- String warnMessage;
-
- warnMessage = "Duplicated Lib Symbol:" + libSymbol + " Found. "
- + "Later package will overide the previous one";
- System.out.println(warnMessage);
- }
- }
-
- mtrLibFunction = ptnLibFunction.matcher(fileContents);
- while (mtrLibFunction.find()) {
- String libFunction;
- String oldLibContainer;
-
- libFunction = mtrLibFunction.group(1);
- oldLibContainer = hashDbLibFunctions.put(libFunction, libContainer);
- if (oldLibContainer != null) {
- String warnMessage;
-
- warnMessage = "Duplicated Lib Function:" + libFunction
- + " Found. "
- + "Later package will overide the previous one";
- System.out.println(warnMessage);
- }
- }
-
- mtrLibExtern = ptnLibExtern.matcher(fileContents);
- while (mtrLibExtern.find()) {
- String libExtern;
- String oldLibContainer;
-
- libExtern = mtrLibExtern.group(1);
- oldLibContainer = hashDbLibExterns.put(libExtern, libContainer);
- if (oldLibContainer != null) {
- String warnMessage;
-
- warnMessage = "Duplicated Lib Extern:" + libExtern + " Found. "
- + "Later package will overide the previous one";
- System.out.println(warnMessage);
- }
- }
- }
-
- private final void collectLibDataBase(PackageSurfaceArea spdDatabase,
- String pkgDirectory) throws Exception {
- String pkgGuid;
- LibraryClassDeclarations libClassDeclarations;
-
- pkgGuid = spdDatabase.getSpdHeader().getGuidValue();
- libClassDeclarations = spdDatabase.getLibraryClassDeclarations();
- if (libClassDeclarations != null) {
- Iterator<LibraryClass> itLibClass;
-
- itLibClass = libClassDeclarations.getLibraryClassList().iterator();
- while (itLibClass.hasNext()) {
- String libHeaderFile;
-
- libHeaderFile = pkgDirectory + File.separator
- + itLibClass.next().getIncludeHeader();
- libHeaderFile = convertToOsFilePath(libHeaderFile);
- try {
- collectLibHeaderFileInfo(libHeaderFile, pkgGuid);
- } catch (Exception e) {
- String errorMessage;
-
- errorMessage = "Error (" + e.getMessage()
- + ")occurs when parsing " + libHeaderFile;
- System.out.println(errorMessage);
- }
- }
- }
- }
-
- private final void collectGuidDatabase(PackageSurfaceArea spdDatabase)
- throws Exception {
- String pkgGuid;
- GuidDeclarations guidDeclarations;
-
- pkgGuid = spdDatabase.getSpdHeader().getGuidValue();
- guidDeclarations = spdDatabase.getGuidDeclarations();
- if (guidDeclarations != null) {
- Iterator<GuidDeclarations.Entry> itGuids;
-
- itGuids = guidDeclarations.getEntryList().iterator();
- while (itGuids.hasNext()) {
- hashDbGuids.put(itGuids.next().getCName(), pkgGuid);
- }
- }
-
- }
-
- private final void collectPpiDatabase(PackageSurfaceArea spdDatabase)
- throws Exception {
- String pkgGuid;
- PpiDeclarations ppiDeclarations;
-
- pkgGuid = spdDatabase.getSpdHeader().getGuidValue();
- ppiDeclarations = spdDatabase.getPpiDeclarations();
-
- if (ppiDeclarations != null) {
- Iterator<PpiDeclarations.Entry> itPpis;
-
- itPpis = ppiDeclarations.getEntryList().iterator();
- while (itPpis.hasNext()) {
- hashDbPpis.put(itPpis.next().getCName(), pkgGuid);
- }
- }
-
- }
-
- private final void collectProtocolDatabase(PackageSurfaceArea spdDatabase)
- throws Exception {
- String pkgGuid;
- ProtocolDeclarations protocolDeclarations;
-
- pkgGuid = spdDatabase.getSpdHeader().getGuidValue();
- protocolDeclarations = spdDatabase.getProtocolDeclarations();
-
- if (protocolDeclarations != null) {
- Iterator<ProtocolDeclarations.Entry> itProtocols;
-
- itProtocols = protocolDeclarations.getEntryList().iterator();
- while (itProtocols.hasNext()) {
- hashDbGuids.put(itProtocols.next().getCName(), pkgGuid);
- }
- }
-
- }
-
- private final void collectPackageDatabase(String packageFileName)
- throws Exception {
- XmlObject xmlPackage;
- PackageSurfaceArea spdDatabase;
- File pkgFile;
-
- pkgFile = new File(packageFileName);
- xmlPackage = XmlObject.Factory.parse(pkgFile);
- spdDatabase = ((PackageSurfaceAreaDocument) xmlPackage)
- .getPackageSurfaceArea();
-
- collectGuidDatabase(spdDatabase);
- collectProtocolDatabase(spdDatabase);
- collectPpiDatabase(spdDatabase);
- collectLibDataBase(spdDatabase, pkgFile.getParent());
-
- }
-
- public final void collectWorkSpaceDatabase() throws Exception {
- String databaseFileName;
- File databaseFile;
- XmlObject xmlDatabase;
- FrameworkDatabase frameworkDatabase;
- Iterator<DbPathAndFilename> packageFile;
-
- workspacePath = System.getenv("WORKSPACE");
-
- if (workspacePath == null) {
- String errorMessage = "Envivornment variable \"WORKSPACE\" is not set!";
- throw new Exception(errorMessage);
- }
- databaseFileName = workspacePath + File.separator + "Tools"
- + File.separator + "Conf" + File.separator
- + "FrameworkDatabase.db";
- System.out.println("Open " + databaseFileName);
- databaseFile = new File(databaseFileName);
- xmlDatabase = XmlObject.Factory.parse(databaseFile);
- frameworkDatabase = ((FrameworkDatabaseDocument) xmlDatabase)
- .getFrameworkDatabase();
- packageFile = frameworkDatabase.getPackageList().getFilenameList()
- .iterator();
-
- while (packageFile.hasNext()) {
- String packageFileName = packageFile.next().getStringValue();
- packageFileName = workspacePath + File.separator + packageFileName;
- packageFileName = convertToOsFilePath(packageFileName);
-
- System.out.println("Parsing: " + packageFileName);
- try {
- collectPackageDatabase(packageFileName);
- } catch (Exception e) {
- System.out.println("Error occured when opening "
- + packageFileName + e.getMessage());
- }
- }
- }
-}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/FirstPanel.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/FirstPanel.java
deleted file mode 100644
index 3e6dc9af9d..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/FirstPanel.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.Set;
-
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.UIManager;
-
-public final class FirstPanel extends JPanel implements ActionListener,
- ItemListener, UI {
- /**
- * Define class Serial Version UID
- */
- private static final long serialVersionUID = 207759413522910399L;
-
- private static final FirstPanel INSTANCE = FirstPanel.init();
-
- private String startpath = null;
-
- private JButton moduleButton, goButton, msaEditorButton, criticButton,
- specifyCommentButton;
-
- private JTextField moduletext;
-
- private JTextArea log;
-
- private JFileChooser fc = new JFileChooser();
-
- private JCheckBox filebox, screenbox, mibox, criticbox, defaultpathbox;
-
- private boolean tofile = true, toscreen = true;
-
- private PrintWriter logfile;
-
- FirstPanel() {
- GridBagLayout gridbag = new GridBagLayout();
- setLayout(gridbag);
-
- GridBagConstraints cst = new GridBagConstraints();
-
- goButton = new JButton("Go");
- goButton.addActionListener(this);
- goButton.setActionCommand("go");
-
- moduleButton = new JButton("Choose ModulePath");
- moduleButton.addActionListener(this);
-
- msaEditorButton = new JButton("MsaEditor");
- msaEditorButton.addActionListener(this);
-
- criticButton = new JButton("Critic");
- criticButton.addActionListener(this);
-
- specifyCommentButton = new JButton("Comment Style");
- specifyCommentButton.addActionListener(this);
-
- moduletext = new JTextField(30);
-
- filebox = new JCheckBox("Output to logfile", true);
- filebox.addItemListener(this);
-
- screenbox = new JCheckBox("Specify logfile", false);
- screenbox.addItemListener(this);
-
- mibox = new JCheckBox("Print ModuleInfo", false);
- mibox.addItemListener(this);
- MigrationTool.printModuleInfo = false;
-
- criticbox = new JCheckBox("Run Critic", true);
- criticbox.addItemListener(this);
- MigrationTool.doCritic = true;
-
- defaultpathbox = new JCheckBox("Use Default Output Path", true);
- defaultpathbox.addItemListener(this);
- MigrationTool.defaultoutput = true;
-
- JPanel modulePanel = new JPanel();
- modulePanel.add(moduleButton);
- modulePanel.add(moduletext);
- modulePanel.add(goButton);
- // modulePanel.add(msaEditorButton);
- cst.gridx = 0;
- cst.gridy = 0;
- // cst.gridwidth = GridBagConstraints.REMAINDER;
- gridbag.setConstraints(modulePanel, cst);
- add(modulePanel);
-
- cst.gridx = 1;
- cst.gridy = 0;
- gridbag.setConstraints(specifyCommentButton, cst);
- add(specifyCommentButton);
- // gridbag.setConstraints(criticButton, cst);
- // add(criticButton);
-
- JPanel checkboxPanel = new JPanel();
- checkboxPanel.setLayout(new BoxLayout(checkboxPanel, BoxLayout.Y_AXIS));
- checkboxPanel.add(filebox);
- checkboxPanel.add(screenbox);
- checkboxPanel.add(mibox);
- checkboxPanel.add(criticbox);
- checkboxPanel.add(defaultpathbox);
- cst.gridx = 1;
- cst.gridy = 1;
- // cst.gridheight = 2;
- gridbag.setConstraints(checkboxPanel, cst);
- add(checkboxPanel);
-
- log = new JTextArea(10, 20);
- log.setMargin(new Insets(5, 5, 5, 5));
- log.setEditable(false);
- JScrollPane logScrollPane = new JScrollPane(log);
- cst.gridx = 0;
- cst.gridy = 1;
- cst.fill = GridBagConstraints.BOTH;
- gridbag.setConstraints(logScrollPane, cst);
- add(logScrollPane);
- }
-
- // ---------------------------------------------------------------------------------------//
-
- public boolean yesOrNo(String question) {
- return JOptionPane.showConfirmDialog(this, question, "Yes or No",
- JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
- }
-
- public void print(String message) {
- if (toscreen == true) {
- log.append(message);
- System.out.print(message);
- }
- if (tofile == true) {
- logfile.append(message);
- }
- }
-
- public void println(String message) {
- print(message + "\n");
- }
-
- public void println(Set<String> hash) {
- if (toscreen == true) {
- log.append(hash + "\n");
- System.out.println(hash);
- }
- if (tofile == true) {
- logfile.append(hash + "\n");
- }
- }
-
- public String choose(String message, Object[] choicelist) {
- return (String) JOptionPane.showInputDialog(this, message, "Choose",
- JOptionPane.PLAIN_MESSAGE, null, choicelist, choicelist[0]);
- }
-
- public String getInput(String message) {
- return (String) JOptionPane.showInputDialog(message);
- }
-
- // ---------------------------------------------------------------------------------------//
-
- public String getFilepath(String title, int mode) {
- fc.setDialogTitle(title);
- fc.setFileSelectionMode(mode);
- if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
- log.append(fc.getSelectedFile().getAbsolutePath() + "\n");
- return fc.getSelectedFile().getAbsolutePath();
- }
- return null;
- }
-
- // ---------------------------------------------------------------------------------------//
-
- public void actionPerformed(ActionEvent e) {
- if (e.getSource() == moduleButton) {
- startpath = getFilepath("Please choose a starting path",
- JFileChooser.DIRECTORIES_ONLY);
- moduletext.setText(startpath);
- }
- if (e.getSource() == goButton) {
- try {
- logfile = new PrintWriter(new BufferedWriter(new FileWriter(
- startpath.replaceAll(Common.STRSEPARATER, "$1")
- + File.separator + "migration.log")));
- MigrationTool.startMigrateAll(startpath);
- logfile.flush();
- logfile.close();
- } catch (Exception en) {
- println(en.getMessage());
- }
- }
- if (e.getSource() == msaEditorButton) {
- try {
- MsaTreeEditor.init();
- } catch (Exception en) {
- println(en.getMessage());
- }
- }
- if (e.getSource() == criticButton) {
- try {
- Critic.fireAt(startpath);
- } catch (Exception en) {
- println(en.getMessage());
- }
- }
- if (e.getSource() == specifyCommentButton) {
- try { // input examine is not imposed but should be added
- MigrationTool.MIGRATIONCOMMENT = getInput("Please type in wanted comment style used by the tool\nbe sure to start with '//', or you won't enjoy the result");
- // MsaWriter.parse("C:\\tianocore\\edk2\\MdePkg\\Library\\BaseLib\\BaseLib.msa");
- } catch (Exception en) {
- println(en.getMessage());
- }
- }
- }
-
- public void itemStateChanged(ItemEvent e) {
- if (e.getSource() == filebox) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- System.out.println("filebox DESELECTED");
- } else if (e.getStateChange() == ItemEvent.SELECTED) {
- System.out.println("filebox SELECTED");
- }
- } else if (e.getSource() == screenbox) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- System.out.println("screenbox DESELECTED");
- } else if (e.getStateChange() == ItemEvent.SELECTED) {
- System.out.println("screenbox SELECTED");
- }
- } else if (e.getSource() == mibox) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- MigrationTool.printModuleInfo = false;
- } else if (e.getStateChange() == ItemEvent.SELECTED) {
- MigrationTool.printModuleInfo = true;
- }
- } else if (e.getSource() == criticbox) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- MigrationTool.doCritic = false;
- } else if (e.getStateChange() == ItemEvent.SELECTED) {
- MigrationTool.doCritic = true;
- }
- } else if (e.getSource() == defaultpathbox) {
- if (e.getStateChange() == ItemEvent.DESELECTED) {
- MigrationTool.defaultoutput = false;
- } else if (e.getStateChange() == ItemEvent.SELECTED) {
- MigrationTool.defaultoutput = true;
- }
- }
- }
-
- // ---------------------------------------------------------------------------------------//
-
- private static final FirstPanel init() {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
-
- JFrame frame = new JFrame("MigrationTools");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- FirstPanel fp = new FirstPanel();
- fp.setOpaque(true);
- frame.setContentPane(fp);
-
- frame.pack();
- frame.setVisible(true);
-
- return fp;
- }
-
- public static final FirstPanel getInstance() {
- return INSTANCE;
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Func.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Func.java
deleted file mode 100644
index 3cebcba9fd..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Func.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class Func {
- Func(String r8func, String r8lib, String r9func, String r9lib) {
- r8funcname = r8func;
- r8libname = r8lib;
- r9funcname = r9func;
- r9libname = r9lib;
- }
-
- Func(String[] linecontext) {
- r8funcname = linecontext[1];
- r8libname = linecontext[0];
- r9funcname = linecontext[2];
- if (r9funcname.contains("n/a")) {
- r9funcname = "#error Unknown or missing library function in EDKII: "
- + r8funcname;
- }
- r9libname = linecontext[3];
- }
-
- public String r8funcname;
-
- public String r8libname;
-
- public String r9funcname;
-
- public String r9libname;
-
- public static Pattern ptnbrace = Pattern.compile("\\{[^\\{\\}]*\\}",
- Pattern.MULTILINE);
-
- public static Pattern ptnfuncc = Pattern.compile(
- "(?<!->)([a-zA-Z_]\\w*)\\s*\\(", Pattern.MULTILINE);
-
- public static Pattern ptnfuncd = Pattern.compile(
- "([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)\\s*@", Pattern.MULTILINE);
-
- public static Pattern ptnlowcase = Pattern.compile("[a-z]"); // must be
- // removed
-
- private static String reservedwords = "if for pack while switch return sizeof";
-
- public static String register(Matcher mtr, ModuleInfo mi, Database db) {
- String temp = null;
-
- temp = mtr.group(1); // both changed and not changed funcc are
- // registered , for finding all the non-local
- // function calls
- Matcher mtrlowcase = ptnlowcase.matcher(temp); // must be removed , so
- // the two funcs can be
- // merged
- if (!reservedwords.contains(temp) && mtrlowcase.find()) {
- mi.hashfuncc.add(temp);
- }
- return temp;
- }
-}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Guid.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Guid.java
deleted file mode 100644
index e43b62aff4..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Guid.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.tianocore.UsageTypes;
-
-public class Guid {
- Guid(String r8, String t, String n, String r9, String gv, String p) {
- r8name = r8;
- type = t;
- name = n;
- r9name = r9;
- guidvalue = gv;
- pack = p;
- }
-
- Guid(String[] linecontext, String t) {
- r8name = linecontext[1];
- type = t;
- name = linecontext[0];
- r9name = linecontext[2];
- guidvalue = linecontext[3];
- pack = linecontext[4];
- }
-
- public String r8name;
-
- public String type;
-
- public String name;
-
- public String r9name;
-
- public String guidvalue;
-
- public String pack;
-
- public static Pattern ptnguid = Pattern.compile("g\\w*Guid");
-
- public static String register(Matcher mtr, ModuleInfo mi, Database db) {
- String type = null;
- String temp = null;
-
- temp = mtr.group();
- if (MigrationTool.db.hasGuid(temp)) { // only changed guids
- // registered, because both
- // changed and not changed guids
- // are included in database
- type = MigrationTool.db.getGuidType(temp);
- if (type.matches("Protocol")) {
- mi.addProtocol(temp, UsageTypes.ALWAYS_CONSUMED);
- // mi.protocols.add(temp);
- } else if (type.matches("Ppi")) {
- mi.addPpi(temp, UsageTypes.ALWAYS_CONSUMED);
- // mi.ppis.add(temp);
- } else if (type.matches("Guid")) {
- mi.addGuid(temp, UsageTypes.ALWAYS_CONSUMED);
- // mi.guids.add(temp);
- }
- return temp;
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java
deleted file mode 100644
index 91c878a1c8..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class Macro {
- Macro(String r8, String r9) {
- r8name = r8;
- r9name = r9;
- }
-
- Macro(String[] linecontext) {
- r8name = linecontext[0];
- r9name = linecontext[1];
- }
-
- public String r8name;
-
- public String r9name;
-
- public static Pattern ptntmacro = Pattern.compile("\\b\\w(\\w|\\d)*",
- Pattern.MULTILINE);
-
- private static String unmacro = "VOID UINTN BOOLEAN ASSERT OPTIONAL STATIC NULL TRUE IN OUT FALSE";
-
- public static String register(Matcher mtr, ModuleInfo mi, Database db) {
- String temp = null;
-
- temp = mtr.group();
- mi.hashmacro.add(temp);
- if (MigrationTool.db.hasMacro(temp)) { // only changed macros
- // registered, because the
- // database of macro has only
- // changed ones
- if (!unmacro.contains(temp)) {
- mi.hashnonlocalmacro.add(temp);
- }
- return temp;
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MigrationTool.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
deleted file mode 100644
index c65a425df4..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.swing.JFileChooser;
-
-/**
- * The class is used as the main class of the MigrationTool, maintains the main
- * work flow, and all the global variables and constants. It extends nothing.
- *
- */
-public class MigrationTool {
-
- //
- // These two objects are serves globally, it is always required, and only
- // one instance is ever allowed.
- //
- public static UI ui = null;
-
- public static Database db = null;
-
- //
- // The global constant for MigrationTool generated comments.
- //
- public static String MIGRATIONCOMMENT = "//@MT:";
-
- //
- // Global switches that are changed by user by the FirstPanel.
- //
- public static boolean printModuleInfo = false;
-
- public static boolean doCritic = false;
-
- public static boolean defaultoutput = false;
-
- //
- // A hashmap that associates the reference to a ModuleInfo with its
- // outputpath.
- //
- public static final HashMap<ModuleInfo, String> ModuleInfoMap = new HashMap<ModuleInfo, String>();
-
- //
- // The starting point of the MigrationTool.
- //
- private static String startpath = null;
-
- /**
- * This method defines the overall main work flow of the MigrationTool.
- *
- * @param mi
- * @throws Exception
- */
- private static final void mainFlow(ModuleInfo mi) throws Exception {
- ModuleReader.aimAt(mi);
- SourceFileReplacer.fireAt(mi); // some adding library actions are taken
- // here,so it must be put before
- // "MsaWriter"
-
- // show result
- if (MigrationTool.printModuleInfo) {
- MigrationTool.ui.println("\nModule Information : ");
- MigrationTool.ui.println("Entrypoint : " + mi.entrypoint);
- show(mi.protocols, "Protocol : ");
- show(mi.ppis, "Ppi : ");
- show(mi.guids, "Guid : ");
- show(mi.hashfuncc, "call : ");
- show(mi.hashfuncd, "def : ");
- show(mi.hashEFIcall, "EFIcall : ");
- show(mi.hashnonlocalmacro, "macro : ");
- show(mi.hashnonlocalfunc, "nonlocal : ");
- show(mi.hashr8only, "hashr8only : ");
- }
- new MsaWriter(mi).flush();
-
- // mi.getMsaOwner().flush(MigrationTool.ModuleInfoMap.get(mi) +
- // File.separator + "Migration_" + mi.modulename + File.separator +
- // mi.modulename + ".___");
-
- if (MigrationTool.doCritic) {
- Critic.fireAt(ModuleInfoMap.get(mi) + File.separator + "Migration_"
- + mi.modulename);
- }
-
- MigrationTool.ui.println("Errors Left : " + MigrationTool.db.error);
- MigrationTool.ui.println("Complete!");
- }
-
- /**
- * This method is specially written to print the message for ModuleInfo,
- * just for less code repeating.
- *
- * @param hash
- * @param show
- */
- private static final void show(Set<String> hash, String show) {
- MigrationTool.ui.println(show + hash.size());
- MigrationTool.ui.println(hash);
- }
-
- /**
- * This method designates the location of temp directory.
- *
- * @param modulepath
- * @return String
- */
- public static final String getTempDir(String modulepath) {
- return "C:" + File.separator + "MigrationTool_Temp"
- + modulepath.replace(startpath, "");
- }
-
- /**
- * This method is the default output path generating scheme.
- *
- * @param inputpath
- * @return String
- */
- private static final String assignOutPutPath(String inputpath) {
- if (MigrationTool.defaultoutput) {
- return inputpath.replaceAll(Common.STRSEPARATER, "$1");
- } else {
- return MigrationTool.ui.getFilepath(
- "Please choose where to place the output module",
- JFileChooser.DIRECTORIES_ONLY);
- }
- }
-
- /**
- * This function is called by main loop of the MigrationTool which
- * verifies whether a dir contains a module, thus generating a map
- * which shows the corresponding path for each module.
- *
- * @param filepath
- * @throws Exception
- */
- public static final void seekModule(String filepath) throws Exception {
- if (ModuleInfo.isModule(filepath)) {
- ModuleInfoMap.put(new ModuleInfo(filepath),
- assignOutPutPath(filepath));
- }
- }
-
- /**
- * This is the main loop of the tool.
- *
- * @param path
- * @throws Exception
- */
- public static final void startMigrateAll(String path) throws Exception {
- startpath = path;
- MigrationTool.ui.println("Project Migration");
- MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");
-
- if (new File("C:" + File.separator + "MigrationTool_Temp").exists()) {
- Common.deleteDir("C:" + File.separator + "MigrationTool_Temp");
- }
-
- Common.toDoAll(path, MigrationTool.class.getMethod("seekModule",
- String.class), null, null, Common.DIR);
-
- Iterator<ModuleInfo> miit = ModuleInfoMap.keySet().iterator();
- while (miit.hasNext()) {
- mainFlow(miit.next());
- }
-
- ModuleInfoMap.clear();
-
- Common.deleteDir("C:" + File.separator + "MigrationTool_Temp");
- }
-
- /**
- * This main method initializes the environment.
- *
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
- ui = FirstPanel.getInstance();
- db = Database.getInstance();
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
deleted file mode 100644
index 8f54d81b58..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.tianocore.UsageTypes;
-import org.tianocore.SupportedArchitectures.Enum;
-
-/*
- * Class ModuleInfo is built for scanning the source files, it contains all the
- * needed information and all the temporary data.
- */
-public final class ModuleInfo {
- ModuleInfo(String modulepath) throws Exception {
- this.modulepath = modulepath;
- this.temppath = MigrationTool.getTempDir(this.modulepath);
- }
-
- public final String modulepath;
-
- public final String temppath;
-
- private MsaOwner msaowner = MsaOwner.initNewMsaOwner();
-
- public boolean isLibrary = false;
-
- public String modulename = null;
-
- public String guidvalue = null;
-
- public String moduletype = null;
-
- public String entrypoint = null;
-
- public String license = null;
-
- public final Set<String> localmodulesources = new HashSet<String>(); // contains
- // both
- // .c
- // and
- // .h
-
- public final Set<String> preprocessedccodes = new HashSet<String>();
-
- public final Set<String> msaorinf = new HashSet<String>(); // only a
- // little, hash
- // may be too
- // big for this
-
- public final Set<String> infincludes = new HashSet<String>();
-
- public final Set<String> infsources = new HashSet<String>();
-
- public final Set<String> hashfuncc = new HashSet<String>();
-
- public final Set<String> hashfuncd = new HashSet<String>();
-
- public final Set<String> hashnonlocalfunc = new HashSet<String>();
-
- public final Set<String> hashnonlocalmacro = new HashSet<String>();
-
- public final Set<String> hashEFIcall = new HashSet<String>();
-
- public final Set<String> hashr8only = new HashSet<String>();
-
- public final Set<String> hashmacro = new HashSet<String>();
-
- public final Set<String> hashrequiredr9libs = new HashSet<String>(); // hashrequiredr9libs
- // is
- // now
- // all
- // added
- // in
- // SourceFileReplacer
-
- public final Set<String> guids = new HashSet<String>();
-
- public final Set<String> protocols = new HashSet<String>();
-
- public final Set<String> ppis = new HashSet<String>();
-
- // -----------------------------------------------------------------------------------//
-
- // addModuleType
- // addGuidValue
- // addModuleName
-
- public final boolean addSourceFile(String filename, Enum en) {
- localmodulesources.add(filename);
- return msaowner.addSourceFile(filename, en);
- }
-
- public final boolean addProtocol(String proname, UsageTypes.Enum usage) {
- protocols.add(proname);
- return msaowner.addProtocol(proname, usage);
- }
-
- public final boolean addPpi(String ppiname, UsageTypes.Enum usage) {
- ppis.add(ppiname);
- return msaowner.addPpi(ppiname, usage);
- }
-
- public final boolean addGuid(String guidname, UsageTypes.Enum usage) {
- guids.add(guidname);
- return msaowner.addGuid(guidname, usage);
- }
-
- public final boolean addLibraryClass(String name, UsageTypes.Enum usage) {
- //
- // This section is only for adding library classes, this functionality
- // should be inside MsaOwner!!!
- //
- // if (!hashrequiredr9libs.contains(name)) {
- msaowner.addLibraryClass(name, usage);
- // }
- //
- hashrequiredr9libs.add(name);
- return true;
- }
-
- // -----------------------------------------------------------------------------------//
-
- public final String getModuleType() {
- if (moduletype.contains("PEI")) {
- return "PEIM";
- } else {
- return "DXE_DRIVER";
- }
- }
-
- public final void enroll(String filepath) throws Exception {
- String temp = null;
- if (filepath.contains(".inf") || filepath.contains(".msa")) {
- temp = filepath.replace(modulepath + File.separator, "");
- if (!temp.contains(File.separator)) { // .inf in subdirectory is
- // not regarded
- msaorinf.add(temp);
- }
- } else if (filepath.contains(".c") || filepath.contains(".C")
- || filepath.contains(".h") || filepath.contains(".H")
- || filepath.contains(".dxs") || filepath.contains(".uni")
- || filepath.contains(".s") || filepath.contains(".S")
- || filepath.contains(".i") || filepath.contains(".asm")) {
- addSourceFile(filepath.replace(modulepath + File.separator, ""),
- null);
- }
- }
-
- public static final boolean isModule(String path) {
- String[] list = new File(path).list();
- for (int i = 0; i < list.length; i++) {
- if (!new File(list[i]).isDirectory()) {
- if (list[i].contains(".inf") || list[i].contains(".msa")) {
- return true;
- }
- }
- }
- return false;
- }
-
- public final MsaOwner getMsaOwner() {
- return msaowner;
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
deleted file mode 100644
index f3eb7069eb..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.tianocore.FilenameDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.MsaHeaderDocument;
-import org.tianocore.SourceFilesDocument;
-
-public final class ModuleReader implements Common.ForDoAll {
- private static final ModuleReader modulereader = new ModuleReader();
-
- private ModuleInfo mi;
-
- private final CommentLaplace commentlaplace = new CommentLaplace();
-
- private static final Pattern ptninfequation = Pattern
- .compile("([^\\s]*)\\s*=\\s*([^\\s]*)");
-
- private static final Pattern ptnsection = Pattern.compile(
- "\\[([^\\[\\]]*)\\]([^\\[\\]]*)\\n", Pattern.MULTILINE);
-
- private static final Pattern ptnfilename = Pattern.compile("[^\\s]+");
-
- public final void ModuleScan() throws Exception {
- Common.toDoAll(mi.modulepath, ModuleInfo.class.getMethod("enroll",
- String.class), mi, null, Common.FILE);
-
- // inf&msa
- String filename = null;
- if (mi.msaorinf.isEmpty()) {
- MigrationTool.ui.println("No INF nor MSA file found!");
- System.exit(0);
- } else {
- if (mi.msaorinf.size() == 1) {
- filename = (String) mi.msaorinf.toArray()[0];
- } else {
- filename = MigrationTool.ui.choose(
- "Found .inf or .msa file for module\n" + mi.modulepath
- + "\nChoose one Please", mi.msaorinf.toArray());
- }
- }
-
- if (filename.contains(".inf")) {
- readInf(filename);
- } else if (filename.contains(".msa")) {
- readMsa(filename);
- }
- // inf&msa
-
- preProcessModule();
- }
-
- private final void readMsa(String name) throws Exception {
- ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory
- .parse(new File(mi.modulepath + File.separator + name));
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = msadoc
- .getModuleSurfaceArea();
- MsaHeaderDocument.MsaHeader msaheader = msa.getMsaHeader();
-
- mi.modulename = msaheader.getModuleName();
- mi.guidvalue = msaheader.getGuidValue();
- mi.moduletype = msaheader.getModuleType().toString(); // ???
-
- SourceFilesDocument.SourceFiles sourcefiles = msa.getSourceFiles();
-
- String temp;
- Iterator<FilenameDocument.Filename> li = sourcefiles.getFilenameList()
- .iterator();
- while (li.hasNext()) {
- if (!mi.localmodulesources.contains(temp = li.next().toString())) {
- System.out.println("Source File Missing! : " + temp);
- }
- }
- }
-
- private final String extractLicense(String wholeline) throws Exception {
- String tempLine;
- String license = null;
-
- BufferedReader rd = new BufferedReader(new StringReader(wholeline));
- while ((tempLine = rd.readLine()) != null) {
- if (tempLine.contains("#")) {
- if (tempLine.contains("Copyright")) {
- //
- // Find license info.
- //
- license = "";
- while ((tempLine = rd.readLine()) != null) {
- if (!tempLine.contains("#")
- || tempLine.contains("Module Name:")
- || tempLine.contains("Abstract:")) {
- //
- // We assume license ends here.
- //
- break;
- }
- license += " "
- + tempLine
- .replaceAll("\\s*[#]\\s*(.*)", "$1\n");
- }
- break;
- }
- }
- }
- return license;
- }
-
- private final void readInf(String name) throws Exception {
- System.out.println("\nParsing INF file: " + name);
- String wholeline;
- Matcher mtrinfequation;
- Matcher mtrsection;
- Matcher mtrfilename;
-
- wholeline = Common.file2string(mi.modulepath + File.separator + name);
- mi.license = extractLicense(wholeline);
- mtrsection = ptnsection.matcher(wholeline);
- while (mtrsection.find()) {
- if (mtrsection.group(1).matches("defines")) {
- mtrinfequation = ptninfequation.matcher(mtrsection.group(2));
- while (mtrinfequation.find()) {
- if (mtrinfequation.group(1).matches("BASE_NAME")) {
- mi.modulename = mtrinfequation.group(2);
- }
- if (mtrinfequation.group(1).matches("FILE_GUID")) {
- mi.guidvalue = mtrinfequation.group(2);
- }
- if (mtrinfequation.group(1).matches("COMPONENT_TYPE")) {
- mi.moduletype = mtrinfequation.group(2);
- if (mi.moduletype.matches("LIBRARY")) {
- mi.isLibrary = true;
- }
- }
- }
- }
- if (mtrsection.group(1).contains("nmake.")) {
- mtrinfequation = ptninfequation.matcher(mtrsection.group(2));
- while (mtrinfequation.find()) {
- if (mtrinfequation.group(1).matches("IMAGE_ENTRY_POINT")) {
- mi.entrypoint = mtrinfequation.group(2);
- }
- if (mtrinfequation.group(1).matches("DPX_SOURCE")) {
- if (!mi.localmodulesources.contains(mtrinfequation
- .group(2))) {
- MigrationTool.ui.println("DPX File Missing! : "
- + mtrinfequation.group(2));
- }
- }
- }
- }
- if (mtrsection.group(1).contains("sources.")) {
- mtrfilename = ptnfilename.matcher(mtrsection.group(2));
- while (mtrfilename.find()) {
- mi.infsources.add(mtrfilename.group());
- if (!mi.localmodulesources.contains(mtrfilename.group())) {
- MigrationTool.ui
- .println("Warn: Source File Missing! : "
- + mtrfilename.group());
- }
- }
- }
- if (mtrsection.group(1).matches("includes.")) {
- mtrfilename = ptnfilename.matcher(mtrsection.group(2));
- while (mtrfilename.find()) {
- mi.infincludes.add(mtrfilename.group());
- }
- }
- }
- }
-
- private final void preProcessModule() throws Exception {
- // according to .inf file, add extraordinary includes and sourcefiles
- Common.dirCopy(mi.modulepath, mi.temppath); // collect all
- // Laplace.namechange to
- // here???
-
- if (!mi.infincludes.isEmpty()) {
- Iterator<String> it = mi.infincludes.iterator();
- String tempincludename = null;
- while (it.hasNext()) {
- tempincludename = it.next();
- if (tempincludename.contains("..")) {
- Matcher mtr = Common.PTNSEPARATER.matcher(tempincludename);
- if (mtr.find() && !mtr.group(2).matches(".")) {
- Common.oneLevelDirCopy(mi.modulepath.replaceAll(
- Common.STRSEPARATER, "$1")
- + File.separator + mtr.group(2), mi.temppath,
- ".h");
- } else {
- Common.oneLevelDirCopy(mi.modulepath.replaceAll(
- Common.STRSEPARATER, "$1"), mi.temppath, ".h");
- }
- }
- }
- }
- if (!mi.infsources.isEmpty()) {
- Iterator<String> it = mi.infsources.iterator();
- String tempsourcename = null;
- while (it.hasNext()) {
- tempsourcename = it.next();
- if (tempsourcename.contains("..")) {
- Common.ensureDir(mi.temppath + File.separator
- + "MT_Parent_Sources");
- Matcher mtr = Common.PTNSEPARATER.matcher(tempsourcename);
- if (mtr.find()) {
- Common.fileCopy(mi.modulepath.replaceAll(
- Common.STRSEPARATER, "$1")
- + File.separator + mtr.group(2), mi.temppath
- + File.separator + "MT_Parent_Sources"
- + File.separator + mtr.group(2));
- }
- }
- }
- }
-
- Common.toDoAll(mi.temppath, this, Common.FILE);
-
- parsePreProcessedSourceCode();
-
- }
-
- private final void parsePreProcessedSourceCode() throws Exception {
- BufferedReader rd = null;
- String ifile = null;
- String line = null;
- String temp = null;
-
- Iterator<String> ii = mi.localmodulesources.iterator();
- while (ii.hasNext()) {
- temp = ii.next();
- if (temp.contains(".c") || temp.contains(".dxs")) {
- mi.preprocessedccodes.add(temp);
- }
- }
-
- ii = mi.preprocessedccodes.iterator();
-
- Pattern patefifuncc = Pattern.compile(
- "g?(BS|RT)\\s*->\\s*([a-zA-Z_]\\w*)", Pattern.MULTILINE);
- Matcher matguid;
- Matcher matfuncc;
- Matcher matfuncd;
- Matcher matenclosereplace;
- Matcher matefifuncc;
- Matcher matmacro;
-
- while (ii.hasNext()) {
- StringBuffer wholefile = new StringBuffer();
- ifile = ii.next();
- rd = new BufferedReader(new FileReader(mi.temppath + File.separator
- + ifile));
- while ((line = rd.readLine()) != null) {
- wholefile.append(line + '\n');
- }
- line = wholefile.toString();
-
- // find guid
- matguid = Guid.ptnguid.matcher(line); // several ways to implement
- // this , which one is
- // faster ? :
- while (matguid.find()) { // 1.currently , find once , then call
- // to identify which is it
- if ((temp = Guid.register(matguid, mi, MigrationTool.db)) != null) { // 2.use
- // 3
- // different
- // matchers
- // ,
- // search
- // 3
- // times
- // to
- // find
- // each
- // matguid.appendReplacement(result,
- // MigrationTool.db.getR9Guidname(temp)); // search the
- // database for all 3 kinds of guids , high cost
- }
- }
- // matguid.appendTail(result);
- // line = result.toString();
-
- // find EFI call in form of '->' , many
- // 'gUnicodeCollationInterface->' like things are not changed
- // This item is not simply replaced , special operation is required.
- matefifuncc = patefifuncc.matcher(line);
- while (matefifuncc.find()) {
- mi.hashEFIcall.add(matefifuncc.group(2));
- }
-
- // find function call
- matfuncc = Func.ptnfuncc.matcher(line);
- while (matfuncc.find()) {
- if ((temp = Func.register(matfuncc, mi, MigrationTool.db)) != null) {
- // MigrationTool.ui.println(ifile + " dofunc " + temp);
- // matfuncc.appendReplacement(result,
- // MigrationTool.db.getR9Func(temp));
- }
- }
- // matfuncc.appendTail(result);
- // line = result.toString();
-
- // find macro
- matmacro = Macro.ptntmacro.matcher(line);
- while (matmacro.find()) {
- if ((temp = Macro.register(matmacro, mi, MigrationTool.db)) != null) {
- }
- }
-
- // find function definition
- // replace all {} to @
- while ((matenclosereplace = Func.ptnbrace.matcher(line)).find()) {
- line = matenclosereplace.replaceAll("@");
- }
-
- matfuncd = Func.ptnfuncd.matcher(line);
- while (matfuncd.find()) {
- if ((temp = Func.register(matfuncd, mi, MigrationTool.db)) != null) {
- }
- }
- }
-
- // op on hash
- Iterator<String> funcci = mi.hashfuncc.iterator();
- while (funcci.hasNext()) {
- if (!mi.hashfuncd.contains(temp = funcci.next())
- && !mi.hashEFIcall.contains(temp)) {
- mi.hashnonlocalfunc.add(temp); // this set contains both
- // changed and not changed items
- }
- }
- }
-
- public class CommentLaplace extends Common.Laplace {
- public String operation(String wholeline) {
- StringBuffer wholebuffer = new StringBuffer();
- String templine = null;
- Pattern ptnincludefile = Pattern.compile("[\"<](.*[.]h)[\">]");
- Pattern ptninclude = Pattern.compile("#include\\s*(.*)");
- Matcher mtrinclude = ptninclude.matcher(wholeline);
- Matcher mtrincludefile = null;
- while (mtrinclude.find()) {
- mtrincludefile = ptnincludefile.matcher(mtrinclude.group(1));
- if (mtrincludefile.find()
- && mi.localmodulesources.contains(mtrincludefile
- .group(1))) {
- templine = mtrinclude.group();
- } else {
- String line = mtrinclude.group().toLowerCase();
- if (line.contains("pal.h")) {
- templine = "#include <IndustryStandard/Pal.h>\n";
- } else if (line.contains("sal.h")) {
- templine = "#include <IndustryStandard/Sal.h>\n";
- } else if (line.contains("pci22.h")) {
- templine = "#include <IndustryStandard/Pci22.h>\n";
- } else if (line.contains("pci23.h")) {
- templine = "#include <IndustryStandard/Pci23.h>\n";
- } else if (line.contains("pci30.h")) {
- templine = "#include <IndustryStandard/Pci30.h>\n";
- } else if (line.contains("pci.h")) {
- templine = "#include <IndustryStandard/Pci.h>\n";
- } else if (line.contains("acpi.h")) {
- templine = "#include <IndustryStandard/Acpi.h>\n";
- } else if (line.contains("scsi.h")) {
- templine = "#include <IndustryStandard/Scsi.h>\n";
- } else if (line.contains("usb.h")) {
- templine = "#include <IndustryStandard/Usb.h>\n";
- } else {
- templine = MigrationTool.MIGRATIONCOMMENT
- + mtrinclude.group();
- }
- }
- mtrinclude.appendReplacement(wholebuffer, templine);
- }
- mtrinclude.appendTail(wholebuffer);
- return wholebuffer.toString();
- }
-
- public boolean recognize(String filename) {
- return filename.contains(".c") || filename.contains(".h")
- || filename.contains(".dxs");
- }
-
- public String namechange(String oldname) {
- return oldname;
- }
- }
-
- // -----------------------------------ForDoAll-----------------------------------//
- public void run(String filepath) throws Exception {
- String name = mi.temppath + File.separator
- + filepath.replace(mi.temppath + File.separator, "");
- if (commentlaplace.recognize(name)) {
- commentlaplace.transform(name, name);
- }
- }
-
- public boolean filter(File dir) {
- return true;
- }
-
- // -----------------------------------ForDoAll-----------------------------------//
-
- public final void setModuleInfo(ModuleInfo m) {
- mi = m;
- }
-
- public static final void aimAt(ModuleInfo mi) throws Exception {
- modulereader.setModuleInfo(mi);
- modulereader.ModuleScan();
- }
-}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
deleted file mode 100644
index 085a6ba111..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.xmlbeans.XmlOptions;
-import org.tianocore.ExternsDocument;
-import org.tianocore.FilenameDocument;
-import org.tianocore.GuidsDocument;
-import org.tianocore.LibraryClassDefinitionsDocument;
-import org.tianocore.LibraryClassDocument;
-import org.tianocore.LicenseDocument;
-import org.tianocore.ModuleDefinitionsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.MsaHeaderDocument;
-import org.tianocore.PPIsDocument;
-import org.tianocore.PackageDependenciesDocument;
-import org.tianocore.ProtocolsDocument;
-import org.tianocore.SourceFilesDocument;
-import org.tianocore.SupportedArchitectures;
-import org.tianocore.UsageTypes;
-import org.tianocore.SupportedArchitectures.Enum;
-
-public class MsaOwner {
- public static final String COPYRIGHT = "Copyright (c) 2006, Intel Corporation";
-
- public static final String VERSION = "1.0";
-
- public static final String ABSTRACT = "Component name for module ";
-
- public static final String DESCRIPTION = "FIX ME!";
-
- public static final String LICENSE = "All rights reserved.\n"
- + " This software and associated documentation (if any) is furnished\n"
- + " under a license and may only be used or copied in accordance\n"
- + " with the terms of the license. Except as permitted by such\n"
- + " license, no part of this software or documentation may be\n"
- + " reproduced, stored in a retrieval system, or transmitted in any\n"
- + " form or by any means without the express written consent of\n"
- + " Intel Corporation.";
-
- public static final String SPECIFICATION = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
-
- public static final Enum IA32 = SupportedArchitectures.IA_32;
-
- public static final Enum X64 = SupportedArchitectures.X_64;
-
- public static final Enum IPF = SupportedArchitectures.IPF;
-
- public static final Enum EBC = SupportedArchitectures.EBC;
-
- private ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory
- .newInstance();
-
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
-
- private MsaHeaderDocument.MsaHeader msaheader = null;
-
- private LicenseDocument.License license = null;
-
- private ModuleDefinitionsDocument.ModuleDefinitions moduledefinitions = null;
-
- private SourceFilesDocument.SourceFiles sourcefiles = null; // found local
- // .h files are
- // not written
-
- private GuidsDocument.Guids guids = null;
-
- private ProtocolsDocument.Protocols protocols = null;
-
- private PPIsDocument.PPIs ppis = null;
-
- private PackageDependenciesDocument.PackageDependencies packagedependencies = null;
-
- private LibraryClassDefinitionsDocument.LibraryClassDefinitions libclassdefs = null;
-
- private ExternsDocument.Externs externs = null;
-
- private List<Enum> listarch = new ArrayList<Enum>();
-
- // private Map<String, Enum> mapfilenames = new HashMap<String, Enum>();
- // //this need to be installed manually when msa is to be written
- // private Map<String, UsageTypes.Enum> mapprotocols = new HashMap<String,
- // UsageTypes.Enum>();
-
- // -----------------------------msaheader-------------------------------------//
-
- public final boolean addLibraryClass(String name, UsageTypes.Enum usage) {
- /*
- * if (!libclassdefs.getLibraryClassList().contains(name)) {
- * LibraryClassDocument.LibraryClass classname; classname =
- * libclassdefs.addNewLibraryClass(); classname.setKeyword(name);
- * classname.setUsage(usage); return true; } else { return false; }
- */
- if (name == null) {
- return false;
- } else {
- Iterator<LibraryClassDocument.LibraryClass> classit = libclassdefs
- .getLibraryClassList().iterator();
- while (classit.hasNext()) {
- if (classit.next().getKeyword().matches(name)) {
- // MigrationTool.ui.println ("Warning: Duplicate
- // LibraryClass");
- return false;
- }
- }
-
- LibraryClassDocument.LibraryClass classname;
- classname = libclassdefs.addNewLibraryClass();
- classname.setKeyword(name);
- classname.setUsage(usage);
- return true;
-
- }
- }
-
- public final boolean addGuid(String guidname, UsageTypes.Enum usage) {
- if (guids == null) {
- guids = msa.addNewGuids();
- }
-
- Iterator<GuidsDocument.Guids.GuidCNames> guidit = guids
- .getGuidCNamesList().iterator();
- while (guidit.hasNext()) {
- if (guidit.next().getGuidCName() == guidname) {
- // MigrationTool.ui.println ("Warning: Duplicate Guid");
- return false;
- }
- }
-
- GuidsDocument.Guids.GuidCNames guid;
- guid = guids.addNewGuidCNames();
- guid.setGuidCName(guidname);
- guid.setUsage(usage);
- return true;
- }
-
- public final boolean addPpi(String ppiname, UsageTypes.Enum usage) {
- if (ppis == null) {
- ppis = msa.addNewPPIs();
- }
-
- Iterator<PPIsDocument.PPIs.Ppi> ppiit = ppis.getPpiList().iterator();
- while (ppiit.hasNext()) {
- if (ppiit.next().getPpiCName() == ppiname) {
- // MigrationTool.ui.println ("Warning: Duplicate Ppi");
- return false;
- }
- }
-
- PPIsDocument.PPIs.Ppi ppi;
- ppi = ppis.addNewPpi();
- ppi.setPpiCName(ppiname);
- ppi.setUsage(usage);
- return true;
- }
-
- public final boolean addProtocol(String proname, UsageTypes.Enum usage) {
- if (protocols == null) {
- protocols = msa.addNewProtocols();
- }
-
- Iterator<ProtocolsDocument.Protocols.Protocol> proit = protocols
- .getProtocolList().iterator();
- while (proit.hasNext()) {
- if (proit.next().getProtocolCName() == proname) {
- // MigrationTool.ui.println ("Warning: Duplicate Protocol");
- return false;
- }
- }
-
- ProtocolsDocument.Protocols.Protocol protocol;
- protocol = protocols.addNewProtocol();
- protocol.setProtocolCName(proname);
- protocol.setUsage(usage);
- return true;
- }
-
- public final boolean addSourceFile(String name, Enum en) {
- Iterator<FilenameDocument.Filename> fileit = sourcefiles
- .getFilenameList().iterator();
- while (fileit.hasNext()) {
- if (fileit.next().getStringValue() == name) {
- MigrationTool.ui.println("Warning: Duplicate SourceFileName");
- return false;
- }
- }
-
- FilenameDocument.Filename filename;
- List<Enum> arch = new ArrayList<Enum>();
- filename = sourcefiles.addNewFilename();
- filename.setStringValue(name);
- arch.add(en);
- filename.setSupArchList(arch);
- return true;
- }
-
- // entry point todo
-
- public final boolean setupExternSpecification() {
- addExternSpecification("EFI_SPECIFICATION_VERSION 0x00020000");
- addExternSpecification("EDK_RELEASE_VERSION 0x00020000");
- return true;
- }
-
- public final boolean addExternSpecification(String specification) {
- if (externs.getSpecificationList().contains(specification)) {
- return false;
- } else {
- externs.addSpecification(specification);
- return true;
- }
- }
-
- public final boolean setupPackageDependencies() {
- Iterator<String> it;
- //
- // For now, simply add all package guids in the database.
- //
- it = MigrationTool.db.dumpAllPkgGuid();
- while (it.hasNext()) {
- packagedependencies.addNewPackage().setPackageGuid(it.next());
- }
- return true;
- }
-
- public final boolean addPackage(String guid) {
- if (packagedependencies.getPackageList().contains(guid)) {
- return false;
- } else {
- packagedependencies.addNewPackage().setPackageGuid(guid);
- return true;
- }
- }
-
- public final boolean setupModuleDefinitions() { // ????????? give this job
- // to moduleinfo
- moduledefinitions.setBinaryModule(false);
- moduledefinitions.setOutputFileBasename(msaheader.getModuleName());
- return true;
- }
-
- public final boolean addSupportedArchitectures(Enum arch) {
- if (listarch.contains(arch)) {
- return false;
- } else {
- listarch.add(arch);
- return true;
- }
- }
-
- public final boolean addSpecification(String specification) {
- if (msaheader.getSpecification() == null) {
- if (specification == null) {
- msaheader.setSpecification(SPECIFICATION);
- } else {
- msaheader.setSpecification(specification);
- }
- return true;
- } else {
- MigrationTool.ui.println("Warning: Duplicate Specification");
- return false;
- }
- }
-
- public final boolean addLicense(String licensecontent) {
- if (msaheader.getLicense() == null) {
- license = msaheader.addNewLicense();
- if (licensecontent == null) {
- license.setStringValue(LICENSE);
- } else {
- license.setStringValue(licensecontent);
- }
- return true;
- } else {
- MigrationTool.ui.println("Warning: Duplicate License");
- return false;
- }
- }
-
- public final boolean addDescription(String description) {
- if (msaheader.getDescription() == null) {
- if (description == null) {
- msaheader.setDescription(DESCRIPTION);
- } else {
- msaheader.setDescription(description);
- }
- return true;
- } else {
- MigrationTool.ui.println("Warning: Duplicate Description");
- return false;
- }
- }
-
- public final boolean addAbstract(String abs) {
- if (msaheader.getAbstract() == null) {
- if (abs == null) {
- msaheader.setAbstract(ABSTRACT + msaheader.getModuleName());
- } else {
- msaheader.setVersion(abs);
- }
- return true;
- } else {
- MigrationTool.ui.println("Warning: Duplicate Abstract");
- return false;
- }
- }
-
- public final boolean addVersion(String version) {
- if (msaheader.getVersion() == null) {
- if (version == null) {
- msaheader.setVersion(VERSION);
- } else {
- msaheader.setVersion(version);
- }
- return true;
- } else {
- MigrationTool.ui.println("Warning: Duplicate Version");
- return false;
- }
- }
-
- public final boolean addCopyRight(String copyright) {
- if (msaheader.getCopyright() == null) {
- if (copyright == null) {
- msaheader.setCopyright(COPYRIGHT);
- } else {
- msaheader.setCopyright(copyright);
- }
- return true;
- } else {
- MigrationTool.ui.println("Warning: Duplicate CopyRight");
- return false;
- }
- }
-
- public final boolean addModuleType(String moduletype) {
- if (msaheader.getModuleType() == null) {
- msaheader.setModuleType(ModuleTypeDef.Enum.forString(moduletype));
- return true;
- } else {
- MigrationTool.ui.println("Warning: Duplicate ModuleType");
- return false;
- }
- }
-
- public final boolean addGuidValue(String guidvalue) {
- if (msaheader.getGuidValue() == null) {
- msaheader.setGuidValue(guidvalue);
- return true;
- } else {
- MigrationTool.ui.println("Warning: Duplicate GuidValue");
- return false;
- }
- }
-
- public final boolean addModuleName(String modulename) {
- if (msaheader.getModuleName() == null) {
- msaheader.setModuleName(modulename);
- return true;
- } else {
- MigrationTool.ui.println("Warning: Duplicate ModuleName");
- return false;
- }
- }
-
- // -----------------------------msaheader-------------------------------------//
-
- private final void fullfill() throws Exception {
- addCopyRight(null);
- addVersion(null);
- addAbstract(null);
- addDescription(null);
- addLicense(null);
- addSpecification(null);
- }
-
- public final void flush(String outputpath) throws Exception {
- XmlOptions options = new XmlOptions();
-
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- options.setUseDefaultNamespace();
-
- BufferedWriter bw = new BufferedWriter(new FileWriter(outputpath));
- fullfill();
- msadoc.save(bw, options);
- bw.flush();
- bw.close();
- }
-
- private final MsaOwner init() {
- msa = msadoc.addNewModuleSurfaceArea();
- msaheader = msa.addNewMsaHeader();
- moduledefinitions = msa.addNewModuleDefinitions();
- moduledefinitions.setSupportedArchitectures(listarch);
-
- sourcefiles = msa.addNewSourceFiles();
- packagedependencies = msa.addNewPackageDependencies();
- libclassdefs = msa.addNewLibraryClassDefinitions();
- externs = msa.addNewExterns();
- return this;
- }
-
- public static final MsaOwner initNewMsaOwner() {
- return new MsaOwner().init();
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java
deleted file mode 100644
index b2bce97d9f..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package org.tianocore.migration;
-
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.JTree;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class MsaTreeEditor extends JPanel {
- /**
- * Define class Serial Version UID
- */
- private static final long serialVersionUID = 3169905938472150649L;
-
- MsaTreeEditor() throws Exception {
- rootNode = new DefaultMutableTreeNode("Root Node");
- treeModel = new DefaultTreeModel(rootNode);
-
- tree = new JTree(treeModel);
- tree.setEditable(true);
- tree.getSelectionModel().setSelectionMode(
- TreeSelectionModel.SINGLE_TREE_SELECTION);
- tree.setShowsRootHandles(false);
- tree.addMouseListener(mouseadapter);
-
- JScrollPane scrollPane = new JScrollPane(tree);
- // scrollPane.setSize(800, 600);
- add(scrollPane);
-
- popupmenu = new JPopupMenu();
- menuitemadd = new JMenuItem("Add Node");
- menuitemdel = new JMenuItem("Delete Node");
- menuitemedit = new JMenuItem("Edit Node");
- popupmenu.add(menuitemadd);
- popupmenu.add(menuitemdel);
- popupmenu.add(menuitemedit);
- menuitemadd.addActionListener(actionListener);
- menuitemdel.addActionListener(actionListener);
- menuitemedit.addActionListener(actionListener);
-
- genDomTree(MigrationTool.ui.getFilepath("Select a msa file",
- JFileChooser.FILES_AND_DIRECTORIES));
- }
-
- // private ModuleSurfaceAreaDocument msadoc;
-
- private JTree tree;
-
- private DefaultMutableTreeNode rootNode;
-
- private DefaultTreeModel treeModel;
-
- private JMenuItem menuitemadd, menuitemdel, menuitemedit;
-
- private JPopupMenu popupmenu;
-
- private MouseAdapter mouseadapter = new MouseAdapter() {
- public void mouseReleased(MouseEvent me) {
- if (me.getClickCount() == 1
- && SwingUtilities.isRightMouseButton(me)) {
- tree.setSelectionPath(tree.getPathForLocation(me.getX(), me
- .getY()));
- popupmenu.show(tree, me.getX(), me.getY());
- }
- }
- };
-
- private ActionListener actionListener = new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- if (ae.getSource() == menuitemadd) {
- addNode();
- } else if (ae.getSource() == menuitemdel) {
- delNode();
- } else if (ae.getSource() == menuitemedit) {
- editNode();
- }
- }
- };
-
- private void editNode() {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) (tree
- .getSelectionPath().getLastPathComponent());
- Element element = (Element) node.getUserObject();
- System.out.println(element.getTextContent());
- }
-
- private void delNode() {
- treeModel.removeNodeFromParent((DefaultMutableTreeNode) (tree
- .getSelectionPath().getLastPathComponent()));
- }
-
- private void addNode() {
- addNode((DefaultMutableTreeNode) (tree.getSelectionPath()
- .getLastPathComponent()), MigrationTool.ui
- .getInput("Input Node Name"));
- }
-
- private DefaultMutableTreeNode addNode(DefaultMutableTreeNode parentNode,
- Object child) {
- DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child);
- treeModel.insertNodeInto(childNode, parentNode, parentNode
- .getChildCount());
- tree.scrollPathToVisible(new TreePath(childNode.getPath()));
- return childNode;
- }
-
- private final void handleNode(Node node, DefaultMutableTreeNode parentNode) {
- DefaultMutableTreeNode curNode = null;
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- System.out.println("elem");
- curNode = addNode(parentNode, node);
- } else if (node.getNodeType() == Node.DOCUMENT_NODE) {
- System.out.println("doc");
- curNode = addNode(parentNode, "MsaDocum"); // can Docum be with
- // Root Node?
- }
-
- NodeList nodelist = node.getChildNodes();
- for (int i = 0; i < nodelist.getLength(); i++) {
- handleNode(nodelist.item(i), curNode);
- }
- }
-
- private final void genDomTree(String filename) throws Exception {
- DocumentBuilder builder = DocumentBuilderFactory.newInstance()
- .newDocumentBuilder();
- Document document = builder.parse(filename);
- handleNode(document, rootNode);
- }
-
- public static final void init() throws Exception {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-
- JFrame frame = new JFrame("MsaTreeEditor");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- MsaTreeEditor mte = new MsaTreeEditor();
- mte.setLayout(new GridBagLayout());
- mte.setOpaque(true);
- frame.setContentPane(mte);
-
- frame.pack();
- frame.setVisible(true);
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
deleted file mode 100644
index deb0ae0b9c..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlOptions;
-import org.tianocore.ExternsDocument;
-import org.tianocore.FilenameDocument;
-import org.tianocore.GuidsDocument;
-import org.tianocore.LibraryClassDefinitionsDocument;
-import org.tianocore.LibraryClassDocument;
-import org.tianocore.ModuleDefinitionsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.MsaHeaderDocument;
-import org.tianocore.PPIsDocument;
-import org.tianocore.PackageDependenciesDocument;
-import org.tianocore.ProtocolsDocument;
-import org.tianocore.SourceFilesDocument;
-import org.tianocore.SupportedArchitectures;
-import org.tianocore.UsageTypes;
-import org.tianocore.SupportedArchitectures.Enum;
-
-public class MsaWriter {
- MsaWriter(ModuleInfo moduleinfo) {
- mi = moduleinfo;
- }
-
- private ModuleInfo mi;
-
- private ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory
- .newInstance();
-
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = msadoc
- .addNewModuleSurfaceArea();
-
- private MsaHeaderDocument.MsaHeader msaheader = msa.addNewMsaHeader();
-
- private ModuleDefinitionsDocument.ModuleDefinitions md = msa
- .addNewModuleDefinitions();
-
- private SourceFilesDocument.SourceFiles sourcefiles = msa
- .addNewSourceFiles(); // found local .h files are not written
-
- private GuidsDocument.Guids guids;
-
- private ProtocolsDocument.Protocols protocols;
-
- private PPIsDocument.PPIs ppis;
-
- private PackageDependenciesDocument.PackageDependencies pd = msa
- .addNewPackageDependencies();
-
- private LibraryClassDefinitionsDocument.LibraryClassDefinitions libclassdefs = msa
- .addNewLibraryClassDefinitions();
-
- private ExternsDocument.Externs externs = msa.addNewExterns();
-
- private String Query(String requirement) throws Exception {
- String answer;
- BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
- System.out.println(requirement);
- while ((answer = rd.readLine()).length() == 0)
- ;
- return answer;
- }
-
- private void addSourceFiles(String name) { // furthur modification needed
- List<Enum> arch = new ArrayList<Enum>();
- FilenameDocument.Filename filename;
- filename = sourcefiles.addNewFilename();
- filename.setStringValue(name);
-
- if (name.contains("x64" + File.separator)) { // filename ???
- arch.add(SupportedArchitectures.X_64);
- System.out.println("x64" + File.separator);
- filename.setSupArchList(arch);
- } else if (name.contains("Ia32" + File.separator)) { // filename ???
- arch.add(SupportedArchitectures.IA_32);
- System.out.println("Ia32" + File.separator);
- filename.setSupArchList(arch);
- } else if (name.contains("Ipf" + File.separator)) { // filename ???
- arch.add(SupportedArchitectures.IPF);
- System.out.println("Ipf" + File.separator);
- filename.setSupArchList(arch);
- } else if (name.contains("Ebc" + File.separator)) { // filename ???
- arch.add(SupportedArchitectures.EBC);
- System.out.println("Ebc" + File.separator);
- filename.setSupArchList(arch);
- }
- }
-
- private void addWrapper() {
- XmlCursor cursor = msa.newCursor();
- String uri = "http://www.TianoCore.org/2006/Edk2.0";
- cursor.push();
- cursor.toNextToken();
- cursor.insertNamespace("", uri);
- cursor.insertNamespace("xsi",
- "http://www.w3.org/2001/XMLSchema-instance");
- cursor.pop();
- msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) cursor.getObject();
- }
-
- private ModuleSurfaceAreaDocument fulfillMsadoc() throws Exception {
- Iterator<String> it;
- String temp;
-
- if (mi.modulename != null) {
- msaheader.setModuleName(mi.modulename);
- } else {
- msaheader
- .setModuleName(mi.modulename = Query("Module Name Not Found! Please Input ModuleName"));
- }
- if (mi.guidvalue == null) {
- mi.guidvalue = UUID.randomUUID().toString();
- MigrationTool.ui
- .println("Guid value can not be retrieved from inf file. Generate "
- + mi.guidvalue + " at random!");
- }
- msaheader.setGuidValue(mi.guidvalue);
- if (mi.moduletype != null) {
- msaheader.setModuleType(ModuleTypeDef.Enum.forString(mi
- .getModuleType()));
- } else {
- msaheader
- .setModuleType(ModuleTypeDef.Enum
- .forString(mi.moduletype = Query("Guid Value Not Found! Please Input Guid Value")));
- }
-
- msaheader
- .setCopyright("Copyright (c) 2007, Intel Corporation. All rights reserved.");
- msaheader.setVersion("1.0");
- msaheader.setAbstract("Component name for module " + mi.modulename);
- msaheader.setDescription("FIX ME!");
-
- if (mi.license == null) {
- mi.license = "FIX ME!";
- MigrationTool.ui
- .println("Fail to extract license info in inf file");
- }
- msaheader.addNewLicense().setStringValue(mi.license);
- msaheader
- .setSpecification("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
-
- List<Enum> arch = new ArrayList<Enum>();
- arch.add(SupportedArchitectures.IA_32);
- arch.add(SupportedArchitectures.X_64);
- arch.add(SupportedArchitectures.IPF);
- arch.add(SupportedArchitectures.EBC);
- md.setSupportedArchitectures(arch);
- md.setBinaryModule(false);
- md.setOutputFileBasename(mi.modulename);
- //
- // For now, simply add all package guids in the database.
- //
- it = MigrationTool.db.dumpAllPkgGuid();
- while (it.hasNext()) {
- pd.addNewPackage().setPackageGuid(it.next());
- }
- externs.addNewSpecification().setStringValue(
- "EFI_SPECIFICATION_VERSION 0x00020000");
- externs.addNewSpecification().setStringValue(
- "EDK_RELEASE_VERSION 0x00020000");
- if (mi.entrypoint != null) {
- externs.addNewExtern().setModuleEntryPoint(mi.entrypoint);
- org.tianocore.ModuleTypeDef.Enum moduleType = msaheader
- .getModuleType();
- if (moduleType == ModuleTypeDef.PEIM) {
- mi.hashrequiredr9libs.add("PeimEntryPoint");
- } else {
- mi.hashrequiredr9libs.add("UefiDriverEntryPoint");
- }
- }
-
- it = mi.localmodulesources.iterator();
- while (it.hasNext()) {
- addSourceFiles(it.next());
- }
- if (!mi.protocols.isEmpty()) {
- protocols = msa.addNewProtocols();
- it = mi.protocols.iterator();
- while (it.hasNext()) {
- if ((temp = it.next()) != null) {
- ProtocolsDocument.Protocols.Protocol pr = protocols
- .addNewProtocol();
- pr.setProtocolCName(temp);
- pr.setUsage(UsageTypes.ALWAYS_CONSUMED);
- }
- }
- }
- if (!mi.ppis.isEmpty()) {
- ppis = msa.addNewPPIs();
- it = mi.ppis.iterator();
- while (it.hasNext()) {
- if ((temp = it.next()) != null) {
- PPIsDocument.PPIs.Ppi pp = ppis.addNewPpi();
- pp.setPpiCName(temp);
- pp.setUsage(UsageTypes.ALWAYS_CONSUMED);
- }
- }
- }
- if (!mi.guids.isEmpty()) {
- guids = msa.addNewGuids();
- it = mi.guids.iterator();
- while (it.hasNext()) {
- if ((temp = it.next()) != null) {
- GuidsDocument.Guids.GuidCNames gcn = guids
- .addNewGuidCNames();
- gcn.setGuidCName(temp);
- gcn.setUsage(UsageTypes.ALWAYS_CONSUMED);
- }
- }
- }
- if (mi.isLibrary) {
- LibraryClassDocument.LibraryClass lc = libclassdefs
- .addNewLibraryClass();
- lc.setKeyword(mi.modulename);
- lc.setUsage(UsageTypes.ALWAYS_PRODUCED);
- }
- it = mi.hashrequiredr9libs.iterator();
- while (it.hasNext()) {
- if ((temp = it.next()) != null && !temp.matches("%")
- && !temp.matches("n/a")) {
- LibraryClassDocument.LibraryClass lc = libclassdefs
- .addNewLibraryClass();
- lc.setKeyword(temp);
- lc.setUsage(UsageTypes.ALWAYS_CONSUMED);
- }
- }
- addWrapper();
- msadoc.setModuleSurfaceArea(msa);
- return msadoc;
- }
-
- public void flush() throws Exception {
- XmlOptions options = new XmlOptions();
-
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- options.setUseDefaultNamespace();
-
- BufferedWriter bw = new BufferedWriter(new FileWriter(
- MigrationTool.ModuleInfoMap.get(mi) + File.separator
- + "Migration_" + mi.modulename + File.separator
- + mi.modulename + ".msa"));
- fulfillMsadoc().save(bw, options);
- // MsaTreeEditor.init(mi, ui, msadoc);
- bw.flush();
- bw.close();
- }
-
- private static void flush(String path, ModuleSurfaceAreaDocument msadoc)
- throws Exception {
- XmlOptions options = new XmlOptions();
-
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- options.setUseDefaultNamespace();
-
- BufferedWriter bw = new BufferedWriter(new FileWriter(path));
- msadoc.save(bw, options);
- bw.flush();
- bw.close();
- }
-
- public static final void parse(String msafile) throws Exception {
- ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory
- .parse(msafile);
- flush("c:\\temp.msa", msadoc);
- }
-}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/PathIterator.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/PathIterator.java
deleted file mode 100644
index 39f25db0d3..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/PathIterator.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.Iterator;
-
-public final class PathIterator implements Common.ForDoAll {
- // this PathIterator is based on HashSet, an thread implementation is
- // required.
- PathIterator(String path, int md) throws Exception {
- startpath = path;
- mode = md;
- Common.toDoAll(startpath, this, mode);
- it = pathlist.iterator();
- }
-
- private String startpath = null;
-
- private int mode;
-
- private HashSet<String> pathlist = new HashSet<String>();
-
- private Iterator<String> it = null;
-
- public final void run(String path) throws Exception {
- pathlist.add(path);
- }
-
- public boolean filter(File dir) {
- return true;
- }
-
- public final String next() {
- return it.next();
- }
-
- public final boolean hasNext() {
- return it.hasNext();
- }
-
- public final String toString() {
- return pathlist.toString();
- }
-}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
deleted file mode 100644
index 6bf0b24b53..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.tianocore.UsageTypes;
-
-public final class SourceFileReplacer implements Common.ForDoAll {
- private static final SourceFileReplacer SFReplacer = new SourceFileReplacer();
-
- private ModuleInfo mi;
-
- private static final Set<Common.Laplace> Laplaces = new HashSet<Common.Laplace>();
-
- // these sets are used only for printing log of the changes in current file
- private static final Set<r8tor9> filefunc = new HashSet<r8tor9>();
-
- private static final Set<r8tor9> filemacro = new HashSet<r8tor9>();
-
- private static final Set<r8tor9> fileguid = new HashSet<r8tor9>();
-
- private static final Set<r8tor9> fileppi = new HashSet<r8tor9>();
-
- private static final Set<r8tor9> fileprotocol = new HashSet<r8tor9>();
-
- private static final Set<String> filer8only = new HashSet<String>();
-
- private static final String[] specialhoblibfunc = { "BuildModuleHob",
- "BuildResourceDescriptorHob", "BuildFvHob", "BuildCpuHob",
- "BuildGuidDataHob", "BuildStackHob", "BuildBspStoreHob",
- "BuildMemoryAllocationHob" };
-
- private static final String[] peiserviceslibfunc = { "InstallPpi",
- "ReInstallPpi", "LocatePpi", "NotifyPpi", "GetBootMode",
- "SetBootMode", "GetHobList", "CreateHob", "FfsFindNextVolume",
- "FfsFindNextFile", "FfsFindSectionData", "InstallPeiMemory",
- "AllocatePages", "AllocatePool", "PeiResetSystem" };
-
- // ---------------------------------------inner
- // classes---------------------------------------//
- private static class r8tor9 {
- r8tor9(String r8, String r9) {
- r8thing = r8;
- r9thing = r9;
- }
-
- public String r8thing;
-
- public String r9thing;
- }
-
- private class IdleLaplace extends Common.Laplace {
- public String operation(String wholeline) {
- return replaceLibrary(wholeline, mi.hashmacro);
- }
-
- public boolean recognize(String filename) {
- return filename.contains(".h") || filename.contains(".H")
- || filename.contains(".uni") || filename.contains(".s")
- || filename.contains(".S") || filename.contains(".asm")
- || (!filename.contains(".inf") && filename.contains(".i"));
- }
-
- public String namechange(String oldname) {
- if (oldname.contains(".H")) {
- return oldname.replaceFirst(".H", ".h");
- } else {
- return oldname;
- }
- }
- }
-
- private class DxsLaplace extends Common.Laplace {
- public String operation(String wholeline) {
- wholeline = replaceMacro(wholeline, mi.hashnonlocalmacro);
- if (mi.getModuleType().equals("PEIM")) {
- return addincludefile(wholeline, "\\<PeimDepex.h\\>");
- } else {
- return addincludefile(wholeline, "\\<DxeDepex.h\\>");
- }
- }
-
- public boolean recognize(String filename) {
- return filename.contains(".dxs");
- }
-
- public String namechange(String oldname) {
- return oldname;
- }
- }
-
- private class CLaplace extends Common.Laplace {
- public String operation(String wholeline) {
- // remove EFI_DRIVER_ENTRY_POINT
- wholeline = wholeline.replaceAll(
- "(EFI_[A-Z]+_ENTRY_POINT\\s*\\(\\s*\\w(\\w|\\d)*\\s*\\))",
- MigrationTool.MIGRATIONCOMMENT + " $1");
- // redefine module entry point for some self-relocated modules
- wholeline = wholeline.replaceAll(mi.entrypoint + "([^{]*?})",
- "_ModuleEntryPoint" + "$1");
- // remove R8 library contractor
- wholeline = wholeline.replaceAll(
- "(\\b(?:Efi|Dxe)InitializeDriverLib\\b)",
- MigrationTool.MIGRATIONCOMMENT + " $1");
- // Add Library Class for potential reference of gBS, gRT & gDS.
- if (Common.find(wholeline, "\\bg?BS\\b")) {
- mi.hashrequiredr9libs.add("UefiBootServicesTableLib");
- }
- if (Common.find(wholeline, "\\bg?RT\\b")) {
- mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");
- }
- if (Common.find(wholeline, "\\bgDS\\b")) {
- mi.hashrequiredr9libs.add("DxeServicesTableLib");
- }
-
- wholeline = replaceLibrary(wholeline, mi.hashnonlocalfunc);
- wholeline = replaceLibrary(wholeline, mi.hashmacro);
- // Converting macro
- wholeline = replaceMacro(wholeline, mi.hashnonlocalmacro);
-
- // Converting guid
- replaceGuid(wholeline, mi.guids, "guid", fileguid);
- replaceGuid(wholeline, mi.ppis, "ppi", fileppi);
- replaceGuid(wholeline, mi.protocols, "protocol", fileprotocol);
-
- // Converting Pei
- if (mi.getModuleType().matches("PEIM")) {
- //
- // Try to remove PeiServicesTablePointer;
- //
- wholeline = dropPeiServicesPointer(wholeline);
- //
- // Drop the possible return Status of Hob building function.
- //
- wholeline = drophobLibReturnStatus(wholeline);
- }
- //
- // Expand obsolete R8 macro.
- //
- wholeline = replaceObsoleteMacro(wholeline);
-
- show(filefunc, "function");
- show(filemacro, "macro");
- show(fileguid, "guid");
- show(fileppi, "ppi");
- show(fileprotocol, "protocol");
- if (!filer8only.isEmpty()) {
- MigrationTool.ui.println("Converting r8only : " + filer8only);
- }
-
- filefunc.clear();
- filemacro.clear();
- fileguid.clear();
- fileppi.clear();
- fileprotocol.clear();
- filer8only.clear();
-
- return wholeline;
- }
-
- public boolean recognize(String filename) {
- return filename.contains(".c") || filename.contains(".C");
- }
-
- public String namechange(String oldname) {
- if (oldname.contains(".C")) {
- return oldname.replaceFirst(".C", ".c");
- } else {
- return oldname;
- }
- }
- }
-
- // ---------------------------------------inner
- // classes---------------------------------------//
-
- // -------------------------------------process
- // functions-------------------------------------//
- private static final String addincludefile(String wholeline, String hfile) {
- return wholeline.replaceFirst("(\\*/\\s)", "$1\n#include " + hfile
- + "\n");
- }
-
- private static final void show(Set<r8tor9> hash, String sh) {
- Iterator<r8tor9> it = hash.iterator();
- r8tor9 temp;
- if (!hash.isEmpty()) {
- MigrationTool.ui.print("Converting " + sh + " : ");
- while (it.hasNext()) {
- temp = it.next();
- MigrationTool.ui.print("[" + temp.r8thing + "->" + temp.r9thing
- + "] ");
- }
- MigrationTool.ui.println("");
- }
- }
-
- private static final void replaceGuid(String line, Set<String> hash,
- String kind, Set<r8tor9> filehash) {
- Iterator<String> it;
- String r8thing;
- String r9thing;
- it = hash.iterator();
- while (it.hasNext()) {
- r8thing = it.next();
- if ((r9thing = MigrationTool.db.getR9Guidname(r8thing)) != null) {
- if (!r8thing.equals(r9thing)) {
- if (line.contains(r8thing)) {
- line = line.replaceAll(r8thing, r9thing);
- filehash.add(new r8tor9(r8thing, r9thing));
- }
- }
- }
- }
- }
-
- private final String dropPeiServicesPointer(String wholeline) {
- String peiServicesTablePointer;
- String peiServicesTableCaller;
- String regPeiServices;
- Pattern ptnPei;
- Matcher mtrPei;
-
- peiServicesTablePointer = "\\w(?:\\w|[0-9]|->)*";
- peiServicesTableCaller = "\\(\\*\\*?\\s*(" + peiServicesTablePointer
- + ")\\s*\\)[.-]>?\\s*";
- for (int i = 0; i < peiserviceslibfunc.length; i++) {
- regPeiServices = peiServicesTableCaller + peiserviceslibfunc[i]
- + "\\s*\\(\\s*\\1\\s*,(\\t| )*";
- ptnPei = Pattern.compile(regPeiServices);
- mtrPei = ptnPei.matcher(wholeline);
- if (mtrPei.find()) {
- wholeline = mtrPei.replaceAll("PeiServices"
- + peiserviceslibfunc[i] + " (");
- mi.hashrequiredr9libs.add("PeiServicesLib");
- }
- }
- regPeiServices = peiServicesTableCaller + "(CopyMem|SetMem)"
- + "\\s*\\((\\t| )*";
- ptnPei = Pattern.compile(regPeiServices);
- mtrPei = ptnPei.matcher(wholeline);
- if (mtrPei.find()) {
- wholeline = mtrPei.replaceAll("$2 (");
- mi.hashrequiredr9libs.add("BaseMemoryLib");
- }
-
- ptnPei = Pattern.compile("#%+(\\s*\\(+\\s*)" + peiServicesTablePointer
- + "\\s*,\\s*", Pattern.MULTILINE);
- mtrPei = ptnPei.matcher(wholeline);
- while (mtrPei.find()) {
- wholeline = mtrPei.replaceAll("$1");
- }
-
- return wholeline;
- }
-
- private final String drophobLibReturnStatus(String wholeline) { // or use
- // regex to
- // find
- // pattern
- // "Status =
- // ..."
- Pattern ptnhobstatus;
- Matcher mtrhobstatus;
- String templine = wholeline;
- for (int i = 0; i < specialhoblibfunc.length; i++) {
- do {
- ptnhobstatus = Pattern.compile(
- "((?:\t| )*)(\\w(?:\\w|\\d)*)\\s*=\\s*"
- + specialhoblibfunc[i] + "(.*?;)",
- Pattern.DOTALL);
- mtrhobstatus = ptnhobstatus.matcher(templine);
- if (!mtrhobstatus.find()) {
- break;
- }
- String captureIndent = mtrhobstatus.group(1);
- String captureStatus = mtrhobstatus.group(2);
- String replaceString = captureIndent + specialhoblibfunc[i]
- + mtrhobstatus.group(3) + "\n";
- replaceString += captureIndent
- + MigrationTool.MIGRATIONCOMMENT
- + "R9 Hob-building library functions will assert if build failure.\n";
- replaceString += captureIndent + captureStatus
- + " = EFI_SUCCESS;";
- templine = mtrhobstatus.replaceFirst(replaceString);
- } while (true);
- }
- return templine;
- }
-
- private final String replaceMacro(String wholeline, Set<String> symbolSet) {
- String r8thing;
- String r9thing;
- Iterator<String> it;
-
- it = symbolSet.iterator();
- while (it.hasNext()) { // macros are all assumed MdePkg currently
- r8thing = it.next();
- // mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));
- if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {
- if (wholeline.contains(r8thing)) {
- String findString = "(?<!(?:\\d|\\w))" + r8thing
- + "(?!(?:\\d|\\w))";
- wholeline = wholeline.replaceAll(findString, r9thing);
- filemacro.add(new r8tor9(r8thing, r9thing));
- }
- }
- }
- return wholeline;
- }
-
- private final String replaceLibrary(String wholeline, Set<String> symbolSet) {
- boolean addr8 = false;
- // start replacing names
- String r8thing;
- String r9thing;
- Iterator<String> it;
- // Converting non-locla function
- it = symbolSet.iterator();
- while (it.hasNext()) {
- r8thing = it.next();
- mi.addLibraryClass(MigrationTool.db.getR9Lib(r8thing),
- UsageTypes.ALWAYS_CONSUMED);
- // mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); //
- // add a library here
-
- r8tor9 temp;
- if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {
- if (!r8thing.equals(r9thing)) {
- if (wholeline.contains(r8thing)) {
- String findString = "(?<!(?:\\d|\\w))" + r8thing
- + "(?!(?:\\d|\\w))";
- wholeline = wholeline.replaceAll(findString, r9thing);
- filefunc.add(new r8tor9(r8thing, r9thing));
- Iterator<r8tor9> rt = filefunc.iterator();
- while (rt.hasNext()) {
- temp = rt.next();
- if (MigrationTool.db.r8only.contains(temp.r8thing)) {
- filer8only.add(r8thing);
- mi.hashr8only.add(r8thing);
- addr8 = true;
- }
- }
- }
- }
- }
- } // is any of the guids changed?
- if (addr8 == true) {
- wholeline = addincludefile(wholeline, "\"R8Lib.h\"");
- }
- return wholeline;
- }
-
- private final String replaceObsoleteMacro(String wholeline) {
- Matcher mtrmac;
- mtrmac = Pattern.compile("EFI_IDIV_ROUND\\((.*), (.*)\\)").matcher(
- wholeline);
- if (mtrmac.find()) {
- wholeline = mtrmac
- .replaceAll("\\($1 \\/ $2 \\+ \\(\\(\\(2 \\* \\($1 \\% $2\\)\\) \\< $2\\) \\? 0 \\: 1\\)\\)");
- }
- mtrmac = Pattern.compile("EFI_MIN\\((.*), (.*)\\)").matcher(wholeline);
- if (mtrmac.find()) {
- wholeline = mtrmac
- .replaceAll("\\(\\($1 \\< $2\\) \\? $1 \\: $2\\)");
- }
- mtrmac = Pattern.compile("EFI_MAX\\((.*), (.*)\\)").matcher(wholeline);
- if (mtrmac.find()) {
- wholeline = mtrmac
- .replaceAll("\\(\\($1 \\> $2\\) \\? $1 \\: $2\\)");
- }
- mtrmac = Pattern.compile("EFI_UINTN_ALIGNED\\((.*)\\)").matcher(
- wholeline);
- if (mtrmac.find()) {
- wholeline = mtrmac
- .replaceAll("\\(\\(\\(UINTN\\) $1\\) \\& \\(sizeof \\(UINTN\\) \\- 1\\)\\)");
- }
- if (wholeline.contains("EFI_UINTN_ALIGN_MASK")) {
- wholeline = wholeline.replaceAll("EFI_UINTN_ALIGN_MASK",
- "(sizeof (UINTN) - 1)");
- }
- return wholeline;
- }
-
- private final void addr8only() throws Exception {
- String paragraph = null;
- String line = Common.file2string(MigrationTool.db.DatabasePath
- + File.separator + "R8Lib.c");
- PrintWriter outfile1 = new PrintWriter(new BufferedWriter(
- new FileWriter(MigrationTool.ModuleInfoMap.get(mi)
- + File.separator + "Migration_" + mi.modulename
- + File.separator + "R8Lib.c")));
- PrintWriter outfile2 = new PrintWriter(new BufferedWriter(
- new FileWriter(MigrationTool.ModuleInfoMap.get(mi)
- + File.separator + "Migration_" + mi.modulename
- + File.separator + "R8Lib.h")));
- Pattern ptnr8only = Pattern.compile(
- "////#?(\\w*)?(.*?R8_(\\w*).*?)////~", Pattern.DOTALL);
- Matcher mtrr8only = ptnr8only.matcher(line);
- Matcher mtrr8onlyhead;
-
- // add head comment
- if (mi.license != null) {
- String header = "/**@file\n Copyright (c) 2007, Intel Corporation\n\n" +
- mi.license.replace(" ", " ") + "**/\n\n";
- outfile1.append(header);
- outfile2.append(header);
- }
-
- // add functions body
- while (mtrr8only.find()) {
- if (mi.hashr8only.contains(mtrr8only.group(3))) {
- paragraph = mtrr8only.group(2);
- outfile1.append(paragraph + "\n\n");
- if (mtrr8only.group(1).length() != 0) {
- mi.hashrequiredr9libs.add(mtrr8only.group(1));
- }
- // generate R8lib.h
- while ((mtrr8onlyhead = Func.ptnbrace.matcher(paragraph))
- .find()) {
- paragraph = mtrr8onlyhead.replaceAll(";");
- }
- outfile2.append(paragraph + "\n\n");
- }
- }
- outfile1.flush();
- outfile1.close();
- outfile2.flush();
- outfile2.close();
-
- mi.localmodulesources.add("R8Lib.h");
- mi.localmodulesources.add("R8Lib.c");
- }
-
- // -------------------------------------process
- // functions-------------------------------------//
-
- // -----------------------------------ForDoAll-----------------------------------//
- public void run(String filepath) throws Exception {
- String inname = filepath.replace(mi.temppath + File.separator, "");
- String tempinpath = mi.temppath + File.separator;
- String tempoutpath = MigrationTool.ModuleInfoMap.get(mi)
- + File.separator + "Migration_" + mi.modulename
- + File.separator;
-
- Iterator<Common.Laplace> itLaplace = Laplaces.iterator();
- while (itLaplace.hasNext()) {
- Common.Laplace lap = itLaplace.next();
- if (lap.recognize(inname)) {
- MigrationTool.ui.println("\nHandling file: " + inname);
- lap.transform(tempinpath + inname, tempoutpath
- + lap.namechange(inname));
- }
- }
- }
-
- public boolean filter(File dir) {
- return true;
- }
-
- // -----------------------------------ForDoAll-----------------------------------//
-
- private final void setModuleInfo(ModuleInfo moduleinfo) {
- mi = moduleinfo;
- }
-
- private final void start() throws Exception {
- Laplaces.add(new DxsLaplace());
- Laplaces.add(new CLaplace());
- Laplaces.add(new IdleLaplace());
-
- Common.toDoAll(mi.temppath, this, Common.FILE);
-
- if (!mi.hashr8only.isEmpty()) {
- addr8only();
- }
-
- Laplaces.clear();
- }
-
- public static final void fireAt(ModuleInfo moduleinfo) throws Exception {
- SFReplacer.setModuleInfo(moduleinfo);
- SFReplacer.start();
- }
-}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/UI.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/UI.java
deleted file mode 100644
index ddbc85b847..0000000000
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/UI.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/** @file
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.migration;
-
-import java.util.Set;
-
-public interface UI {
-
- public boolean yesOrNo(String question);
-
- public void print(String message);
-
- public void println(String message);
-
- public void println(Set<String> hash);
-
- public String choose(String message, Object[] choicelist);
-
- public String getInput(String message);
-
- public String getFilepath(String title, int mode); // necessary ?
-}
diff --git a/Tools/Java/Source/PcdTools/PcdTools.msa b/Tools/Java/Source/PcdTools/PcdTools.msa
deleted file mode 100644
index 11a68567ec..0000000000
--- a/Tools/Java/Source/PcdTools/PcdTools.msa
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
- <MsaHeader>
- <ModuleName>PcdTools</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>95506773-88f3-475a-91a1-14ce0c847353</GuidValue>
- <Version>2.0</Version>
- <Abstract>This is the EFI/Tiano PCD Tool Resources Module</Abstract>
- <Description>
- This Module provdes the entity, action and exception package for PCD
- tools, This package will be shared for building tools or wizard tools.
- </Description>
- <Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
- <License>
-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.
- </License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>build.xml</Filename>
- <Filename>org/tianocore/pcd/action/PlatformPcdPreprocessAction.java</Filename>
- <Filename>org/tianocore/pcd/action/BuildAction.java</Filename>
- <Filename>org/tianocore/pcd/entity/CommonDefinition.java</Filename>
- <Filename>org/tianocore/pcd/entity/DynamicTokenValue.java</Filename>
- <Filename>org/tianocore/pcd/entity/MemoryDatabaseManager.java</Filename>
- <Filename>org/tianocore/pcd/entity/ModulePcdInfoFromFpd.java</Filename>
- <Filename>org/tianocore/pcd/entity/SkuInstance.java</Filename>
- <Filename>org/tianocore/pcd/entity/Token.java</Filename>
- <Filename>org/tianocore/pcd/entity/UsageInstance.java</Filename>
- <Filename>org/tianocore/pcd/exception/BuildActionException.java</Filename>
- <Filename>org/tianocore/pcd/exception/EntityException.java</Filename>
- <Filename>org/tianocore/pcd/exception/PlatformPcdPreprocessException.java</Filename>
- <Filename>org/tianocore/pcd/exception/UIException.java</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/PcdTools/build.xml b/Tools/Java/Source/PcdTools/build.xml
deleted file mode 100644
index 4db07e0cf4..0000000000
--- a/Tools/Java/Source/PcdTools/build.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="PcdTools" default="PcdTools" basedir=".">
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="SurfaceArea.jar"/>
- <fileset dir="${WORKSPACE}/Tools/Jars" includes="Common.jar"/>
- <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
- </path>
- <property name="buildDir" value="build"/>
- <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>
- <target name="PcdTools" depends="install"/>
- <target name="source">
- <mkdir dir="${buildDir}"/>
- <javac srcdir="." destdir="${buildDir}">
- <classpath refid="classpath"/>
- <compilerarg value="-Xlint"/>
- </javac>
- </target>
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false" quiet="true">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/PcdTools" includes="${buildDir}"/>
- </delete>
- </target>
- <target name="cleanall" depends="clean">
- <echo message="Removing Class Files and the Java Archive: PcdTools.jar"/>
- <delete file="${installLocation}/PcdTools.jar"/>
- <if>
- <available file="${installLocation}/PcdTools.jar"/>
- <then>
- <echo message="You must manually remove the file: ${installLocation}/PcdTools.jar"/>
- <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
- </then>
- </if>
- </target>
- <target name="install" depends="source">
- <jar destfile="${installLocation}/PcdTools.jar"
- basedir="${buildDir}"
- includes="**"
- />
- </target>
-</project>
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/action/BuildAction.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/action/BuildAction.java
deleted file mode 100644
index 9d30a76bdc..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/action/BuildAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/** @file
- BuildAction class.
-
- BuildAction is the parent class for all action related to ant Task. This class will
- define some common utility functionality, such as logMsg, warningMsg..etc.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.action;
-
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
-import org.tianocore.pcd.exception.BuildActionException;
-
-/** BuildAction is the parent class for all action related to ant Task. This class will
- define some common utility functionality, such as logMsg, warningMsg..etc.
-**/
-public abstract class BuildAction extends Task {
- ///
- /// Original message level before this action. This value will
- /// be restored when quit this action.
- ///
- private int originalMessageLevel;
-
- /**
- checkParameter function check all parameter valid.
-
- This function will be overrided by child class.
- **/
- public abstract void checkParameter() throws BuildActionException;
-
- /**
- performAction is to execute the detail action.
-
- This function will be overrided by child class.
- **/
- public abstract void performAction() throws BuildActionException;
-
- /**
- execute function is the main flow for all build action class.
-
- This workflow will be:
- 1) Check paramet of this action.
- 2) Perform the child class action function.
- 3) Restore the message level.
-
- @throws BuildActionException
- **/
- public void execute() throws BuildActionException {
- checkParameter();
- performAction();
- }
-}
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
deleted file mode 100644
index ee91f2a8e8..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
+++ /dev/null
@@ -1,992 +0,0 @@
-/** @file
- PlatformPcdPreprocessAction class.
-
- The abstract parent class PlatformPcdPreprocessAction, This class is to collect platform's
- pcd build information from fpd file.
- This class will be extended by building tools and wizard tools.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.action;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;
-import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;
-import org.tianocore.pcd.entity.*;
-import org.tianocore.pcd.entity.Token;
-import org.tianocore.pcd.entity.MemoryDatabaseManager;
-import org.tianocore.pcd.exception.PlatformPcdPreprocessException;
-
-/**
- The abstract parent class PlatformPcdPreprocessAction, This class is to collect platform's
- pcd build information from fpd file.
- This class will be extended by building tools and wizard tools.
-
-**/
-public abstract class PlatformPcdPreprocessAction {
- ///
- /// PCD memory database
- ///
- private MemoryDatabaseManager pcdDbManager;
-
- ///
- /// Errors string when perform preprocess
- ///
- private String errorString;
-
- ///
- /// the count of errors when perform preprocess
- ///
- private int errorCount;
-
- /**
- Default contructor function
- **/
- public PlatformPcdPreprocessAction() {
- pcdDbManager = null;
- errorString = null;
- errorCount = 0;
- }
-
- /**
- Set parameter pcdDbManager
-
- @param pcdDbManager
- **/
- public void setPcdDbManager(MemoryDatabaseManager pcdDbManager) {
- this.pcdDbManager = pcdDbManager;
- }
-
- /**
- Get parameter pcdDbManager
-
- @return MemoryDatabaseManager
- **/
- public MemoryDatabaseManager getPcdDbManager() {
- return pcdDbManager;
- }
-
- /**
- Abstract function: retrieve module information from FPD file.
-
- In building environement, this function will be implementated by FpdParserTask.
-
- @return List<ModulePcdInfoFromFpd> the component array.
- @throws PlatformPcdPreprocessException get all modules in <ModuleSA> in FPD file.
-
- **/
- public abstract List<ModulePcdInfoFromFpd> getComponentsFromFpd()
- throws PlatformPcdPreprocessException;
-
- /**
- Abstract function to get GUID string from SPD file.
-
- In building evnironment, this function will be implementated by GlobaData.
-
- @param guidCName the CName of GUID
-
- @return String Guid information from SPD file.
- @throws PlatformPcdPreprocessException
- Fail to get Guid information from SPD file.
- **/
- public abstract String getGuidInfoFromSpd(String guidCName) throws PlatformPcdPreprocessException;
-
- /**
- Abstract function: Verification the PCD data.
-
- In different environment, such as building environment and wizard environment,
- it has different implementation according to optimization.
-
- @param cName The token name
- @param moduleName The module who use this PCD token
- @param datum The PCD's datum
- @param datumType The PCD's datum type
- @param maxDatumSize The max size for PCD's Datum.
-
- @return String exception strings.
-
- **/
- public abstract String verifyDatum(String cName, String moduleName, String datum,
- Token.DATUM_TYPE datumType, int maxDatumSize);
-
- /**
- Abstract function: Get dynamic information for a token
-
- @param token
- @param moduleName
-
- @return DynamicPcdBuildDefinitions.PcdBuildData
- **/
- public abstract DynamicPcdBuildDefinitions.PcdBuildData
- getDynamicInfoFromFpd(Token token,
- String moduleName)
- throws PlatformPcdPreprocessException;
-
- /**
- Abstract function: Get all dynamic PCD information from FPD file.
-
- @return List<DynamicPcdBuildDefinitions.PcdBuildData> All DYNAMIC PCD list in <DynamicPcdBuildDefinitions> in FPD file.
- @throws PlatformPcdPreprocessBuildException Failure to get dynamic information list.
-
- **/
- public abstract List<DynamicPcdBuildDefinitions.PcdBuildData>
- getAllDynamicPcdInfoFromFpd()
- throws PlatformPcdPreprocessException;
-
- /**
- Return the error string after preprocess
-
- @return String error string
- **/
- public String getErrorString() {
- return errorString;
- }
-
- public void putError(String error) {
- if (errorString == null) {
- errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";
- } else {
- errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";
- }
-
- errorCount++;
- }
-
- /**
- Collect all PCD information from FPD file into PCD memory database.
-
- **/
- public void initPcdMemoryDbWithPlatformInfo()
- throws PlatformPcdPreprocessException {
- int index;
- int pcdIndex;
- List<PcdBuildDefinition.PcdData> pcdBuildDataArray = new ArrayList<PcdBuildDefinition.PcdData>();
- PcdBuildDefinition.PcdData pcdBuildData;
- Token token = null;
- List<ModulePcdInfoFromFpd> modules;
- String primaryKey;
- String exceptionString;
- UsageInstance usageInstance;
- Token.PCD_TYPE pcdType = Token.PCD_TYPE.UNKNOWN;
- Token.DATUM_TYPE datumType = Token.DATUM_TYPE.UNKNOWN;
- long tokenNumber;
- String moduleName;
- String datum;
- int maxDatumSize;
- String tokenSpaceStrRet;
- ModulePcdInfoFromFpd curModule;
-
- //
- // ----------------------------------------------
- // 1), Get all <ModuleSA> from FPD file.
- // ----------------------------------------------
- //
- modules = getComponentsFromFpd();
-
- if (modules == null) {
- throw new PlatformPcdPreprocessException(
- "No modules found in the FPD file.\nPlease check whether there are elements in <FrameworkModules> in the FPD file!");
- }
-
- //
- // -------------------------------------------------------------------
- // 2), Loop all modules to process <PcdBuildDeclarations> for each module.
- // -------------------------------------------------------------------
- //
- for (index = 0; index < modules.size(); index++) {
- curModule = modules.get(index);
-
- //
- // It is legal for a module does not contains ANY pcd build definitions.
- //
- if (curModule.pcdBuildDefinition == null) {
- continue;
- }
-
- pcdBuildDataArray = curModule.pcdBuildDefinition.getPcdDataList();
- moduleName = curModule.usageId.moduleName;
-
- //
- // ----------------------------------------------------------------------
- // 2.1), Loop all Pcd entry for a module and add it into memory database.
- // ----------------------------------------------------------------------
- //
- for (pcdIndex = 0; pcdIndex < pcdBuildDataArray.size(); pcdIndex++) {
- pcdBuildData = pcdBuildDataArray.get(pcdIndex);
-
- tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());
-
- if (tokenSpaceStrRet == null) {
- putError("Failed to get Token Space Guid for token " + pcdBuildData.getCName() +
- " from any SPD file. You must have an <GuidDeclaration> for this Token Space Guid!");
- //
- // Do not break preprocess, continues to analysis.
- // All errors will be summary to be shown.
- //
- continue;
- }
-
- primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(), tokenSpaceStrRet);
- pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());
- datumType = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());
- tokenNumber = Long.decode(pcdBuildData.getToken().toString());
- if (pcdBuildData.getValue() != null) {
- datum = pcdBuildData.getValue().toString();
- } else {
- datum = null;
- }
- maxDatumSize = pcdBuildData.getMaxDatumSize();
-
- if ((pcdType == Token.PCD_TYPE.FEATURE_FLAG) &&
- (datumType != Token.DATUM_TYPE.BOOLEAN)){
- exceptionString = String.format("In FPD file, for PCD %s in module %s, the PCD type is FEATURE_FLAG but "+
- "datum type for this PCD entry is not BOOLEAN!",
- pcdBuildData.getCName(),
- moduleName);
- putError(exceptionString);
- //
- // Do not break preprocess, continues to analysis.
- // All errors will be summary to be shown.
- //
- continue;
- }
-
- //
- // -------------------------------------------------------------------------------------------
- // 2.1.1), Do some necessary checking work for FixedAtBuild, FeatureFlag and PatchableInModule
- // -------------------------------------------------------------------------------------------
- //
- if (!Token.isDynamic(pcdType)) {
- //
- // Value is required.
- //
- if (datum == null) {
- exceptionString = String.format("In the FPD file, there is no value for PCD entry %s in module %s!",
- pcdBuildData.getCName(),
- moduleName);
- putError(exceptionString);
- //
- // Do not break preprocess, continues to analysis.
- // All errors will be summary to be shown.
- //
- continue;
- }
-
- //
- // Check whether the datum size is matched datum type.
- //
- if ((exceptionString = verifyDatum(pcdBuildData.getCName(),
- moduleName,
- datum,
- datumType,
- maxDatumSize)) != null) {
- putError(exceptionString);
- //
- // Do not break preprocess, continues to analysis.
- // All errors will be summary to be shown.
- //
- continue;
- }
- }
-
- //
- // ---------------------------------------------------------------------------------
- // 2.1.2), Create token or update token information for current anaylized PCD data.
- // ---------------------------------------------------------------------------------
- //
- if (pcdDbManager.isTokenInDatabase(primaryKey)) {
- //
- // If the token is already exist in database, do some necessary checking
- // and add a usage instance into this token in database
- //
- token = pcdDbManager.getTokenByKey(primaryKey);
-
- //
- // checking for DatumType, DatumType should be unique for one PCD used in different
- // modules.
- //
- if (token.datumType != datumType) {
- exceptionString = String.format("In the FPD file, the datum type of the PCD entry %s is %s, which is different from %s which was previously defined!",
- pcdBuildData.getCName(),
- pcdBuildData.getDatumType().toString(),
- Token.getStringOfdatumType(token.datumType));
- putError(exceptionString);
- //
- // Do not break preprocess, continues to analysis.
- // All errors will be summary to be shown.
- //
- continue;
- }
-
- //
- // Check token number is valid
- //
- if (tokenNumber != token.tokenNumber) {
- exceptionString = String.format("In the FPD file, the token number of PCD entry %s in module %s is different from the same PCD entry in other modules!",
- pcdBuildData.getCName(),
- moduleName);
- putError(exceptionString);
- //
- // Do not break preprocess, continues to analysis.
- // All errors will be summary to be shown.
- //
- continue;
- }
-
- //
- // For same PCD used in different modules, the PCD type should all be dynamic or non-dynamic.
- //
- if (token.isDynamicPCD != Token.isDynamic(pcdType)) {
- exceptionString = String.format("In the FPD file, for PCD entry %s in module %s, you defined dynamic or non-dynamic PCD type which"+
- " is different from other module's definition.",
- token.cName,
- moduleName);
- putError(exceptionString);
- //
- // Do not break preprocess, continues to analysis.
- // All errors will be summary to be shown.
- //
- continue;
- }
-
- if (token.isDynamicPCD) {
- if ((maxDatumSize != 0) &&
- (maxDatumSize != token.datumSize)){
- exceptionString = String.format("In the FPD file, for dynamic PCD %s in module %s, the max datum size is %d which "+
- "is different than <MaxDatumSize> %d defined in <DynamicPcdBuildDefinitions>!",
- token.cName,
- moduleName,
- maxDatumSize,
- token.datumSize);
- putError(exceptionString);
- //
- // Do not break preprocess, continues to analysis.
- // All errors will be summary to be shown.
- //
- continue;
- }
- }
-
- } else {
- //
- // If the token is not in database, create a new token instance and add
- // a usage instance into this token in database.
- //
- tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());
-
- if (tokenSpaceStrRet == null) {
- putError("Failed to get the Token Space Guid for token" + token.cName +
- " from any SPD file. You must have a <GuidDeclaration> for this Token Space Guid!");
- //
- // Do not break preprocess, continues to analysis.
- // All errors will be summary to be shown.
- //
- continue;
- }
-
- token = new Token(pcdBuildData.getCName(), tokenSpaceStrRet);
-
- token.datumType = datumType;
- token.tokenNumber = tokenNumber;
- token.isDynamicPCD = Token.isDynamic(pcdType);
- token.datumSize = maxDatumSize;
-
- if (token.isDynamicPCD) {
- //
- // For Dynamic and Dynamic Ex type, need find the dynamic information
- // in <DynamicPcdBuildDefinition> section in FPD file.
- //
- if (null == updateDynamicInformation(moduleName,
- token,
- datum,
- maxDatumSize)) {
- continue;
- }
- }
-
- pcdDbManager.addTokenToDatabase(primaryKey, token);
- }
-
- //
- // -----------------------------------------------------------------------------------
- // 2.1.3), Add the PcdType in current module into this Pcd token's supported PCD type.
- // -----------------------------------------------------------------------------------
- //
- token.updateSupportPcdType(pcdType);
-
- //
- // ------------------------------------------------
- // 2.1.4), Create an usage instance for this token.
- // ------------------------------------------------
- //
- usageInstance = new UsageInstance(token,
- curModule.usageId,
- pcdType,
- datum,
- maxDatumSize);
- if (!token.addUsageInstance(usageInstance)) {
- putError(String.format("PCD %s for module %s(%s) already exists in the database.\nPlease check all PCD build entries "+
- "in the %s module's <ModuleSA> section to make sure there are no duplicated definitions in the FPD file!",
- token.cName,
- curModule.usageId.moduleGuid,
- moduleName,
- moduleName));
- continue;
- }
- }
- }
-
- //
- // ------------------------------------------------
- // 3), Add unreference dynamic_Ex pcd token into Pcd database.
- // ------------------------------------------------
- //
- List<Token> tokenArray = getUnreferencedDynamicPcd();
- if (tokenArray != null) {
- for (index = 0; index < tokenArray.size(); index++) {
- pcdDbManager.addTokenToDatabase(tokenArray.get(index).getPrimaryKeyString(),
- tokenArray.get(index));
- }
- }
- }
-
- /**
- Update dynamic information for PCD entry.
-
- Dynamic information is retrieved from <PcdDynamicBuildDeclarations> in
- FPD file.
-
- @param moduleName The name of the module who use this PCD
- @param token The token instance
- @param datum The <datum> in module's PCD information
- @param maxDatumSize The <maxDatumSize> in module's PCD information
-
- @return Token
- */
- private Token updateDynamicInformation(String moduleName,
- Token token,
- String datum,
- int maxDatumSize)
- throws PlatformPcdPreprocessException {
- int index = 0;
- int offset;
- String exceptionString = null;
- SkuInstance skuInstance = null;
- String temp;
- boolean hasSkuId0 = false;
- long tokenNumber = 0;
- String hiiDefaultValue = null;
- String variableGuidString = null;
-
- List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> skuInfoList = null;
- DynamicPcdBuildDefinitions.PcdBuildData dynamicInfo = null;
-
- dynamicInfo = getDynamicInfoFromFpd(token, moduleName);
- if (dynamicInfo == null) {
- exceptionString = String.format("In the FPD file, the Dynamic PCD %s is used by module %s.\n" +
- "However, there is no dynamic information in the <DynamicPcdBuildDefinitions> " +
- "section of the FPD file. This section is required!",
- token.cName,
- moduleName);
- putError(exceptionString);
- return null;
- }
-
- token.datumSize = dynamicInfo.getMaxDatumSize();
-
- exceptionString = verifyDatum(token.cName,
- moduleName,
- null,
- token.datumType,
- token.datumSize);
- if (exceptionString != null) {
- throw new PlatformPcdPreprocessException(exceptionString);
- }
-
- if ((maxDatumSize != 0) &&
- (maxDatumSize != token.datumSize)) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s, the datum size in module %s is %d, but "+
- "the datum size in <DynamicPcdBuildDefinitions> is %d, they do not match!",
- token.cName,
- moduleName,
- maxDatumSize,
- dynamicInfo.getMaxDatumSize());
- putError(exceptionString);
- return null;
- }
- tokenNumber = Long.decode(dynamicInfo.getToken().toString());
- if (tokenNumber != token.tokenNumber) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s, the token number in module %s is 0x%x, but "+
- "in the <DynamicPcdBuildDefinictions> section, the token number is 0x%x, they do not match!",
- token.cName,
- moduleName,
- token.tokenNumber,
- tokenNumber);
- putError(exceptionString);
- return null;
- }
-
- token.dynamicExTokenNumber = tokenNumber;
-
- skuInfoList = dynamicInfo.getSkuInfoList();
-
- //
- // Loop all sku data
- //
- for (index = 0; index < skuInfoList.size(); index++) {
- skuInstance = new SkuInstance();
- //
- // Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.
- //
- temp = skuInfoList.get(index).getSkuId().toString();
- skuInstance.id = Integer.decode(temp);
- if (skuInstance.id == 0) {
- hasSkuId0 = true;
- }
- //
- // Judge whether is DefaultGroup at first, because most case is DefautlGroup.
- //
- if (skuInfoList.get(index).getValue() != null) {
- skuInstance.value.setValue(skuInfoList.get(index).getValue().toString());
- if ((exceptionString = verifyDatum(token.cName,
- null,
- skuInfoList.get(index).getValue().toString(),
- token.datumType,
- token.datumSize)) != null) {
- putError(exceptionString);
- return null;
- }
-
- token.skuData.add(skuInstance);
-
- continue;
- }
-
- //
- // Judge whether is HII group case.
- //
- if (skuInfoList.get(index).getVariableName() != null) {
- exceptionString = null;
- if (skuInfoList.get(index).getVariableGuid() == null) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+
- "file, use of HII was defined, but there is no <VariableGuid> defined for SKU %d data!",
- token.cName,
- index);
- putError(exceptionString);
- return null;
- }
-
- if (skuInfoList.get(index).getVariableOffset() == null) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+
- "file, use of HII was defined, but there is no <VariableOffset> defined for SKU %d data!",
- token.cName,
- index);
- putError(exceptionString);
- return null;
- }
-
- if (skuInfoList.get(index).getHiiDefaultValue() == null) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+
- "file, use of HII was defined, but there is no <HiiDefaultValue> defined for SKU %d data!",
- token.cName,
- index);
- putError(exceptionString);
- return null;
- }
-
- if (skuInfoList.get(index).getHiiDefaultValue() != null) {
- hiiDefaultValue = skuInfoList.get(index).getHiiDefaultValue().toString();
- } else {
- hiiDefaultValue = null;
- }
-
- if ((exceptionString = verifyDatum(token.cName,
- null,
- hiiDefaultValue,
- token.datumType,
- token.datumSize)) != null) {
- throw new PlatformPcdPreprocessException(exceptionString);
- }
-
- offset = Integer.decode(skuInfoList.get(index).getVariableOffset());
- if (offset > 0xFFFF) {
- putError(String.format("In the FPD file, for dynamic PCD %s, the variable offset defined in SKU %d data "+
- "exceeds 64K, which is not allowed!",
- token.cName,
- index));
- return null;
- }
-
- //
- // Get variable guid string according to the name of guid which will be mapped into a GUID in SPD file.
- //
- variableGuidString = getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());
- if (variableGuidString == null) {
- putError(String.format("In the FPD file, for dynamic PCD %s, the variable guid: %s cannot be found in any SPD file!",
- token.cName,
- skuInfoList.get(index).getVariableGuid().toString()));
- return null;
- }
- String variableStr = skuInfoList.get(index).getVariableName();
- Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");
- Matcher matcher = pattern.matcher(variableStr);
- List<String> varNameList = new ArrayList<String>();
- while (matcher.find()){
- String str = variableStr.substring(matcher.start(),matcher.end());
- varNameList.add(str);
- }
-
- skuInstance.value.setHiiData(varNameList,
- translateSchemaStringToUUID(variableGuidString),
- skuInfoList.get(index).getVariableOffset(),
- skuInfoList.get(index).getHiiDefaultValue().toString());
- token.skuData.add(skuInstance);
- continue;
- }
-
- if (skuInfoList.get(index).getVpdOffset() != null) {
- skuInstance.value.setVpdData(skuInfoList.get(index).getVpdOffset());
- token.skuData.add(skuInstance);
- continue;
- }
-
- exceptionString = String.format("In the FPD file, for dynamic PCD %s, the dynamic info must "+
- "be one of: 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",
- token.cName);
- putError(exceptionString);
- return null;
- }
-
- if (!hasSkuId0) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions>, there is "+
- "no SKU ID = 0 data, which is required for every dynamic PCD",
- token.cName);
- putError(exceptionString);
- return null;
- }
-
- return token;
- }
-
- /**
- Get all dynamic PCD defined in <DynamicPcdBuildDefinitions> which unreferenced by
- any <ModuleSA> in FPD file.
-
- @return List<Token> Return PCD token
- **/
- private List<Token> getUnreferencedDynamicPcd () throws PlatformPcdPreprocessException {
- List<Token> tokenArray = new ArrayList<Token>();
- Token token = null;
- List<DynamicPcdBuildDefinitions.PcdBuildData> dynamicPcdBuildDataArray = null;
- DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData = null;
- List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> skuInfoList = null;
- Token.PCD_TYPE pcdType;
- SkuInstance skuInstance = null;
- String primaryKey = null;
- boolean hasSkuId0 = false;
- int index, offset, index2;
- String temp;
- String exceptionString;
- String hiiDefaultValue;
- String tokenSpaceStrRet;
- String variableGuidString;
-
- dynamicPcdBuildDataArray = getAllDynamicPcdInfoFromFpd();
- if (dynamicPcdBuildDataArray == null) {
- return null;
- }
-
- for (index2 = 0; index2 < dynamicPcdBuildDataArray.size(); index2++) {
- pcdBuildData = dynamicPcdBuildDataArray.get(index2);
- tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());
-
- if (tokenSpaceStrRet == null) {
- putError("Failed to get the Token Space Guid for token" + pcdBuildData.getCName());
- continue;
- }
-
- primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(),
- tokenSpaceStrRet);
-
- if (pcdDbManager.isTokenInDatabase(primaryKey)) {
- continue;
- }
-
- pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());
- if (pcdType != Token.PCD_TYPE.DYNAMIC_EX) {
- putError(String.format("In the FPD file, it not allowed to define DYNAMIC PCD %s that is not used by any module",
- pcdBuildData.getCName()));
- continue;
- }
-
- //
- // Create new token for unreference dynamic PCD token
- //
- token = new Token(pcdBuildData.getCName(), tokenSpaceStrRet);
- token.datumSize = pcdBuildData.getMaxDatumSize();
-
-
- token.datumType = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());
- token.tokenNumber = Long.decode(pcdBuildData.getToken().toString());
- token.dynamicExTokenNumber = token.tokenNumber;
- token.isDynamicPCD = true;
- token.updateSupportPcdType(pcdType);
-
- exceptionString = verifyDatum(token.cName,
- null,
- null,
- token.datumType,
- token.datumSize);
- if (exceptionString != null) {
- putError(exceptionString);
- continue;
- }
-
- skuInfoList = pcdBuildData.getSkuInfoList();
-
- //
- // Loop all sku data
- //
- for (index = 0; index < skuInfoList.size(); index++) {
- skuInstance = new SkuInstance();
- //
- // Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.
- //
- temp = skuInfoList.get(index).getSkuId().toString();
- skuInstance.id = Integer.decode(temp);
- if (skuInstance.id == 0) {
- hasSkuId0 = true;
- }
- //
- // Judge whether is DefaultGroup at first, because most case is DefautlGroup.
- //
- if (skuInfoList.get(index).getValue() != null) {
- skuInstance.value.setValue(skuInfoList.get(index).getValue().toString());
- if ((exceptionString = verifyDatum(token.cName,
- null,
- skuInfoList.get(index).getValue().toString(),
- token.datumType,
- token.datumSize)) != null) {
- putError(exceptionString);
- continue;
- }
-
- token.skuData.add(skuInstance);
-
- continue;
- }
-
- //
- // Judge whether is HII group case.
- //
- if (skuInfoList.get(index).getVariableName() != null) {
- exceptionString = null;
- if (skuInfoList.get(index).getVariableGuid() == null) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s in the <DynamicPcdBuildDefinitions> section of the FPD "+
- "file, use of HII is defined, but there is no <VariableGuid> defined for SKU %d data!",
- token.cName,
- index);
- putError(exceptionString);
- continue;
- }
-
- if (skuInfoList.get(index).getVariableOffset() == null) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s in the <DynamicPcdBuildDefinitions> section of the FPD "+
- "file, use of HII is defined, but there is no <VariableOffset> defined for SKU %d data!",
- token.cName,
- index);
- putError(exceptionString);
- continue;
- }
-
- if (skuInfoList.get(index).getHiiDefaultValue() == null) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s in the <DynamicPcdBuildDefinitions> section of the FPD "+
- "file, use of HII is defined, but there is no <HiiDefaultValue> defined for SKU %d data!",
- token.cName,
- index);
- putError(exceptionString);
- continue;
- }
-
- if (skuInfoList.get(index).getHiiDefaultValue() != null) {
- hiiDefaultValue = skuInfoList.get(index).getHiiDefaultValue().toString();
- } else {
- hiiDefaultValue = null;
- }
-
- if ((exceptionString = verifyDatum(token.cName,
- null,
- hiiDefaultValue,
- token.datumType,
- token.datumSize)) != null) {
- putError(exceptionString);
- continue;
- }
-
- offset = Integer.decode(skuInfoList.get(index).getVariableOffset());
- if (offset > 0xFFFF) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s, the variable offset defined in SKU %d data "+
- "exceeds 64K, which is not allowed!",
- token.cName,
- index);
- putError(exceptionString);
- continue;
- }
-
- //
- // Get variable guid string according to the name of guid which will be mapped into a GUID in SPD file.
- //
- variableGuidString = getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());
- if (variableGuidString == null) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s, the variable guid %s cannot be found in any SPD file!",
- token.cName,
- skuInfoList.get(index).getVariableGuid().toString());
- putError(exceptionString);
- continue;
- }
- String variableStr = skuInfoList.get(index).getVariableName();
- Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");
- Matcher matcher = pattern.matcher(variableStr);
- List<String> varNameList = new ArrayList<String>();
- while (matcher.find()){
- String str = variableStr.substring(matcher.start(),matcher.end());
- varNameList.add(str);
- }
-
- skuInstance.value.setHiiData(varNameList,
- translateSchemaStringToUUID(variableGuidString),
- skuInfoList.get(index).getVariableOffset(),
- skuInfoList.get(index).getHiiDefaultValue().toString());
- token.skuData.add(skuInstance);
- continue;
- }
-
- if (skuInfoList.get(index).getVpdOffset() != null) {
- skuInstance.value.setVpdData(skuInfoList.get(index).getVpdOffset());
- token.skuData.add(skuInstance);
- continue;
- }
-
- exceptionString = String.format("In the FPD file, for dynamic PCD %s, the dynamic info must "+
- "be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",
- token.cName);
- putError(exceptionString);
- }
-
- if (!hasSkuId0) {
- exceptionString = String.format("In the FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions>, there is "+
- "no SKU ID = 0 data, which is required for every dynamic PCD",
- token.cName);
- putError(exceptionString);
- continue;
- }
-
- tokenArray.add(token);
- }
-
- return tokenArray;
- }
-
- /**
- Translate the schema string to UUID instance.
-
- In schema, the string of UUID is defined as following two types string:
- 1) GuidArrayType: pattern = 0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},(
- )*0x[a-fA-F0-9]{1,4}(,( )*\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\})?
-
- 2) GuidNamingConvention: pattern =
- [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}
-
- This function will convert string and create uuid instance.
-
- @param uuidString UUID string in XML file
-
- @return UUID UUID instance
- **/
- private UUID translateSchemaStringToUUID(String uuidString)
- throws PlatformPcdPreprocessException {
- String temp;
- String[] splitStringArray;
- int index;
- int chIndex;
- int chLen;
-
- if (uuidString == null) {
- return null;
- }
-
- if (uuidString.length() == 0) {
- return null;
- }
-
- if (uuidString.equals("0") ||
- uuidString.equalsIgnoreCase("0x0")) {
- return new UUID(0, 0);
- }
-
- uuidString = uuidString.replaceAll("\\{", "");
- uuidString = uuidString.replaceAll("\\}", "");
-
- //
- // If the UUID schema string is GuidArrayType type then need translate
- // to GuidNamingConvention type at first.
- //
- if ((uuidString.charAt(0) == '0') && ((uuidString.charAt(1) == 'x') || (uuidString.charAt(1) == 'X'))) {
- splitStringArray = uuidString.split("," );
- if (splitStringArray.length != 11) {
- throw new PlatformPcdPreprocessException ("Wrong format for GUID string: " + uuidString);
- }
-
- //
- // Remove blank space from these string and remove header string "0x"
- //
- for (index = 0; index < 11; index++) {
- splitStringArray[index] = splitStringArray[index].trim();
- splitStringArray[index] = splitStringArray[index].substring(2, splitStringArray[index].length());
- }
-
- //
- // Add heading '0' to normalize the string length
- //
- for (index = 3; index < 11; index++) {
- chLen = splitStringArray[index].length();
- for (chIndex = 0; chIndex < 2 - chLen; chIndex++) {
- splitStringArray[index] = "0" + splitStringArray[index];
- }
- }
-
- //
- // construct the final GuidNamingConvention string
- //
- temp = String.format("%s-%s-%s-%s%s-%s%s%s%s%s%s",
- splitStringArray[0],
- splitStringArray[1],
- splitStringArray[2],
- splitStringArray[3],
- splitStringArray[4],
- splitStringArray[5],
- splitStringArray[6],
- splitStringArray[7],
- splitStringArray[8],
- splitStringArray[9],
- splitStringArray[10]);
- uuidString = temp;
- }
-
- return UUID.fromString(uuidString);
- }
-}
-
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java
deleted file mode 100644
index 3cd272f719..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/** @file
- CommonDefinition class.
-
- This class is to define some common marcos and funcions, which used by AutoGen.
-
- Copyright (c) 2006, 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.
-
- **/
-package org.tianocore.pcd.entity;
-
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- CommonDefinition
-
- This class is to define some common marcos, which used by AutoGen.
-
-**/
-public class CommonDefinition {
- public final static String spdSuffix = ".spd";
- public final static String mbdSuffix = ".mbd";
- public final static String msaSuffix = ".msa";
- public final static String LibraryStr = "LIBRARY";
- public final static String autoGenHbegin = "extern int __make_me_compile_correctly;\r\n";
- public final static String include = "#include";
- public final static String autoGenCLine1 = "\r\n";
-
- public final static String autoGenCLine2 = "const UINT8 _gDebugPropertyMask "
- + "= DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED"
- + " | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED"
- + " | DEBUG_PROPERTY_DEBUG_CODE_ENABLED;\r\n";
-
- public final static String autoGenCLine3 = "const UINTN _gModuleDefaultErrorLevel"
- + " = EFI_D_ERROR | EFI_D_LOAD;\r\n";
-
- public final static String autoGenHLine1 = "#define EFI_SPECIFICATION_VERSION 0x00020000\r\n";
- public final static String autoGenHVersionDefault = "#define EFI_SPECIFICATION_VERSION 0x00000000\r\n";
- public final static String autoGenHLine2 = "#define EDK_RELEASE_VERSION 0x00090000\r\n";
- public final static String autoGenHReleaseDefault = "#define EDK_RELEASE_VERSION 0x00000000\r\n";
-
- public final static String includeAutogenH = "#include <AutoGen.h>\r\n" ;
- public final static String marcDefineStr = "#define ";
-
- public final static String gEfi = "gEfi";
- public final static String protocolGuid = "ProtocolGuid";
- public final static String ppiGuid = "PpiGuid";
- public final static String guidGuid = "Guid";
-
- public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";
- public final static String flashMapH = "FlashMap.h";
-
- //
- // AutoGen.h and AutoGen.c file's header
- //
- public final static String autogenHNotation =
- "/**\r\n" +
- " DO NOT EDIT\r\n" +
- " FILE auto-generated by GenBuild tasks\r\n" +
- " Module name:\r\n" +
- " AutoGen.h\r\n" +
- " Abstract:" +
- " Auto-generated AutoGen.h for building module or library.\r\n" +
- "**/\r\n\r\n";
-
- public final static String autogenCNotation =
- "/**\r\n" +
- " DO NOT EDIT\r\n" +
- " FILE auto-generated by GenBuild tasks\r\n" +
- " Module name:\r\n" +
- " AutoGen.c\r\n" +
- " Abstract:" +
- " Auto-generated AutoGen.c for building module or library.\r\n" +
- "**/\r\n\r\n";
-
- //
- // module type
- //
- public final static int ModuleTypeBase = 0;
- public final static int ModuleTypeSec = 1;
- public final static int ModuleTypePeiCore = 2;
- public final static int ModuleTypePeim = 3;
- public final static int ModuleTypeDxeCore = 4;
- public final static int ModuleTypeDxeDriver = 5;
- public final static int ModuleTypeDxeRuntimeDriver = 6;
- public final static int ModuleTypeDxeSmmDriver = 7;
- public final static int ModuleTypeDxeSalDriver = 8;
- public final static int ModuleTypeUefiDriver = 9;
- public final static int ModuleTypeUefiApplication = 10;
- public final static int ModuleTypeUnknown = 11;
-
-
- //
- // component type
- //
- public final static int ComponentTypeNull = 0;
- public final static int ComponentTypeApriori = 1;
- public final static int ComponentTypeSec = 2;
- public final static int ComponentTypeLibrary = 3;
- public final static int ComponentTypeFvImageFile = 4;
- public final static int ComponentTypeBsDriver = 5;
- public final static int ComponentTypeRtDriver = 6;
- public final static int ComponentTypeSalRtDriver =7;
- public final static int ComponentTypePe32Peim = 8;
- public final static int ComponentTypePicPeim =9;
- public final static int ComponentTypeCombinedPeimDriver =10;
- public final static int ComponentTypePeiCore = 11;
- public final static int ComponentTypeDxeCore = 12;
- public final static int ComponentTypeApplication = 13;
- public final static int ComponentTypeBsDriverEfi = 14;
- public final static int ComponentTypeShellApp = 15;
- public final static int ComponentTypeBinary =16;
- public final static int ComponentTypeLogo = 17;
- public final static int ComponentTypeCustomBuild = 18;
- public final static int ComponentTypeUnknown = 19;
-
-
- //
- // Usaged style
- //
- public final static String AlwaysConsumed = "ALWAYS_CONSUMED";
- public final static String AlwaysProduced = "ALWAYS_PRODUCED";
-
-
- public static class MyEnum {
- String moduleTypeStr;
- int type;
-
- MyEnum (String str, int type) {
- this.type = type;
- this.moduleTypeStr = str;
- }
-
- int ForInt(String str) {
- if (str.equals(this.moduleTypeStr)) {
- return this.type;
- } else
- return -1;
- }
- }
-
- //
- // Module type
- //
- public static final MyEnum[] moduleEnum = new MyEnum[] {
- new MyEnum("BASE", ModuleTypeBase),
- new MyEnum("SEC", ModuleTypeSec),
- new MyEnum("PEI_CORE", ModuleTypePeiCore),
- new MyEnum("PEIM", ModuleTypePeim),
- new MyEnum("DXE_CORE", ModuleTypeDxeCore),
- new MyEnum("DXE_DRIVER", ModuleTypeDxeDriver),
- new MyEnum("DXE_RUNTIME_DRIVER", ModuleTypeDxeRuntimeDriver),
- new MyEnum("DXE_SAL_DRIVER", ModuleTypeDxeSalDriver),
- new MyEnum("DXE_SMM_DRIVER", ModuleTypeDxeSmmDriver),
- new MyEnum("UEFI_DRIVER", ModuleTypeUefiDriver),
- new MyEnum("UEFI_APPLICATION", ModuleTypeUefiApplication) };
-
- //
- // Component type
- //
- public static final MyEnum[] componentEnum = new MyEnum[]{
- new MyEnum("APRIORI", ComponentTypeApriori),
- new MyEnum("SEC", ComponentTypeSec),
- new MyEnum("LIBRARY", ComponentTypeLibrary),
- new MyEnum("FV_IMAGE_FILE", ComponentTypeFvImageFile),
- new MyEnum("BS_DRIVER", ComponentTypeBsDriver),
- new MyEnum("RT_DRIVER", ComponentTypeRtDriver),
- new MyEnum("SAL_RT_DRIVER", ComponentTypeSalRtDriver),
- new MyEnum("PE32_PEIM", ComponentTypePe32Peim),
- new MyEnum("PIC_PEIM", ComponentTypePicPeim),
- new MyEnum("COMBINED_PEIM_DRIVER", ComponentTypeCombinedPeimDriver),
- new MyEnum("PEI_CORE", ComponentTypePeiCore),
- new MyEnum("DXE_CORE", ComponentTypeDxeCore),
- new MyEnum("APPLICATION", ComponentTypeApplication),
- new MyEnum("BS_DRIVER_EFI", ComponentTypeBsDriverEfi),
- new MyEnum("SHELLAPP", ComponentTypeShellApp),
- new MyEnum("BINARY", ComponentTypeBinary),
- new MyEnum("LOGO", ComponentTypeLogo),
- new MyEnum("CUSTOM_BUILD", ComponentTypeCustomBuild)
- };
-
- /**
- getModuleType
-
- This function get the module type value according module type string.
-
- @param moduleTypeStr String of modlue type.
- @return
- **/
- static public int getModuleType(String moduleTypeStr) {
- int returnValue = -1;
- for (int i = 0; i < CommonDefinition.moduleEnum.length; i++) {
- returnValue = CommonDefinition.moduleEnum[i].ForInt(moduleTypeStr);
- if (returnValue != -1) {
- return returnValue;
- }
- }
- return CommonDefinition.ModuleTypeUnknown;
- }
-
- /**
- getComponentType
-
- This function get the component type value according commponet type
- string.
-
- @param componentTypeStr String of component type.
- @return
- **/
- static public int getComponentType (String componentTypeStr){
- int returnValue = -1;
- for (int i = 0; i < CommonDefinition.componentEnum.length; i++) {
- returnValue = CommonDefinition.componentEnum[i].ForInt(componentTypeStr);
- if (returnValue != -1) {
- return returnValue;
- }
- }
- return CommonDefinition.ComponentTypeUnknown;
- }
-
- /**
- getComponentTypeString
-
- This function get the commponet type string according component type value.
-
- @param componentType Integer value of component type.
- @return
- **/
- static public String getComponentTypeString (int componentType) {
- if ((componentType > CommonDefinition.ComponentTypeUnknown) ||
- (componentType < CommonDefinition.ComponentTypeNull)) {
- return null;
- }
- for (int index = 0; index < CommonDefinition.componentEnum.length; index++) {
- if (componentType == CommonDefinition.componentEnum[index].type) {
- return CommonDefinition.componentEnum[index].moduleTypeStr;
- }
- }
- return null;
- }
-
- /**
- isLibraryComponent
-
- This function is to check does componet is library according to commponet
- type value.
-
- @param componentType Integer value of component type.
- @return
- **/
- static public boolean isLibraryComponent (int componentType) {
- if (ComponentTypeLibrary == componentType) {
- return true;
- }
- return false;
- }
-
- /**
- * formateGuidName
- *
- * This function is to formate GUID to ANSI c form.
- *
- * @param guidNameCon
- * String of GUID.
- * @return Formated GUID.
- */
- public static String formatGuidName(String guidNameConv) {
- String[] strList;
- String guid = "";
- int index = 0;
- if (guidNameConv
- .matches("[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}")) {
- strList = guidNameConv.split("-");
- guid = "0x" + strList[0] + ", ";
- guid = guid + "0x" + strList[1] + ", ";
- guid = guid + "0x" + strList[2] + ", ";
- guid = guid + "{";
- guid = guid + "0x" + strList[3].substring(0, 2) + ", ";
- guid = guid + "0x" + strList[3].substring(2, 4);
-
- while (index < strList[4].length()) {
- guid = guid + ", ";
- guid = guid + "0x" + strList[4].substring(index, index + 2);
- index = index + 2;
- }
- guid = guid + "}";
- return guid;
- } else if (guidNameConv
- .matches("0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?")) {
- strList = guidNameConv.split(",");
-
- //
- // chang Microsoft specific form to ANSI c form
- //
- for (int i = 0; i < 3; i++) {
- guid = guid + strList[i] + ",";
- }
- guid = guid + "{";
-
- for (int i = 3; i < strList.length; i++) {
- if (i == strList.length - 1) {
- guid = guid + strList[i];
- } else {
- guid = guid + strList[i] + ",";
- }
- }
- guid = guid + "}";
- return guid;
- } else {
- System.out
- .println("Check GUID Value, it doesn't conform to the registry format specified by the schema!!!");
- return "0";
-
- }
- }
-
- /**
- * Remove deuplicat string in list
- *
- * This function is to duplicat string in list
- *
- * @param String[]
- * String list.
- * @return String[] String list which remove the duplicate string.
- */
- public static String[] remDupString (String[] orgList){
- Set<String> strList = new LinkedHashSet<String>();
- String[] desList ;
- if (orgList == null){
- return new String[0];
- }
- for (int i = 0; i < orgList.length; i++){
- strList.add(orgList[i]);
- }
- desList = new String[strList.size()];
- Iterator item = strList.iterator();
- int index = 0;
- while (item.hasNext()){
- desList[index] = (String)item.next();
- index++;
- }
- return desList;
- }
-
-}
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java
deleted file mode 100644
index 15d003622c..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/** @file
- DynamicTokenValue class.
-
- This module contains the value type of a dynamic token.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.entity;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.tianocore.pcd.exception.EntityException;
-
-/**
- This class is to descript a value type of dynamic PCD.
- For a dynamic or dynamicEx type PCD data, the value type can be:
- 1) Hii type: the value of dynamic or dynamicEx is stored into a variable.
- 2) Vpd type: the value of dynamic or dynamicEx is stored into somewhere set
- by OEM.
- 3) Default type: the value of dynamic or dynamicEx is stored into PCD dynamic
- database.
-**/
-public class DynamicTokenValue {
- ///
- /// Enumeration macro defintion for value type.
- ///
- public static enum VALUE_TYPE {HII_TYPE, VPD_TYPE, DEFAULT_TYPE}
-
- ///
- /// The value type maybe:
- /// HII_TYPE: the value stored into variable area.
- /// VPD_TYPE: the value stored into OEM specific area.
- /// DEFAULT_TYPE: the value stored into PCD runtime database.
- ///
- public VALUE_TYPE type;
-
- ///
- /// ---------------------------------------------------------------------
- /// Following member is for HII case. The value of HII case will be put
- /// into variable area in flash.
- /// ---------------------------------------------------------------------
- ///
-
- ///
- /// variableName is valid only when this token support Hii functionality. variableName
- /// indicates the value of token is associated with what variable.
- /// variableName is defined in FPD.
- public List variableName;
-
- ///
- /// variableGuid is the GUID this token associated with.
- ///
- public UUID variableGuid;
-
- ///
- /// Variable offset indicate the associated variable's offset in NV storage.
- ///
- public String variableOffset;
-
- ///
- /// The default value for HII case.
- ///
- public String hiiDefaultValue;
-
- ///
- /// ---------------------------------------------------------------------
- /// Following member is for VPD case. The value of VPD case will be put into
- /// some flash position pointed by OEM.
- /// ---------------------------------------------------------------------
- ///
-
- public String vpdOffset;
-
- /// ---------------------------------------------------------------------
- /// Following member is for default case. The value of default type will
- /// be put into PCD runtime database.
- /// ---------------------------------------------------------------------
-
- ///
- /// The default value of this PCD in default case.
- ///
- public String value;
-
- /**
- Constructor function for DynamicTokenValue class.
-
- **/
- public DynamicTokenValue() {
- type = VALUE_TYPE.DEFAULT_TYPE;
- variableName = null;
- variableGuid = null;
- variableOffset = null;
- hiiDefaultValue = null;
- vpdOffset = null;
- value = null;
- }
-
- /**
- Set the HII case data.
-
- @param variableName The variable name
- @param variableGuid The variable guid
- @param variableOffset The offset of value in this variable
- @param hiiDefaultValue Default value for this PCD
- **/
- public void setHiiData(List variableName,
- UUID variableGuid,
- String variableOffset,
- String hiiDefaultValue) {
- this.type = VALUE_TYPE.HII_TYPE;
-
- this.variableName = variableName;
- this.variableGuid = variableGuid;
- this.variableOffset = variableOffset;
- this.hiiDefaultValue = hiiDefaultValue;
- }
-
- /**
- Get the variable Name.
-
- @return String
- **/
- public List getStringOfVariableName() {
- return variableName;
- }
-
- /**
- Set Vpd case data.
-
- @param vpdOffset the value offset the start address of OEM specific.
- **/
- public void setVpdData(String vpdOffset) {
- this.type = VALUE_TYPE.VPD_TYPE;
-
- this.vpdOffset = vpdOffset;
- }
-
- /**
- Set default case data.
-
- @param value
- **/
- public void setValue(String value) {
- this.type = VALUE_TYPE.DEFAULT_TYPE;
-
- this.value = value;
- }
-}
-
-
-
-
-
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
deleted file mode 100644
index f7c08f5330..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/** @file
- MemoryDatabaseManager class.
-
- Database hold all PCD information comes from SPD, MSA, FPD file in memory.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.entity;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.tianocore.pcd.entity.UsageIdentification;
-import org.tianocore.pcd.exception.EntityException;
-
-/**
- Database hold all PCD information comes from SPD, MSA, FPD file in memory.
-**/
-public class MemoryDatabaseManager {
- ///
- /// Memory database. The string "cName + SpaceNameGuid" is primary key.
- /// memory database is in global scope, and it will be used for others PCD tools.
- ///
- private static Map<String, Token> memoryDatabase = null;
-
- ///
- /// Before build a module, the used libary will be build firstly, the PCD of these
- /// library is inheritted by the module, so stored module's PCD information as PCD
- /// context of building libary.
- ///
- public static List<UsageInstance> UsageInstanceContext = null;
-
- ///
- /// Current module name, if now is buiding library, this value indicate this library
- /// is for building what module.
- ///
- public static String CurrentModuleName = null;
-
- ///
- /// String for PCD PEIM and DXE autogen file
- ///
- public static String PcdPeimHString = "";
- public static String PcdPeimCString = "";
- public static String PcdDxeHString = "";
- public static String PcdDxeCString = "";
-
- /**
- Constructure function
- **/
- public MemoryDatabaseManager() {
- //
- // Allocate memory for new database in global scope.
- //
- if (memoryDatabase == null) {
- memoryDatabase = new HashMap<String, Token>();
- }
- }
-
- /**
- Judege whether token exists in memory database
-
- @param primaryKey the primaryKey for searching token
-
- @retval TRUE - token already exist in database.
- @retval FALSE - token does not exist in database.
- **/
- public boolean isTokenInDatabase(String primaryKey) {
- return (memoryDatabase.get(primaryKey) != null);
- }
-
- /**
- Add a pcd token into memory database.
-
- @param primaryKey the primary key for searching token
- @param token token instance
- **/
- public void addTokenToDatabase(String primaryKey, Token token) {
- memoryDatabase.put(primaryKey, token);
- }
-
- /**
- Get a token instance from memory database with primary key.
-
- @param primaryKey the primary key for searching token
-
- @return token instance.
- **/
- public Token getTokenByKey(String primaryKey) {
- return memoryDatabase.get(primaryKey);
- }
-
- /**
- Get the number of PCD token record in memory database.
-
- @return the number of PCD token record in memory database.
- **/
- public int getDBSize() {
- return memoryDatabase.size();
- }
-
- /**
- Get the token record array contained all PCD token in memory database.
-
- @return the token record array contained all PCD token in memory database.
- **/
- public Token[] getRecordArray() {
- Token[] tokenArray = null;
- Object[] dataArray = null;
- Map.Entry entry = null;
- int index = 0;
- int size = 0;
-
- if (memoryDatabase == null) {
- return null;
- }
- dataArray = memoryDatabase.entrySet().toArray();
- size = memoryDatabase.size();
- tokenArray = new Token[memoryDatabase.size()];
- for (index = 0; index < size; index++) {
- entry =(Map.Entry) dataArray [index];
- tokenArray[index] =(Token) entry.getValue();
- }
- return tokenArray;
- }
-
- /**
- Get record array only contains DYNAMIC or DYNAMIC_EX type PCD.
-
- @return ArrayList the array list contains all dynamic type PCD.
- **/
- private ArrayList getDynamicRecordArray() {
- Token[] tokenArray = getRecordArray();
- int index = 0;
- ArrayList<Token> al = new ArrayList<Token>();
-
- for (index = 0; index < tokenArray.length; index++) {
- if (tokenArray[index].isDynamicPCD) {
- al.add(tokenArray[index]);
- }
- }
-
- return al;
- }
-
-
- /**
- Get the token record array contained all PCD token referenced by PEI phase.
- The output array is sorted based on descending order of the size of alignment for each feilds.
-
- @return the token record array contained all PCD token referenced in PEI phase.
- @throws EntityException
- **/
- public void getTwoPhaseDynamicRecordArray(ArrayList<Token> pei, ArrayList<Token> dxe)
- throws EntityException {
- int usageInstanceIndex = 0;
- int index = 0;
- ArrayList tokenArrayList = getDynamicRecordArray();
- Object[] usageInstanceArray = null;
- UsageInstance usageInstance = null;
- int size = 0;
- int consumerSize = 0;
-
- size = tokenArrayList.size();
- for (index = 0; index < size; index++) {
- boolean found = false;
- Token token = (Token) tokenArrayList.get(index);
- if (token.consumers != null) {
- usageInstanceArray = token.consumers.entrySet().toArray();
- consumerSize = token.consumers.size();
- for (usageInstanceIndex = 0; usageInstanceIndex < consumerSize; usageInstanceIndex++) {
- usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());
- if (usageInstance.isPeiPhaseComponent()) {
- pei.add(token);
- found = true;
- break;
- }
- }
- }
-
- //
- // If no PEI components reference the PCD entry,
- // we check if it is referenced in DXE driver.
- //
- if (!found) {
- if (token.consumers != null) {
- usageInstanceArray = token.consumers.entrySet().toArray();
- consumerSize = token.consumers.size();
- for (usageInstanceIndex = 0; usageInstanceIndex < consumerSize; usageInstanceIndex++) {
- usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());
- if (usageInstance.isDxePhaseComponent()) {
- dxe.add(token);
- found = true;
- break;
- }
- }
- }
-
- if (!found) {
- if (token.isDynamicPCD && token.consumers.size() == 0) {
- dxe.add(token);
- } else {
- //
- // We only support Dynamice(EX) type for PEI and DXE phase.
- // If it is not referenced in either PEI or DXE, throw exception now.
- //
- throw new EntityException("[PCD Tool Internal Error] Dynamic(EX) PCD Entries are referenced in a module that is not used in either PEI or DXE phases.");
- }
- }
- }
- }
- }
-
- public void clearDatabase() {
- memoryDatabase.clear();
- }
-
- /**
- Get all PCD token for a usage instance according to primary key.
-
- @param primaryKey the primary key of usage instance.
-
- @return List<UsageInstance> the list contains all usage instances.
- **/
- public List<UsageInstance> getUsageInstanceArrayById(UsageIdentification usageId) {
- Token[] tokenArray = null;
- int recordIndex = 0;
- UsageInstance usageInstance = null;
- List<UsageInstance> returnArray = new ArrayList<UsageInstance>();
- String primaryKey = usageId.toString();
-
- tokenArray = getRecordArray();
-
- //
- // Loop to find all PCD record related to current module
- //
- for (recordIndex = 0; recordIndex < getDBSize(); recordIndex++) {
- if (tokenArray[recordIndex].consumers.size() != 0) {
- usageInstance = tokenArray[recordIndex].consumers.get(primaryKey);
- if (usageInstance != null) {
- returnArray.add(usageInstance);
- }
- }
- }
-
- return returnArray;
- }
-
- public List<Token> getPcdTokenListForModule(UsageIdentification usageId) {
- List<UsageInstance> usageList = getUsageInstanceArrayById(usageId);
- List<Token> tokenList = new ArrayList<Token>();
-
- if (usageList == null) {
- return null;
- }
-
- for (int usageIndex = 0; usageIndex < usageList.size(); usageIndex++) {
- tokenList.add(usageList.get(usageIndex).parentToken);
- }
-
- return tokenList;
- }
-
- /**
- Get all modules name who contains PCD information
-
- @return Array for usage's identification
- **/
- public List<UsageIdentification> getAllModuleArray()
- {
- int tokenIndex = 0;
- int usageIndex = 0;
- int moduleIndex = 0;
- Token[] tokenArray = null;
- Object[] usageInstanceArray = null;
- List<UsageIdentification> usageArray = new ArrayList<UsageIdentification>();
- UsageInstance usageInstance = null;
- boolean bFound = false;
- String primaryKey = null;
-
- tokenArray = getRecordArray();
- //
- // Find all consumer usage instance for retrieving module's name
- //
- for (tokenIndex = 0; tokenIndex < getDBSize(); tokenIndex++) {
- usageInstanceArray = tokenArray[tokenIndex].consumers.entrySet().toArray();
- for (usageIndex = 0; usageIndex < tokenArray[tokenIndex].consumers.size(); usageIndex++) {
- usageInstance = (UsageInstance)((Map.Entry)usageInstanceArray[usageIndex]).getValue();
- primaryKey = usageInstance.getPrimaryKey();
- bFound = false;
- for (moduleIndex = 0; moduleIndex < usageArray.size(); moduleIndex++) {
- if (usageArray.get(moduleIndex).toString().equalsIgnoreCase(primaryKey)) {
- bFound = true;
- break;
- }
- }
- if (!bFound) {
- usageArray.add(usageInstance.usageId);
- }
- }
- }
- return usageArray;
- }
-}
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/ModulePcdInfoFromFpd.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/ModulePcdInfoFromFpd.java
deleted file mode 100644
index fe9f7ecabc..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/ModulePcdInfoFromFpd.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
- ModulePcdInfoFromFpd class.
-
- The interface parameter from <ModuleSA>'s Pcd information got from global data.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.entity;
-
-import org.tianocore.PcdBuildDefinitionDocument;
-import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;
-import org.apache.xmlbeans.XmlObject;
-
-/**
- PCD build information in <ModuleSA> in FPD file.
-**/
-public class ModulePcdInfoFromFpd {
- ///
- /// Usage identification for a module
- ///
- public UsageIdentification usageId;
-
- ///
- /// <ModuleSA>'s <PcdBuildDefinition> information.
- ///
- public PcdBuildDefinition pcdBuildDefinition;
-
- /**
- Construct function.
-
- @param usageId The usage instance's identification
- @param pcdBuildDefinition The <PcdBuildDefinition> information in <ModuleSA> in FPD file.
-
- **/
- public ModulePcdInfoFromFpd(UsageIdentification usageId,
- PcdBuildDefinition pcdBuildDefinition) {
- this.usageId = usageId;
- this.pcdBuildDefinition = pcdBuildDefinition;
- }
-}
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/SkuInstance.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/SkuInstance.java
deleted file mode 100644
index 6e666ba84f..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/SkuInstance.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
- SkuInstance class.
-
- Sku instance contains ID and value, A pcd token maybe contains more than one Sku instance.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.entity;
-
-/**
- Sku instance contains ID and value, A pcd token maybe contains more than one Sku instance.
-**/
-public class SkuInstance {
- ///
- /// The id number of this SKU instance
- ///
- public int id;
-
- ///
- /// The value of this SKU instance
- ///
- public DynamicTokenValue value;
-
- /**
- Constructure function
-
- @param id sku id
- @param value sku value for this id.
- **/
- public SkuInstance(int id, DynamicTokenValue value) {
- this.id = id;
- this.value = value;
- }
-
- /**
- Default constructor function.
- **/
- public SkuInstance() {
- this.id = 0;
- this.value = new DynamicTokenValue();
- }
-}
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/Token.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/Token.java
deleted file mode 100644
index 74f55ddec3..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/Token.java
+++ /dev/null
@@ -1,960 +0,0 @@
-/** @file
- Token class.
-
- This module contains all classes releted to PCD token.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.entity;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- This class is to descript a PCD token object. The information of a token mainly
- comes from MSA, SPD and setting produced by platform developer.
-**/
-public class Token {
- ///
- /// Enumeration macro defintion for PCD type.
- ///
- public static enum PCD_TYPE {FEATURE_FLAG, FIXED_AT_BUILD, PATCHABLE_IN_MODULE, DYNAMIC,
- DYNAMIC_EX, UNKNOWN}
-
- ///
- /// Enumeration macro definition for datum type. All type mainly comes from ProcessBind.h.
- /// Wizard maybe expand this type as "int, unsigned int, short, unsigned short etc" in
- /// prompt dialog.
- ///
- public static enum DATUM_TYPE {UINT8, UINT16, UINT32, UINT64, BOOLEAN, POINTER, UNKNOWN}
-
- ///
- /// Enumeration macor defintion for usage of PCD
- ///
- public static enum PCD_USAGE {ALWAYS_PRODUCED, ALWAYS_CONSUMED, SOMETIMES_PRODUCED,
- SOMETIMES_CONSUMED, UNKNOWN}
-
- ///
- /// cName is to identify a PCD entry and will be used for generating autogen.h/autogen.c.
- /// cName will be defined in MSA, SPD and FPD, can be regarded as primary key with token space guid.
- ///
- public String cName;
-
- ///
- /// Token space name is the guid defined by token itself in package or module level. This
- /// name mainly for DynamicEx type. For other PCD type token, his token space name is the
- /// assignedtokenSpaceName as follows.
- /// tokenSpaceName is defined in MSA, SPD, FPD, can be regarded as primary key with cName.
- ///
- public String tokenSpaceName;
-
- ///
- /// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in
- /// platform token space. For Dynamic, dynamicEx type, this number will be re-adjust by
- /// PCD run-time database autogen tools.
- ///
- public long tokenNumber;
-
- ///
- /// This token number is retrieved from FPD file for DynamicEx type.
- ///
- public long dynamicExTokenNumber;
-
- ///
- /// All supported PCD type, this value can be retrieved from SPD
- /// Currently, only record all PCD type for this token in FPD file.
- ///
- public List<PCD_TYPE> supportedPcdType;
-
- ///
- /// If the token's item type is Dynamic or DynamicEx type, isDynamicPCD
- /// is true.
- ///
- public boolean isDynamicPCD;
-
- ///
- /// datumSize is to descript the fix size or max size for this token.
- /// datumSize is defined in SPD.
- ///
- public int datumSize;
-
- ///
- /// datum type is to descript what type can be expressed by a PCD token.
- /// For same PCD used in different module, the datum type should be unique.
- /// So it belong memeber to Token class.
- ///
- public DATUM_TYPE datumType;
-
- ///
- /// skuData contains all value for SkuNumber of token.
- /// This field is for Dynamic or DynamicEx type PCD,
- ///
- public List<SkuInstance> skuData;
-
- ///
- /// consumers array record all module private information who consume this PCD token.
- ///
- public Map<String, UsageInstance> consumers;
-
- /**
- Constructure function for Token class
-
- @param cName The name of token
- @param tokenSpaceName The name of token space, it is a guid string
- **/
- public Token(String cName, String tokenSpaceName) {
- this.cName = cName;
- this.tokenSpaceName = tokenSpaceName;
- this.tokenNumber = 0;
- this.datumType = DATUM_TYPE.UNKNOWN;
- this.datumSize = -1;
- this.skuData = new ArrayList<SkuInstance>();
-
- this.consumers = new HashMap<String, UsageInstance>();
- this.supportedPcdType = new ArrayList<PCD_TYPE>();
- }
-
- /**
- updateSupportPcdType
-
- SupportPcdType should be gotten from SPD file actually, but now it just
- record all PCD type for this token in FPD file.
-
- @param pcdType new PCD type found in FPD file for this token.
- **/
- public void updateSupportPcdType(PCD_TYPE pcdType) {
- int size = supportedPcdType.size();
- for (int index = 0; index < size; index++) {
- if (supportedPcdType.get(index) == pcdType) {
- return;
- }
- }
-
- //
- // If not found, add the pcd type to member variable supportedPcdType
- //
- supportedPcdType.add(pcdType);
- }
-
- /**
- Judge whether pcdType is belong to dynamic type. Dynamic type includes
- DYNAMIC and DYNAMIC_EX.
-
- @param pcdType the judged pcd type
-
- @return boolean
- **/
- public static boolean isDynamic(PCD_TYPE pcdType) {
- if ((pcdType == PCD_TYPE.DYNAMIC ) ||
- (pcdType == PCD_TYPE.DYNAMIC_EX)) {
- return true;
- }
-
- return false;
- }
-
- /**
- The pcd type is DynamicEx?
-
- @retval true Is DynamicEx type
- @retval false not DynamicEx type
- **/
- public boolean isDynamicEx() {
- int size = supportedPcdType.size();
- for (int i = 0; i < size; i++) {
- if (supportedPcdType.get(i) == PCD_TYPE.DYNAMIC_EX) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- Use "TokencName + "-" + SpaceTokenName" as primary key when adding token into database
-
- @param cName Token name.
- @param tokenSpaceName The token space guid string defined in MSA or SPD
-
- @retval primary key for this token in token database.
- **/
- public static String getPrimaryKeyString(String cName, String tokenSpaceName) {
- if (tokenSpaceName == null) {
- return cName + "_nullTokenSpaceGuid";
- } else {
- return cName + "_" + tokenSpaceName.toString().replace('-', '_').toLowerCase();
- }
- }
-
- /**
- If skudata list contains more than one data, then Sku mechanism is enable.
-
- @retval boolean if the number of sku data exceed to 1
- **/
- public boolean isSkuEnable() {
- if (this.skuData.size() > 1) {
- return true;
- }
- return false;
- }
-
- /**
- If Hii type for value of token
-
- @return boolean
- **/
- public boolean isHiiEnable() {
- if (getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.HII_TYPE) {
- return true;
- }
- return false;
- }
-
- /**
- If Vpd type for value of token
-
- @return boolean
- **/
- public boolean isVpdEnable() {
- if (getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.VPD_TYPE) {
- return true;
- }
- return false;
- }
-
- /**
- Get the token primary key in token database.
-
- @return String
- **/
- public String getPrimaryKeyString () {
- return Token.getPrimaryKeyString(cName, tokenSpaceName);
- }
-
- /**
- Judge datumType is valid
-
- @param type The datumType want to be judged.
-
- @retval TRUE - The type is valid.
- @retval FALSE - The type is invalid.
- **/
- public static boolean isValiddatumType(DATUM_TYPE type) {
- if ((type.ordinal() < DATUM_TYPE.UINT8.ordinal() ) ||
- (type.ordinal() > DATUM_TYPE.POINTER.ordinal())) {
- return false;
- }
- return true;
- }
-
- /**
- Judge pcdType is valid
-
- @param type The PCdType want to be judged.
-
- @retval TRUE - The type is valid.
- @retval FALSE - The type is invalid.
- **/
- public static boolean isValidpcdType(PCD_TYPE type) {
- if ((type.ordinal() < PCD_TYPE.FEATURE_FLAG.ordinal() ) ||
- (type.ordinal() > PCD_TYPE.DYNAMIC_EX.ordinal())) {
- return false;
- }
- return true;
- }
-
- /**
- Add an usage instance for token
-
- @param usageInstance The usage instance
-
- @retval TRUE - Success to add usage instance.
- @retval FALSE - Fail to add usage instance
- **/
- public boolean addUsageInstance(UsageInstance usageInstance) {
- if (isUsageInstanceExist(usageInstance.usageId)) {
- return false;
- }
-
- //
- // Put usage instance into usage instance database of this PCD token.
- //
- consumers.put(usageInstance.getPrimaryKey(), usageInstance);
-
- return true;
- }
-
- /**
- Judge whether exist an usage instance for this token
-
- @param usageId The UsageInstance identification for usage instance
-
- @return boolean whether exist an usage instance for this token.
- **/
- public boolean isUsageInstanceExist(UsageIdentification usageId) {
- String keyStr = UsageInstance.getPrimaryKey(usageId);
-
- return (consumers.get(keyStr) != null);
- }
-
- /**
- Get the PCD_TYPE according to the string of PCD_TYPE
-
- @param pcdTypeStr The string of PCD_TYPE
-
- @return PCD_TYPE
- **/
- public static PCD_TYPE getPcdTypeFromString(String pcdTypeStr) {
- if (pcdTypeStr == null) {
- return PCD_TYPE.UNKNOWN;
- }
-
- if (pcdTypeStr.equalsIgnoreCase("FEATURE_FLAG")) {
- return PCD_TYPE.FEATURE_FLAG;
- } else if (pcdTypeStr.equalsIgnoreCase("FIXED_AT_BUILD")) {
- return PCD_TYPE.FIXED_AT_BUILD;
- } else if (pcdTypeStr.equalsIgnoreCase("PATCHABLE_IN_MODULE")) {
- return PCD_TYPE.PATCHABLE_IN_MODULE;
- } else if (pcdTypeStr.equalsIgnoreCase("DYNAMIC")) {
- return PCD_TYPE.DYNAMIC;
- } else if (pcdTypeStr.equalsIgnoreCase("DYNAMIC_EX")) {
- return PCD_TYPE.DYNAMIC_EX;
- } else {
- return PCD_TYPE.UNKNOWN;
- }
- }
-
- /**
- Get the string of given datumType. This string will be used for generating autogen files
-
- @param datumType Given datumType
-
- @return The string of datum type.
- **/
- public static String getStringOfdatumType(DATUM_TYPE datumType) {
- return datumType.toString();
- }
-
- /**
- Get the datumType according to a string.
-
- @param datumTypeStr The string of datumType
-
- @return DATUM_TYPE
- **/
- public static DATUM_TYPE getdatumTypeFromString(String datumTypeStr) {
- if (datumTypeStr.equalsIgnoreCase("UINT8")) {
- return DATUM_TYPE.UINT8;
- } else if (datumTypeStr.equalsIgnoreCase("UINT16")) {
- return DATUM_TYPE.UINT16;
- } else if (datumTypeStr.equalsIgnoreCase("UINT32")) {
- return DATUM_TYPE.UINT32;
- } else if (datumTypeStr.equalsIgnoreCase("UINT64")) {
- return DATUM_TYPE.UINT64;
- } else if (datumTypeStr.equalsIgnoreCase("VOID*")) {
- return DATUM_TYPE.POINTER;
- } else if (datumTypeStr.equalsIgnoreCase("BOOLEAN")) {
- return DATUM_TYPE.BOOLEAN;
- }
- return DATUM_TYPE.UNKNOWN;
- }
-
- /**
- Get string of given pcdType
-
- @param pcdType The given PcdType
-
- @return The string of PCD_TYPE.
- **/
- public static String getStringOfpcdType(PCD_TYPE pcdType) {
- return pcdType.toString();
- }
-
- /**
- Get the PCD_USAGE according to a string
-
- @param usageStr The string of PCD_USAGE
-
- @return The PCD_USAGE
- **/
- public static PCD_USAGE getUsageFromString(String usageStr) {
- if (usageStr == null) {
- return PCD_USAGE.UNKNOWN;
- }
-
- if (usageStr.equalsIgnoreCase("ALWAYS_PRODUCED")) {
- return PCD_USAGE.ALWAYS_PRODUCED;
- } else if (usageStr.equalsIgnoreCase("SOMETIMES_PRODUCED")) {
- return PCD_USAGE.SOMETIMES_PRODUCED;
- } else if (usageStr.equalsIgnoreCase("ALWAYS_CONSUMED")) {
- return PCD_USAGE.ALWAYS_CONSUMED;
- } else if (usageStr.equalsIgnoreCase("SOMETIMES_CONSUMED")) {
- return PCD_USAGE.SOMETIMES_CONSUMED;
- }
-
- return PCD_USAGE.UNKNOWN;
- }
-
- /**
- Get the string of given PCD_USAGE
-
- @param usage The given PCD_USAGE
-
- @return The string of PDC_USAGE.
- **/
- public static String getStringOfUsage(PCD_USAGE usage) {
- return usage.toString();
- }
-
- /**
- Get the Defined datumType string for autogen. The string is for generating some MACROs in Autogen.h
-
- @param datumType The given datumType
-
- @return string of datum type for autogen.
- **/
- public static String GetAutogenDefinedatumTypeString(DATUM_TYPE datumType) {
- switch (datumType) {
-
- case UINT8:
- return "8";
- case UINT16:
- return "16";
- case BOOLEAN:
- return "BOOL";
- case POINTER:
- return "PTR";
- case UINT32:
- return "32";
- case UINT64:
- return "64";
- default:
- return null;
- }
- }
-
- /**
- Get the datumType String for Autogen. This string will be used for generating defintions of PCD token in autogen
-
- @param datumType The given datumType
-
- @return string of datum type.
- **/
-
- public static String getAutogendatumTypeString(DATUM_TYPE datumType) {
- switch (datumType) {
- case UINT8:
- return "UINT8";
- case UINT16:
- return "UINT16";
- case UINT32:
- return "UINT32";
- case UINT64:
- return "UINT64";
- case POINTER:
- return "VOID*";
- case BOOLEAN:
- return "BOOLEAN";
- }
- return null;
- }
-
- /**
- Get the datumType string for generating some MACROs in autogen file of Library
-
- @param datumType The given datumType
-
- @return String of datum for genrating bit charater.
- **/
- public static String getAutogenLibrarydatumTypeString(DATUM_TYPE datumType) {
- switch (datumType) {
- case UINT8:
- return "8";
- case UINT16:
- return "16";
- case BOOLEAN:
- return "Bool";
- case POINTER:
- return "Ptr";
- case UINT32:
- return "32";
- case UINT64:
- return "64";
- default:
- return null;
- }
- }
-
- /**
- Get the sku data who id is 0.
-
- @retval DynamicTokenValue the value of this dyanmic token.
- **/
- public DynamicTokenValue getDefaultSku() {
- int index;
- int size = skuData.size();
- for (index = 0; index < size; index++) {
- if (skuData.get(index).id == 0) {
- return skuData.get(index).value;
- }
- }
-
- return null;
- }
-
- /**
- Get the number of Sku data for this token
-
- @retval int the number of sku data
- **/
- public int getSkuIdCount () {
- return this.skuData.size();
- }
-
- /**
- Get the size of PCD value, this PCD is POINTER type.
-
- @param str the string of the value
- @param al the array list for outer parameter.
- **/
- private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {
- if (isValidNullValue(str)) {
- al.add(new Integer(0));
- } else {
- //
- // isValidNullValue has already make sure that str here
- // always contain a valid default value of the following 3
- // cases:
- // 1) "Hello world" //Assci string
- // 2) L"Hello" //Unicode string
- // 3) {0x01, 0x02, 0x03} //Byte stream
- //
- if (str.startsWith("\"")) {
- al.add(new Integer(str.length() - 2));
- } else if (str.startsWith("L\"")){
- //
- // Unicode is 2 bytes each.
- //
- al.add(new Integer((str.length() - 3) * 2));
- } else if (str.startsWith("{")) {
- //
- // We count the number of "," in the string.
- // The number of byte is one plus the number of
- // comma.
- //
- String str2 = str;
-
- int cnt = 0;
- int pos = 0;
- pos = str2.indexOf(",", 0);
- while (pos != -1) {
- cnt++;
- pos++;
- pos = str2.indexOf(",", pos);
- }
- cnt++;
- al.add(new Integer(cnt));
- }
- }
- }
-
- /**
- This method can be used to get the MAX and current size
- for pointer type dynamic(ex) PCD entry
- **/
- public ArrayList<Integer> getPointerTypeSize () {
- ArrayList<Integer> al = new ArrayList<Integer>();
-
- //
- // For VPD_enabled and HII_enabled, we can only return the MAX size.
- // For the default DATA type dynamic PCD entry, we will return
- // the MAX size and current size for each SKU_ID.
- //
- al.add(new Integer(this.datumSize));
-
- if (!this.isVpdEnable()) {
- int idx;
- if (this.isHiiEnable()){
- for (idx = 0; idx < this.skuData.size(); idx++) {
- String str = this.skuData.get(idx).value.hiiDefaultValue;
- getCurrentSizeFromDefaultValue(str, al);
- }
- } else {
- for (idx = 0; idx < this.skuData.size(); idx++) {
- String str = this.skuData.get(idx).value.value;
- getCurrentSizeFromDefaultValue(str, al);
- }
- }
- }
-
- return al;
- }
-
- /**
- Get default value for a token, For HII type, HiiDefaultValue of default
- SKU 0 will be returned; For Default type, the defaultvalue of default SKU
- 0 will be returned.
-
- @return String get the default value for a DYNAMIC type PCD.
- **/
- public String getDynamicDefaultValue() {
- DynamicTokenValue dynamicData = getDefaultSku();
- if (hasDefaultValue()) {
- switch (dynamicData.type) {
- case DEFAULT_TYPE:
- return dynamicData.value;
- }
- }
-
- return null;
- }
-
- /**
- Judge whether a DYNAMIC PCD has default value.
-
- @return whether a DYNAMIC PCD has default value.
- **/
- public boolean hasDefaultValue () {
- DynamicTokenValue dynamicValue = null;
-
- if (isSkuEnable()) {
- return true;
- }
-
- if (this.isDynamicPCD) {
- dynamicValue = getDefaultSku();
- switch (dynamicValue.type) {
- case HII_TYPE:
- return true;
- case VPD_TYPE:
- return true;
- case DEFAULT_TYPE:
- return !isValidNullValue(dynamicValue.value);
- }
- }
-
- return false;
- }
-
- /**
- Judge the value is NULL value. NULL value means the value is uninitialized value
-
- @param judgedValue the want want to be judged
-
- @return boolean whether the value of PCD is NULL.
- **/
- public boolean isValidNullValue(String judgedValue) {
- String subStr;
- BigInteger bigIntValue;
-
- switch (datumType) {
- case UINT8:
- case UINT16:
- case UINT32:
- if (judgedValue.length() > 2) {
- if ((judgedValue.charAt(0) == '0') &&
- ((judgedValue.charAt(1) == 'x') || (judgedValue.charAt(1) == 'X'))){
- subStr = judgedValue.substring(2, judgedValue.length());
- bigIntValue = new BigInteger(subStr, 16);
- } else {
- bigIntValue = new BigInteger(judgedValue);
- }
- } else {
- bigIntValue = new BigInteger(judgedValue);
- }
- if (bigIntValue.bitCount() == 0) {
- return true;
- }
- break;
- case UINT64:
- if (judgedValue.length() > 2){
- if ((judgedValue.charAt(0) == '0') &&
- ((judgedValue.charAt(1) == 'x') ||
- (judgedValue.charAt(1) == 'X'))) {
- bigIntValue = new BigInteger(judgedValue.substring(2, judgedValue.length()), 16);
- if (bigIntValue.bitCount() == 0) {
- return true;
- }
- } else {
- bigIntValue = new BigInteger(judgedValue);
- if (bigIntValue.bitCount() == 0) {
- return true;
- }
- }
- } else {
- bigIntValue = new BigInteger(judgedValue);
- if (bigIntValue.bitCount() == 0) {
- return true;
- }
- }
- break;
- case BOOLEAN:
- if (judgedValue.equalsIgnoreCase("false")) {
- return true;
- }
- break;
- case POINTER:
- if (judgedValue.equalsIgnoreCase("\"\"") ||
- judgedValue.equalsIgnoreCase("L\"\"") ||
- (judgedValue.length() == 0)) {
- return true;
- } else if (judgedValue.trim().charAt(0) == '{') {
- int start = judgedValue.indexOf('{');
- int end = judgedValue.lastIndexOf('}');
- String[] strValueArray = judgedValue.substring(start + 1, end).split(",");
- if (strValueArray.length > 1) {
- return false;
- } else {
- if (strValueArray[0].matches("(0x)?(0X)?0*")) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- Is the string value in Unicode
-
- @return boolean the string value is UNICODE type string.
- **/
- public boolean isHiiDefaultValueUnicodeStringType() {
- DynamicTokenValue dynamicData = getDefaultSku();
-
- if (dynamicData == null)
- return false;
-
- return dynamicData.hiiDefaultValue.startsWith("L\"")
- && dynamicData.hiiDefaultValue.endsWith("\"");
- }
-
- /**
- Is the string value in ANSCI
-
- @return boolean whether the dfault value for HII case is string type.
- **/
- public boolean isHiiDefaultValueASCIIStringType() {
- DynamicTokenValue dynamicData = getDefaultSku();
-
- if (dynamicData == null)
- return false;
-
- return dynamicData.hiiDefaultValue.startsWith("\"")
- && dynamicData.hiiDefaultValue.endsWith("\"");
- }
-
- /**
- Judege whether current value is UNICODE string type.
-
- @return boolean whether the value is UNICODE string.
- **/
- public boolean isUnicodeStringType () {
- String str = getDynamicDefaultValue();
-
- if (str == null) {
- return false;
- }
-
- if (datumType == Token.DATUM_TYPE.POINTER &&
- str.startsWith("L\"") &&
- str.endsWith("\"")) {
- return true;
- }
-
- return false;
- }
-
- /**
- Judge whether the string type is ANSIC string.
-
- @return boolean whether the string type is ANSIC string
- **/
- public boolean isASCIIStringType () {
- String str = getDynamicDefaultValue();
-
- if (str == null) {
- return false;
- }
-
- if (datumType == Token.DATUM_TYPE.POINTER &&
- str.startsWith("\"") &&
- str.endsWith("\"")) {
- return true;
- }
-
- return false;
- }
-
- /**
- Judge whether the string value is byte array.
-
- @return boolean whether the string value is byte array.
-
- **/
- public boolean isByteStreamType () {
- String str = getDynamicDefaultValue();
-
- if (str == null) {
- return false;
- }
-
- if (datumType == Token.DATUM_TYPE.POINTER &&
- str.startsWith("{") &&
- str.endsWith("}")) {
- return true;
- }
-
- return false;
-
- }
-
- /**
- Get string value for ANSIC string type
-
- @return String the string value
- **/
- public String getStringTypeString () {
- return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);
- }
-
- /**
- Judge whether a datum string is byte array.
-
- @param datum datum string
-
- @return boolean true - is byte array, false - not byte array
- **/
- public static boolean isByteArrayDatum(String datum) {
- if (datum == null) {
- return false;
- }
-
- String trimedStr = datum.trim();
-
- if (trimedStr.length() == 0) {
- return false;
- }
-
- if (trimedStr.startsWith("{") &&
- trimedStr.endsWith("}")) {
- return true;
- }
-
- return false;
- }
-
- /**
- Judge whether a datum string is unicode.
-
- @param datum datum string
-
- @return boolean true - is unicode, false - not unicode
- **/
- public static boolean isUnicodeDatum(String datum) {
- if (datum == null) {
- return false;
- }
-
- String trimedStr = datum.trim();
- if (trimedStr.length() == 0) {
- return false;
- }
-
- if (trimedStr.startsWith("L") &&
- trimedStr.charAt(1) == '"' &&
- trimedStr.endsWith("\"")) {
- return true;
- }
-
- return false;
- }
-
- /**
- Judge whether a datum string is ANSCI string.
-
- @param datum datum string
-
- @return boolean true - is ANSIC, false - not ANSIC
- **/
- public static boolean isAnsciDatum(String datum) {
- if (datum == null) {
- return false;
- }
-
- String trimedStr = datum.trim();
-
- if (trimedStr.length() == 0) {
- return false;
- }
-
- if (datum.startsWith("\"") &&
- datum.endsWith("\"")) {
- return true;
- }
-
- return false;
- }
-
- /**
- Get byte array string for POINTER type Datum.
-
- @param datum the datum whose type is POINTER
-
- @return String the byte array string
- **/
- public String getByteArrayForPointerDatum(String datum) {
- String byteArray = "{";
-
- if (datumType != Token.DATUM_TYPE.POINTER) {
- return null;
- }
-
- if (Token.isAnsciDatum(datum)) {
- String trimedStr = datum.trim();
- trimedStr = trimedStr.substring(1, trimedStr.length() - 1);
- char charArray[] = trimedStr.toCharArray();
- for (int index = 0; index < charArray.length; index++) {
- byteArray += String.format("0x%02x ", (byte)charArray[index]);
- if (index != (charArray.length - 1)) {
- byteArray += ",";
- }
- }
- } else if (Token.isUnicodeDatum(datum)) {
- String trimedStr = datum.trim();
- trimedStr = trimedStr.substring(2, trimedStr.length() - 1);
- for (int index = 0; index < trimedStr.length(); index++) {
- short unicodeVal = (short)trimedStr.codePointAt(index);
- byteArray += String.format("0x%02x, 0x%02x",
- (byte)unicodeVal,
- (byte)((unicodeVal & 0xFF00) >> 8));
- if (index != (trimedStr.length() - 1)) {
- byteArray += " ,";
- }
- }
- } else if (Token.isByteArrayDatum(datum)){
- return datum;
- } else {
- return null;
- }
-
- byteArray += "}";
-
- return byteArray;
- }
-}
-
-
-
-
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java
deleted file mode 100644
index 0c54525661..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/** @file
- UsageIdentification class.
-
- This class an identification for a PCD UsageInstance.
-
-Copyright (c) 2006, 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.
-
-**/
-
-package org.tianocore.pcd.entity;
-
-/**
- The identification for a UsageInstance.
- It should be extend from ModuleIdentification in future.
-
-**/
-public class UsageIdentification {
- ///
- /// The module CName: one key of Identification
- ///
- public String moduleName;
-
- ///
- /// The module Guid String: one key of Identification
- ///
- public String moduleGuid;
-
- ///
- /// The package CName: one key of Identification
- ///
- public String packageName;
-
- ///
- /// The package Guid: one key of Identification
- ///
- public String packageGuid;
-
- ///
- /// Module's Arch: one key of Identification
- ///
- public String arch;
-
- ///
- /// Module's version: one key of Identification
- ///
- public String version;
-
- ///
- /// Module's type
- ///
- public String moduleType;
-
- /**
- Constructor function for UsageIdentification class.
-
- @param moduleName The key of module's name
- @param moduleGuid The key of module's GUID string
- @param packageName The key of package's name
- @param packageGuid The key of package's Guid
- @param arch The architecture string
- @param version The version String
- @param moduleType The module type
- **/
- public UsageIdentification (String moduleName,
- String moduleGuid,
- String packageName,
- String packageGuid,
- String arch,
- String version,
- String moduleType) {
- this.moduleName = moduleName;
- this.moduleGuid = moduleGuid;
- this.packageName = packageName;
- this.packageGuid = packageGuid;
- this.arch = arch;
- this.version = version;
- this.moduleType = moduleType;
- }
-
- /**
- Generate the string for UsageIdentification
-
- @return the string value for UsageIdentification
- **/
- public String toString() {
- //
- // Because currently transition schema not require write moduleGuid, package Name, Packge GUID in
- // <ModuleSA> section, So currently no expect all paramter must be valid.
- // BUGBUG: Because currently we can not get version from MSA, So ignore verison.
- //
- return(moduleName + "_" +
- ((moduleGuid != null) ? moduleGuid.toLowerCase() : "NullModuleGuid") + "_" +
- ((packageName != null) ? packageName : "NullPackageName") + "_" +
- ((packageGuid != null) ? packageGuid.toLowerCase() : "NullPackageGuid") + "_" +
- ((arch != null) ? arch : "NullArch") + "_" +
- "NullVersion");
- }
-}
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java
deleted file mode 100644
index 2484453149..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java
+++ /dev/null
@@ -1,512 +0,0 @@
-/** @file
- UsageInstance class.
-
- This class indicate an usage instance for a PCD token. This instance maybe a module
- or platform setting. When a module produce or cosume a PCD token, then this module
- is an usage instance for this PCD token.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.entity;
-
-import org.tianocore.pcd.entity.CommonDefinition;
-import org.tianocore.pcd.entity.UsageIdentification;
-
-/**
- This class indicate an usage instance for a PCD token. This instance maybe a module
- or platform setting. When a module produce or cosume a PCD token, then this module
- is an usage instance for this PCD token.
-**/
-public class UsageInstance {
- ///
- /// This parent that this usage instance belongs to.
- ///
- public Token parentToken;
-
- ///
- /// ModuleIdentification for Usage Instance
- ///
- public UsageIdentification usageId;
-
- ///
- /// Arch also is a key for a UsageInstance
- ///
- public String arch;
-
- ///
- /// The PCD type defined for module
- ///
- public Token.PCD_TYPE modulePcdType;
-
- ///
- /// The value of the PCD in this usage instance.
- ///
- public String datum;
-
- ///
- /// The maxDatumSize could be different for same PCD in different module
- /// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule
- /// type.
- ///
- public int maxDatumSize;
-
- ///
- /// Autogen string for header file.
- ///
- public String hAutogenStr;
-
- ///
- /// Auotgen string for C code file.
- ///
- public String cAutogenStr;
-
- /**
- Constructure function for UsageInstance
-
- @param parentToken The token instance for this usgaInstance
- @param usageId The identification for usage instance
- @param modulePcdType The PCD type for this usage instance
- @param value The value of this PCD in this usage instance
- @param maxDatumSize The max datum size of this PCD in this usage
- instance.
- **/
- public UsageInstance(Token parentToken,
- UsageIdentification usageId,
- Token.PCD_TYPE modulePcdType,
- String value,
- int maxDatumSize) {
- this.parentToken = parentToken;
- this.usageId = usageId;
- this.modulePcdType = modulePcdType;
- this.datum = value;
- this.maxDatumSize = maxDatumSize;
- }
-
- /**
- Get the primary key for usage instance array for every token.
-
- @param usageId The identification of UsageInstance
-
- @retval String The primary key for this usage instance
- **/
- public static String getPrimaryKey(UsageIdentification usageId) {
- return usageId.toString();
- }
-
- /**
- Get primary key string for this usage instance
-
- @return String primary key string
- **/
- public String getPrimaryKey() {
- return UsageInstance.getPrimaryKey(usageId);
- }
-
- /**
- Judget whether current module is PEI driver
-
- @return boolean whether current module is PEI driver
- **/
- public boolean isPeiPhaseComponent() {
- int moduleType = CommonDefinition.getModuleType(usageId.moduleType);
-
- if ((moduleType == CommonDefinition.ModuleTypePeiCore) ||
- (moduleType == CommonDefinition.ModuleTypePeim)) {
- return true;
- }
- return false;
- }
-
- /**
- Judge whether current module is DXE driver.
-
- @return boolean whether current module is DXE driver
- **/
- public boolean isDxePhaseComponent() {
- int moduleType = CommonDefinition.getModuleType(usageId.moduleType);
-
- if ((moduleType == CommonDefinition.ModuleTypeDxeDriver) ||
- (moduleType == CommonDefinition.ModuleTypeDxeRuntimeDriver) ||
- (moduleType == CommonDefinition.ModuleTypeDxeSalDriver) ||
- (moduleType == CommonDefinition.ModuleTypeDxeSmmDriver) ||
- (moduleType == CommonDefinition.ModuleTypeUefiDriver) ||
- (moduleType == CommonDefinition.ModuleTypeUefiApplication)
- ) {
- return true;
- }
- return false;
- }
-
- /**
- Generate autogen string for header file and C code file.
-
- @param isBuildUsedLibrary whether the autogen is for library.
- **/
- public void generateAutoGen(boolean isBuildUsedLibrary) {
- String guidStringCName = null;
- boolean isByteArray = false;
- String printDatum = null;
- String tokenNumberString = null;
-
- hAutogenStr = "";
- cAutogenStr = "";
-
- if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {
- //
- // For DYNAMIC_EX type PCD, use original token number in SPD or FPD to generate autogen
- //
- tokenNumberString = Long.toString(parentToken.dynamicExTokenNumber, 16);
- } else {
- //
- // For Others type PCD, use autogenerated token number to generate autogen
- //
- tokenNumberString = Long.toString(parentToken.tokenNumber, 16);
- }
-
- hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%s\r\n", parentToken.cName, tokenNumberString);
-
- //
- // Judge the value of this PCD is byte array type
- //
- if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {
- if (datum.trim().charAt(0) == '{') {
- isByteArray = true;
- }
- }
-
- //
- // "ULL" should be added to value's tail for UINT64 value
- //
- if (parentToken.datumType == Token.DATUM_TYPE.UINT64) {
- printDatum = this.datum + "ULL";
- } else {
- printDatum = this.datum;
- }
-
- switch (modulePcdType) {
- case FEATURE_FLAG:
- //
- // Example autogen string for following generation:
- // "extern const BOOLEAN _gPcd_FixedAtBuild_PcdSampleToken";
- //
- hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n",
- parentToken.cName);
- //
- // Example autogen string for following generation:
- // "#define _PCD_GET_MODE_8_PcdSampleToken _gPcd_FixedAtBuild_PcdSampleToken";
- //
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- //
- // Example autogen string for following generation:
- // "//#define _PCD_SET_MODE_8_PcdSampleToken ASSERT(FALSE) If is not allowed to set value...";
- //
- hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) If is not allowed to set value for a FEATURE_FLAG PCD\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName);
-
- if (!isBuildUsedLibrary) {
- //
- // Example autogen string for following generation:
- // "#define _PCD_VALUE_PcdSampleToken 0x1000"
- //
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- printDatum);
- //
- // Example autogen string for following generation:
- // "GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_PcdSampleToken = _PCD_VALUE_PcdSampleToken;"
- //
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
- parentToken.cName,
- parentToken.cName);
- }
- break;
- case FIXED_AT_BUILD:
- if (isByteArray) {
- //
- // Example autogen string for following generation:
- // "extern const BOOLEAN _gPcd_FixedAtBuild_PcdSampleToken";
- //
- hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",
- parentToken.cName);
- //
- // Example autogen string for following generation:
- // "#define _PCD_GET_MODE_8_PcdSampleToken (VOID*)_gPcd_FixedAtBuild_PcdSampleToken";
- //
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s (VOID*)_gPcd_FixedAtBuild_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- } else {
- //
- // Example autogen string for following generation:
- // "extern const UINT8 _gPcd_FixedAtBuild_PcdSampleToken";
- //
- hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- //
- // Example autogen string for following generation:
- // "#define _PCD_GET_MODE_8_PcdSampleToken _gPcd_FixedAtBuild_PcdSampleToken";
- //
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
-
- //
- // Example autogen string for following generation:
- // "//#define _PCD_SET_MODE_8_PcdSampleToken ASSERT(FALSE) If is not allowed to set value...";
- //
- hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName);
- if (!isBuildUsedLibrary) {
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- if (isByteArray) {
- //
- // Example autogen string for following generation:
- // "#define _PCD_VALUE_PcdSampleToken (VOID*)_gPcd_FixedAtBuild_PcdSampleToken"
- //
- hAutogenStr += String.format("#define _PCD_VALUE_%s (VOID*)_gPcd_FixedAtBuild_%s\r\n",
- parentToken.cName,
- parentToken.cName);
- //
- // Example autogen string for following generation:
- // "GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_PcdSampleToken[] = 'dfdf';"
- //
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = %s;\r\n",
- parentToken.cName,
- printDatum);
- } else {
- //
- // Example autogen string for following generation:
- // "#define _PCD_VALUE_PcdSampleToken 0x222"
- //
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- printDatum);
- //
- // Example autogen string for following generation:
- // "GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"
- //
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
- } else {
- //
- // Example autogen string for following generation:
- // "#define _PCD_VALUE_PcdSampleToken 0x222"
- //
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- printDatum);
- //
- // Example autogen string for following generation:
- // "GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"
- //
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
- }
- break;
- case PATCHABLE_IN_MODULE:
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- //
- // Example autogen string for following generation:
- // "extern UINT8 _gPcd_BinaryPatch_PcdSampleToken[];"
- //
- hAutogenStr += String.format("extern UINT8 _gPcd_BinaryPatch_%s[];\r\n",
- parentToken.cName);
- //
- // Example autogen string for following generation:
- // "#define _PCD_GET_MODE_8_PcdSampleToken (VOID*)_gPcd_BinaryPatch_PcdSampleToken"
- //
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s (VOID*)_gPcd_BinaryPatch_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- //
- // Example autogen string for following generation:
- // "#define _PCD_SET_MODE_8_PcdSampleToken(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_PcdSampleToken, (Buffer), (SizeOfBuffer))"
- //
- hAutogenStr += String.format("#define _PCD_PATCHABLE_%s_SIZE %d\r\n",
- parentToken.cName,
- parentToken.datumSize);
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) "+
- "LibPatchPcdSetPtr (_gPcd_BinaryPatch_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, "+
- "(SizeOfBuffer), (Buffer))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName,
- parentToken.cName);
-
- } else {
- //
- // Example autogen string for following generation:
- // "extern UINT8 _gPcd_BinaryPatch_PcdSampleToken;"
- //
- hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- //
- // Example autogen string for following generation:
- // "#define _PCD_GET_MODE_8_PcdSampleToken _gPcd_BinaryPatch_PcdSampleToken"
- //
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- //
- // Example autogen string for following generation:
- // "#define _PCD_SET_MODE_8_PcdSampleToken(Value) (_gPcd_BinaryPatch_PcdSampleToken = (Value))"
- //
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) (_gPcd_BinaryPatch_%s = (Value))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
-
- if (!isBuildUsedLibrary) {
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- printDatum = parentToken.getByteArrayForPointerDatum(printDatum);
- }
- //
- // Example autogen string for following generation:
- // "#define _PCD_VALUE_PcdSampleToken 0x111"
- //
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- printDatum);
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- //
- // Example autogen string for following generation:
- // "GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"
- //
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[%d] = _PCD_VALUE_%s;\r\n",
- parentToken.cName,
- parentToken.datumSize,
- parentToken.cName);
- } else {
- //
- // Example autogen string for following generation:
- // "GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"
- //
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
- }
-
- break;
- case DYNAMIC:
- //
- // Example autogen string for following generation:
- // "#define _PCD_GET_MODE_8_PcdSampleToken LibPcdGet%s(_PCD_TOKEN_PcdSampleToken)"
- //
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s LibPcdGet%s(_PCD_TOKEN_%s)\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- parentToken.cName);
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- //
- // Example autogen string for following generation:
- // "#define _PCD_SET_MODE_8_PcdSampleToken(SizeOfBuffer, Buffer) LibPcdSet%s(_PCD_TOKEN_PcdSampleToken, (SizeOfBuffer), (Buffer))"
- //
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) LibPcdSet%s(_PCD_TOKEN_%s, (SizeOfBuffer), (Buffer))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- parentToken.cName);
- } else {
- //
- // Example autogen string for following generation:
- // "#define _PCD_SET_MODE_8_PcdSampleToken(Value) LibPcdSet%s(_PCD_TOKEN_PcdSampleToken, (Value))"
- //
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) LibPcdSet%s(_PCD_TOKEN_%s, (Value))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- parentToken.cName);
- }
- break;
- case DYNAMIC_EX:
- guidStringCName = "_gPcd_TokenSpaceGuid_" +
- parentToken.tokenSpaceName.toString().replaceAll("-", "_");
-
- //
- // Example autogen string for following generation:
- // "#define _PCD_GET_MODE_8_PcdSampleToken LibPcdGetEx%s(&_gPcd_TokenSpaceGuid_00_00_00, _PCD_TOKEN_PcdSampleToken)"
- //
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s LibPcdGetEx%s(&%s, _PCD_TOKEN_%s)\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- guidStringCName,
- parentToken.cName);
-
- if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {
- //
- // Example autogen string for following generation:
- // "#define _PCD_SET_MODE_8_PcdSampleToken(SizeOfBuffer, Buffer) LibPcdSetEx%s(&_gPcd_TokenSpaceGuid_00_00_00, _PCD_TOKEN_PcdSampleToken, (SizeOfBuffer), (Buffer))"
- //
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, _PCD_TOKEN_%s, (SizeOfBuffer), (Buffer))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- guidStringCName,
- parentToken.cName);
- } else {
- //
- // Example autogen string for following generation:
- // "#define _PCD_SET_MODE_8_PcdSampleToken(Value) LibPcdSetEx%s(&_gPcd_TokenSpaceGuid_00_00_00, _PCD_TOKEN_PcdSampleToken, (Value))"
- //
- hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) LibPcdSetEx%s(&%s, _PCD_TOKEN_%s, (Value))\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- guidStringCName,
- parentToken.cName);
-
- }
- break;
- }
- }
-
- /**
- Get the autogen string for header file.
-
- @return The string of header file.
- **/
- public String getHAutogenStr() {
- return hAutogenStr;
- }
-
- /**
- Get the autogen string for C code file.
-
- @return The string of C Code file.
- **/
- public String getCAutogenStr() {
- return cAutogenStr;
- }
-}
-
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/BuildActionException.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/BuildActionException.java
deleted file mode 100644
index 9cd4e63fef..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/BuildActionException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/** @file
- BuildActionException class.
-
- BuildAction Exception deals with all build action exceptions.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.exception;
-
-import org.apache.tools.ant.BuildException;
-
-/**
- BuildAction Exception deals with all build action exceptions.
-**/
-public class BuildActionException extends BuildException {
- static final long serialVersionUID = -7034897190740066939L;
- /**
- Constructure function
-
- @param reason exception message string.
- **/
- public BuildActionException(String reason) {
- super(reason);
- }
-}
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/EntityException.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/EntityException.java
deleted file mode 100644
index 5316cba554..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/EntityException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @file
- EntityException class.
-
- The class handle the exception throwed by entity class.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.exception;
-
-/**
- The class handle the exception throwed by entity class.
-**/
-public class EntityException extends Exception {
- static final long serialVersionUID = -8034897190740066939L;
- /**
- Constructure function
-
- @param expStr exception message string.
- **/
- public EntityException(String expStr) {
- super("[PCD Tool Internal Error]:" + expStr);
- }
-}
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/PlatformPcdPreprocessException.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/PlatformPcdPreprocessException.java
deleted file mode 100644
index 69b50c8f2f..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/PlatformPcdPreprocessException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
- PlatformPcdPreprocessException class.
-
- The class handle the exception throwed by PlatformPcdPreprocessAction class.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.exception;
-
-public class PlatformPcdPreprocessException extends Exception {
- /**
- serial version ID
- **/
- private static final long serialVersionUID = 2858398552845888282L;
-
- /**
- Constructure function
-
- @param expStr exception message string.
- **/
- public PlatformPcdPreprocessException(String expStr) {
- super("\r\n[PlatformPcdPreprocess Failure] #############################\r\n" + expStr);
- }
-
- public PlatformPcdPreprocessException() {
- super();
- }
-}
diff --git a/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/UIException.java b/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/UIException.java
deleted file mode 100644
index 377a8a4b1d..0000000000
--- a/Tools/Java/Source/PcdTools/org/tianocore/pcd/exception/UIException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @file
- UIException class.
-
- The class handle the exception throwed by UI action class.
-
-Copyright (c) 2006, 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.
-
-**/
-package org.tianocore.pcd.exception;
-
-/**
- The class handle the exception throwed by UI action class.
-**/
-public class UIException extends Exception {
- static final long serialVersionUID = -7034897190740066930L;
- /**
- Constructure function
-
- @param reason exception message string.
- **/
- public UIException(String reason) {
- super(reason);
- }
-}
diff --git a/Tools/Java/Source/SurfaceArea/SurfaceArea.msa b/Tools/Java/Source/SurfaceArea/SurfaceArea.msa
deleted file mode 100644
index da51e90603..0000000000
--- a/Tools/Java/Source/SurfaceArea/SurfaceArea.msa
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
- <MsaHeader>
- <ModuleName>Surface Area Build</ModuleName>
- <ModuleType>TOOL</ModuleType>
- <GuidValue>C21A4ED4-491E-4602-BF94-698EA54F254B</GuidValue>
- <Version>2.0</Version>
- <Abstract>This is the EFI/Tiano SurfaceArea Module</Abstract>
- <Description>
- This Module provides the EFI/Tiano Tools that are used to create EFI/Tiano
- Modules and Platform Binary Files (PBF)
- These tools require compilation only once if the Developer Workstation and
- the Developer's choice of HOST tool chain are stable. If the developer
- updates either the OS or the HOST tool chain, these tools should be rebuilt.
- </Description>
- <Copyright>Copyright 2006, Intel Corporation</Copyright>
- <License>
-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.
- </License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NULL</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>build.xml</Filename>
- </SourceFiles>
-</ModuleSurfaceArea>
diff --git a/Tools/Java/Source/SurfaceArea/build.xml b/Tools/Java/Source/SurfaceArea/build.xml
deleted file mode 100644
index 6dd98cd9d1..0000000000
--- a/Tools/Java/Source/SurfaceArea/build.xml
+++ /dev/null
@@ -1,220 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project default="all" basedir="." name="SurfaceArea">
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env" />
- <property name="WORKSPACE" value="${env.WORKSPACE}"/>
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
-
- <path id="classpath">
- <fileset dir="${WORKSPACE}/Tools/Jars">
- <include name="*.jar"/>
- </fileset>
- <fileset dir="${env.XMLBEANS_HOME}/lib">
- <include name="*.jar"/>
- </fileset>
- <pathelement path = "${env.CLASSPATH}"/>
- </path>
-
- <target name="init">
- <uptodate targetfile="${WORKSPACE}/Tools/Jars/SurfaceArea.jar" property="jar.newer">
- <srcfiles dir="${WORKSPACE}/Tools/XMLSchema" includes="*.xsd"/>
- </uptodate>
- </target>
-
- <!--
- Generate SurfaceArea.jar and source code
- -->
- <target name="SurfaceArea.jar" depends="init">
- <java classname="org.apache.xmlbeans.impl.tool.SchemaCompiler">
- <classpath refid="classpath"/>
- <arg value="-javasource"/>
- <arg value="1.5"/>
- <arg value="-dl"/>
- <arg value="-out"/>
- <arg value="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/FarManifest.xsd"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/>
- </java>
- </target>
-
- <target name="SurfaceArea.java" depends="init">
- <antcall target="SurfaceArea.java.clean"/>
- <java classname="org.apache.xmlbeans.impl.tool.SchemaCompiler">
- <classpath refid="classpath"/>
- <arg value="-javasource"/>
- <arg value="1.5"/>
- <arg value="-dl"/>
- <arg value="-srconly"/>
- <arg value="-src"/>
- <arg value="${WORKSPACE}/Tools/Java/Source/SurfaceArea"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/FarManifest.xsd"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/>
- </java>
- </target>
-
- <target name="SurfaceArea" depends="init" unless="jar.newer">
- <antcall target="SurfaceArea.java.clean"/>
- <java classname="org.apache.xmlbeans.impl.tool.SchemaCompiler" fork="true">
- <classpath refid="classpath"/>
- <arg value="-javasource"/>
- <arg value="1.5"/>
- <arg value="-dl"/>
- <arg value="-src"/>
- <arg value="${WORKSPACE}/Tools/Java/Source/SurfaceArea"/>
- <arg value="-out"/>
- <arg value="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/FarManifest.xsd"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/>
- </java>
- </target>
-
- <target name="SurfaceArea.java.clean">
- <delete includeemptydirs="true" failonerror="false">
- <fileset dir="${WORKSPACE}/Tools/Java/Source/SurfaceArea" includes="org"/>
- </delete>
- </target>
-
- <target name="SurfaceArea.jar.clean">
- </target>
-
- <!--
- Surface Area Description file validation
- -->
- <target name="validate">
- <echo message="Validating ... ${SURFACE_AREA_FILE}"/>
- <!--
- java -classpath %cp% org.apache.xmlbeans.impl.tool.InstanceValidator %*
- -->
- <copy file="${SURFACE_AREA_FILE}" tofile="${SURFACE_AREA_FILE}.xml"/>
- <java classname="org.apache.xmlbeans.impl.tool.InstanceValidator"
- outputproperty="XMLBEANS_OUTPUT"
- errorproperty="XMLBEANS_ERROR">
-
- <classpath refid="classpath"/>
- <arg value="-dl"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>
- <arg value="${SURFACE_AREA_FILE}.xml"/>
-
- </java>
-
- <delete file="${SURFACE_AREA_FILE}.xml" quiet="true"/>
- <if>
- <or>
- <contains string="${XMLBEANS_OUTPUT}" substring="NOT valid"/>
- <contains string="${XMLBEANS_OUTPUT}" substring=": error:"/>
- <contains string="${XMLBEANS_ERROR}" substring="XmlException"/>
- <contains string="${XMLBEANS_ERROR}" substring=": error:"/>
- </or>
- <then>
- <echo message="Result ... ${XMLBEANS_OUTPUT}&#x0d;&#x0a;${XMLBEANS_ERROR}"/>
- <fail message="${SURFACE_AREA_FILE} is invalid!"/>
- </then>
- <else>
- <echo message="Result ... ${SURFACE_AREA_FILE} is valid"/>
- </else>
- </if>
- </target>
-
- <!--
- beautify xml file
- -->
- <target name="pretty">
- <echo message="Beautify ... ${SURFACE_AREA_FILE}"/>
- <!--
- java -classpath %cp% org.apache.xmlbeans.impl.tool.PrettyPrinter %*
- -->
- <java classname="org.apache.xmlbeans.impl.tool.PrettyPrinter"
- errorproperty="XMLBEANS_OUTPUT"
- output="${SURFACE_AREA_FILE}">
-
- <classpath refid="classpath"/>
- <arg value="-indent"/>
- <arg value="2"/>
- <arg value="${SURFACE_AREA_FILE}"/>
-
- </java>
-
- <if>
- <equals arg1="${XMLBEANS_OUTPUT}" arg2=""/>
- <then>
- <echo message="Result ... DONE"/>
- </then>
- <else>
- <echo message="Result ... ${XMLBEANS_OUTPUT}"/>
- </else>
- </if>
- </target>
-
- <!--
- generate Surface Area template file from schema
- -->
- <target name="generate">
- <echo message="Generating ... ${SURFACE_AREA_FILE}"/>
- <!--
- java -classpath %cp% org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator %*
- -->
- <java classname="org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator" fork="true"
- errorproperty="XMLBEANS_OUTPUT"
- output="${SURFACE_AREA_FILE}.tmp">
-
- <classpath refid="classpath"/>
- <arg value="-dl"/>
- <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>
- <arg value="-name"/>
- <arg value="${SURFACE_AREA_ELEMENT}"/>
-
- </java>
-
- <concat destfile="${SURFACE_AREA_FILE}">
- <header trimleading="yes" filtering="no"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]>
- </header>
- <fileset file="${SURFACE_AREA_FILE}.tmp"/>
- </concat>
-
- <delete file="${SURFACE_AREA_FILE}.tmp" deleteonexit="true" quiet="true"/>
- <if>
- <equals arg1="${XMLBEANS_OUTPUT}" arg2=""/>
- <then>
- <echo message="Result ... DONE"/>
- </then>
- <else>
- <echo message="Result ... ${XMLBEANS_OUTPUT}"/>
- </else>
- </if>
- </target>
-
- <target name="clean" depends="SurfaceArea.java.clean">
- </target>
-
- <target name="cleanall" depends="SurfaceArea.jar.clean">
- <echo message="Removing Class Files and the Java Archive: SurfaceArea.jar"/>
- <delete file="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>
- <if>
- <available file="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>
- <then>
- <echo message="You must manually remove the file: ${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>
- <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
- </then>
- </if>
- </target>
-
- <target name="all" depends="SurfaceArea">
- </target>
-
- <target name="install" depends="SurfaceArea.jar">
- </target>
-
-</project>
diff --git a/Tools/OldBuildEnv b/Tools/OldBuildEnv
deleted file mode 100644
index f7bae84764..0000000000
--- a/Tools/OldBuildEnv
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-
-# Setup the environment for unix-like systems running a bash-like shell.
-# This file must be "sourced" not merely executed. For example: ". edksetup.sh"
-
-# CYGWIN users: Your path and filename related environment variables should be
-# set up in the unix style. This script will make the necessary conversions to
-# windows style.
-
-export WORKSPACE=$(pwd)
-
-# In unix-like systems, gcc is the compiler for building tools
-export TOOL_CHAIN=gcc
-
-if [ "$JAVA_HOME" == "" ]
-then
- echo "Please set JAVA_HOME before sourcing this script."
-else
-if [ "$ANT_HOME" == "" ]
-then
- echo "Please set ANT_HOME before sourcing this script."
-else
-if [ "$XMLBEANS_HOME" == "" ]
-then
- echo "Please set XMLBEANS_HOME before sourcing this script."
-else
-
-# These should be ok as they are.
-export CLASSPATH=$ANT_HOME/lib/ant-contrib.jar:$WORKSPACE/Tools/Jars/SurfaceArea.jar:$WORKSPACE/Tools/Jars/frameworktasks.jar:$WORKSPACE/Tools/Jars/cpptasks.jar:$WORKSPACE/Tools/Jars/PcdTools.jar:$WORKSPACE/Tools/Jars/GenBuild.jar:$XMLBEANS_HOME/lib/resolver.jar:$XMLBEANS_HOME/lib/xbean.jar:$XMLBEANS_HOME/lib/xmlpublic.jar:$XMLBEANS_HOME/lib/jsr173_1.0_api.jar:$XMLBEANS_HOME/lib/saxon8.jar:$XMLBEANS_HOME/lib/xbean_xpath.jar:$XMLBEANS_HOME/lib/saxon8-dom.jar:$XMLBEANS_HOME/lib/saxon8-xpath.jar
-export CLASSPATH=$CLASSPATH:$WORKSPACE/Tools/Jars/Common.jar
-export CLASSPATH=$CLASSPATH:$WORKSPACE/Tools/Jars/PcdTools.jar
-export CLASSPATH=$CLASSPATH:$WORKSPACE/Tools/bin/FrameworkWizard.jar
-export FRAMEWORK_TOOLS_PATH=$WORKSPACE/Tools/bin
-export PATH=$FRAMEWORK_TOOLS_PATH:$ANT_HOME/bin:$JAVA_HOME/bin:$PATH
-
-# Handle any particulars down here.
-case "`uname`" in
- CYGWIN*)
- # Convert paths to windows format.
- export WORKSPACE=`cygpath -w $WORKSPACE`
- export ANT_HOME=`cygpath -w $ANT_HOME`
- export XMLBEANS_HOME=`cygpath -w $XMLBEANS_HOME`
- export CLASSPATH=`cygpath -w -p $CLASSPATH`
- export FRAMEWORK_TOOLS_PATH=`cygpath -w -p $FRAMEWORK_TOOLS_PATH`
- ;;
-esac
-
-if [ \
- "$1" = Rebuild -o \
- "$1" = ForceRebuild -o \
- ! -e "$WORKSPACE/Tools/Jars/Common.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/PcdTools.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/GenBuild.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/SurfaceArea.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/cpptasks.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/frameworktasks.jar" -o \
- ! -e "$WORKSPACE/Tools/bin/FrameworkWizard.jar" -o \
- ! -e "$WORKSPACE/Tools/bin/CompressDll.dll" -o \
- ! -e "$WORKSPACE/Tools/bin/CreateMtFile" -o \
- ! -e "$WORKSPACE/Tools/bin/EfiCompress" -o \
- ! -e "$WORKSPACE/Tools/bin/EfiRom" -o \
- ! -e "$WORKSPACE/Tools/bin/FlashMap" -o \
- ! -e "$WORKSPACE/Tools/bin/FwImage" -o \
- ! -e "$WORKSPACE/Tools/bin/GenAcpiTable" -o \
- ! -e "$WORKSPACE/Tools/bin/GenCRC32Section" -o \
- ! -e "$WORKSPACE/Tools/bin/GenCapsuleHdr" -o \
- ! -e "$WORKSPACE/Tools/bin/GenDepex" -o \
- ! -e "$WORKSPACE/Tools/bin/GenFfsFile" -o \
- ! -e "$WORKSPACE/Tools/bin/GenFvImage" -o \
- ! -e "$WORKSPACE/Tools/bin/GenSection" -o \
- ! -e "$WORKSPACE/Tools/bin/GenTEImage" -o \
- ! -e "$WORKSPACE/Tools/bin/MakeDeps" -o \
- ! -e "$WORKSPACE/Tools/bin/ModifyInf" -o \
- ! -e "$WORKSPACE/Tools/bin/PeiRebase_Ia32" -o \
- ! -e "$WORKSPACE/Tools/bin/PeiRebase_Ipf" -o \
- ! -e "$WORKSPACE/Tools/bin/PeiRebase_X64" -o \
- ! -e "$WORKSPACE/Tools/bin/SecApResetVectorFixup" -o \
- ! -e "$WORKSPACE/Tools/bin/SecFixup" -o \
- ! -e "$WORKSPACE/Tools/bin/SetStamp" -o \
- ! -e "$WORKSPACE/Tools/bin/SplitFile" -o \
- ! -e "$WORKSPACE/Tools/bin/StrGather" -o \
- ! -e "$WORKSPACE/Tools/bin/Strip" -o \
- ! -e "$WORKSPACE/Tools/bin/VfrCompile" -o \
- ! -e "$WORKSPACE/Tools/bin/ZeroDebugData" -o \
- ! -e "$WORKSPACE/Tools/bin/antlr" -o \
- ! -e "$WORKSPACE/Tools/bin/dlg" ]
-then
- case "$1" in
- ForceRebuild)
- ant -noclasspath -f $WORKSPACE/Tools/build.xml cleanall all
- ;;
- *)
- ant -noclasspath -f $WORKSPACE/Tools/build.xml all
- ;;
- esac
-fi
-fi
-fi
-fi
diff --git a/Tools/Python/Calc-Deps.py b/Tools/Python/Calc-Deps.py
deleted file mode 100755
index b022a907ae..0000000000
--- a/Tools/Python/Calc-Deps.py
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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.
-
-"""Calculate the dependencies a given module has by looking through the source
-code to see what guids and functions are referenced to see which Packages and
-Library Classes need to be referenced. """
-
-import os, sys, re, getopt, string, glob, xml.dom.minidom, pprint
-from XmlRoutines import *
-
-# Map each function name back to the lib class that declares it.
-function_table = {}
-
-# Map each guid name to a package name.
-cname_table = {}
-
-def inWorkspace(rel_path):
- """Treat the given path as relative to the workspace."""
-
- # Make sure the user has set the workspace variable:
- try:
- return os.path.join(os.environ["WORKSPACE"], rel_path )
- except:
- print "Oops! You must set the WORKSPACE environment variable to run this script."
- sys.exit()
-
-def getIdentifiers(infiles):
-
- """Build a set of all the identifiers in this file."""
-
- # Start with an empty set.
- ids = set()
-
- for infile in infiles:
-
- # Open the file
- f = open(infile)
-
- # Create some lexical categories that we will use to filter out
- strings=re.compile('L?"[^"]*"')
- chars=re.compile("'[^']*'")
- hex=re.compile("0[Xx][0-9a-fA-F]*")
- keywords = re.compile('for|do|while|if|else|break|int|unsigned|switch|volatile|goto|case|char|long|struct|return|extern')
- common = re.compile('VOID|UINTN|UINT32|UINT8|UINT64')
-
- # Compile a Regular expression to grab all the identifers from the input.
- identifier = re.compile('[_a-zA-Z][0-9_a-zA-Z]{3,}')
-
- for line in f.readlines():
-
- # Filter some lexical categories out.
- # for filter in [strings, chars, hex, keywords, common]:
- for filter in [strings, chars, hex]:
- line = re.sub(filter, '', line)
-
- # Add all the identifiers that we found on this line.
- ids = ids.union(set(identifier.findall(line)))
-
- # Close the file
- f.close()
-
- # Return the set of identifiers.
- return ids
-
-
-def search_classes(ids):
-
- """ Search the set of classes for functions."""
-
- # Start with an empty set.
- classes = set()
-
- for id in ids:
- try:
- # If it is not a "hit" in the table add it to the set.
- classes.add(function_table[id])
- except:
- # If it is not a "hit" in the table, ignore it.
- pass
-
- return classes
-
-def search_cnames(ids):
-
- """Search all the Packages to see if this code uses a Guid from one of them.
- Return a set of matching packages."""
-
- packages = set()
-
- for id in ids:
- try:
- # If it is not a "hit" in the table add it to the set.
- packages.add(cname_table[id])
- except:
- # If it is not a "hit" in the table, ignore it.
- pass
-
- return packages
-
-def getSpds():
-
- """Open the database and get all the spd files out."""
-
- # Open the database
- database = xml.dom.minidom.parse(inWorkspace("Tools/Conf/FrameworkDatabase.db"))
-
- # Get a list of all the packages
- for filename in XmlList(database, "/FrameworkDatabase/PackageList/Filename"):
- spdFile = XmlElementData(filename)
-
- # Now open the spd file and build the database of guids.
- getCNames(inWorkspace(spdFile))
- getLibClasses(inWorkspace(spdFile))
-
-def getCNames(spdFile):
-
- """Extract all the C_Names from an spd file."""
-
- # Begin to parse the XML of the .spd
- spd = xml.dom.minidom.parse(spdFile)
-
- # Get the name of the package
- packageName = XmlElement(spd, "PackageSurfaceArea/SpdHeader/PackageName")
- packageVersion = XmlElement(spd, "PackageSurfaceArea/SpdHeader/Version")
- packageGuid = XmlElement(spd, "PackageSurfaceArea/SpdHeader/GuidValue")
-
- # Find the C_Name
- for cname in XmlList(spd, "/PackageSurfaceArea/GuidDeclarations/Entry/C_Name") + \
- XmlList(spd, "/PackageSurfaceArea/PcdDeclarations/PcdEntry/C_Name") + \
- XmlList(spd, "/PackageSurfaceArea/PpiDeclarations/Entry/C_Name") + \
- XmlList(spd, "/PackageSurfaceArea/ProtocolDeclarations/Entry/C_Name"):
-
- # Get the text of the <C_Name> tag.
- cname_text = XmlElementData(cname)
-
- # Map the <C_Name> to the <PackageName>. We will use this to lookup every
- # identifier in the Input Code.
- cname_table[cname_text] = {"name": packageName, "version": packageVersion, "guid": packageGuid}
-
-
- return
-
-def getLibClasses(spdFile):
-
- """Extract all the Lib Classes from an spd file."""
-
- # Begin to parse the XML of the .spd
- spd = xml.dom.minidom.parse(spdFile)
-
- # Get the guid of the package
- packageGuid = XmlElement(spd, "/PackageSurfaceArea/SpdHeader/GuidValue")
-
- for libClass in XmlList(spd, "/PackageSurfaceArea/LibraryClassDeclarations/LibraryClass"):
- className = XmlAttribute(libClass, "Name")
- headerfile = XmlElementData(libClass.getElementsByTagName("IncludeHeader")[0])
-
- packageRoot=os.path.dirname(spdFile)
-
- headerfile = os.path.join(packageRoot, headerfile)
-
- f = open(headerfile)
-
- # This pattern can pick out function names if the EFI coding
- # standard is followed. We could also use dumpbin on library
- # instances to get a list of symbols.
- functionPattern = re.compile("([_a-zA-Z][_a-zA-Z0-9]*) *\( *");
-
- for line in f.readlines():
- m = functionPattern.match(line)
- if m:
- functionName = m.group(1)
- # Map it!
- function_table[functionName] = (className, packageGuid)
-
- f.close()
-
-def guid(strVal):
- """Make a guid number out of a guid hex string."""
- return long(strVal.replace('-',''), 16)
-
-# This acts like the main() function for the script, unless it is 'import'ed into another
-# script.
-if __name__ == '__main__':
-
- # Create a pretty printer for dumping data structures in a readable form.
- pp = pprint.PrettyPrinter(indent=2)
-
- # Process the command line args.
- optlist, args = getopt.getopt(sys.argv[1:], 'h', [ 'example-long-arg=', 'testing'])
-
- """You should pass a file name as a paramter. It should be preprocessed text
-of all the .c and .h files in your module, which is cat'ed together into one
-large file."""
-
- # Scrape out all the things that look like identifiers.
- ids = getIdentifiers(args)
-
- # Read in the spds from the workspace to find the Guids.
- getSpds()
-
- # Debug stuff.
- print "Function Table = "
- pp.pprint(function_table)
- print "CName Table = "
- pp.pprint(cname_table)
- print "Classes = "
- pp.pprint(list(search_classes(ids)))
- print "C_Names = "
- pp.pprint(list(search_cnames(ids)))
diff --git a/Tools/Python/ContextTool.py b/Tools/Python/ContextTool.py
deleted file mode 100755
index 0dfd5c65b4..0000000000
--- a/Tools/Python/ContextTool.py
+++ /dev/null
@@ -1,600 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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.
-
-"""The EDK II Build System Context Tool Utility maintains Target.txt settings
-in an EDK II Workspace."""
-
-import wx, os, sys, copy
-from EdkIIWorkspace import *
-
-class ContextToolModel(EdkIIWorkspace):
- def __init__(self):
- self.WorkspaceStatus = EdkIIWorkspace.__init__(self)
- self.Database = {}
- self.OriginalDatabase = {}
-
- def LoadTargetTxtFile(self):
- self.ConvertTextFileToDictionary('Tools/Conf/Target.txt', self.TargetTxtDictionary, '#', '=', True, None)
- if self.TargetTxtDictionary['ACTIVE_PLATFORM'] == []:
- self.TargetTxtDictionary['ACTIVE_PLATFORM'] = ['']
- else:
- self.TargetTxtDictionary['ACTIVE_PLATFORM'] = [self.TargetTxtDictionary['ACTIVE_PLATFORM'][0]]
- self.TargetTxtDictionary['TOOL_CHAIN_CONF'] = [self.TargetTxtDictionary['TOOL_CHAIN_CONF'][0]]
- self.TargetTxtDictionary['MULTIPLE_THREAD'] = [self.TargetTxtDictionary['MULTIPLE_THREAD'][0]]
- self.TargetTxtDictionary['MAX_CONCURRENT_THREAD_NUMBER'] = [self.TargetTxtDictionary['MAX_CONCURRENT_THREAD_NUMBER'][0]]
- self.TargetTxtDictionary['TARGET'] = list(set(self.TargetTxtDictionary['TARGET']))
- self.TargetTxtDictionary['TOOL_CHAIN_TAG'] = list(set(self.TargetTxtDictionary['TOOL_CHAIN_TAG']))
- self.TargetTxtDictionary['TARGET_ARCH'] = list(set(self.TargetTxtDictionary['TARGET_ARCH']))
- if self.TargetTxtDictionary['TARGET'] == []:
- self.TargetTxtDictionary['TARGET'] = ['']
- if self.TargetTxtDictionary['TOOL_CHAIN_TAG'] == []:
- self.TargetTxtDictionary['TOOL_CHAIN_TAG'] = ['']
- if self.TargetTxtDictionary['TARGET_ARCH'] == []:
- self.TargetTxtDictionary['TARGET_ARCH'] = ['']
- self.TargetTxtDictionary['TARGET'].sort()
- self.TargetTxtDictionary['TOOL_CHAIN_TAG'].sort()
- self.TargetTxtDictionary['TARGET_ARCH'].sort()
- self.OriginalTargetTxtDictionary = copy.deepcopy(self.TargetTxtDictionary)
-
- def LoadToolsDefTxtFile(self):
- self.ToolsDefTxtDictionary = {}
- if self.TargetTxtDictionary['TOOL_CHAIN_CONF'] != ['']:
- self.ConvertTextFileToDictionary(self.TargetTxtDictionary['TOOL_CHAIN_CONF'][0], self.ToolsDefTxtDictionary, '#', '=', False, None)
-
- def LoadFrameworkDatabase(self):
- self.PlatformDatabase = {}
- Fd = self.XmlParseFile ('Tools/Conf/FrameworkDatabase.db')
- PlatformList = XmlList (Fd, '/FrameworkDatabase/PlatformList/Filename')
- for File in PlatformList:
- FpdFileName = XmlElementData(File)
- FpdPlatformHeader = self.XmlParseFileSection (FpdFileName, 'PlatformHeader')
- FpdPlatformDefinitions = self.XmlParseFileSection (FpdFileName,'PlatformDefinitions')
- PlatformName = XmlElement (FpdPlatformHeader, '/PlatformHeader/PlatformName')
- PlatformVersion = XmlElement (FpdPlatformHeader, '/PlatformHeader/Version')
- PlatformUiName = PlatformName + '[' + PlatformVersion + ']'
- if PlatformUiName not in self.PlatformDatabase:
- self.PlatformDatabase[PlatformUiName] = {}
- self.PlatformDatabase[PlatformUiName]['XmlFileName'] = FpdFileName
- self.PlatformDatabase[PlatformUiName]['SupportedArchitectures'] = set(XmlElement (FpdPlatformDefinitions, '/PlatformSurfaceArea/PlatformDefinitions/SupportedArchitectures').split(' '))
- self.PlatformDatabase[PlatformUiName]['BuildTargets'] = set(XmlElement (FpdPlatformDefinitions, '/PlatformSurfaceArea/PlatformDefinitions/BuildTargets').split(' '))
-
- def ComputeToolsDefTxtDatabase(self):
- self.ToolsDefTxtDatabase = {
- 'TARGET' : [],
- 'TOOL_CHAIN_TAG' : [],
- 'TARGET_ARCH' : []
- }
- for Key in dict(self.ToolsDefTxtDictionary):
- List = Key.split('_')
- if len(List) != 5:
- del self.ToolsDefTxtDictionary[Key]
- elif List[4] == '*':
- del self.ToolsDefTxtDictionary[Key]
- else:
- if List[0] != '*':
- self.ToolsDefTxtDatabase['TARGET'] += [List[0]]
- if List[1] != '*':
- self.ToolsDefTxtDatabase['TOOL_CHAIN_TAG'] += [List[1]]
- if List[2] != '*':
- self.ToolsDefTxtDatabase['TARGET_ARCH'] += [List[2]]
- self.ToolsDefTxtDatabase['TARGET'] = list(set(self.ToolsDefTxtDatabase['TARGET']))
- self.ToolsDefTxtDatabase['TOOL_CHAIN_TAG'] = list(set(self.ToolsDefTxtDatabase['TOOL_CHAIN_TAG']))
- self.ToolsDefTxtDatabase['TARGET_ARCH'] = list(set(self.ToolsDefTxtDatabase['TARGET_ARCH']))
- self.ToolsDefTxtDatabase['TARGET'].sort()
- self.ToolsDefTxtDatabase['TOOL_CHAIN_TAG'].sort()
- self.ToolsDefTxtDatabase['TARGET_ARCH'].sort()
-
- def NewModel(self):
- self.TargetTxtDictionary = {
- 'ACTIVE_PLATFORM' : [''],
- 'TOOL_CHAIN_CONF' : [''],
- 'MULTIPLE_THREAD' : ['Disable'],
- 'MAX_CONCURRENT_THREAD_NUMBER' : ['2'],
- 'TARGET' : [''],
- 'TOOL_CHAIN_TAG' : [''],
- 'TARGET_ARCH' : ['']
- }
-
- def RevertModel(self):
- self.TargetTxtDictionary = copy.deepcopy(self.OriginalTargetTxtDictionary)
-
- def RescanModel(self):
- self.NewModel()
- self.LoadTargetTxtFile()
-
- def RefreshModel(self):
- self.LoadFrameworkDatabase()
- self.LoadToolsDefTxtFile()
- self.ComputeToolsDefTxtDatabase()
-
- if self.Verbose:
- print self.TargetTxtDictionary
- print 'ActivePlatform = ', self.TargetTxtDictionary['ACTIVE_PLATFORM'][0]
- print 'ToolChainConf = ', self.TargetTxtDictionary['TOOL_CHAIN_CONF'][0]
- print 'MultipleThread = ', self.TargetTxtDictionary['MULTIPLE_THREAD'][0]
- print 'MaxThreads = ', self.TargetTxtDictionary['MAX_CONCURRENT_THREAD_NUMBER'][0]
- print 'TargetSet = ', self.TargetTxtDictionary['TARGET']
- print 'ToolChainSet = ', self.TargetTxtDictionary['TOOL_CHAIN_TAG']
- print 'TargetArchSet = ', self.TargetTxtDictionary['TARGET_ARCH']
- Platforms = self.PlatformDatabase.keys()
- print 'Possible Settings:'
- print ' Platforms = ', Platforms
- print ' TargetSet = ', self.ToolsDefTxtDatabase['TARGET']
- print ' ToolChainSet = ', self.ToolsDefTxtDatabase['TOOL_CHAIN_TAG']
- print ' TargetArchSet = ', self.ToolsDefTxtDatabase['TARGET_ARCH']
- return True
-
- def ModelModified(self):
- if self.TargetTxtDictionary != self.OriginalTargetTxtDictionary:
- return True
- return False
-
- def SaveModel(self, Filename='Tools/Conf/Target.txt'):
- if self.Verbose:
- for Item in self.TargetTxtDictionary:
- print Item,'=',self.TargetTxtDictionary[Item]
- self.ConvertDictionaryToTextFile(Filename, self.TargetTxtDictionary, '#', '=', True, None)
- self.OriginalTargetTxtDictionary = copy.deepcopy(self.TargetTxtDictionary)
-
- def CloseModel(self):
- pass
-
-class Frame(wx.Frame):
- def __init__(self):
- wx.Frame.__init__(self,None,-1,'EDK II Build System Context Tool')
- panel = wx.Panel(self, style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL)
- wx.HelpProvider_Set(wx.SimpleHelpProvider())
- self.Model = ContextToolModel()
- if not self.Model.WorkspaceStatus:
- self.Close()
- return
-
- #
- # Help text
- #
- ActivePlatformHelpText = (
- "Specifies the Platform Name and Platform Version of the platform that will be "
- "used for build. If set to [Build Directory] and the current directory contains "
- "an FPD file, then a plaform build on that FPD file will be performed. If set "
- "to [Build Directory] and there is no FPD file in the current directory, then no "
- "build will be performed."
- )
-
- ToolChainConfHelpText = (
- "Specifies the name of the file that declares all the tools and flag settings "
- "required to complete a build. This is typically set to Tools/Conf/tools_def.txt."
- )
-
- MultipleThreadHelpText = (
- "Flag to enable or disable multi-thread builds. If your computer is multi-core "
- "or contans multiple CPUs, enabling this feature will improve build performance. "
- "For multi-thread builds, a log will be written to ${BUILD_DIR}/build.log. This "
- "feature is only for platform builds. Clean, cleanall, and stand-alone module "
- "builds only use one thread."
- )
-
- ThreadsHelpText = (
- "The number of concurrent threads. The best performance is achieved if this "
- "value is set to one greater than the number or cores or CPUs in the build system."
- )
-
- TargetHelpText = (
- "Specifies the set of targets to build. If set to All, then all build targets "
- "are built. Otherwise, the subset of enabled build targets are built. The "
- "standard build targets are RELEASE and DEBUG, but additional user-defined build "
- "targets may be declared in the TOOL_CHAIN_CONF file. The DEBUG builds with "
- "source level debugging enabled. RELEASE builds with source level debugging "
- "disabled and results in smaller firmware images."
- )
-
- ToolChainTagHelpText = (
- "Specifies the set of tool chains to use during a build. If set to All, then "
- "all of the supported tools chains are used. Otherwise, only the subset of "
- "enabled tool chains are used. The TOOL_CHAIN_CONF file declares one or more "
- "tool chains that may be used."
- )
-
- TargetArchHelpText = (
- "Specifies the set of CPU architectures to build. If set to All, then all the "
- "CPU architectures supported by the platform FPD file are built. Otherwise, "
- "only the subset of enabled CPU architectures are built. The standard CPU "
- "architectures are IA32, X64, IPF, and EBC, but additional CPU architectures "
- "may be declared in the TOOL_CHAIN_CONF file."
- )
-
- #
- # Status Bar
- #
- self.CreateStatusBar()
-
- #
- # Build Menus
- #
- MenuBar = wx.MenuBar()
-
- FileMenu = wx.Menu()
- NewMenuItem = FileMenu.Append(-1, "&New\tCtrl+N", "New target.txt")
- SaveMenuItem = FileMenu.Append(-1, "&Save\tCtrl+S", "Save target.txt")
- SaveAsMenuItem = FileMenu.Append(-1, "Save &As...", "Save target.txt as...")
- RevertMenuItem = FileMenu.Append(-1, "&Revert", "Revert to the original target.txt")
- ExitMenuItem = FileMenu.Append(-1, "E&xit\tAlt+F4", "Exit ContextTool")
- MenuBar.Append(FileMenu, "&File")
- self.Bind(wx.EVT_MENU, self.OnSaveClick, SaveMenuItem)
- self.Bind(wx.EVT_MENU, self.OnSaveAsClick, SaveAsMenuItem)
- self.Bind(wx.EVT_MENU, self.OnRevertClick, RevertMenuItem)
- self.Bind(wx.EVT_MENU, self.OnExitClick, ExitMenuItem)
-
- ViewMenu = wx.Menu()
- RefreshMenuItem = ViewMenu.Append (-1, "&Refresh\tF5", "Rescan target.txt")
- ShowToolBarMenuItem = ViewMenu.AppendCheckItem (-1, "Show &Toolbar", "Shows or hides the toolbar")
- ShowToolBarMenuItem.Check(True)
- MenuBar.Append(ViewMenu, "&View")
- self.Bind(wx.EVT_MENU, self.OnViewRefreshClick, RefreshMenuItem)
- self.Bind(wx.EVT_MENU, self.OnShowToolBarClick, ShowToolBarMenuItem)
-
- HelpMenu = wx.Menu()
- AboutMenuItem = HelpMenu.Append (-1, "&About...", "About")
- MenuBar.Append(HelpMenu, "&Help")
- self.Bind(wx.EVT_MENU, self.OnAboutClick, AboutMenuItem)
-
- self.SetMenuBar (MenuBar)
-
- #
- # Build Toolbar
- #
- self.ShowToolBar = False
- self.OnShowToolBarClick(self)
-
- #
- # Active Platform Combo Box
- #
- ActivePlatformLabel = wx.StaticText(panel, -1, 'ACTIVE_PLATFORM')
- ActivePlatformLabel.SetHelpText(ActivePlatformHelpText)
- self.ActivePlatformText = wx.ComboBox(panel,-1, style=wx.CB_DROPDOWN | wx.CB_SORT | wx.CB_READONLY)
- self.ActivePlatformText.SetHelpText(ActivePlatformHelpText)
- self.ActivePlatformText.Bind(wx.EVT_TEXT, self.OnActivePlatformClick)
-
- #
- # Tool Chain Configuration Text Control and Browse Button for a File Dialog Box
- #
- ToolChainConfFileLabel = wx.StaticText(panel, -1, 'TOOL_CHAIN_CONF')
- ToolChainConfFileLabel.SetHelpText(ToolChainConfHelpText)
- self.ToolChainConfFileText = wx.TextCtrl(panel, -1, style=wx.TE_PROCESS_ENTER)
- self.ToolChainConfFileText.Bind(wx.EVT_TEXT_ENTER, self.OnToolChainConfClick)
- self.ToolChainConfFileText.Bind(wx.EVT_KILL_FOCUS, self.OnToolChainConfClick)
- self.ToolChainConfFileText.SetHelpText(ToolChainConfHelpText)
- self.BrowseButton = wx.Button(panel, -1, 'Browse...')
- self.BrowseButton.Bind(wx.EVT_BUTTON, self.OnBrowseButtonClick)
-
- #
- # Multiple Thread enable/disable radio button
- #
- MultipleThreadLabel = wx.StaticText(panel, -1, 'MULTIPLE_THREAD')
- MultipleThreadLabel.SetHelpText(MultipleThreadHelpText)
- self.MultipleThreadRadioBox = wx.RadioBox(panel, -1, choices=['Enable','Disable'], style=wx.RA_SPECIFY_COLS)
- self.MultipleThreadRadioBox.Bind(wx.EVT_RADIOBOX, self.OnMultipleThreadRadioBox)
- self.MultipleThreadRadioBox.SetHelpText(MultipleThreadHelpText)
-
- #
- # Thread count spin control
- #
- ThreadsLabel = wx.StaticText(panel, -1, 'THREADS')
- ThreadsLabel.SetHelpText(ThreadsHelpText)
- self.ThreadsSpinCtrl = wx.SpinCtrl(panel, -1, size=(50, -1), min=2)
- self.ThreadsSpinCtrl.Bind(wx.EVT_TEXT, self.OnThreadsSpinCtrl)
- self.ThreadsSpinCtrl.SetHelpText(ThreadsHelpText)
-
- #
- # Target, ToolChain, and Arch Check List Boxes
- #
- TargetLabel = wx.StaticText(panel, -1, 'TARGET')
- TargetLabel.SetHelpText(TargetHelpText)
-
- ToolChainTagLabel = wx.StaticText(panel, -1, 'TOOL_CHAIN_TAG')
- ToolChainTagLabel.SetHelpText(ToolChainTagHelpText)
-
- TargetArchLabel = wx.StaticText(panel, -1, 'TARGET_ARCH')
- TargetArchLabel.SetHelpText(TargetArchHelpText)
-
- self.TargetCheckListBox = wx.CheckListBox(panel, -1)
- self.TargetCheckListBox.Bind(wx.EVT_CHECKLISTBOX, self.OnTargetCheckListClick)
- self.TargetCheckListBox.Bind(wx.EVT_SET_FOCUS, self.OnTargetSetFocus)
- self.TargetCheckListBox.Bind(wx.EVT_KILL_FOCUS, self.OnTargetKillFocus)
- self.TargetCheckListBox.SetHelpText(TargetHelpText)
-
- self.ToolChainTagCheckListBox = wx.CheckListBox(panel, -1)
- self.ToolChainTagCheckListBox.Bind(wx.EVT_CHECKLISTBOX, self.OnToolChainTagCheckListClick)
- self.ToolChainTagCheckListBox.Bind(wx.EVT_SET_FOCUS, self.OnToolChainTagSetFocus)
- self.ToolChainTagCheckListBox.Bind(wx.EVT_KILL_FOCUS, self.OnToolChainTagKillFocus)
- self.ToolChainTagCheckListBox.SetHelpText(ToolChainTagHelpText)
-
- self.TargetArchCheckListBox = wx.CheckListBox(panel, -1)
- self.TargetArchCheckListBox.Bind(wx.EVT_CHECKLISTBOX, self.OnTargetArchCheckListClick)
- self.TargetArchCheckListBox.Bind(wx.EVT_SET_FOCUS, self.OnTargetArchSetFocus)
- self.TargetArchCheckListBox.Bind(wx.EVT_KILL_FOCUS, self.OnTargetArchKillFocus)
- self.TargetArchCheckListBox.SetHelpText(TargetArchHelpText)
-
- #
- # Define layout using sizers
- #
- self.mainSizer = wx.BoxSizer(wx.VERTICAL)
-
- flexSizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
- flexSizer.AddGrowableCol(1)
- flexSizer.Add(ActivePlatformLabel, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
- flexSizer.Add(self.ActivePlatformText, 0, wx.EXPAND)
- flexSizer.Add((0,0), wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
-
- flexSizer.Add(ToolChainConfFileLabel, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
- flexSizer.Add(self.ToolChainConfFileText, 0, wx.EXPAND)
- flexSizer.Add(self.BrowseButton, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
-
- self.mainSizer.Add (flexSizer, 0, wx.EXPAND | wx.ALL, 10)
-
- threadsSizer = wx.FlexGridSizer(cols = 5, hgap=5, vgap=5)
- threadsSizer.Add(MultipleThreadLabel, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
- threadsSizer.Add(self.MultipleThreadRadioBox, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
- threadsSizer.Add(ThreadsLabel, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
- threadsSizer.Add(self.ThreadsSpinCtrl, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
-
- self.mainSizer.Add (threadsSizer, 0, wx.ALL, 10)
-
- listSizer = wx.FlexGridSizer(rows = 2, cols = 3, hgap=5, vgap=5)
- listSizer.AddGrowableRow(1)
- listSizer.AddGrowableCol(0)
- listSizer.AddGrowableCol(1)
- listSizer.AddGrowableCol(2)
- listSizer.Add(TargetLabel, 0, wx.ALIGN_CENTER)
- listSizer.Add(ToolChainTagLabel, 0, wx.ALIGN_CENTER)
- listSizer.Add(TargetArchLabel, 0, wx.ALIGN_CENTER)
- listSizer.Add(self.TargetCheckListBox, 0, wx.ALL | wx.EXPAND)
- listSizer.Add(self.ToolChainTagCheckListBox, 0, wx.ALL | wx.EXPAND)
- listSizer.Add(self.TargetArchCheckListBox, 0, wx.ALL | wx.EXPAND)
-
- self.mainSizer.Add (listSizer, wx.EXPAND | wx.ALL, wx.EXPAND | wx.ALL, 10)
-
- panel.SetSizer (self.mainSizer)
-
- self.Model.RescanModel()
- self.OnRefreshClick(self)
-
- def OnActivePlatformClick(self, event):
- Platform = self.ActivePlatformText.GetValue()
- if Platform == ' [Build Directory]':
- self.Model.TargetTxtDictionary['ACTIVE_PLATFORM'][0] = ''
- else:
- self.Model.TargetTxtDictionary['ACTIVE_PLATFORM'][0] = self.Model.PlatformDatabase[Platform]['XmlFileName']
-
- def OnToolChainConfClick(self, event):
- if self.Model.TargetTxtDictionary['TOOL_CHAIN_CONF'][0] != self.ToolChainConfFileText.GetValue():
- self.Model.TargetTxtDictionary['TOOL_CHAIN_CONF'][0] = self.ToolChainConfFileText.GetValue()
- self.OnRefreshClick(self)
-
- def OnBrowseButtonClick(self, event):
- wildcard = "Text Documents (*.txt)|*.txt|" \
- "All files (*.*)|*.*"
- dialog = wx.FileDialog (None, 'Choose a Tool Chain Configuration File', self.Model.WorkspaceFile('Tools/Conf'), '', wildcard, wx.OPEN)
- if dialog.ShowModal() == wx.ID_OK:
- print dialog.GetPath()
- ToolChainConfFile = self.Model.WorkspaceRelativePath(dialog.GetPath())
- self.ToolChainConfFileText.SetValue(ToolChainConfFile)
- self.Model.TargetTxtDictionary['TOOL_CHAIN_CONF'][0] = self.ToolChainConfFileText.GetValue()
- self.OnRefreshClick(self)
- dialog.Destroy()
-
- def OnMultipleThreadRadioBox (self, event):
- self.Model.TargetTxtDictionary['MULTIPLE_THREAD'] = [self.MultipleThreadRadioBox.GetStringSelection()]
- if self.MultipleThreadRadioBox.GetStringSelection() == 'Disable':
- self.ThreadsSpinCtrl.Disable()
- else:
- self.ThreadsSpinCtrl.Enable()
-
- def OnThreadsSpinCtrl(self, event):
- self.Model.TargetTxtDictionary['MAX_CONCURRENT_THREAD_NUMBER'] = [str(self.ThreadsSpinCtrl.GetValue())]
-
- def CheckListFocus(self, CheckListBox, Set):
- Index = 0
- while Index < CheckListBox.GetCount():
- CheckListBox.SetSelection(Index, False)
- Index += 1
- if Set:
- CheckListBox.SetSelection(0, True)
-
- def CheckListClick(self, CheckListBox, Name):
- if CheckListBox.IsChecked(0):
- Index = 1
- while Index < CheckListBox.GetCount():
- CheckListBox.Check(Index, False)
- Index += 1
- if CheckListBox.IsChecked(0):
- self.Model.TargetTxtDictionary[Name] = ['']
- else:
- self.Model.TargetTxtDictionary[Name] = []
- Index = 1
- while Index < CheckListBox.GetCount():
- if CheckListBox.IsChecked(Index):
- self.Model.TargetTxtDictionary[Name] += [CheckListBox.GetString(Index)]
- Index += 1
- if self.Model.TargetTxtDictionary[Name] == []:
- self.Model.TargetTxtDictionary[Name] = ['']
-
- def OnTargetCheckListClick(self, event):
- self.CheckListClick(self.TargetCheckListBox, 'TARGET')
-
- def OnTargetSetFocus(self, event):
- self.CheckListFocus(self.TargetCheckListBox, True)
-
- def OnTargetKillFocus(self, event):
- self.CheckListFocus(self.TargetCheckListBox, False)
-
- def OnToolChainTagCheckListClick(self, event):
- self.CheckListClick(self.ToolChainTagCheckListBox, 'TOOL_CHAIN_TAG')
-
- def OnToolChainTagSetFocus(self, event):
- self.CheckListFocus(self.ToolChainTagCheckListBox, True)
-
- def OnToolChainTagKillFocus(self, event):
- self.CheckListFocus(self.ToolChainTagCheckListBox, False)
-
- def OnTargetArchCheckListClick(self, event):
- self.CheckListClick(self.TargetArchCheckListBox, 'TARGET_ARCH')
-
- def OnTargetArchSetFocus(self, event):
- self.CheckListFocus(self.TargetArchCheckListBox, True)
-
- def OnTargetArchKillFocus(self, event):
- self.CheckListFocus(self.TargetArchCheckListBox, False)
-
- def OnRevertClick(self, event):
- self.Model.RevertModel()
- self.OnRefreshClick(self)
-
- def RefreshCheckListBox(self, CheckListBox, Name):
- CheckListBox.Set(['All'] + self.Model.ToolsDefTxtDatabase[Name])
- Index = 0
- MaximumString = ''
- while Index < CheckListBox.GetCount():
- String = CheckListBox.GetString(Index)
- if len(String) > len(MaximumString):
- MaximumString = String
- if String in self.Model.TargetTxtDictionary[Name]:
- CheckListBox.Check(Index, True)
- else:
- CheckListBox.Check(Index, False)
- Index += 1
- if self.Model.TargetTxtDictionary[Name] == ['']:
- CheckListBox.Check(0, True)
- Extents = CheckListBox.GetFullTextExtent (MaximumString)
- CheckListBox.SetMinSize((Extents[0],(CheckListBox.GetCount()+1) * (Extents[1]+Extents[2])))
-
- def OnRefreshClick(self, event):
- self.Model.RefreshModel()
- Platforms = self.Model.PlatformDatabase.keys()
- Platforms.sort()
- self.ActivePlatformText.SetItems([' [Build Directory]'] + Platforms)
- self.ActivePlatformText.SetValue(' [Build Directory]')
- for Platform in self.Model.PlatformDatabase:
- if self.Model.PlatformDatabase[Platform]['XmlFileName'] == self.Model.TargetTxtDictionary['ACTIVE_PLATFORM'][0]:
- self.ActivePlatformText.SetValue(Platform)
- if self.ActivePlatformText.GetValue() == ' [Build Directory]':
- self.Model.TargetTxtDictionary['ACTIVE_PLATFORM'][0] = ''
- MaximumString = ' [Build Directory]'
- for String in Platforms:
- if len(String) > len(MaximumString):
- MaximumString = String
- Extents = self.ActivePlatformText.GetFullTextExtent (MaximumString)
- self.ActivePlatformText.SetMinSize((Extents[0] + 24,-1))
-
- self.ToolChainConfFileText.SetValue(self.Model.TargetTxtDictionary['TOOL_CHAIN_CONF'][0])
- Extents = self.ToolChainConfFileText.GetFullTextExtent (self.Model.TargetTxtDictionary['TOOL_CHAIN_CONF'][0])
- self.ToolChainConfFileText.SetMinSize((Extents[0] + 24,-1))
-
- self.MultipleThreadRadioBox.SetStringSelection(self.Model.TargetTxtDictionary['MULTIPLE_THREAD'][0])
- if self.MultipleThreadRadioBox.GetStringSelection() == 'Disable':
- self.ThreadsSpinCtrl.Disable()
- self.ThreadsSpinCtrl.SetValue(int(self.Model.TargetTxtDictionary['MAX_CONCURRENT_THREAD_NUMBER'][0]))
-
- self.RefreshCheckListBox (self.TargetCheckListBox, 'TARGET')
- self.RefreshCheckListBox (self.ToolChainTagCheckListBox, 'TOOL_CHAIN_TAG')
- self.RefreshCheckListBox (self.TargetArchCheckListBox, 'TARGET_ARCH')
-
- self.mainSizer.SetSizeHints(self)
- self.mainSizer.Fit(self)
-
- def OnViewRefreshClick(self, event):
- self.Model.RescanModel()
- self.OnRefreshClick(self)
-
- def AddTool (self, Handler, ArtId, Label, HelpText):
- Tool = self.ToolBar.AddSimpleTool(
- -1,
- wx.ArtProvider.GetBitmap(ArtId, wx.ART_TOOLBAR, self.ToolSize),
- Label,
- HelpText
- )
- self.Bind(wx.EVT_MENU, Handler, Tool)
-
- def OnShowToolBarClick(self, event):
- if self.ShowToolBar:
- self.ShowToolBar = False
- self.ToolBar.Destroy()
- else:
- self.ShowToolBar = True
- self.ToolBar = self.CreateToolBar()
- self.ToolSize = (24,24)
- self.ToolBar.SetToolBitmapSize(self.ToolSize)
- self.AddTool (self.OnNewClick, wx.ART_NEW, "New", "New target.txt")
- self.AddTool (self.OnSaveClick, wx.ART_FILE_SAVE, "Save", "Save target.txt")
- self.AddTool (self.OnSaveAsClick, wx.ART_FILE_SAVE_AS, "Save As...", "Save target.txt as...")
- self.AddTool (self.OnRevertClick, wx.ART_UNDO, "Revert", "Revert to original target.txt")
- self.AddTool (self.OnHelpClick, wx.ART_HELP, "Help", "Context Sensitive Help")
- self.AddTool (self.OnExitClick, wx.ART_QUIT, "Exit", "Exit Context Tool application")
- self.ToolBar.Realize()
-
- def OnNewClick(self, event):
- self.Model.NewModel()
- self.OnRefreshClick(self)
-
- def OnSaveClick(self, event):
- self.Model.SaveModel()
-
- def OnSaveAsClick(self, event):
- wildcard = "Text Documents (*.txt)|*.txt|" \
- "All files (*.*)|*.*"
- dialog = wx.FileDialog (None, 'Save As', self.Model.WorkspaceFile('Tools/Conf'), '', wildcard, wx.SAVE | wx.OVERWRITE_PROMPT)
- if dialog.ShowModal() == wx.ID_OK:
- TargetTxtFile = self.Model.WorkspaceRelativePath(dialog.GetPath())
- if TargetTxtFile != '':
- self.Model.SaveModel(TargetTxtFile)
- dialog.Destroy()
-
- def OnExitClick(self, event):
- if self.Model.ModelModified():
- dialog = wx.MessageDialog(None, 'The contents have changed.\nDo you want to save changes?', 'EDK II Build System Context Tool', style = wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_EXCLAMATION)
- Status = dialog.ShowModal()
- dialog.Destroy()
- if Status == wx.ID_YES:
- self.OnSaveClick (self)
- elif Status == wx.ID_CANCEL:
- return
- self.Model.CloseModel()
- self.Close()
-
- def OnHelpClick(self, event):
- wx.ContextHelp().BeginContextHelp()
-
- def OnAboutClick(self, event):
- AboutInfo = wx.AboutDialogInfo()
- AboutInfo.Name = 'EDK II Build System Context Tool'
- AboutInfo.Version = '0.3'
- AboutInfo.Copyright = 'Copyright (c) 2006, Intel Corporation'
- AboutInfo.Description = """
- The EDK II Build System Context Tool maintains the target.txt
- settings in an EDK II Workspace."""
- AboutInfo.WebSite = ("http://tianocore.org", "Tiano Core home page")
- AboutInfo.License = """
- 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."""
- if self.Model.Icon != None:
- AboutInfo.Icon = self.Model.Icon
- wx.AboutBox(AboutInfo)
-
-if __name__ == '__main__':
- app = wx.PySimpleApp()
- frame = Frame()
- frame.Show()
- app.MainLoop()
diff --git a/Tools/Python/Doxyfile b/Tools/Python/Doxyfile
deleted file mode 100644
index c9ea39075d..0000000000
--- a/Tools/Python/Doxyfile
+++ /dev/null
@@ -1,259 +0,0 @@
-# Doxyfile 1.4.5
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Python Scripts for EDK II ($Rev$)"
-PROJECT_NUMBER = "Revision $(DOXY_PROJ_NUM)"
-OUTPUT_DIRECTORY = docs
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = YES
-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 = NO
-STRIP_FROM_PATH = .
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = YES
-BUILTIN_STL_SUPPORT = NO
-DISTRIBUTE_GROUP_DOC = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = YES
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = 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 = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 9999
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = YES
-FILE_VERSION_FILTER =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = YES
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = .
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.d \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.idl \
- *.odl \
- *.cs \
- *.php \
- *.php3 \
- *.inc \
- *.m \
- *.mm \
- *.dox \
- *.py
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS = *
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = NO
-REFERENCES_RELATION = NO
-USE_HTAGS = NO
-VERBATIM_HEADERS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-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 = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-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
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 1000
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = YES
diff --git a/Tools/Python/EdkIIWorkspace.py b/Tools/Python/EdkIIWorkspace.py
deleted file mode 100755
index 935ffadc09..0000000000
--- a/Tools/Python/EdkIIWorkspace.py
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env python
-
-# This is the base class for applications that operate on an EDK II Workspace
-
-import os, sys
-from XmlRoutines import *
-
-class EdkIIWorkspace:
- def __init__(self):
- """Collect WorkspaceDir from the environment, the Verbose command line flag, and detect an icon bitmap file."""
- if os.environ.get('WORKSPACE') == None:
- print 'ERROR: WORKSPACE not defined. Please run EdkSetup from the EDK II install directory.'
- return False
-
- self.WorkspaceDir = os.path.realpath(os.environ.get('WORKSPACE'))
- (Drive, Path) = os.path.splitdrive(self.WorkspaceDir)
- if Drive == '':
- (Drive, CwdPath) = os.path.splitdrive(os.getcwd())
- if Drive != '':
- self.WorkspaceDir = Drive + Path
- else:
- self.WorkspaceDir = Drive.upper() + Path
-
- try:
- self.Icon = wx.Icon(self.WorkspaceFile('tools/Python/TianoCoreOrgLogo.gif'),wx.BITMAP_TYPE_GIF)
- except:
- self.Icon = None
-
- self.Verbose = False
- for arg in sys.argv:
- if arg.lower() == '-v':
- self.Verbose = True
-
- return True
-
- def WorkspaceRelativePath(self, FileName):
- """Convert a full path filename to a workspace relative filename."""
- FileName = os.path.realpath(FileName)
- if FileName.find(self.WorkspaceDir) != 0:
- return ''
- return FileName.replace (self.WorkspaceDir, '').strip('\\').strip('/')
-
- def WorkspaceFile(self, FileName):
- """Convert a workspace relative filename to a full path filename."""
- return os.path.realpath(os.path.join(self.WorkspaceDir,FileName))
-
- def XmlParseFile (self, FileName):
- """Parse an XML file into a DOM and return the DOM."""
- if self.Verbose:
- print FileName
- return XmlParseFile (self.WorkspaceFile(FileName))
-
- def XmlParseFileSection (self, FileName, SectionTag):
- """Parse a section of an XML file into a DOM(Document Object Model) and return the DOM."""
- if self.Verbose:
- print FileName
- return XmlParseFileSection (self.WorkspaceFile(FileName), SectionTag)
-
- def XmlSaveFile (self, Dom, FileName):
- """Save a DOM(Document Object Model) into an XML file."""
- if self.Verbose:
- print FileName
- return XmlSaveFile (Dom, self.WorkspaceFile(FileName))
-
- def ConvertTextFileToDictionary(self, FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
- """Convert a workspace relative text file to a dictionary of (name:value) pairs."""
- if self.Verbose:
- print FileName
- return ConvertTextFileToDictionary(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter)
-
- def ConvertDictionaryToTextFile(self, FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
- """Convert a dictionary of (name:value) pairs to a workspace relative text file."""
- if self.Verbose:
- print FileName
- return ConvertDictionaryToTextFile(self.WorkspaceFile(FileName), Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter)
-
-#
-# Convert a text file to a dictionary
-#
-def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
- """Convert a text file to a dictionary of (name:value) pairs."""
- try:
- f = open(FileName,'r')
- except:
- return False
- Keys = []
- for Line in f:
- LineList = Line.split(KeySplitCharacter,1)
- if len(LineList) >= 2:
- Key = LineList[0].split()
- if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys:
- if ValueSplitFlag:
- Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter)
- else:
- Dictionary[Key[0]] = LineList[1].strip().replace('\\','/')
- Keys += [Key[0]]
- f.close()
- return True
-
-def ConvertDictionaryToTextFile(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
- """Convert a dictionary of (name:value) pairs to a text file."""
- try:
- f = open(FileName,'r')
- Lines = []
- Lines = f.readlines()
- f.close()
- except:
- Lines = []
- Keys = Dictionary.keys()
- MaxLength = 0
- for Key in Keys:
- if len(Key) > MaxLength:
- MaxLength = len(Key)
- Index = 0
- for Line in Lines:
- LineList = Line.split(KeySplitCharacter,1)
- if len(LineList) >= 2:
- Key = LineList[0].split()
- if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] in Dictionary:
- if ValueSplitFlag:
- Line = '%-*s %c %s\n' % (MaxLength, Key[0], KeySplitCharacter, ' '.join(Dictionary[Key[0]]))
- else:
- Line = '%-*s %c %s\n' % (MaxLength, Key[0], KeySplitCharacter, Dictionary[Key[0]])
- Lines.pop(Index)
- if Key[0] in Keys:
- Lines.insert(Index,Line)
- Keys.remove(Key[0])
- Index += 1
- for RemainingKey in Keys:
- if ValueSplitFlag:
- Line = '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCharacter,' '.join(Dictionary[RemainingKey]))
- else:
- Line = '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCharacter, Dictionary[RemainingKey])
- Lines.append(Line)
- try:
- f = open(FileName,'w')
- except:
- return False
- f.writelines(Lines)
- f.close()
- return True
-
-# 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.
- pass
diff --git a/Tools/Python/Fd.py b/Tools/Python/Fd.py
deleted file mode 100755
index f8b26059e7..0000000000
--- a/Tools/Python/Fd.py
+++ /dev/null
@@ -1,582 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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.
-
-"""An EDK II Build System Framework Database Utility maintains
-FrameworkDatabase.db settings in an EDK II Workspace."""
-
-import wx, os, sys, copy
-from EdkIIWorkspace import *
-
-class FrameworkDatabaseModel(EdkIIWorkspace):
- def __init__(self):
- self.WorkspaceStatus = EdkIIWorkspace.__init__(self)
- self.Database = {}
- self.OriginalDatabase = {}
-
- def AddFile (self, DirName, FileName, FileType, Enabled):
- if DirName != '':
- FileName = os.path.join(DirName,FileName)
- if FileType == 'Package':
- Header = self.XmlParseFileSection (FileName, 'SpdHeader')
- Name = XmlElement (Header, '/SpdHeader/PackageName')
- Version = XmlElement (Header, '/SpdHeader/Version')
- elif FileType == 'Platform':
- Header = self.XmlParseFileSection (FileName, 'PlatformHeader')
- Name = XmlElement (Header, '/PlatformHeader/PlatformName')
- Version = XmlElement (Header, '/PlatformHeader/Version')
- else:
- return
- FileName = FileName.replace('\\','/')
- if Name == '' and Version == '':
- ValidType = 'Invalid'
- OtherType = 'Valid'
- UiName = FileName
- else:
- ValidType = 'Valid'
- OtherType = 'Invalid'
- UiName = Name + ' [' + Version + ']'
- self.Database[FileType][OtherType]['PossibleSettings'].pop(FileName, None)
- self.Database[FileType][OtherType]['EnabledSettings'].pop(FileName, None)
- self.Database[FileType][ValidType]['PossibleSettings'][FileName] = UiName
- if Enabled:
- self.Database[FileType][ValidType]['EnabledSettings'][FileName] = UiName
- return
-
- def NewModel(self):
- self.Database['Platform'] = {'Valid': {'PossibleSettings':{}, 'EnabledSettings':{}},'Invalid': {'PossibleSettings':{}, 'EnabledSettings':{}}}
- self.Database['Package'] = {'Valid': {'PossibleSettings':{}, 'EnabledSettings':{}},'Invalid': {'PossibleSettings':{}, 'EnabledSettings':{}}}
-
- def RevertModel(self):
- self.Database = copy.deepcopy(self.OriginalDatabase)
-
- def RescanModel(self):
- self.NewModel()
- self.Fd = self.XmlParseFile ('Tools/Conf/FrameworkDatabase.db')
- PackageList = XmlList (self.Fd, '/FrameworkDatabase/PackageList/Filename')
- for File in PackageList:
- SpdFileName = XmlElementData(File)
- self.AddFile ('', SpdFileName, 'Package', True)
- PlatformList = XmlList (self.Fd, '/FrameworkDatabase/PlatformList/Filename')
- for File in PlatformList:
- FpdFileName = XmlElementData(File)
- self.AddFile ('', FpdFileName, 'Platform', True)
- self.OriginalDatabase = copy.deepcopy(self.Database)
-
- def RefreshModel(self):
- Temp = copy.deepcopy(self.Database)
- for FileType in ['Package','Platform']:
- for Valid in ['Valid','Invalid']:
- for Item in Temp[FileType][Valid]['PossibleSettings']:
- self.AddFile('',Item, FileType, Item in Temp[FileType][Valid]['EnabledSettings'])
- return True
-
- def ModelModified(self):
- if self.Database['Package']['Valid']['EnabledSettings'] != self.OriginalDatabase['Package']['Valid']['EnabledSettings']:
- return True
- if self.Database['Package']['Invalid']['EnabledSettings'] != self.OriginalDatabase['Package']['Invalid']['EnabledSettings']:
- return True
- if self.Database['Platform']['Valid']['EnabledSettings'] != self.OriginalDatabase['Platform']['Valid']['EnabledSettings']:
- return True
- if self.Database['Platform']['Invalid']['EnabledSettings'] != self.OriginalDatabase['Platform']['Invalid']['EnabledSettings']:
- return True
- return False
-
- def SaveModel(self, Filename='Tools/Conf/FrameworkDatabase.db'):
- EnabledList = self.Database['Package']['Valid']['EnabledSettings'].keys()
- EnabledList += self.Database['Package']['Invalid']['EnabledSettings'].keys()
- PackageList = XmlList (self.Fd, '/FrameworkDatabase/PackageList/Filename')
- for File in PackageList:
- SpdFileName = XmlElementData(File)
- if SpdFileName in EnabledList:
- EnabledList.remove(SpdFileName)
- continue
- XmlRemoveElement(File)
-
- ParentNode = XmlList (self.Fd, '/FrameworkDatabase/PackageList')[0]
- for SpdFileName in EnabledList:
- XmlAppendChildElement(ParentNode, u'Filename', SpdFileName)
-
- EnabledList = self.Database['Platform']['Valid']['EnabledSettings'].keys()
- EnabledList += self.Database['Platform']['Invalid']['EnabledSettings'].keys()
- PlatformList = XmlList (self.Fd, '/FrameworkDatabase/PlatformList/Filename')
- for File in PlatformList:
- FpdFileName = XmlElementData(File)
- if FpdFileName in EnabledList:
- EnabledList.remove(FpdFileName)
- continue
- XmlRemoveElement(File)
-
- ParentNode = XmlList (self.Fd, '/FrameworkDatabase/PlatformList')[0]
- for FpdFileName in EnabledList:
- XmlAppendChildElement(ParentNode, u'Filename', FpdFileName)
-
- self.XmlSaveFile (self.Fd, Filename)
- self.OriginalDatabase = copy.deepcopy(self.Database)
-
- def CloseModel(self):
- pass
-
-class Frame(wx.Frame):
- def __init__(self):
- wx.Frame.__init__(self,None,-1,'EDK II Build System Framework Database Utility')
- panel = wx.Panel(self, style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL)
- wx.HelpProvider_Set(wx.SimpleHelpProvider())
-
- self.Model = FrameworkDatabaseModel()
-
- #
- # Help text
- #
- PackagesHelpText = (
- "The set of packages that are active in the current WORKSPACE."
- )
-
- PlatformsHelpText = (
- "The set of platforms that are active in the current WORKSPACE."
- )
-
- InvalidPackagesHelpText = (
- "The set of packages that are in Framework Database, but not in the current WORKSPACE."
- )
-
- InvalidPlatformsHelpText = (
- "The set of platforms that are in Framework Database, but not in the current WORKSPACE."
- )
-
- #
- # Status Bar
- #
- self.StatusBar = self.CreateStatusBar()
-
- #
- # Build Menus
- #
- MenuBar = wx.MenuBar()
-
- FileMenu = wx.Menu()
- NewMenuItem = FileMenu.Append(-1, "&New\tCtrl+N", "New FrameworkDatabase.db")
- SaveMenuItem = FileMenu.Append(-1, "&Save\tCtrl+S", "Save FramdworkDatabase.db")
- SaveAsMenuItem = FileMenu.Append(-1, "Save &As...", "Save FrameworkDatabase.db as...")
- RevertMenuItem = FileMenu.Append(-1, "&Revert", "Revert to the original FrameworkDatabase.db")
- ScanMenuItem = FileMenu.Append(-1, "Scan &WORKSPACE\tCtrl+W", "Scan WORKSPACE for additional packages and platforms")
- ScanAndSyncMenuItem = FileMenu.Append(-1, "Scan &WORKSPACE and Sync\tCtrl+W", "Scan WORKSPACE for additional packages and platforms and sync FramdworkDatabase.db")
- ExitMenuItem = FileMenu.Append(-1, "E&xit\tAlt+F4", "Exit Framework Database Tool")
- MenuBar.Append(FileMenu, "&File")
- self.Bind(wx.EVT_MENU, self.OnSaveClick, SaveMenuItem)
- self.Bind(wx.EVT_MENU, self.OnSaveAsClick, SaveAsMenuItem)
- self.Bind(wx.EVT_MENU, self.OnRevertClick, RevertMenuItem)
- self.Bind(wx.EVT_MENU, self.OnScanClick, ScanMenuItem)
- self.Bind(wx.EVT_MENU, self.OnScanAndSyncClick, ScanAndSyncMenuItem)
- self.Bind(wx.EVT_MENU, self.OnExitClick, ExitMenuItem)
-
- EditMenu = wx.Menu()
- SelectAllPlatformsMenuItem = EditMenu.Append (-1, "Select All Platforms", "Select all platforms")
- ClearAllPlatformsMenuItem = EditMenu.Append (-1, "Clear All Platforms", "Clear all platforms")
- SelectAllPackagesMenuItem = EditMenu.Append (-1, "Select All Packages", "Select all packages")
- ClearAllPackagesMenuItem = EditMenu.Append (-1, "Clear All Packages", "Clear all packages")
- SelectAllInvalidPlatformsMenuItem = EditMenu.Append (-1, "Select All Invalid Platforms", "Select all invalid platforms")
- ClearAllInvalidPlatformsMenuItem = EditMenu.Append (-1, "Clear All Invalid Platforms", "Clear all invalid platforms")
- SelectAllInvalidPackagesMenuItem = EditMenu.Append (-1, "Select All Invalid Packages", "Select all invalid packages")
- ClearAllInvalidPackagesMenuItem = EditMenu.Append (-1, "Clear All Invalid Packages", "Clear all invalid packages")
- MenuBar.Append(EditMenu, "&Edit")
- self.Bind(wx.EVT_MENU, self.OnSelectAllPlatformsClick, SelectAllPlatformsMenuItem)
- self.Bind(wx.EVT_MENU, self.OnClearAllPlatformsClick, ClearAllPlatformsMenuItem)
- self.Bind(wx.EVT_MENU, self.OnSelectAllPackagesClick, SelectAllPackagesMenuItem)
- self.Bind(wx.EVT_MENU, self.OnClearAllPackagesClick, ClearAllPackagesMenuItem)
- self.Bind(wx.EVT_MENU, self.OnSelectAllInvalidPlatformsClick, SelectAllInvalidPlatformsMenuItem)
- self.Bind(wx.EVT_MENU, self.OnClearAllInvalidPlatformsClick, ClearAllInvalidPlatformsMenuItem)
- self.Bind(wx.EVT_MENU, self.OnSelectAllInvalidPackagesClick, SelectAllInvalidPackagesMenuItem)
- self.Bind(wx.EVT_MENU, self.OnClearAllInvalidPackagesClick, ClearAllInvalidPackagesMenuItem)
-
- ViewMenu = wx.Menu()
- RefreshMenuItem = ViewMenu.Append (-1, "&Refresh\tF5", "Rescan FrameworkDatabase.db")
- ShowToolBarMenuItem = ViewMenu.AppendCheckItem (-1, "Show &Toolbar", "Shows or hides the toolbar")
- ShowToolBarMenuItem.Check(True)
- MenuBar.Append(ViewMenu, "&View")
- self.Bind(wx.EVT_MENU, self.OnViewRefreshClick, RefreshMenuItem)
- self.Bind(wx.EVT_MENU, self.OnShowToolBarClick, ShowToolBarMenuItem)
-
- HelpMenu = wx.Menu()
- AboutMenuItem = HelpMenu.Append (-1, "&About...", "About")
- MenuBar.Append(HelpMenu, "&Help")
- self.Bind(wx.EVT_MENU, self.OnAboutClick, AboutMenuItem)
-
- self.SetMenuBar (MenuBar)
-
- #
- # Build Toolbar
- #
- self.ShowToolBar = False
- self.OnShowToolBarClick(self)
-
- #
- # Target, ToolChain, and Arch Check List Boxes
- #
- PackagesLabel = wx.StaticText(panel, -1, 'Packages')
- PackagesLabel.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
- PackagesLabel.SetHelpText(PackagesHelpText)
-
- PlatformsLabel = wx.StaticText(panel, -1, 'Platforms')
- PlatformsLabel.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
- PlatformsLabel.SetHelpText(PlatformsHelpText)
-
- #
- # Buttons
- #
- self.SelectAllPackagesButton = wx.Button(panel, -1, 'Select All')
- self.ClearAllPackagesButton = wx.Button(panel, -1, 'Clear All')
- self.SelectAllPackagesButton.Bind (wx.EVT_BUTTON, self.OnSelectAllPackagesClick)
- self.ClearAllPackagesButton.Bind (wx.EVT_BUTTON, self.OnClearAllPackagesClick)
-
- self.PackagesCheckListBox = wx.CheckListBox(panel, -1)
- self.PackagesCheckListBox.Bind(wx.EVT_CHECKLISTBOX, self.OnPackagesCheckListClick)
- self.PackagesCheckListBox.Bind(wx.EVT_SET_FOCUS, self.OnPackagesSetFocus)
- self.PackagesCheckListBox.Bind(wx.EVT_KILL_FOCUS, self.OnPackagesKillFocus)
- self.PackagesCheckListBox.SetHelpText(PackagesHelpText)
-
-
- self.SelectAllPlatformsButton = wx.Button(panel, -1, 'Select All')
- self.ClearAllPlatformsButton = wx.Button(panel, -1, 'Clear All')
- self.SelectAllPlatformsButton.Bind(wx.EVT_BUTTON, self.OnSelectAllPlatformsClick)
- self.ClearAllPlatformsButton.Bind (wx.EVT_BUTTON, self.OnClearAllPlatformsClick)
-
- self.PlatformsCheckListBox = wx.CheckListBox(panel, -1)
- self.PlatformsCheckListBox.Bind(wx.EVT_CHECKLISTBOX, self.OnPlatformsCheckListClick)
- self.PlatformsCheckListBox.Bind(wx.EVT_SET_FOCUS, self.OnPlatformsSetFocus)
- self.PlatformsCheckListBox.Bind(wx.EVT_KILL_FOCUS, self.OnPlatformsKillFocus)
- self.PlatformsCheckListBox.SetHelpText(PlatformsHelpText)
-
- InvalidPackagesLabel = wx.StaticText(panel, -1, 'Invalid Packages')
- InvalidPackagesLabel.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
- InvalidPackagesLabel.SetHelpText(InvalidPackagesHelpText)
-
- InvalidPlatformsLabel = wx.StaticText(panel, -1, 'Invalid Platforms')
- InvalidPlatformsLabel.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
- InvalidPlatformsLabel.SetHelpText(InvalidPlatformsHelpText)
-
- self.SelectAllInvalidPackagesButton = wx.Button(panel, -1, 'Select All')
- self.ClearAllInvalidPackagesButton = wx.Button(panel, -1, 'Clear All')
- self.SelectAllInvalidPackagesButton.Bind (wx.EVT_BUTTON, self.OnSelectAllInvalidPackagesClick)
- self.ClearAllInvalidPackagesButton.Bind (wx.EVT_BUTTON, self.OnClearAllInvalidPackagesClick)
-
- self.InvalidPackagesCheckListBox = wx.CheckListBox(panel, -1)
- self.InvalidPackagesCheckListBox.Bind(wx.EVT_CHECKLISTBOX, self.OnInvalidPackagesCheckListClick)
- self.InvalidPackagesCheckListBox.Bind(wx.EVT_SET_FOCUS, self.OnInvalidPackagesSetFocus)
- self.InvalidPackagesCheckListBox.Bind(wx.EVT_KILL_FOCUS, self.OnInvalidPackagesKillFocus)
- self.InvalidPackagesCheckListBox.SetHelpText(PackagesHelpText)
-
- self.SelectAllInvalidPlatformsButton = wx.Button(panel, -1, 'Select All')
- self.ClearAllInvalidPlatformsButton = wx.Button(panel, -1, 'Clear All')
- self.SelectAllInvalidPlatformsButton.Bind(wx.EVT_BUTTON, self.OnSelectAllInvalidPlatformsClick)
- self.ClearAllInvalidPlatformsButton.Bind (wx.EVT_BUTTON, self.OnClearAllInvalidPlatformsClick)
-
- self.InvalidPlatformsCheckListBox = wx.CheckListBox(panel, -1)
- self.InvalidPlatformsCheckListBox.Bind(wx.EVT_CHECKLISTBOX, self.OnInvalidPlatformsCheckListClick)
- self.InvalidPlatformsCheckListBox.Bind(wx.EVT_SET_FOCUS, self.OnInvalidPlatformsSetFocus)
- self.InvalidPlatformsCheckListBox.Bind(wx.EVT_KILL_FOCUS, self.OnInvalidPlatformsKillFocus)
- self.InvalidPlatformsCheckListBox.SetHelpText(PlatformsHelpText)
-
- #
- # Define layout using sizers
- #
- self.mainSizer = wx.BoxSizer(wx.VERTICAL)
-
- listSizer = wx.GridBagSizer(hgap=5, vgap=5)
- listSizer.Add(PackagesLabel, pos=(0,0), span=(1,2), flag=wx.ALIGN_CENTER)
- listSizer.Add(PlatformsLabel, pos=(0,2), span=(1,2), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.SelectAllPackagesButton, pos=(1,0), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.ClearAllPackagesButton, pos=(1,1), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.SelectAllPlatformsButton, pos=(1,2), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.ClearAllPlatformsButton, pos=(1,3), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.PackagesCheckListBox, pos=(2,0), span=(1,2), flag=wx.ALL | wx.EXPAND)
- listSizer.Add(self.PlatformsCheckListBox, pos=(2,2), span=(1,2), flag=wx.ALL | wx.EXPAND)
-
- listSizer.Add(InvalidPackagesLabel, pos=(3,0), span=(1,2), flag=wx.ALIGN_CENTER)
- listSizer.Add(InvalidPlatformsLabel, pos=(3,2), span=(1,2), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.SelectAllInvalidPackagesButton, pos=(4,0), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.ClearAllInvalidPackagesButton, pos=(4,1), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.SelectAllInvalidPlatformsButton, pos=(4,2), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.ClearAllInvalidPlatformsButton, pos=(4,3), flag=wx.ALIGN_CENTER)
- listSizer.Add(self.InvalidPackagesCheckListBox, pos=(5,0), span=(1,2), flag=wx.ALL | wx.EXPAND)
- listSizer.Add(self.InvalidPlatformsCheckListBox, pos=(5,2), span=(1,2), flag=wx.ALL | wx.EXPAND)
-
- listSizer.AddGrowableRow(2)
- listSizer.AddGrowableRow(5)
- listSizer.AddGrowableCol(0)
- listSizer.AddGrowableCol(1)
- listSizer.AddGrowableCol(2)
- listSizer.AddGrowableCol(3)
-
- self.mainSizer.Add (listSizer, wx.EXPAND | wx.ALL, wx.EXPAND | wx.ALL, 10)
-
- panel.SetSizer (self.mainSizer)
-
- self.OnViewRefreshClick(self)
-
- def CheckListFocus(self, CheckListBox, Set):
- Index = 0
- while Index < CheckListBox.GetCount():
- CheckListBox.SetSelection(Index, False)
- Index += 1
- if Set and CheckListBox.GetCount() > 0:
- CheckListBox.SetSelection(0, True)
-
- def CheckListClick(self, CheckListBox, Database):
- Index = 0
- Database['EnabledSettings'] = {}
- while Index < CheckListBox.GetCount():
- if CheckListBox.IsChecked(Index):
- for Item in Database['PossibleSettings']:
- if Database['PossibleSettings'][Item] == CheckListBox.GetString(Index):
- Database['EnabledSettings'][Item] = Database['PossibleSettings'][Item]
- Index += 1
-
- def OnPackagesCheckListClick(self, event):
- self.CheckListClick(self.PackagesCheckListBox, self.Model.Database['Package']['Valid'])
-
- def OnPackagesSetFocus(self, event):
- self.CheckListFocus(self.PackagesCheckListBox, True)
-
- def OnPackagesKillFocus(self, event):
- self.CheckListFocus(self.PackagesCheckListBox, False)
-
- def OnPlatformsCheckListClick(self, event):
- self.CheckListClick(self.PlatformsCheckListBox, self.Model.Database['Platform']['Valid'])
-
- def OnPlatformsSetFocus(self, event):
- self.CheckListFocus(self.PlatformsCheckListBox, True)
-
- def OnPlatformsKillFocus(self, event):
- self.CheckListFocus(self.PlatformsCheckListBox, False)
-
- def OnInvalidPackagesCheckListClick(self, event):
- self.CheckListClick(self.InvalidPackagesCheckListBox, self.Model.Database['Package']['Invalid'])
-
- def OnInvalidPackagesSetFocus(self, event):
- self.CheckListFocus(self.InvalidPackagesCheckListBox, True)
-
- def OnInvalidPackagesKillFocus(self, event):
- self.CheckListFocus(self.InvalidPackagesCheckListBox, False)
-
- def OnInvalidPlatformsCheckListClick(self, event):
- self.CheckListClick(self.InvalidPlatformsCheckListBox, self.Model.Database['Platform']['Invalid'])
-
- def OnInvalidPlatformsSetFocus(self, event):
- self.CheckListFocus(self.InvalidPlatformsCheckListBox, True)
-
- def OnInvalidPlatformsKillFocus(self, event):
- self.CheckListFocus(self.InvalidPlatformsCheckListBox, False)
-
- def OnRevertClick(self, event):
- self.Model.RevertModel()
- self.StatusBar.SetFocus()
- self.OnRefreshClick(self)
-
- def RefreshCheckListBox(self, CheckListBox, SelectAllButton, ClearAllButton, Database):
- NameList = []
- for Item in Database['PossibleSettings']:
- NameList.append(Database['PossibleSettings'][Item])
- NameList.sort()
- CheckListBox.Set(NameList)
- Index = 0
- MaximumString = '.'
- while Index < CheckListBox.GetCount():
- String = CheckListBox.GetString(Index)
- if len(String) > len(MaximumString):
- MaximumString = String
- Enabled = False
- for Item in Database['EnabledSettings']:
- if String == Database['EnabledSettings'][Item]:
- Enabled = True
- if Enabled:
- CheckListBox.Check(Index, True)
- else:
- CheckListBox.Check(Index, False)
- Index += 1
- Extents = CheckListBox.GetFullTextExtent (MaximumString)
- CheckListBox.SetMinSize((Extents[0] + 30,(CheckListBox.GetCount()+2) * (Extents[1]+Extents[2])))
- if NameList == []:
- CheckListBox.Disable()
- SelectAllButton.Disable()
- ClearAllButton.Disable()
- else:
- CheckListBox.Enable()
- SelectAllButton.Enable()
- ClearAllButton.Enable()
-
- def OnRefreshClick(self, event):
- self.Model.RefreshModel()
- self.RefreshCheckListBox (self.PackagesCheckListBox, self.SelectAllPackagesButton, self.ClearAllPackagesButton, self.Model.Database['Package']['Valid'])
- self.RefreshCheckListBox (self.PlatformsCheckListBox, self.SelectAllPlatformsButton, self.ClearAllPlatformsButton, self.Model.Database['Platform']['Valid'])
- self.RefreshCheckListBox (self.InvalidPackagesCheckListBox, self.SelectAllInvalidPackagesButton, self.ClearAllInvalidPackagesButton, self.Model.Database['Package']['Invalid'])
- self.RefreshCheckListBox (self.InvalidPlatformsCheckListBox, self.SelectAllInvalidPlatformsButton, self.ClearAllInvalidPlatformsButton, self.Model.Database['Platform']['Invalid'])
- self.mainSizer.SetSizeHints(self)
- self.mainSizer.Fit(self)
- self.Update()
-
- def OnViewRefreshClick(self, event):
- self.Model.RescanModel()
- self.StatusBar.SetFocus()
- self.OnRefreshClick(self)
-
- def AddTool (self, Handler, ArtId, Label, HelpText):
- Tool = self.ToolBar.AddSimpleTool(
- -1,
- wx.ArtProvider.GetBitmap(ArtId, wx.ART_TOOLBAR, self.ToolSize),
- Label,
- HelpText
- )
- self.Bind(wx.EVT_MENU, Handler, Tool)
-
- def OnShowToolBarClick(self, event):
- if self.ShowToolBar:
- self.ShowToolBar = False
- self.ToolBar.Destroy()
- else:
- self.ShowToolBar = True
- self.ToolBar = self.CreateToolBar()
- self.ToolSize = (24,24)
- self.ToolBar.SetToolBitmapSize(self.ToolSize)
- self.AddTool (self.OnNewClick, wx.ART_NEW, "New", "New FrameworkDatabase.db")
- self.AddTool (self.OnScanAndSyncClick, wx.ART_HARDDISK, "Scan WORKSPACE and Sync", "Scan WORKSPACE for new Packages and Platforms and sync FrameworkDatabase.db")
- self.AddTool (self.OnSaveClick, wx.ART_FILE_SAVE, "Save", "Save FrameworkDatabase.db")
- self.AddTool (self.OnSaveAsClick, wx.ART_FILE_SAVE_AS, "Save As...", "Save FrameworkDatabase.db as...")
- self.AddTool (self.OnRevertClick, wx.ART_UNDO, "Revert", "Revert to original FrameworkDatabase.db")
- self.AddTool (self.OnHelpClick, wx.ART_HELP, "Help", "Context Sensitive Help")
- self.AddTool (self.OnExitClick, wx.ART_QUIT, "Exit", "Exit EDK II Build System Framework Database Utility")
- self.ToolBar.Realize()
-
- def OnNewClick(self, event):
- self.Model.NewModel()
- self.OnRefreshClick(self)
-
- def ScanDirectory(self, Data, DirName, FilesInDir):
- WorkspaceDirName = self.Model.WorkspaceRelativePath(DirName)
- self.StatusBar.SetStatusText('Scanning: ' + WorkspaceDirName)
- RemoveList = []
- for File in FilesInDir:
- if File[0] == '.':
- RemoveList.insert(0, File)
- for File in RemoveList:
- FilesInDir.remove(File)
- for File in FilesInDir:
- if os.path.splitext(File)[1].lower() == '.spd':
- self.Model.AddFile (WorkspaceDirName, File, 'Package', False)
- self.OnRefreshClick(self)
- if os.path.splitext(File)[1].lower() == '.fpd':
- self.Model.AddFile (WorkspaceDirName, File, 'Platform', False)
- self.OnRefreshClick(self)
-
- def OnScanClick(self, event):
- os.path.walk(self.Model.WorkspaceFile(''), self.ScanDirectory, None)
- self.StatusBar.SetStatusText('Scanning: Complete')
- self.StatusBar.SetFocus()
- self.OnRefreshClick(self)
-
- def OnScanAndSyncClick(self, event):
- self.OnSelectAllPackagesClick(self)
- self.OnSelectAllPlatformsClick(self)
- self.OnClearAllInvalidPackagesClick(self)
- self.OnClearAllInvalidPlatformsClick(self)
- self.OnScanClick(self)
- self.OnSelectAllPackagesClick(self)
- self.OnSelectAllPlatformsClick(self)
- self.OnClearAllInvalidPackagesClick(self)
- self.OnClearAllInvalidPlatformsClick(self)
-
- def OnSelectAllPackagesClick(self, event):
- self.Model.Database['Package']['Valid']['EnabledSettings'] = self.Model.Database['Package']['Valid']['PossibleSettings']
- self.OnRefreshClick(self)
-
- def OnClearAllPackagesClick(self, event):
- self.Model.Database['Package']['Valid']['EnabledSettings'] = {}
- self.OnRefreshClick(self)
-
- def OnSelectAllPlatformsClick(self, event):
- self.Model.Database['Platform']['Valid']['EnabledSettings'] = self.Model.Database['Platform']['Valid']['PossibleSettings']
- self.OnRefreshClick(self)
-
- def OnClearAllPlatformsClick(self, event):
- self.Model.Database['Platform']['Valid']['EnabledSettings'] = {}
- self.OnRefreshClick(self)
-
- def OnSelectAllInvalidPackagesClick(self, event):
- self.Model.Database['Package']['Invalid']['EnabledSettings'] = self.Model.Database['Package']['Invalid']['PossibleSettings']
- self.OnRefreshClick(self)
-
- def OnClearAllInvalidPackagesClick(self, event):
- self.Model.Database['Package']['Invalid']['EnabledSettings'] = {}
- self.OnRefreshClick(self)
-
- def OnSelectAllInvalidPlatformsClick(self, event):
- self.Model.Database['Platform']['Invalid']['EnabledSettings'] = self.Model.Database['Platform']['Invalid']['PossibleSettings']
- self.OnRefreshClick(self)
-
- def OnClearAllInvalidPlatformsClick(self, event):
- self.Model.Database['Platform']['Invalid']['EnabledSettings'] = {}
- self.OnRefreshClick(self)
-
- def OnSaveClick(self, event):
- self.Model.SaveModel()
-
- def OnSaveAsClick(self, event):
- wildcard = "Text Documents (*.db)|*.db|" \
- "All files (*.*)|*.*"
- dialog = wx.FileDialog (None, 'Save As', self.Model.WorkspaceFile('Tools/Conf'), '', wildcard, wx.SAVE | wx.OVERWRITE_PROMPT)
- if dialog.ShowModal() == wx.ID_OK:
- FrameworkDatabaseDbFile = self.Model.WorkspaceRelativePath(dialog.GetPath())
- if FrameworkDatabaseDbFile != '':
- self.Model.SaveModel(FrameworkDatabaseDbFile)
- dialog.Destroy()
-
- def OnExitClick(self, event):
- if self.Model.ModelModified():
- dialog = wx.MessageDialog(None, 'The contents have changed.\nDo you want to save changes?', 'EDK II Build System Framework Databsase Utility', style = wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_EXCLAMATION)
- Status = dialog.ShowModal()
- dialog.Destroy()
- if Status == wx.ID_YES:
- self.OnSaveClick (self)
- elif Status == wx.ID_CANCEL:
- return
- self.Model.CloseModel()
- self.Close()
-
- def OnHelpClick(self, event):
- wx.ContextHelp().BeginContextHelp()
-
- def OnAboutClick(self, event):
- AboutInfo = wx.AboutDialogInfo()
- AboutInfo.Name = 'EDK II Build System Framework Database Utility'
- AboutInfo.Version = '0.3'
- AboutInfo.Copyright = 'Copyright (c) 2006, Intel Corporation'
- AboutInfo.Description = """
- The EDK II Build System Framework Database Utility maintains FrameworkDatabase.db
- settings in an EDK II Workspace."""
- AboutInfo.WebSite = ("http://tianocore.org", "Tiano Core home page")
- AboutInfo.License = """
- 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."""
- if self.Model.Icon != None:
- AboutInfo.Icon = self.Model.Icon
- wx.AboutBox(AboutInfo)
-
-if __name__ == '__main__':
- app = wx.PySimpleApp()
- frame = Frame()
- frame.Show()
- app.MainLoop()
-
diff --git a/Tools/Python/GenMake.py b/Tools/Python/GenMake.py
deleted file mode 100755
index 171a6d79bd..0000000000
--- a/Tools/Python/GenMake.py
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/usr/bin/env python
-
-"""Create GNU Makefiles for the Libraries of the MdePkg."""
-
-import os, sys, getopt, string, xml.dom.minidom, shutil
-from XmlRoutines import *
-from WorkspaceRoutines import *
-
-Makefile = string.Template("""ARCH = $ARCH
-
-MAKEROOT ?= ../..
-
-VPATH = ..
-
-$IDENTIFIER
-
-OBJECTS = $OBJECTS
-
-include $$(MAKEROOT)/lib.makefile
-""")
-
-def openSpd(spdFile):
-
- """Open the spdFile and process the msa files it contains."""
-
- db = xml.dom.minidom.parse(inWorkspace(spdFile))
-
- for arch in ["IA32", "X64"]:
- for msaFile in XmlList(db, "/PackageSurfaceArea/MsaFiles/Filename"):
- msaFileName = XmlElementData(msaFile)
- doLib(msaFileName, arch)
-
- # Copy the Include tree for the Package
- packageDir = os.path.dirname(spdFile)
- mkdir(packageDir)
- if not os.path.exists(os.path.join(packageDir, "Include")):
- print "Exporting the include dir..."
- os.system("svn export %s %s" %
- (inWorkspace(os.path.join(packageDir, "Include")),
- os.path.join(packageDir, "Include")))
- else:
- print "Error: The directory '%s' is in the way. Please move it." % os.path.join(packageDir, "Include")
- sys.exit()
-
-def inMde(f):
- """Make a path relative to the Mde Pkg root dir."""
- return inWorkspace(os.path.join("MdePkg", f))
-
-def doLib(msafile, arch):
-
- """Create a directory with the sources, AutoGen.h and a makefile."""
-
- objects = []
-
- msa = xml.dom.minidom.parse(inMde(msafile))
- modName = str(XmlElement(msa, "/ModuleSurfaceArea/MsaHeader/ModuleName"))
- base, _ = os.path.splitext(msafile)
- msabase = os.path.basename(base)
-
- suppArch = str(XmlElement(msa, "/ModuleSurfaceArea/ModuleDefinitions/SupportedArchitectures"))
- if not arch in string.split(suppArch, " "):
- return
-
- # What kind of module is this?
-
- # Assume it is a driver.
- identifier = "DRIVERNAME = %s" % modName
-
- # Let's see if it claims to produce a library class.
- for libClass in XmlList(msa, "/ModuleSurfaceArea/LibraryClassDefinitions/LibraryClass"):
- if libClass.getAttribute("Usage") == "ALWAYS_PRODUCED":
- # It's a library.
- identifier = "LIBNAME = %s" % modName
-
- mkdir(modName)
-
- buildDir = os.path.join(modName, "build-%s" % arch )
- mkdir(buildDir)
-
- for sourceFile in XmlList(msa, "/ModuleSurfaceArea/SourceFiles/Filename"):
-
- sourceFileName = str(XmlElementData(sourceFile))
- suppArchs = sourceFile.getAttribute("SupArchList").split(" ")
- toolchain = sourceFile.getAttribute("ToolChainFamily")
- base, ext = os.path.splitext(sourceFileName)
-
- if (suppArchs == [""] or arch in suppArchs) and toolchain in ["", "GCC"] and ext in [".c", ".h", ".S"]:
- if ext in [".c", ".S"]:
- obj = str(base+".o")
- if obj in objects:
- print "Error: The msa file %s is ambiguous. There are mutliple sources that can produce the object file %s. Please fix it." % (msafile, obj)
- sys.exit()
- else:
- objects.append(obj)
- sourceDir = os.path.join(modName, os.path.dirname(sourceFileName))
- mkdir(sourceDir)
- mkdir(os.path.join(buildDir, os.path.dirname(sourceFileName)))
- shutil.copy(inMde(os.path.join(os.path.dirname(msafile), sourceFileName)),
- sourceDir)
-
- # Write a Makefile for this module
- f = open(os.path.join(buildDir, "Makefile"), "w")
- f.write(Makefile.substitute(ARCH=arch, IDENTIFIER=identifier, OBJECTS=string.join(objects, " ")))
- f.close()
-
- # Right now we are getting the AutoGen.h file from a previous build. We
- # could create it from scratch also.
- shutil.copy(inWorkspace("Build/Mde/DEBUG_UNIXGCC/%s/MdePkg/Library/%s/%s/DEBUG/AutoGen.h") % (arch, modName, msabase), buildDir)
-
-# This acts like the main() function for the script, unless it is 'import'ed
-# into another script.
-if __name__ == '__main__':
-
- openSpd("MdePkg/MdePkg.spd")
diff --git a/Tools/Python/InstallFar.py b/Tools/Python/InstallFar.py
deleted file mode 100755
index 7bc03aa0ca..0000000000
--- a/Tools/Python/InstallFar.py
+++ /dev/null
@@ -1,328 +0,0 @@
-#!/usr/bin/env python
-
-"""This is a python script that takes user input from the command line and
-installs a far (Framework Archive Manifest) file into the workspace."""
-
-import os, sys, getopt, string, xml.dom.minidom, zipfile, md5
-from XmlRoutines import *
-from WorkspaceRoutines import *
-
-class Flags:
- """Keep track of some command line flags and operating modes."""
- def __init__(self):
- self.verbose = False
- self.force = False
- self.reinstall = False
- self.dir = ''
-
-class Database:
-
- """This class encapsulates the FrameworkDatabase file for the workspace we
- are operating on."""
-
- def __init__(self, filename="Tools/Conf/FrameworkDatabase.db"):
-
- # First try to get a lock file.
- self.DBFile = inWorkspace(filename)
- self.lockfile = inWorkspace("Tools/Conf/FrameworkDatabase.lock")
- if os.path.exists(self.lockfile):
- self.itsMyLockFile = False
- print "Error: The database file is locked by ", self.lockfile
- raise OSError("The Database is locked.")
- else:
- self.lock = open(self.lockfile, 'w')
- self.lock.write("pid "+str(os.getpid()))
- self.itsMyLockFile = True
-
- self.dom = XmlParseFile(inWorkspace(filename))
-
- self.installedPackages = {}
- self.installedPlatforms = {}
- self.installedFars = {}
-
- for spdfile in XmlList(self.dom, "/FrameworkDatabase/PackageList/Filename"):
- filename = str(XmlElementData(spdfile))
- spd = XmlParseFileSection(inWorkspace(filename), "SpdHeader")
- self.installedPackages[GetSpdGuidVersion(spd, 1)] = \
- XmlElement(spd, "/SpdHeader/PackageName")
-
- for fpdfile in XmlList(self.dom, "/FrameworkDatabase/PlatformList/Filename"):
- filename = str(XmlElementData(fpdfile))
- fpd = XmlParseFileSection(inWorkspace(filename), "PlatformHeader")
- self.installedPlatforms[GetFpdGuidVersion(fpd, 1)] = \
- XmlElement(fpd, "/PlatformHeader/PlatformName")
-
- for farfile in XmlList(self.dom, "/FrameworkDatabase/FarList/Filename"):
- farGuid = Guid(farfile.getAttribute("FarGuid"))
- self.installedFars[farGuid] = XmlElementData(farfile)
-
- self.packageList = XmlNode(self.dom, "/FrameworkDatabase/PackageList")
- self.platformList = XmlNode(self.dom, "/FrameworkDatabase/PlatformList")
- self.farList = XmlNode(self.dom, "/FrameworkDatabase/FarList")
-
- def __del__(self):
- if self.itsMyLockFile:
- self.lock.close()
- os.unlink(self.lockfile)
-
- def HasPackage(self, (guid, version)):
- """Return true iff this package is already installed."""
- if version == "":
- # Look for the guid.
- for (g, v) in self.installedPackages.keys():
- if g == guid:
- return True
- return self.installedPackages.has_key((guid, version))
-
- def HasPlatform(self, (guid, version)):
- """Return true iff this platform is already installed."""
- if version == "":
- # Look for the guid.
- for (g, v) in self.installedPlatforms.keys():
- if g == guid:
- return True
- return self.installedPlatforms.has_key((guid, version))
-
- def HasFar(self, farguid):
- """Return true iff this far is already installed."""
- return self.installedFars.has_key(farguid)
-
- def AddPackage(self, f):
- """Put this package in the database"""
- XmlAppendChildElement(self.packageList, "Filename", f)
-
- def AddPlatform(self, f):
- """Put this platform in the database"""
- XmlAppendChildElement(self.platformList, "Filename", f)
-
- def AddFar(self, f, guid=""):
- """Put this far in the database"""
- XmlAppendChildElement(self.farList, "Filename", f, {"FarGuid":guid} )
-
- def Write(self):
- """Save the Xml tree out to the file."""
- if True:
- XmlSaveFile(self.dom, self.DBFile)
- else:
- f=open(self.DBFile, 'w')
- f.write(self.dom.toprettyxml(2*" "))
- f.close()
-
-def ExtractFile(zip, file, defaultDir="", workspaceLocation="", md5sum=""):
- """Unzip a file."""
- if flags.verbose:
- print "Extracting ", file
-
- destFile = os.path.join(inWorkspace(workspaceLocation), str(file))
- destDir = os.path.dirname(destFile)
-
- mkdir(destDir)
-
- f = open(destFile, "w")
- contents = zip.read(os.path.join(defaultDir,file))
- if md5sum and (md5.md5(contents).hexdigest() != md5sum):
- print "Error: The md5 sum does not match on file %s." % file
- f.write(contents)
- f.close()
-
-def GetFpdGuidVersion(Dom, strip=0):
-
- """Get the Guid and version of the fpd from a dom object."""
-
- gpath = ["PlatformSurfaceArea", "PlatformHeader", "GuidValue"]
- vpath = ["PlatformSurfaceArea", "PlatformHeader", "Version"]
-
- return Guid(XmlElement(Dom, "/".join(gpath[strip:]))), \
- XmlElement(Dom, "/".join(vpath[strip:]))
-
-def GetSpdGuidVersion(Dom, strip=0):
-
- """Get the Guid and version of the spd from a dom object."""
-
- gpath = ["PackageSurfaceArea", "SpdHeader", "GuidValue"]
- vpath = ["PackageSurfaceArea", "SpdHeader", "Version"]
-
- return Guid(XmlElement(Dom, "/".join(gpath[strip:]))), \
- XmlElement(Dom, "/".join(vpath[strip:]))
-
-def InstallFar(farfile, workspaceLocation=""):
-
- """Unpack the far an install it in the workspace. We need to adhere to the
- rules of far handling."""
-
- far = zipfile.ZipFile(farfile, "r")
-
- # Use this list to make sure we get everything from the far.
- zipContents = far.namelist()
-
- manifest = xml.dom.minidom.parseString(far.read("FrameworkArchiveManifest.xml"))
- zipContents.remove("FrameworkArchiveManifest.xml")
- fdb = Database()
-
- # First we need to make sure that the far will install cleanly.
-
- installError = False # Let's hope for the best.
- spdDoms = []
- farSpds = []
-
- # Check the packages
- for farPackage in XmlList(manifest, "/FrameworkArchiveManifest/FarPackageList/FarPackage/FarFilename"):
- spdfile = str(XmlElementData(farPackage))
- spd = XmlParseStringSection(far.read(spdfile), "SpdHeader")
- packageGV = GetSpdGuidVersion(spd, 1)
- if fdb.HasPackage(packageGV):
- if not flags.reinstall:
- print "Error: This package is already installed: ", spdfile
- installError = True
-
- # Build up a list of the package guid versions that this far is bringing in.
- # This is needed to satisfy dependencies of msas that are in the other packages of
- # this far.
- farSpds.append(packageGV)
-
- spdDoms.append((spd, spdfile))
-
- for spd, spdfile in spdDoms:
- # Now we need to get a list of every msa in this spd and check the package dependencies.
- for msafile in XmlList(spd, "/PackageSurfaceArea/MsaFiles/Filename"):
- msafilePath = str(os.path.join(os.path.dirname(spdfile), XmlElementData(msafile)))
-
- msa = XmlParseString(far.read(msafilePath))
-
- for package in XmlList(msa, "/ModuleSurfaceArea/PackageDependencies/Package"):
- guid = Guid(package.getAttribute("PackageGuid"))
- version = package.getAttribute("PackageVersion")
-
- # Does anyone provide this package?
- if not fdb.HasPackage((guid, version)) and not (guid, version) in farSpds:
- print ("Error: The module %s depends on the package guid %s version %s, which " + \
- "is not installed in the workspace, nor is it provided by this far.") \
- % (msafilePath, guid, version)
- installError = True
-
- # Check the platforms
- for farPlatform in XmlList(manifest, "/FrameworkArchiveManifest/FarPlatformList/FarPlatform/FarFilename"):
- fpdfile = str(XmlElementData(farPlatform))
- fpd = XmlParseString(far.read(fpdfile))
- if fdb.HasPlatform(GetFpdGuidVersion(fpd, 0)):
- if not flags.reinstall:
- print "Error: This platform is already installed: ", fpdfile
- installError = True
-
- # Now we need to check that all the Platforms (and modules?) that are
- # referenced by this fpd are installed in the workspace or are in this far.
- packagesNeeded = set()
-
- # Go through the dependencies
- for dependency in XmlList(fpd, "/PlatformSurfaceArea/FrameworkModules/ModuleSA") + \
- XmlList(fpd, "/PlatformSurfaceArea/FrameworkModules/ModuleSA/Libraries/Instance"):
- packagesNeeded.add((Guid(dependency.getAttribute("PackageGuid")),
- dependency.getAttribute("PackageVersion")))
-
- # Let's see if all the packages are in the workspace
- for guid, version in packagesNeeded:
- # Does anyone provide this package?
- if not fdb.HasPackage((guid, version)) and not (guid, version) in farSpds:
- print ("Error: The fpd %s depends on the package guid %s version %s, which " + \
- "is not installed in the workspace, nor is it provided by this far.") \
- % (fpdfile, guid, version)
- installError = True
-
- # Check the fars
- thisFarGuid = Guid(XmlElement(manifest, "/FrameworkArchiveManifest/FarHeader/GuidValue"))
- if fdb.HasFar(thisFarGuid):
- if not flags.reinstall:
- print "Error: There is a far with this guid already installed."
- installError = True
-
- # We can not do the install
- if installError:
- if flags.force:
- print "Warning: Ignoring previous errors as you requested."
- else:
- return False
-
- # Install the packages
- for farPackage in XmlList(manifest, "/FrameworkArchiveManifest/FarPackageList/FarPackage"):
-
- filename = XmlElement(farPackage, "FarPackage/FarFilename")
- if not flags.reinstall:
- fdb.AddPackage(filename)
- ExtractFile(far, filename, workspaceLocation)
- zipContents.remove(filename)
-
- DefaultPath = XmlElement(farPackage, "FarPackage/DefaultPath")
-
- for content in XmlList(farPackage, "FarPackage/Contents/FarFilename"):
-
- filename = XmlElementData(content)
- ExtractFile(far, filename, DefaultPath, workspaceLocation, md5sum=content.getAttribute("Md5Sum"))
- zipContents.remove(os.path.join(DefaultPath, filename))
-
- # Install the platforms
- for farPlatform in XmlList(manifest, "/FrameworkArchiveManifest/FarPlatformList/FarPlatform"):
-
- filename = XmlElement(farPlatform, "FarPlatform/FarFilename")
- if not flags.reinstall:
- fdb.AddPlatform(filename)
- ExtractFile(far, filename, "", workspaceLocation)
- zipContents.remove(filename)
-
- # Install the Contents
- for content in XmlList(manifest, "/FrameworkArchiveManifest/Contents/FarFilename"):
-
- filename = XmlElementData(content)
- ExtractFile(far, filename, "", workspaceLocation)
- zipContents.remove(filename)
-
- # What if there are more files in the far?
- if not zipContents == []:
- print "Warning: There are files in the far that were not expected: ", zipContents
-
- if not flags.reinstall:
- fdb.AddFar(farfile, thisFarGuid)
-
- # If everything has gone well, we can put the manifest file in a safe place...
- farDir = inWorkspace("Tools/Conf/InstalledFars/")
- mkdir(farDir)
- f=open(os.path.join(farDir, thisFarGuid), 'w')
- f.write(far.read("FrameworkArchiveManifest.xml"))
- f.close()
-
- # Write out the new database
- if not flags.reinstall:
- fdb.Write()
-
- far.close()
-
-# This acts like the main() function for the script, unless it is 'import'ed
-# into another script.
-if __name__ == '__main__':
-
- flags = Flags()
-
- # Process the command line args.
- optlist, args = getopt.getopt(sys.argv[1:], '?hvfd:', ['directory=', 'help', 'verbose', 'force', 'reinstall'])
-
- # First pass through the options list.
- for o, a in optlist:
- if o in ["-h", "-?", "--help"]:
- print """
-%s: Install a far (Framework Archive) into the current workspace.
-""" % os.path.basename(sys.argv[0])
-
- sys.exit()
- optlist.remove((o,a))
- if o in ["-v", "--verbose"]:
- flags.verbose = True
- if o in ["-d", "--directory"]:
- flags.dir = a
- if o in ["-f", "--force"]:
- flags.force = True
- if o in ["--reinstall"]:
- flags.reinstall = True
-
- for f in args:
- InstallFar(f)
- if args == []:
- print "Please pass a far filename on the command line."
diff --git a/Tools/Python/Install_Python_OSX.sh b/Tools/Python/Install_Python_OSX.sh
deleted file mode 100755
index e584171b1e..0000000000
--- a/Tools/Python/Install_Python_OSX.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-echo "You proxy is currently set to \"$http_proxy\"."
-echo "It needs to set in order to download through a firewall."
-echo "For example: \"export http_proxy=proxy.company.com:911\""
-set -e
-echo "After the download, get ready to enter the root password."
-curl -C - --remote-name http://www.python.org/ftp/python/2.4.4/python-2.4.4-macosx2006-10-18.dmg --progress-bar
-hdiutil attach python-2.4.4-macosx2006-10-18.dmg
-sudo installer -pkg "/Volumes/Univeral MacPython 2.4.4/MacPython.mpkg/" -target /
-sudo ln -fs /usr/local/bin/python2.4 /usr/bin/python
-hdiutil unmount "/Volumes/Univeral MacPython 2.4.4/"
-
-# Get the wxpython installer.
-curl -C - --remote-name http://superb-west.dl.sourceforge.net/sourceforge/wxpython/wxPython2.8-osx-unicode-2.8.0.1-universal10.4-py2.4.dmg --progress-bar
-hdiutil attach wxPython2.8-osx-unicode-2.8.0.1-universal10.4-py2.4.dmg
-sudo installer -pkg /Volumes/wxPython2.8-osx-unicode-2.8.0.1-universal10.4-py2.4/wxPython2.8-osx-unicode-universal10.4-py2.4.pkg -target /
-hdiutil unmount /Volumes/wxPython2.8-osx-unicode-2.8.0.1-universal10.4-py2.4/
diff --git a/Tools/Python/ListWorkspace.py b/Tools/Python/ListWorkspace.py
deleted file mode 100755
index 1a1c9deaef..0000000000
--- a/Tools/Python/ListWorkspace.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-
-"""List the contents of the Framework Database to the screen in a readble
-form."""
-
-import os, sys, getopt, string, xml.dom.minidom, zipfile, md5
-from XmlRoutines import *
-from WorkspaceRoutines import *
-
-def openDatabase(f):
-
- print "Dumping the contents of %s workspace database file." % f
-
- db = xml.dom.minidom.parse(inWorkspace(f))
-
- return db
-
-def showSpds(db):
-
- print "--------\nPackages\n--------"
-
- for spdFile in XmlList(db, "/FrameworkDatabase/PackageList/Filename"):
- spdFileName = XmlElementData(spdFile)
- spd = xml.dom.minidom.parse(inWorkspace(spdFileName))
- spdName = XmlElement(spd, "/PackageSurfaceArea/SpdHeader/PackageName")
-
- print " %-24s %-10s" % (spdName, spdFileName)
-
-def showFpds(db):
-
- print "--------\nPlatforms\n--------"
-
- for fpdFile in XmlList(db, "/FrameworkDatabase/PlatformList/Filename"):
- fpdFileName = XmlElementData(fpdFile)
- fpd = xml.dom.minidom.parse(inWorkspace(fpdFileName))
- fpdName = XmlElement(fpd, "/PlatformSurfaceArea/PlatformHeader/PlatformName")
-
- print " %-24s %-10s" % (fpdName, fpdFileName)
-
-# This acts like the main() function for the script, unless it is 'import'ed
-# into another script.
-if __name__ == '__main__':
-
- db = openDatabase("Tools/Conf/FrameworkDatabase.db")
-
- showSpds(db)
- showFpds(db)
diff --git a/Tools/Python/MkFar.py b/Tools/Python/MkFar.py
deleted file mode 100755
index 2848b1de65..0000000000
--- a/Tools/Python/MkFar.py
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/usr/bin/env python
-
-"""This is a python script that takes user input from the command line and
-creates a far (Framework Archive Manifest) file for distribution."""
-
-import os, sys, getopt, string, xml.dom.minidom, zipfile, md5
-from XmlRoutines import *
-from WorkspaceRoutines import *
-
-class Far:
- """This class is used to collect arbitrarty data from the template file."""
- def __init__(far):
- """Assign the default values for the far fields."""
- far.FileName = "output.far"
- far.FarName=""
- far.Version=""
- far.License=""
- far.Abstract=""
- far.Description=""
- far.Copyright=""
- far.SpdFiles=[]
- far.FpdFiles=[]
- far.ExtraFiles=[]
-
-far = Far()
-"""The far object is constructed from the template file the user passed in."""
-
-def AddToZip(zip, infile):
-
- """Add a file to a zip file, provided it is not already there."""
-
- if not infile in zip.namelist():
- zip.write(inWorkspace(infile), infile)
-
-def parseMsa(msaFile, spdDir):
-
- """Parse an msa file and return a list of all the files that this msa
- includes."""
-
- filelist = [msaFile]
-
- msaDir = os.path.dirname(msaFile)
-
- msa = xml.dom.minidom.parse(inWorkspace(os.path.join(spdDir, msaFile)))
-
- xmlPaths = [
- "/ModuleSurfaceArea/SourceFiles/Filename",
- "/ModuleSurfaceArea/NonProcessedFiles/Filename" ]
-
- for xmlPath in xmlPaths:
- for f in XmlList(msa, xmlPath):
- filelist.append(str(os.path.join(msaDir, XmlElementData(f))))
-
- return filelist
-
-def parseSpd(spdFile):
-
- """Parse an spd file and return a list of all the files that this spd
- includes."""
-
- files = []
-
- spdDir = os.path.dirname(spdFile)
-
- spd = xml.dom.minidom.parse(inWorkspace(spdFile))
-
- # We are currently ignoring these hints.
- readonly = XmlElement(spd, "/PackageSurfaceArea/PackageDefinitions/ReadOnly") != "false"
- repackage = XmlElement(spd, "/PackageSurfaceArea/PackageDefinitions/RePackage") != "false"
-
- xmlPaths = [
- "/PackageSurfaceArea/LibraryClassDeclarations/LibraryClass/IncludeHeader",
- "/PackageSurfaceArea/IndustryStdIncludes/IndustryStdHeader/IncludeHeader" ]
-
- # These are covered by the Industry Standard Includes.
- # "/PackageSurfaceArea/PackageHeaders/IncludePkgHeader"
-
- for xmlPath in xmlPaths:
- for f in XmlList(spd, xmlPath):
- files.append(str(XmlElementData(f)))
-
- for f in XmlList(spd, "/PackageSurfaceArea/MsaFiles/Filename"):
- msaFile = str(XmlElementData(f))
- files += parseMsa(msaFile, spdDir)
-
- cwd = os.getcwd()
- os.chdir(inWorkspace(spdDir))
- for root, dirs, entries in os.walk("Include"):
- # Some files need to be skipped.
- for r in ["CVS", ".svn"]:
- if r in dirs:
- dirs.remove(r)
- for entry in entries:
- files.append(os.path.join(os.path.normpath(root), entry))
- os.chdir(cwd)
-
- return files
-
-def makeFarHeader(doc):
-
- """Create a dom tree for the Far Header. It will use information from the
- template file passed on the command line, if present."""
-
- header = XmlAppendChildElement(doc.documentElement, "FarHeader")
-
- XmlAppendChildElement(header, "FarName", far.FarName)
- XmlAppendChildElement(header, "GuidValue", genguid())
- XmlAppendChildElement(header, "Version", far.Version)
- XmlAppendChildElement(header, "Abstract", far.Abstract)
- XmlAppendChildElement(header, "Description", far.Description)
- XmlAppendChildElement(header, "Copyright", far.Copyright)
- XmlAppendChildElement(header, "License", far.License)
- XmlAppendChildElement(header, "Specification", "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052")
-
- return header
-
-def getSpdGuidVersion(spdFile):
-
- """Returns a tuple (guid, version) which is read from the given spdFile."""
-
- spd = xml.dom.minidom.parse(inWorkspace(spdFile))
-
- return (XmlElement(spd, "/PackageSurfaceArea/SpdHeader/GuidValue"),
- XmlElement(spd, "/PackageSurfaceArea/SpdHeader/Version"))
-
-def makeFar(files, farname):
-
- """Make a far out of the given filelist and writes it to the file farname."""
-
- domImpl = xml.dom.minidom.getDOMImplementation()
- man = domImpl.createDocument(None, "FrameworkArchiveManifest", None)
- top_element = man.documentElement
-
- top_element.appendChild(makeFarHeader(man))
-
- packList = XmlAppendChildElement(top_element, "FarPackageList")
- platList = XmlAppendChildElement(top_element, "FarPlatformList")
- contents = XmlAppendChildElement(top_element, "Contents")
- XmlAppendChildElement(top_element, "UserExtensions")
-
- try:
- zip = zipfile.ZipFile(farname, "w", zipfile.ZIP_DEFLATED)
- except:
- zip = zipfile.ZipFile(farname, "w", zipfile.ZIP_STORED)
- for infile in set(files):
- if not os.path.exists(inWorkspace(infile)):
- print "Error: Non-existent file '%s'." % infile
- sys.exit()
- (_, extension) = os.path.splitext(infile)
- if extension == ".spd":
- filelist = parseSpd(infile)
- spdDir = os.path.dirname(infile)
-
- (spdGuid, spdVersion) = getSpdGuidVersion(infile)
-
- package = XmlAppendChildElement(packList, "FarPackage")
- XmlAppendChildElement(package, "FarFilename", lean(infile), {"Md5Sum": Md5(inWorkspace(infile))})
- AddToZip(zip, infile)
- XmlAppendChildElement(package, "GuidValue", spdGuid)
- XmlAppendChildElement(package, "Version", spdVersion)
- XmlAppendChildElement(package, "DefaultPath", spdDir)
- XmlAppendChildElement(package, "FarPlatformList")
- packContents = XmlAppendChildElement(package, "Contents")
- XmlAppendChildElement(package, "UserExtensions")
-
- for spdfile in filelist:
- XmlAppendChildElement(packContents, "FarFilename", lean(spdfile), {"Md5Sum": Md5(inWorkspace(os.path.join(spdDir, spdfile)))})
- AddToZip(zip, os.path.join(spdDir,spdfile))
-
- elif extension == ".fpd":
-
- platform = XmlAppendChildElement(platList, "FarPlatform")
- XmlAppendChildElement(platform, "FarFilename", lean(infile), {"Md5Sum": Md5(inWorkspace(infile))})
- AddToZip(zip, infile)
-
- else:
- XmlAppendChildElement(contents, "FarFilename", lean(infile), {"Md5Sum": Md5(inWorkspace(infile))})
- AddToZip(zip, infile)
-
- zip.writestr("FrameworkArchiveManifest.xml", man.toxml('UTF-8'))
- zip.close()
- return
-
-# This acts like the main() function for the script, unless it is 'import'ed
-# into another script.
-if __name__ == '__main__':
-
- # Create a pretty printer for dumping data structures in a readable form.
- # pp = pprint.PrettyPrinter(indent=2)
-
- # Process the command line args.
- optlist, args = getopt.getopt(sys.argv[1:], 'ho:t:v', [ 'template=', 'output=', 'far=', 'help', 'debug', 'verbose', 'version'])
-
- # First pass through the options list.
- for o, a in optlist:
- if o in ["-h", "--help"]:
- print """
-Pass a list of .spd and .fpd files to be placed into a far for distribution.
-You may give the name of the far with a -f or --far option. For example:
-
- %s --template far-template --far library.far MdePkg/MdePkg.spd
-
-The file paths of .spd and .fpd are treated as relative to the WORKSPACE
-environment variable which must be set to a valid workspace root directory.
-
-A template file may be passed in with the --template option. This template file
-is a text file that allows more contol over the contents of the far.
-""" % os.path.basename(sys.argv[0])
-
- sys.exit()
- optlist.remove((o,a))
- if o in ["-t", "--template"]:
- # The template file is processed first, so that command line options can
- # override it.
- templateName = a
- execfile(templateName)
- optlist.remove((o,a))
-
- # Second pass through the options list. These can override the first pass.
- for o, a in optlist:
- if o in ["-o", "--far", "--output"]:
- far.FileName = a
-
- # Let's err on the side of caution and not let people blow away data
- # accidentally.
- if os.path.exists(far.FileName):
- print "Error: File %s exists. Not overwriting." % far.FileName
- sys.exit()
-
- makeFar(far.SpdFiles + far.FpdFiles + far.ExtraFiles + args, far.FileName)
diff --git a/Tools/Python/WorkspaceRoutines.py b/Tools/Python/WorkspaceRoutines.py
deleted file mode 100755
index c75cd57c52..0000000000
--- a/Tools/Python/WorkspaceRoutines.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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 os, sys, re, getopt, string, glob, xml.dom.minidom, pprint, md5, socket, getpass, time, random
-
-def inWorkspace(rel_path=""):
- """Treat the given path as relative to the workspace."""
-
- # Make sure the user has set the workspace variable:
- try:
- return os.path.join(os.environ["WORKSPACE"], rel_path )
- except:
- print "Oops! You must set the WORKSPACE environment variable to run this script."
- sys.exit()
-
-def genguid():
- g = md5.md5(
- str(random.random()) +
- getpass.getuser() +
- str(time.time()) +
- socket.gethostbyname(socket.gethostname())).hexdigest()
- return Guid("%s-%s-%s-%s-%s" % (g[0:8], g[8:12], g[12:16], g[16:20], g[20:]))
-
-def lean(path):
- """Lean the slashes forward"""
-
- return os.path.normpath(path).replace("\\", "/")
-
-def mkdir(path):
- """Make a directory if it is not there already."""
-
- try:
- os.makedirs(path)
- except:
- pass
-
-def Md5(filename):
-
- sum = ""
-
- try:
- f=open(filename, "rb")
- sum = md5.md5(f.read()).hexdigest()
- f.close()
- except IOError:
- print "Error: Unable to open file: %s" % filename
- sys.exit()
-
- return sum
-
-def Guid(guidString):
- """Convert the guid string into a canonical form suitable for comparison."""
- return string.lower(guidString)
diff --git a/Tools/Python/XmlRoutines.py b/Tools/Python/XmlRoutines.py
deleted file mode 100755
index 05abb272ad..0000000000
--- a/Tools/Python/XmlRoutines.py
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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.
-
-"""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."""
-
-import xml.dom.minidom
-
-def XmlList(Dom, String):
- """Get a list of XML Elements using XPath style syntax."""
- if String == None or String == "" or Dom == 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
-
-def XmlNode (Dom, String):
- """Return a single node that matches the String which is XPath style syntax."""
- if String == None or String == "" or Dom == 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 ""
-
-def XmlElement (Dom, String):
- """Return a single element that matches the String which is XPath style syntax."""
- try:
- return XmlNode (Dom, String).firstChild.data.strip()
- except:
- return ''
-
-def XmlElementData (Dom):
- """Get the text for this element."""
- if Dom == None or Dom == '' or Dom.firstChild == None:
- return ''
- return Dom.firstChild.data.strip()
-
-def XmlAttribute (Dom, AttName):
- """Return a single attribute named AttName."""
- if Dom == None or Dom == '':
- return ''
- try:
- return Dom.getAttribute(AttName)
- except:
- return ''
-
-def XmlTopTag(Dom):
- """Return the name of the Root or top tag in the XML tree."""
- return Dom.firstChild.nodeName
-
-def XmlParseFile (FileName):
- """Parse an XML file into a DOM and return the DOM."""
- try:
- f = open(FileName, 'r')
- Dom = xml.dom.minidom.parse(f)
- f.close()
- return Dom
- except:
- return xml.dom.minidom.parseString('<empty/>')
-
-def XmlParseString (Str):
- """Parse an XML string into a DOM and return the DOM."""
- try:
- return xml.dom.minidom.parseString(Str)
- except:
- return xml.dom.minidom.parseString('<empty/>')
-
-def XmlParseFileSection (FileName, Tag):
- """Parse a section of an XML file into a DOM(Document Object Model) and return the DOM."""
- try:
- f = open(FileName, 'r')
- except:
- return xml.dom.minidom.parseString('<empty/>')
- Start = '<' + Tag
- End = '</' + Tag + '>'
- File = ''
- while File.find(Start) < 0 or File.find(End) < 0:
- Section = f.read(0x1000)
- if Section == '':
- break
- File += Section
- f.close()
- if File.find(Start) < 0 or File.find(End) < 0:
- return xml.dom.minidom.parseString('<empty/>')
- File = File[File.find(Start):File.find(End)+len(End)]
- try:
- return xml.dom.minidom.parseString(File)
- except:
- return xml.dom.minidom.parseString('<empty/>')
-
-def XmlParseStringSection (XmlString, Tag):
- """Parse a section of an XML string into a DOM(Document Object Model) and return the DOM."""
- Start = '<' + Tag
- End = '</' + Tag + '>'
- File = XmlString
- if File.find(Start) < 0 or File.find(End) < 0:
- return xml.dom.minidom.parseString('<empty/>')
- File = File[File.find(Start):File.find(End)+len(End)]
- try:
- return xml.dom.minidom.parseString(File)
- except:
- return xml.dom.minidom.parseString('<empty/>')
-
-def XmlSaveFile (Dom, FileName, Encoding='UTF-8'):
- """Save a DOM(Document Object Model) into an XML file."""
- try:
- f = open(FileName, 'w')
- f.write(Dom.toxml(Encoding).replace('&quot;','"').replace('&gt;','>'))
- f.close()
- return True
- except:
- return False
-
-def XmlRemoveElement(Node):
- """Remove an element node from DOM(Document Object Model) tree."""
- ParentNode = Node.parentNode
- if ParentNode == None:
- return False
- PreviousSibling = Node.previousSibling
- while PreviousSibling != None and PreviousSibling.nodeType == PreviousSibling.TEXT_NODE and PreviousSibling.data.strip() == '':
- Temp = PreviousSibling
- PreviousSibling = PreviousSibling.previousSibling
- ParentNode.removeChild(Temp)
- ParentNode.removeChild(Node)
- return True
-
-def XmlAppendChildElement(ParentNode, TagName, ElementText='', AttributeDictionary = {}):
- """Add a child element to a DOM(Document Object Model) tree with optional Attributes."""
- TagName = TagName.strip()
- if TagName == '':
- return None
- Depth = 0
- Dom = ParentNode
- while Dom != None and Dom.nodeType != Dom.DOCUMENT_NODE:
- Dom = Dom.parentNode
- Depth += 1
- if Dom == None:
- return None
- ParentNode.appendChild(Dom.createTextNode('\n%*s' % (Depth * 2, '')))
- ElementNode = Dom.createElement(TagName)
- if ElementText != '':
- ElementNode.appendChild(Dom.createTextNode(ElementText))
- for Item in AttributeDictionary:
- ElementNode.setAttribute(Item, AttributeDictionary[Item])
- ParentNode.appendChild(ElementNode)
- return ElementNode
-
-
-# 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.
- pass
diff --git a/Tools/Python/buildgen/AntTasks.py b/Tools/Python/buildgen/AntTasks.py
deleted file mode 100644
index ce694f9b80..0000000000
--- a/Tools/Python/buildgen/AntTasks.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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.
-
-"""Ant Tasks Dom Element"""
-
-import xml.dom.minidom, os
-
-class AntTask:
- def __init__(self, document, _name, _body=None, **_attributes):
- """Instantiate an Ant task element
- document, _name=task name, _body=task body, **_attributes=task attributes
- """
- self.Document = document
- self.Root = ""
-
- if _name == None or _name == "":
- raise Exception("No Ant task name")
-
- taskElement = self.Document.createElement(_name)
- for name in _attributes:
- taskElement.setAttribute(name, _attributes[name])
-
- if _body != None:
- if isinstance(_body, str):
- text = self.Document.createTextNode(_body)
- taskElement.appendChild(text)
- elif isinstance(_body, list):
- for subtask in _body:
- taskElement.appendChild(subtask)
-
- self.Root = taskElement
-
- def SubTask(self, _name, _body=None, **_attributes):
- """Insert a sub-task into this task"""
- newTask = AntTask(self.Document, _name , _body, **_attributes)
- self.Root.appendChild(newTask.Root)
- return newTask
-
- def AddSubTask(self, subTask):
- """Insert a existing sub-task into this task"""
- self.Root.appendChild(subTask.Root.cloneNode(True))
- return subTask
-
- def Comment(self, string):
- """Generate a XML comment"""
- self.Root.appendChild(self.Document.createComment(string))
-
- def Blankline(self):
- """Generate a blank line"""
- self.Root.appendChild(self.Document.createTextNode(""))
-
-
-class AntBuildFile(AntTask):
- _FileComment = "DO NOT EDIT\nThis file is auto-generated by the build utility\n\nAbstract:\nAuto-generated ANT build file for building Framework modules and platforms\n"
-
- def __init__(self, name, basedir=".", default="all"):
- """Instantiate an Ant build.xml
- name=project name, basedir=project default directory, default=default target of this project
- """
- self.Document = xml.dom.minidom.getDOMImplementation().createDocument(None, "project", None)
- self.Root = self.Document.documentElement
-
- self.Document.insertBefore(self.Document.createComment(self._FileComment), self.Root)
- self.Root.setAttribute("name", name)
- self.Root.setAttribute("basedir", basedir)
- self.Root.setAttribute("default", default)
-
- def Create(self, file):
- """Generate the build.xml using given file path"""
- buildFileDir = os.path.dirname(file)
- if not os.path.exists(buildFileDir):
- os.makedirs(buildFileDir)
-
- f = open(file, "w")
- f.write(self.Document.toprettyxml(2*" ", encoding="UTF-8"))
- f.close()
diff --git a/Tools/Python/buildgen/BuildConfig.py b/Tools/Python/buildgen/BuildConfig.py
deleted file mode 100644
index e91bd294a5..0000000000
--- a/Tools/Python/buildgen/BuildConfig.py
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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.
-
-"""Tools and build configuration"""
-
-from sets import Set
-
-class Config(dict):
- def __init__(self, file):
- """file (target configuration file)"""
- configFile = open(file)
- while True:
- line = configFile.readline()
- if line == "": break ## no more line
-
- line = line.strip()
- # skip blank line
- if line == "": continue
- # skip comment line
- if line[0] == '#': continue
- # skip invalid line
- if line[0] == '=':
- print "! invalid configuration:", line
- continue
-
- defStrings = line.split('=', 1)
- name = defStrings[0].strip()
- value = defStrings[1].strip()
- self[name] = value
-
- configFile.close()
-
- def __getitem__(self, attr):
- if attr not in self:
- return ""
-
- value = dict.__getitem__(self, attr)
- if value == None:
- value = ""
- return value
-
-class ToolConfig(dict):
- def __init__(self, file):
- """file (tools configuration file path)"""
- self.Targets = Set()
- self.Toolchains = Set()
- self.Archs = Set()
- self.ToolCodes = Set()
- self.Families = Set()
- self.Attributes = Set(["FAMILY", "NAME", "PATH", "FLAGS", "EXT", "DPATH", "SPATH", "LIBPATH", "INCLUDEPATH"])
-
- configFile = open(file)
- while True:
- line = configFile.readline()
- if line == "": break
-
- line = line.strip()
- # skip blank line
- if line == "": continue
- # skip comment line
- if line[0] == '#': continue
- # skip invalid line
- if line[0] == '=':
- print "! invalid definition:", line
- continue
-
- # split the definition at the first "="
- tool_def = line.split('=', 1)
- name = tool_def[0].strip()
- value = tool_def[1].strip()
-
- # the name of a tool definition must have five parts concatenated by "_"
- keys = name.split('_')
- # skip non-definition line
- if len(keys) < 5: continue
-
- keys = (keys[1], keys[0], keys[2], keys[3], keys[4])
- self[keys] = value
-
- ###############################################
- ## statistics
- ###############################################
- if keys[0] != '*': self.Toolchains.add(keys[0])
- if keys[1] != '*': self.Targets.add(keys[1])
- if keys[2] != '*': self.Archs.add(keys[2])
- if keys[3] != '*': self.ToolCodes.add(keys[3])
- if keys[4] == "FAMILY": self.Families.add(value)
- elif keys[4] == '*': raise Exception("No * allowed in ATTRIBUTE field")
-
- configFile.close()
- # expand the "*" in each field
- self.expand()
-
- def __getitem__(self, attrs):
- if len(attrs) != 5:
- return ""
-
- if attrs not in self:
- return ""
-
- value = dict.__getitem__(self, attrs)
- if value == None:
- value = ""
- return value
-
- def expand(self):
- summary = {}
- toolchains = []
- targets = []
- archs = []
- toolcodes = []
- for key in self:
- value = self[key]
- if key[0] == '*':
- toolchains = self.Toolchains
- else:
- toolchains = [key[0]]
-
- for toolchain in toolchains:
- if key[1] == '*':
- targets = self.Targets
- else:
- targets = [key[1]]
-
- for target in targets:
- if key[2] == '*':
- archs = self.Archs
- else:
- archs = [key[2]]
-
- for arch in archs:
- if key[3] == '*':
- toolcodes = self.ToolCodes
- else:
- toolcodes = [key[3]]
-
- for toolcode in toolcodes:
- attribute = key[4]
- summary[(toolchain, target, arch, toolcode, attribute)] = value
- self.clear()
- for toolchain in self.Toolchains:
- for target in self.Targets:
- for arch in self.Archs:
- for toolcode in self.ToolCodes:
- key = (toolchain, target, arch, toolcode, "NAME")
- if key not in summary: continue
- for attr in self.Attributes:
- key = (toolchain, target, arch, toolcode, attr)
- if key not in summary: continue
- self[key] = summary[key]
-
-
- def __str__(self):
- s = ""
- for entry in self:
- s += entry[0] + "_" + entry[1] + "_" + entry[2] + "_" + entry[3] + "_" + entry[4]
- s += " = " + self[entry] + "\n"
- return s
-
-class TargetConfig(Config):
- pass
-
-## for test
-if __name__ == "__main__":
- import os
- if "WORKSPACE" not in os.environ:
- raise "No WORKSPACE given"
- cfg = ToolConfig(os.path.join(os.environ["WORKSPACE"], "Tools", "Conf", "tools_def.txt"))
- tgt = TargetConfig(os.path.join(os.environ["WORKSPACE"], "Tools", "Conf", "target.txt"))
-
- for key in cfg:
- print key,"=",cfg[key]
-
- print
- for name in tgt:
- print name,"=",tgt[name]
- \ No newline at end of file
diff --git a/Tools/Python/buildgen/BuildFile.py b/Tools/Python/buildgen/BuildFile.py
deleted file mode 100644
index 9a2aae30b2..0000000000
--- a/Tools/Python/buildgen/BuildFile.py
+++ /dev/null
@@ -1,582 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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.
-
-"""Generate build file for given platform"""
-
-import os, sys, copy
-import xml.dom.minidom, pprint
-import FrameworkElement
-
-from SurfaceAreaElement import *
-from XmlRoutines import *
-from AntTasks import *
-from sets import Set
-
-class BuildFile:
- def __init__(self, workspace, platform, toolchain, target):
- if workspace == None or workspace == "":
- raise Exception("No workspace, no build")
- if platform == None or platform == "":
- raise Exception("No platform, no build")
- if toolchain == None or toolchain == "":
- raise Exception("No toolchain, no build")
- if target == None or target == "":
- raise Exception("No target, no build")
-
- self.Workspace = workspace
- self.Platform = platform
- self.Toolchain = toolchain
- self.Target = target
- self.Path = ""
-
- def Generate(self):
- """Generate the build file"""
- pass
-
-# generating build.xml for platform
-class AntPlatformBuildFile(BuildFile):
- def __init__(self, workspace, platform, toolchain, target):
- BuildFile.__init__(self, workspace, platform, toolchain, target)
- # Form the build file path, hard-coded at present. It should be specified by a configuration file
- self.Path = os.path.join(self.Workspace.Path, self.Platform.OutputPath, target + "_" + toolchain, "build.xml")
- print ""
- # Generate a common build option property file in the format of Java's property file
- self.DefaultBuildOptions()
-
- # new a build file object
- self.BuildXml = AntBuildFile(name="platform", basedir=".", default="all")
-
- # generate the top level properties, tasks, etc.
- self.Header()
-
- # generate "prebuild" target
- self.PreBuild()
-
- # generate "libraries" target for building library modules
- self.Libraries()
-
- # generate "modules" target for building non-library modules
- self.Modules()
-
- # generate "fvs" target for building firmware volume. (not supported yet)
-
- # generate "fds" target for building FlashDevice. (not supported yet)
-
- # generate "postbuild" target
- self.PostBuild()
-
- def Generate(self):
- print "Generating platform build file ...", self.Path
- self.BuildXml.Create(self.Path)
-
- def Header(self):
- _topLevel = self.BuildXml
- # import external tasks
- _topLevel.SubTask("taskdef", resource="GenBuild.tasks")
- _topLevel.SubTask("taskdef", resource="frameworktasks.tasks")
- _topLevel.SubTask("taskdef", resource="net/sf/antcontrib/antlib.xml")
-
- # platform wide properties
- _topLevel.Blankline()
- _topLevel.Comment("WORKSPACE wide attributes")
- _topLevel.SubTask("property", environment="env")
- _topLevel.SubTask("property", name="WORKSPACE_DIR", value="${env.WORKSPACE}")
- _topLevel.SubTask("property", name="CONFIG_DIR", value="${WORKSPACE_DIR}/Tools/Conf")
-
- _topLevel.Blankline()
- _topLevel.Comment("Common build attributes")
- _topLevel.SubTask("property", name="THREAD_COUNT", value=self.Workspace.ThreadCount)
- _topLevel.SubTask("property", name="SINGLE_MODULE_BUILD", value="no")
- _topLevel.SubTask("property", name="MODULE_BUILD_TARGET", value="platform_module_build")
-
- _topLevel.Blankline()
- _topLevel.SubTask("property", name="TOOLCHAIN", value=self.Toolchain)
- _topLevel.SubTask("property", name="TARGET", value=self.Target)
-
- _topLevel.Blankline()
- _topLevel.Comment("Platform attributes")
- _topLevel.SubTask("property", name="PLATFORM", value=self.Platform.Name)
- _topLevel.SubTask("property", name="PLATFORM_GUID", value=self.Platform.GuidValue)
- _topLevel.SubTask("property", name="PLATFORM_VERSION", value=self.Platform.Version)
- _topLevel.SubTask("property", name="PLATFORM_RELATIVE_DIR", value=self.Platform.Dir)
- _topLevel.SubTask("property", name="PLATFORM_DIR", value="${WORKSPACE_DIR}/${PLATFORM_RELATIVE_DIR}")
- _topLevel.SubTask("property", name="PLATFORM_OUTPUT_DIR", value=self.Platform.OutputPath)
-
- # user configurable build path for platform
- _topLevel.Blankline()
- _topLevel.Comment("Common path definition for platform build")
- _topLevel.SubTask("property", file="${WORKSPACE_DIR}/Tools/Python/buildgen/platform_build_path.txt")
-
- # common build tasks in the form of Ant macro
- _topLevel.Blankline()
- _topLevel.Comment("Task Macros for Compiling, Assembling, Linking, etc.")
- _topLevel.SubTask("import", file="${CONFIG_DIR}/BuildMacro.xml")
- _topLevel.Blankline()
- _topLevel.SubTask("echo", message="${PLATFORM}-${PLATFORM_VERSION} (${PLATFORM_RELATIVE_DIR})", level="info")
-
- # define the targets execution sequence
- _topLevel.Blankline()
- _topLevel.Comment("Default target")
- _topLevel.SubTask("target", name="all", depends="prebuild, libraries, modules, postbuild")
-
- def PreBuild(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: prebuild ")
-
- # prebuild is defined by user in the fpd file through <UserExtionsion> element,
- # which has attribute "identifier=0" or "identifier=prebuild"
- prebuildTasks = []
- if self.Platform.UserExtensions.has_key("0"):
- prebuildTasks = self.Platform.UserExtensions["0"]
- elif self.Platform.UserExtensions.has_key("postbuild"):
- prebuildTasks = self.Platform.UserExtensions["prebuild"]
-
- _topLevel.SubTask("target", prebuildTasks, name="prebuild")
-
- def Libraries(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: libraries ")
-
- librariesTarget = _topLevel.SubTask("target", name="libraries")
- parallelBuild = librariesTarget.SubTask("parallel", threadCount="${THREAD_COUNT}")
-
- libraryNumber = 0
- for arch in self.Platform.Libraries:
- libraryNumber += len(self.Platform.Libraries[arch])
- libraryIndex = 0
- for arch in self.Platform.Libraries:
- for lib in self.Platform.Libraries[arch]:
- libraryIndex += 1
- print "Generating library build files ... %d%%\r" % int((float(libraryIndex) / float(libraryNumber)) * 100),
- buildFile = AntModuleBuildFile(self.Workspace, self.Platform, lib, self.Toolchain, self.Target, arch)
- buildFile.Generate()
- buildDir = os.path.join("${TARGET_DIR}", arch, lib.Module.Package.SubPath(lib.Module.Dir),
- lib.Module.FileBaseName)
- parallelBuild.SubTask("ant", dir=buildDir,
- #antfile="build.xml",
- inheritAll="true",
- target="${MODULE_BUILD_TARGET}")
- print ""
-
- def Modules(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: modules ")
-
- modulesTarget = _topLevel.SubTask("target", name="modules")
- parallelBuild = modulesTarget.SubTask("parallel", threadCount="${THREAD_COUNT}")
-
- moduleNumber = 0
- for arch in self.Platform.Modules:
- moduleNumber += len(self.Platform.Modules[arch])
-
- moduleIndex = 0
- for arch in self.Platform.Modules:
- for module in self.Platform.Modules[arch]:
- moduleIndex += 1
- print "Generating module build files ... %d%%\r" % int((float(moduleIndex) / float(moduleNumber)) * 100),
-
- buildDir = os.path.join("${TARGET_DIR}", arch, module.Module.Package.SubPath(module.Module.Dir),
- module.Module.FileBaseName)
- parallelBuild.SubTask("ant", dir=buildDir,
- #antfile="build.xml",
- inheritAll="true",
- target="${MODULE_BUILD_TARGET}")
- buildFile = AntModuleBuildFile(self.Workspace, self.Platform, module, self.Toolchain, self.Target, arch)
- buildFile.Generate()
- print ""
-
- def Fvs(self):
- pass
-
- def Fds(self):
- pass
-
- def PostBuild(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: postbuild ")
-
- # postbuild is defined by user in the fpd file through <UserExtionsion> element,
- # which has attribute "identifier=1" or "identifier=postbuild"
- postbuildTasks = []
- if self.Platform.UserExtensions.has_key("1"):
- postbuildTasks = self.Platform.UserExtensions["1"]
- elif self.Platform.UserExtensions.has_key("postbuild"):
- postbuildTasks = self.Platform.UserExtensions["postbuild"]
-
- _topLevel.SubTask("target", postbuildTasks, name="postbuild")
-
- def Clean(self):
- pass
-
- def CleanAll(self):
- pass
-
- def UserExtensions(self):
- pass
-
- def DefaultBuildOptions(self):
- """Generate ${ARCH}_build.opt which contains the default build&tool definitions"""
- tools = self.Workspace.ToolConfig.ToolCodes
- for arch in self.Workspace.ActiveArchs:
- validTools = []
- for tool in tools:
- key = (self.Toolchain, self.Target, arch, tool, "NAME")
- if self.Workspace.ToolConfig[key] == "": continue
- validTools.append(tool)
-
- optFileDir = os.path.join(self.Workspace.Path, self.Platform.OutputPath,
- self.Target + "_" + self.Toolchain)
- optFileName = arch + "_build.opt"
- if not os.path.exists(optFileDir): os.makedirs(optFileDir)
- f = open(os.path.join(optFileDir, optFileName), "w")
-
- for tool in validTools:
- key = (self.Toolchain, self.Target, arch, tool, "FLAGS")
- if key in self.Platform.BuildOptions:
- flag = self.Platform.BuildOptions[key]
- else:
- key = (self.Toolchain, self.Target, arch, tool, "FAMILY")
- family = self.Workspace.ToolConfig[key]
- key = (family, self.Target, arch, tool, "FLAGS")
- if key in self.Platform.BuildOptions:
- flag = self.Platform.BuildOptions[key]
- else:
- flag = ""
- f.write("PLATFORM_%s_FLAGS=%s\n" % (tool, flag))
- f.write("\n")
-
- for tool in validTools:
- key = (self.Toolchain, self.Target, arch, tool, "FLAGS")
- flag = self.Workspace.ToolConfig[key]
- f.write("DEFAULT_%s_FLAGS=%s\n" % (tool, flag))
-
- f.write("\n")
- for tool in validTools:
- for attr in self.Workspace.ToolConfig.Attributes:
- if attr == "FLAGS": continue
- key = (self.Toolchain, self.Target, arch, tool, attr)
- value = self.Workspace.ToolConfig[key]
- if attr == "NAME":
- path = self.Workspace.ToolConfig[(self.Toolchain, self.Target, arch, tool, "PATH")]
- f.write("%s=%s\n" % (tool, os.path.join(path, value)))
- else:
- f.write("%s_%s=%s\n" % (tool, attr, value))
- f.write("%s_FLAGS=${DEFAULT_%s_FLAGS} ${DEFAULT_MODULE_%s_FLAGS} ${PLATFORM_%s_FLAGS} ${MODULE_%s_FLAGS}\n" %
- (tool, tool, tool, tool, tool))
- f.write("\n")
-
- f.close()
-
-class AntModuleBuildFile(BuildFile):
- def __init__(self, workspace, platform, module, toolchain, target, arch):
- BuildFile.__init__(self, workspace, platform, toolchain, target)
- self.Module = module
- self.Arch = arch
- self.Path = os.path.join(self.Workspace.Path, self.Platform.OutputPath,
- target + "_" + toolchain, arch, self.Module.Module.Package.Dir,
- self.Module.Module.Dir, self.Module.Module.FileBaseName, "build.xml")
- self.BuildXml = AntBuildFile(self.Module.Module.Name)
-
- self.SourceFiles = self.GetSourceFiles()
-
- self.Header()
- self.PreBuild()
- self.Libraries()
- self.Sourcefiles()
- self.Sections()
- self.Ffs()
- self.PostBuild()
-
- def Generate(self):
- # print self.Path,"\r",
- self.BuildXml.Create(self.Path)
-
- def Header(self):
- _topLevel = self.BuildXml
- _topLevel.SubTask("taskdef", resource="frameworktasks.tasks")
- _topLevel.SubTask("taskdef", resource="cpptasks.tasks")
- _topLevel.SubTask("taskdef", resource="cpptasks.types")
- _topLevel.SubTask("taskdef", resource="net/sf/antcontrib/antlib.xml")
-
- _topLevel.Blankline()
- _topLevel.Comment(" TODO ")
- _topLevel.SubTask("property", environment="env")
- _topLevel.SubTask("property", name="WORKSPACE_DIR", value="${env.WORKSPACE}")
-
- _topLevel.Blankline()
- _topLevel.Comment("Common build attributes")
- _topLevel.SubTask("property", name="SINGLE_MODULE_BUILD", value="yes")
- _topLevel.SubTask("property", name="MODULE_BUILD_TARGET", value="single_module_build")
- _topLevel.SubTask("property", name="PLATFORM_PREBUILD", value="yes")
- _topLevel.SubTask("property", name="PLATFORM_POSTBUILD", value="no")
-
- _topLevel.Blankline()
- _topLevel.Comment(" TODO ")
- ifTask = _topLevel.SubTask("if")
- ifTask.SubTask("istrue", value="${SINGLE_MODULE_BUILD}")
- thenTask = ifTask.SubTask("then")
- platformBuildFile = os.path.join("${WORKSPACE_DIR}", self.Platform.OutputPath,
- self.Target + "_" + self.Toolchain, "build.xml")
- thenTask.SubTask("import", file=platformBuildFile)
-
- _topLevel.Blankline()
- _topLevel.SubTask("property", name="ARCH", value=self.Arch)
-
- module = self.Module.Module
- package = module.Package
- _topLevel.Blankline()
- _topLevel.SubTask("property", name="PACKAGE", value=package.Name)
- _topLevel.SubTask("property", name="PACKAGE_GUID", value=package.GuidValue)
- _topLevel.SubTask("property", name="PACKAGE_VERSION", value=package.Version)
- _topLevel.SubTask("property", name="PACKAGE_RELATIVE_DIR", value=package.Dir)
- _topLevel.SubTask("property", name="PACKAGE_DIR", value=os.path.join("${WORKSPACE_DIR}","${PACKAGE_RELATIVE_DIR}"))
-
- _topLevel.Blankline()
- _topLevel.SubTask("property", name="MODULE", value=module.Name)
- _topLevel.SubTask("property", name="MODULE_GUID", value=module.GuidValue)
- _topLevel.SubTask("property", name="MODULE_VERSION", value=module.Version)
- _topLevel.SubTask("property", name="MODULE_TYPE", value=module.Type)
- _topLevel.SubTask("property", name="MODULE_FILE_BASE_NAME", value=module.FileBaseName)
- _topLevel.SubTask("property", name="MODULE_RELATIVE_DIR", value=module.Dir)
- _topLevel.SubTask("property", name="MODULE_DIR", value=os.path.join("${PACKAGE_DIR}", "${MODULE_RELATIVE_DIR}"))
- _topLevel.SubTask("property", name="BASE_NAME", value=module.BaseName)
-
- _topLevel.Blankline()
- _topLevel.SubTask("property", file="${WORKSPACE_DIR}/Tools/Python/buildgen/module_build_path.txt")
-
- self._BuildOption()
-
- _topLevel.Blankline()
- _topLevel.SubTask("property", name="ENTRYPOINT", value="_ModuleEntryPoint")
-
- _topLevel.SubTask("property", name="SOURCE_FILES", value="\n ".join(self._GetSourceFileList()))
- _topLevel.SubTask("property", name="LIBS", value="\n ".join(self._GetLibList()))
-
- _topLevel.Blankline()
- _topLevel.SubTask("property", file="${PLATFORM_BUILD_DIR}/%s_build.opt" % self.Arch)
- _topLevel.Blankline()
- _topLevel.SubTask("echo", message="${MODULE}-${MODULE_VERSION} [${ARCH}] from package ${PACKAGE}-${PACKAGE_VERSION} (${MODULE_RELATIVE_DIR})", level="info")
-
- _topLevel.Blankline()
- _topLevel.Comment("Default target")
- _topLevel.SubTask("target", name="all", depends="single_module_build")
- _topLevel.SubTask("target", name="platform_module_build", depends="prebuild, sourcefiles, sections, output, postbuild")
- _topLevel.SubTask("target", name="single_module_build", depends="prebuild, libraries, sourcefiles, sections, output, postbuild")
-
- def _BuildOption(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- baseModule = self.Module.Module
- tools = self.Workspace.ToolConfig.ToolCodes
-
- for tool in tools:
- key = (self.Toolchain, self.Target, self.Arch, tool, "FLAGS")
- flag = ""
- if key in baseModule.BuildOptions:
- flag = baseModule.BuildOptions[key]
- _topLevel.SubTask("property", name="DEFAULT_MODULE_%s_FLAGS" % tool, value=flag)
-
- _topLevel.Blankline()
- for tool in tools:
- key = (self.Toolchain, self.Target, self.Arch, tool, "FLAGS")
- flag = ""
- if key in self.Module.BuildOptions:
- flag = self.Module.BuildOptions[key]
- _topLevel.SubTask("property", name="MODULE_%s_FLAGS" % tool, value=flag)
-
- def PreBuild(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: prebuild ")
-
- prebuildTasks = []
- module = self.Module.Module
- if module.UserExtensions.has_key("0"):
- prebuildTasks = module.UserExtensions["0"]
- elif module.UserExtensions.has_key("postbuild"):
- prebuildTasks = module.UserExtensions["prebuild"]
-
- _topLevel.SubTask("target", prebuildTasks, name="prebuild")
-
-
- def Libraries(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: libraries ")
-
- librariesTarget = _topLevel.SubTask("target", name="libraries")
- parallelBuild = librariesTarget.SubTask("parallel", threadCount="${THREAD_COUNT}")
- for lib in self.Module.Libraries:
- module = lib.Module
- buildDir = os.path.join("${BIN_DIR}", module.Package.SubPath(module.Dir), module.FileBaseName)
- libTask = parallelBuild.SubTask("ant", dir=buildDir,
- inheritAll="false",
- target="${MODULE_BUILD_TARGET}")
- libTask.SubTask("property", name="PLATFORM_PREBUILD", value="false")
- libTask.SubTask("property", name="PLATFORM_POSTBUILD", value="false")
-
- def Sourcefiles(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: sourcefiles ")
- _sourcefilesTarget = _topLevel.SubTask("target", name="sourcefiles")
-
- _incTask = AntTask(self.BuildXml.Document, "EXTRA.INC")
- _incTask.SubTask("includepath", path="${WORKSPACE_DIR}")
- _incTask.SubTask("includepath", path="${MODULE_DIR}")
- _incTask.SubTask("includepath", path=os.path.join("${MODULE_DIR}", self.Arch.capitalize()))
- _incTask.SubTask("includepath", path="${DEST_DIR_DEBUG}")
- if self.Arch in self.Module.Module.IncludePaths:
- for inc in self.Module.Module.IncludePaths[self.Arch]:
- _incTask.SubTask("includepath", path=os.path.join("${WORKSPACE_DIR}", inc))
-
- # init
- if not self.Module.Module.IsBinary:
- _buildTask = _sourcefilesTarget.SubTask("Build_Init")
- _buildTask.AddSubTask(_incTask)
-
- # AutoGen firt
- _buildTask = _sourcefilesTarget.SubTask("Build_AUTOGEN", FILEEXT="c", FILENAME="AutoGen", FILEPATH=".")
- _buildTask.AddSubTask(_incTask)
-
- # uni file follows
- type = "UNI"
- if type in self.SourceFiles:
- for srcpath in self.SourceFiles[type]:
- taskName = "Build_" + type
- fileDir = os.path.dirname(srcpath)
- if fileDir == "": fileDir = "."
- fileBaseName,fileExt = os.path.basename(srcpath).rsplit(".", 1)
- _buildTask = _sourcefilesTarget.SubTask(taskName, FILENAME=fileBaseName, FILEEXT=fileExt, FILEPATH=fileDir)
- _buildTask.AddSubTask(_incTask)
-
- # others: c, vfr, ...
- for type in self.SourceFiles:
- if type == "Unicode": continue
- for srcpath in self.SourceFiles[type]:
- taskName = "Build_" + type
- fileDir = os.path.dirname(srcpath)
- if fileDir == "": fileDir = "."
- fileBaseName,fileExt = os.path.basename(srcpath).rsplit(".", 1)
- _buildTask = _sourcefilesTarget.SubTask(taskName, FILENAME=fileBaseName, FILEEXT=fileExt, FILEPATH=fileDir)
- _buildTask.AddSubTask(_incTask)
-
- def Sections(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: sections ")
- _sectionsTarget = _topLevel.SubTask("target", name="sections")
-
- def Ffs(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: output ")
- _sectionsTarget = _topLevel.SubTask("target", name="output")
-
- def PostBuild(self):
- _topLevel = self.BuildXml
- _topLevel.Blankline()
- _topLevel.Comment(" TARGET: postbuild ")
-
- postbuildTasks = []
- module = self.Module.Module
- if module.UserExtensions.has_key("1"):
- postbuildTasks = module.UserExtensions["1"]
- elif module.UserExtensions.has_key("postbuild"):
- postbuildTasks = module.UserExtensions["postbuild"]
-
- _topLevel.SubTask("target", postbuildTasks, name="postbuild")
-
- def Clean(self):
- pass
-
- def CleanAll(self):
- pass
-
- def UserExtensions(self):
- pass
-
- def GetSourceFiles(self):
- ## check arch, toolchain, family, toolcode, ext
- ## if the arch of source file supports active arch
- ## if the toolchain of source file supports active toolchain
- ## if the toolchain family of source file supports active toolchain family
- ## if the ext of the source file is supported by the toolcode
- module = self.Module.Module
- files = {} # file type -> src
- for type in module.SourceFiles[self.Arch]:
- if not module.IsBuildable(type):
- # print type,"is not buildable"
- continue
-
- if type not in files:
- files[type] = []
- for src in module.SourceFiles[self.Arch][type]:
- if self.Toolchain not in src.Toolchains:
- # print self.Toolchain,"not in ",src.Toolchains
- continue
- if not self.IsCompatible(src.Families, self.Workspace.ActiveFamilies):
- # print src.Families,"not compatible with",self.Workspace.ActiveFamilies
- continue
- toolcode = src.GetToolCode(src.Type)
- if toolcode != "":
- ext = self.Workspace.GetToolDef(self.Toolchain, self.Target, self.Arch, toolcode, "EXT")
- if ext != "" and ext != src.Ext:
- # print ext,"in tools_def.txt is not the same as",src.Ext
- continue
- ## fileFullPath = os.path.join("${MODULE_DIR}", )
- ## print fileFullPath
- files[type].append(src.Path)
-
- return files
-
- def Intersection(self, list1, list2):
- return list(Set(list1) & Set(list2))
-
- def IsCompatible(self, list1, list2):
- return len(self.Intersection(list1, list2)) > 0
-
- def _GetLibList(self):
- libList = []
- for lib in self.Module.Libraries:
- module = lib.Module
- libList.append(os.path.join("${BIN_DIR}", module.Name + ".lib"))
- return libList
-
- def _GetSourceFileList(self):
- srcList = []
- for type in self.SourceFiles:
- srcList.extend(self.SourceFiles[type])
- return srcList
-
-class NmakeFile(BuildFile):
- pass
-
-class GmakeFile(BuildFile):
- pass
-
-# for test
-if __name__ == "__main__":
- workspacePath = os.getenv("WORKSPACE", os.getcwd())
- startTime = time.clock()
- ws = Workspace(workspacePath, [], [])
-
- # generate build.xml
- ap = ws.ActivePlatform
- for target in ws.ActiveTargets:
- ant = AntPlatformBuildFile(ws, ap, ws.ActiveToolchain, target)
- ant.Generate()
-
- print "\n[Finished in %fs]" % (time.clock() - startTime)
diff --git a/Tools/Python/buildgen/FrameworkElement.py b/Tools/Python/buildgen/FrameworkElement.py
deleted file mode 100644
index 3be8eaae57..0000000000
--- a/Tools/Python/buildgen/FrameworkElement.py
+++ /dev/null
@@ -1,523 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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.
-
-"""Framework Element Classes
-
-TODO
-"""
-
-################################################################################
-##
-## Element class: base class for representing framework elements
-##
-################################################################################
-class Element:
- def __init__(self, **kwargs):
- """(Name, GuidValue, Version, Path, Dir, Archs, Usage, Features, Signature)"""
- ## The path and directory where the information of the element comes from
- self.Path = "."
- self.Dir = "."
-
- ## Element name, guid and version
- self.Name = ""
- self.GuidValue = ""
- self.Version = ""
-
- ## The element supported architecture
- self.Archs = []
-
- ## Indiciate how the element is used
- self.Usage = "ALWAYS_CONSUMED"
-
- ## Indicate what kind of features this element is bound
- self.Features = []
-
- ## Element signature, used to check the its integerity
- self.Signature = 0
-
- def __str__(self):
- return self.Name + "-" + self.Version + " " + " [" + self.GuidValue + "]"
-
- def __eq__(self, other):
- if not isinstance(other, Element):
- return False
-
- if self.GuidValue != other.GuidValue:
- return False
-
- if self.Version != other.Version:
- return False
-
- return True
-
- def __hash__(self):
- return hash(self.GuidValue + self.Version)
-
-################################################################################
-##
-## ToolOption: build tool option
-##
-################################################################################
-class ToolOption(Element):
-
- def __init__(self, **kwargs):
- """Prefix, Value, Tool, Toolchains, Families, Targets"""
- Element.__init__(self)
-
- self.Prefix = "/"
- self.Value = ""
- self.Tool = ""
- self.Toolchains = ""
- self.Families = "MSFT"
- self.Targets = "DEBUG"
-
-################################################################################
-##
-## BuildTool: build tool
-##
-################################################################################
-class BuildTool(Element):
- def __init__(self, **kwargs):
- """Options, Toolchains, Families, Targets"""
- Element.__init__(self)
-
- self.Options = []
- self.Toolchains = []
- self.Families = []
- self.Targets = []
-
-################################################################################
-##
-## SourceFile: files in a module for build
-##
-################################################################################
-class SourceFile(Element):
- def __init__(self, **kwargs):
- """BaseName, Ext, Type, Toolchains, Families, Targets"""
- Element.__init__(self)
-
- self.BaseName = ""
- self.Ext = ""
- self.Type = ""
- self.Toolchains = []
- self.Families = []
- self.Targets = []
-
-################################################################################
-##
-## IncludeFile: header file
-##
-################################################################################
-class IncludeFile(SourceFile):
- def __init__(self, **kwargs):
- """Type, Package, ModuleType"""
- SourceFile.__init__(self)
-
- self.Type = "HeaderFile"
- self.Package = ""
- self.ModuleType = ""
-
-################################################################################
-##
-## IncludePath:
-##
-################################################################################
-class IncludePath(IncludeFile):
- pass
-
-################################################################################
-##
-## LibraryInterface: library class interface
-##
-################################################################################
-class LibraryInterface(Element):
- def __init__(self, **kwargs):
- """Package, FavoriteInstance, Instances, ModuleTypes, Consumers"""
- Element.__init__(self)
-
- self.Package = ""
- self.FavoriteInstance = ""
- self.Instances = []
- self.ModuleTypes = []
- self.Consumers = []
-
- def __eq__(self, other):
- if not isinstance(other, LibraryInterface):
- return False
- return self.Name == other.Name
-
- def __hash__(self):
- return hash(self.Name)
-
-################################################################################
-##
-## LibraryClass: library class
-##
-################################################################################
-class LibraryClass(Element):
- def __init__(self, **kwargs):
- """
- ()
- """
- Element.__init__(self)
-
- self.Interface = ""
- self.FavoriteInstance = ""
-
- def __eq__(self, other):
- if not isinstance(other, LibraryClass):
- return False
- return self.Name == other.Name
-
- def __hash__(self):
- return hash(self.Name)
-
-################################################################################
-##
-## Guid:
-##
-################################################################################
-class Guid(Element):
- def __init__(self, **kwargs):
- """CName, Types, ModuleTypes"""
- Element.__init__(self)
-
- self.CName = ""
- self.Types = []
- self.ModuleTypes= []
-
-################################################################################
-##
-## Protocol:
-##
-################################################################################
-class Protocol(Guid):
- pass
-
-################################################################################
-##
-## ProtocolNotify:
-##
-################################################################################
-class ProtocolNotify(Protocol):
- pass
-
-################################################################################
-##
-## Ppi:
-##
-################################################################################
-class Ppi(Guid):
- pass
-
-################################################################################
-##
-## PpiNotify:
-##
-################################################################################
-class PpiNotify(Ppi):
- pass
-
-################################################################################
-##
-## Extern:
-##
-################################################################################
-class Extern(Element):
- def __init__(self, **kwargs):
- """Specifications, ModuleEntryPoints, ModuleUnloadImages, Constructors, Destructors, DriverBindings, ComponentNames, DriverConfigs, DriverDiags, SetVirtualAddressMapCallBacks, ExitBootServicesCallBacks"""
- Element.__init__(self)
-
- self.Specifications = []
- self.ModuleEntryPoints = []
- self.ModuleUnloadImages = []
- self.Constructors = []
- self.Destructors = []
- self.DriverBindings = []
- self.ComponentNames = []
- self.DriverConfigs = []
- self.DriverDiags = []
- self.SetVirtualAddressMapCallBacks = []
- self.ExitBootServicesCallBacks = []
-
-################################################################################
-##
-## Sku:
-##
-################################################################################
-class Sku(Element):
- def __init__(self, **kwargs):
- """Id, Value"""
- Element.__init__(self)
-
- self.Id = 0
- self.Value = ""
-
-################################################################################
-##
-## Pcd:
-##
-################################################################################
-class Pcd(Element):
- def __init__(self, **kwargs):
- """Types, CName, Value, Token, TokenSpace, DatumType, Sku, ModuleTypes"""
- Element.__init__(self)
-
- self.Types = []
- self.CName = ""
- self.Value = ""
- self.Token = ""
- self.TokenSpace = ""
- self.DatumType = ""
- self.Default = ""
- self.Sku = ""
- self.ModuleTypes= []
-
-################################################################################
-##
-## Module: framework module
-##
-################################################################################
-class Module(Element):
- def __init__(self, **kwargs):
- """Workspace, Package, Type, BaseName, FileBaseName, IsLibrary, PcdIsDriver,
- NeedsFlashMap_h, SourceFiles, IncludePaths, IncludeFiles, NonProcessedFiles,
- LibraryClasses, Guids, Protocols, Ppis, Externs, Pcds,
- UserExtensions, BuildOptions, Environment
- """
- Element.__init__(self)
-
- self.Workspace = ""
- self.Package = ""
- self.Type = ""
- self.BaseName = ""
- self.FileBaseName = ""
- self.IsLibrary = False
- self.IsBinary = False
- self.PcdIsDriver = False
- self.NeedsFlashMap_h = False
- self.SourceFiles = {} # arch -> {file type -> [source file list]}
- self.IncludePaths = {} # arch -> [path list]
- self.IncludeFiles = {}
-
- self.NonProcessedFiles = []
- self.LibraryClasses = {} # arch -> [library class list]
-
- self.Guids = {} # arch -> [guid object list]
- self.Protocols = {} # arch -> []
- self.Ppis = {} # arch -> []
-
- self.Externs = {} # arch -> []
- self.Pcds = {} # arch -> []
-
- self.UserExtensions = {} # identifier -> ...
- self.BuildOptions = {} # (toolchain, target, arch, toolcode, "FLAGS") -> flag
- self.Environment = {}
-
- def __eq__(self, other):
- if not isinstance(other, Module):
- return False
-
- if self.GuidValue != other.GuidValue:
- return False
-
- if self.Version != other.Version:
- return False
-
- if self.Package != other.Package:
- return False
-
- return True
-
- def __hash__(self):
- return hash(self.GuidValue + self.Version + hash(self.Package))
-
-################################################################################
-##
-## PlatformModule: module for build
-##
-################################################################################
-class PlatformModule(Element):
- def __init__(self, **kwargs):
- """Workspace, Platform, Module, Libraries, Pcds, FfsLayouts, FvBindings
- BuildOptions, BuildType, BuildFile, BuildPath, Sections, FfsFile, Environment
- """
- Element.__init__(self)
- self.Workspace = ""
- self.Platform = ""
- self.Module = ""
- self.Libraries = []
- self.Pcds = []
- self.FfsLayouts = []
- self.FvBindings = []
- self.BuildOptions = {}
-
- self.BuildType = "efi" ## efi or lib
- self.BuildFile = "build.xml"
- self.BuildPath = "${MODULE_BUILD_DIR}"
- self.Sections = []
- self.FfsFile = ""
-
- self.Environment = {} # name/value pairs
-
- def __eq__(self, other):
- if not isinstance(other, PlatformModule):
- if not isinstance(other, Module):
- return False
- elif self.Module != other:
- return False
- elif self.Module != other.Module:
- return False
-
- return True
-
- def __hash__(self):
- return hash(self.Module)
-
-################################################################################
-##
-## Package: framework package
-##
-################################################################################
-class Package(Element):
- def __init__(self, **kwargs):
- """Workspace, ReadOnly, Repackage, Modules, PackageIncludes, StandardIncludes,
- LibraryInterfaces, Guids, Protocols, Ppis, Pcds, Environment
- """
- Element.__init__(self)
-
- self.Workspace = ""
- self.ReadOnly = True
- self.Repackage = True
- self.Modules = []
- self.PackageIncludes = {} # module type -> [include file list]
- self.StandardIncludes = []
- self.LibraryInterfaces = {} # class name -> include file
- self.Guids = {} # cname -> guid object
- self.Protocols = {} # cname -> protocol object
- self.Ppis = {} # cname -> ppi object
- self.Pcds = {} # token -> pcd object
-
- self.Environment = {}
-
-################################################################################
-##
-## PackageDependency:
-##
-################################################################################
-class PackageDependency(Element):
- def __init__(self, **kwargs):
- """Package"""
- Element.__init__(self)
-
- self.Package = ""
-
-################################################################################
-##
-## Platform:
-##
-################################################################################
-class Platform(Element):
- def __init__(self, **kwargs):
- """Targets, OutputPath, Images, Modules, DynamicPcds, Fvs, Libraries
- BuildFile, BuildPath, BuildOptions, UserExtensions
- """
- Element.__init__(self)
-
- self.Targets = []
- self.OutputPath = ""
- self.Images = []
- self.Modules = {} # arch -> [module list]
- self.DynamicPcds = []
- self.FfsLayouts = {}
- self.Fvs = {}
-
- self.Libraries = {} # arch -> [library instance]
- self.BuildFile = "build.xml"
- self.BuildPath = "${PLATFORM_BUILD_DIR}"
- self.BuildOptions = {}
- self.UserExtensions = {}
-
- self.Environment = {} # name/value pairs
-
-################################################################################
-##
-## Workspace:
-##
-################################################################################
-class Workspace(Element):
- def __init__(self, **kwargs):
- """Packages, Platforms, Fars, Modules, PlatformIndex, PackageIndex"""
- Element.__init__(self)
-
- self.Packages = []
- self.Platforms = []
- self.Fars = []
- self.Modules = []
-
- ## "GUID" : {guid : {version : platform}}
- ## "PATH" : {path : platform}
- ## "NAME" : {name : [platform]}
- self.PlatformXref = {
- "GUID" : {},
- "PATH" : {},
- "NAME" : {},
- }
- ## "GUID" : {guid : {version : package}}
- ## "PATH" : {path : package}
- ## "NAME" : {name : package}
- self.PackageXref = {
- "GUID" : {},
- "PATH" : {},
- "NAME" : {},
- }
- ## "GUID" : {guid : {version : [module]}}
- ## "PATH" : {path : module}
- ## "NAME" : {name : module}
- self.ModuleXref = {
- "GUID" : {},
- "PATH" : {},
- "NAME" : {},
- }
- ## "NAME" : {name : [library interface]}
- ## "PATH" : {path : library interface}
- self.LibraryInterfaceXref = {
- "PATH" : {},
- "NAME" : {},
- }
- ## TODO
- self.FarIndex = {}
-
- # from target.txt
- self.TargetConfig = {}
- # from tools_def.txt
- self.ToolConfig = {}
-
- self.ActivePlatform = ""
- self.ActiveToolchain = ""
- self.ActiveFamilies = []
- self.ActiveModules = []
- self.ActiveTargets = []
- self.ActiveArchs = []
-
- self.IndividualModuleBuild = False
- self.MultiThreadBuild = False
- self.ThreadCount = "2"
-
- self.Environment = {}
-
-################################################################################
-##
-## For test:
-##
-################################################################################
-if __name__ == "__main__":
- pass
diff --git a/Tools/Python/buildgen/SurfaceAreaElement.py b/Tools/Python/buildgen/SurfaceAreaElement.py
deleted file mode 100644
index ec84582b11..0000000000
--- a/Tools/Python/buildgen/SurfaceAreaElement.py
+++ /dev/null
@@ -1,1555 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2007, 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.
-
-"""Framework SurfaceArea Elemments"""
-#
-# TODO: FFS layout, Flash, FV, PCD
-#
-import os, sys, re, getopt, string, glob, xml.dom.minidom, pprint, time, copy, shelve, pickle
-from XmlRoutines import *
-import FrameworkElement
-import BuildConfig
-
-################################################################################
-##
-## Convert given list to a string in the format like: [a, b, c]
-##
-################################################################################
-def ListString(lst):
- return "[%s]" % ",".join(lst)
-
-class SurfaceAreaElement:
- """Base class for Surface Area XML element"""
- _ModuleTypes = ('BASE', 'SEC', 'PEI_CORE', 'PEIM', 'DXE_CORE', 'DXE_DRIVER',
- 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER',
- 'TOOL', 'UEFI_DRIVER', 'UEFI_APPLICATION', 'USER_DEFINED')
- _GuidTypes = ('DATA_HUB_RECORD', 'EFI_EVENT', 'EFI_SYSTEM_CONFIGURATION_TABLE',
- 'EFI_VARIABLE', 'GUID', 'HII_PACKAGE_LIST', 'HOB', 'TOKEN_SPACE_GUID')
- _Archs = ('EBC', 'IA32', 'X64', 'IPF', 'ARM', 'PPC')
- _Usages = ('ALWAYS_CONSUMED', 'SOMETIMES_CONSUMED', 'ALWAYS_PRODUCED',
- 'SOMETIMES_PRODUCED', 'TO_START', 'BY_START', 'PRIVATE')
- _FileTypes = {
- ".c" : "CCode",
- ".C" : "CCode",
- ".cpp" : "CCode",
- ".Cpp" : "CCode",
- ".CPP" : "CCode",
- ".h" : "CHeader",
- ".H" : "CHeader",
- ".asm" : "ASM",
- ".Asm" : "Assembly",
- ".ASM" : "Assembly",
- ".s" : "IpfAssembly",
- ".S" : "GccAssembly",
- ".uni" : "UNI",
- ".Uni" : "Unicode",
- ".UNI" : "Unicode",
- ".vfr" : "VFR",
- ".Vfr" : "VFR",
- ".VFR" : "VFR",
- ".dxs" : "DPX",
- ".Dxs" : "DPX",
- ".DXS" : "DPX",
- ".fv" : "FirmwareVolume",
- ".Fv" : "FirmwareVolume",
- ".FV" : "FirmwareVolume",
- ".efi" : "EFI",
- ".Efi" : "EFI",
- ".EFI" : "EFI",
- ".SEC" : "FFS",
- ".PEI" : "FFS",
- ".DXE" : "FFS",
- ".APP" : "FFS",
- ".FYI" : "FFS",
- ".FFS" : "FFS",
- ".bmp" : "BMP",
- ".i" : "PPCode",
- ".asl" : "ASL",
- ".Asl" : "ASL",
- ".ASL" : "ASL",
- }
- _ToolMapping = {
- "CCode" : "CC",
- "CHeader" : "",
- "ASM" : "ASM",
- "Assembly" : "ASM",
- "IpfAssembly" : "ASM",
- "GccAssembly" : "ASM",
- "UNI" : "",
- "Unicode" : "",
- "VFR" : "",
- "DPX" : "",
- "FirmwareVolume" : "",
- "EFI" : "",
- "FFS" : "",
- "PPCode" : "PP",
- "BMP" : "",
- }
-
- _BuildableFileTypes = ("CCode", "ASM", "Assembly", "IpfAssembly", "GccAssembly", "UNI", "Unicode", "VFR", "DPX", "EFI")
-
- def __init__(self, workspace, owner=None, dom=None, parse=True, postprocess=True):
- self._Workspace = workspace
-
- if owner == None: self._Owner = ""
- else: self._Owner = owner
-
- if dom == None: self._Root = ""
- else: self._Root = dom
-
- self._Elements = {}
-
- if parse: self.Parse()
- if postprocess: self.Postprocess()
-
- def Parse(self):
- """Parse the XML element in DOM form"""
- pass
-
- def Postprocess(self):
- """Re-organize the original information form XML DOM into a format which can be used directly"""
- pass
-
- def GetArchList(self, dom):
- """Parse the SupArchList attribute. If not spcified, return all ARCH supported"""
- archs = XmlAttribute(dom, "SupArchList").split()
- if archs == []:
- if self._Owner.Archs != []:
- archs = self._Owner.Archs
- elif self._Workspace.ActiveArchs != []:
- archs = self._Workspace.ActiveArchs
- elif self._Workspace.ActivePlatform != "" and self._Workspace.ActivePlatform.Archs != []:
- archs = self._Workspace.ActivePlatform.Archs
- else:
- archs = self._Archs
- return archs
-
- def GetModuleTypeList(self, dom):
- """Parse the SupModuleList attribute. If not specified, return all supported module types"""
- moduleTypes = XmlAttribute(dom, "SupModuleList").split()
- if moduleTypes == []:
- moduleTypes = self._ModuleTypes
- return moduleTypes
-
- def GetGuidTypeList(self, dom):
- """Parse GuidTypeList attribute. Default to GUID if not specified"""
- guidTypes = XmlAttribute(dom, "GuidTypeList")
- if guidTypes == []:
- guidTypes = ["GUID"]
- return guidTypes
-
- def GetFeatureList(self, dom):
- """Parse FeatureFlag attribute"""
- return XmlAttribute(dom, "FeatureFlag").split()
-
- def GetToolchainTagList(self, dom):
- """Parse TagName attribute. Return all defined toolchains defined in tools_def.txt if not given"""
- toolchainTagString = XmlAttribute(dom, "TagName")
- if toolchainTagString == "":
- return self._Workspace.ToolConfig.Toolchains
- return toolchainTagString.split()
-
- def GetToolchainFamilyList(self, dom):
- """Parse ToolChainFamily attribute. Return all defined toolchain families in tools_def.txt if not given"""
- familyString = XmlAttribute(dom, "ToolChainFamily")
- if familyString != "":
- return familyString.split()
- return self._Workspace.ToolConfig.Families
-
- def GetTargetList(self, dom):
- """Parse BuildTargets attribute. Return all build targets defined in tools_def.txt if not given"""
- targetList = XmlAttribute(dom, "BuildTargets").split()
- if targetList == []:
- targetList = self._Workspace.ToolConfig.Targets
- return targetList
-
- def GetUsage(self, dom):
- """Parse Usage attribute. Default to ALWAYS_CONSUMED if not given"""
- usageString = XmlAttribute(dom, "Usage")
- if usageString == "":
- return "ALWAYS_CONSUMED"
- return usageString
-
- def GetBuildOptionList(self, dom):
- """Parse Options/Option element. Return a options dictionay with keys as (toolchain, target, arch, toolcode, attr)"""
- optionList = XmlList(dom, "/Options/Option")
- buildOptions = {}
- for option in optionList:
- targets = self.GetTargetList(option)
- toolchainFamilies = self.GetToolchainFamilyList(option)
- toolchainTags = self.GetToolchainTagList(option)
- toolcode = XmlAttribute(option, "ToolCode")
- archs = self.GetArchList(option)
- flag = XmlElementData(option)
- # print flag
-
- toolchains = []
- if toolchainTags != []:
- toolchains = toolchainTags
- elif toolchainFamilies != []:
- toolchains = toolchainFamilies
- else:
- raise Exception("No toolchain specified for a build option: " + self._Owner.Name)
-
- if targets == []: targets = self._Workspace.ActiveTargets
- if archs == []: archs = self._Workspace.ActiveArchs
-
- for toolchain in toolchains:
- for target in targets:
- for arch in archs:
- buildOptions[(toolchain, target, arch, toolcode, "FLAGS")] = flag
- return buildOptions
-
- def GetFvBindingList(self, dom):
- """Parse FvBinding element. If not specified, return NULL FV"""
- fvBindingList = XmlElementData(dom).split()
- if fvBindingList == []:
- fvBindingList = ["NULL"]
- return fvBindingList
-
- def IsBuildable(self, type):
- """Test if a file with the type can be built by a tool"""
- return type in self._BuildableFileTypes
-
- def GetToolCode(self, type):
- """Get the toolcode which must be used to build files with the type"""
- toolcode = ""
- if type in self._ToolMapping:
- toolcode = self._ToolMapping[type]
- return toolcode
-
- def GetBoolean(self, dom):
- """Transate true/false in string form to python's True/False value"""
- boolString = XmlElementData(dom).upper()
- if boolString == "" or boolString == "FALSE" or boolString == "NO":
- return False
- else:
- return True
-
-class LibraryDeclaration(FrameworkElement.LibraryInterface, SurfaceAreaElement):
- def __init__(self, workspace, package, dom):
- FrameworkElement.LibraryInterface.__init__(self)
- self.Package = package
- SurfaceAreaElement.__init__(self, workspace, package, dom)
-
- def Parse(self):
- dom = self._Root
- self.Name = XmlAttribute(dom, "Name")
- self.Path = os.path.normpath(XmlElementData(XmlNode(dom, "/LibraryClass/IncludeHeader")))
- self.Dir = os.path.dirname(self.Path)
-
- attribute = XmlAttribute(dom, "RecommendedInstanceGuid")
- if attribute is not '':
- self.FavoriteIntance = FrameworkElement.Module()
- self.FavoriteIntance.Guid = attribute
-
- attribute = XmlAttribute(dom, "RecommendedInstanceVersion")
- if attribute is not '':
- if self.FavoriteIntance == "":
- raise "No GUID for the recommened library instance"
- self.FavoriteIntance.Version = attribute
-
- self.Archs = self.GetArchList(dom)
- self.ModuleTypes = self.GetModuleTypeList(dom)
-
-class LibraryClass(FrameworkElement.LibraryClass, SurfaceAreaElement):
- def __init__(self, workspace, module, dom):
- FrameworkElement.LibraryClass.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, module, dom)
-
- def Parse(self):
- dom = self._Root
-
- self.Name = XmlElementData(XmlNode(dom, "/LibraryClass/Keyword"))
- self.Usage = self.GetUsage(dom)
- self.Features = self.GetFeatureList(dom)
- self.Archs = self.GetArchList(dom)
-
- attribute = XmlAttribute(dom, "RecommendedInstanceGuid")
- if attribute is not '':
- self.FavoriteIntance = FrameworkElement.Module()
- self.FavoriteIntance.Guid = attribute
-
- attribute = XmlAttribute(dom, "RecommendedInstanceVersion")
- if attribute is not '':
- if self.FavoriteIntance == "":
- self.FavoriteIntance = FrameworkElement.Module()
- self.FavoriteIntance.Version = attribute
-
-class SourceFile(FrameworkElement.SourceFile, SurfaceAreaElement):
- def __init__(self, workspace, module, dom):
- FrameworkElement.SourceFile.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, module, dom)
-
- def Parse(self):
- dom = self._Root
- self.Path = os.path.normpath(XmlElementData(dom))
- self.Dir = os.path.dirname(self.Path)
- self.Type = self.GetFileType()
- self.Toolchains = self.GetToolchainTagList(dom)
- self.Families = self.GetToolchainFamilyList(dom)
- self.Archs = self.GetArchList(dom)
- self.Features = self.GetFeatureList(dom)
-
- def GetFileType(self):
- type = XmlAttribute(self._Root, "ToolCode")
- if type == "":
- fileName = os.path.basename(self.Path)
- self.BaseName,self.Ext = os.path.splitext(fileName)
- if self.Ext in self._FileTypes:
- type = self._FileTypes[self.Ext]
- else:
- type = ""
- return type
-
-class PackageDependency(FrameworkElement.PackageDependency, SurfaceAreaElement):
- def __init__(self, workspace, module, dom):
- FrameworkElement.PackageDependency.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, module, dom)
-
- def Parse(self):
- dom = self._Root
- self.GuidValue = XmlAttribute(dom, "PackageGuid").upper()
- self.Version = XmlAttribute(dom, "PackageVersion")
- self.Archs = self.GetArchList(dom)
- self.Features = self.GetFeatureList(dom)
-
- def Postprocess(self):
- self.Package = self._Workspace.GetPackage(self.GuidValue, self.Version)
- if self.Package == "": raise "No package with GUID=" + self.GuidValue + "VERSION=" + self.Version
-
-class Protocol(FrameworkElement.Protocol, SurfaceAreaElement):
- def __init__(self, workspace, module, dom):
- FrameworkElement.Protocol.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, module, dom)
-
- def Parse(self):
- dom = self._Root
- self.CName = XmlElementData(XmlNode(dom, "/Protocol/ProtocolCName"))
- self.Usage = self.GetUsage(dom)
- self.Archs = self.GetArchList(dom)
- self.Features = self.GetFeatureList(dom)
-
- def Postprocess(self):
- for pd in self._Owner._Elements["PackageDependencies"]:
- if self.CName not in pd.Package.Protocols: continue
- self.GuidValue = pd.Package.Protocols[self.CName]
-
-class ProtocolNotify(FrameworkElement.ProtocolNotify, SurfaceAreaElement):
- def __init__(self, workspace, module, dom):
- FrameworkElement.ProtocolNotify.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, module, dom)
-
- def Parse(self):
- dom = self._Root
-
- self.CName = XmlElementData(XmlNode(dom, "/ProtocolNotify/ProtocolCName"))
- self.Usage = self.GetUsage(dom)
- self.Archs = self.GetArchList(dom)
- self.Features = self.GetFeatureList(dom)
-
- def Postprocess(self):
- for pd in self._Owner._Elements["PackageDependencies"]:
- if self.CName not in pd.Package.Protocols: continue
- self.GuidValue = pd.Package.Protocols[self.CName]
-
-class Ppi(FrameworkElement.Ppi, SurfaceAreaElement):
- def __init__(self, workspace, module, dom):
- FrameworkElement.Ppi.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, module, dom)
-
- def Parse(self):
- dom = self._Root
- self.CName = XmlElementData(XmlNode(dom, "/Ppi/PpiCName"))
- self.Usage = self.GetUsage(dom)
- self.Archs = self.GetArchList(dom)
- self.Features = self.GetFeatureList(dom)
-
- def Postprocess(self):
- for pd in self._Owner._Elements["PackageDependencies"]:
- if self.CName not in pd.Package.Ppis: continue
- self.GuidValue = pd.Package.Ppis[self.CName]
-
-class PpiNotify(FrameworkElement.PpiNotify, SurfaceAreaElement):
- def __init__(self, workspace, module, dom):
- FrameworkElement.PpiNotify.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, module, dom)
-
- def Parse(self):
- dom = self._Root
- self.CName = XmlElementData(XmlNode(dom, "/PpiNotify/PpiCName"))
- self.Usage = self.GetUsage(dom)
- self.Archs = self.GetArchList(dom)
- self.Features = self.GetFeatureList(dom)
-
- def Postprocess(self):
- for pd in self._Owner._Elements["PackageDependencies"]:
- if self.CName not in pd.Package.Ppis: continue
- self.GuidValue = pd.Package.Ppis[self.CName]
-
-class Guid(FrameworkElement.Guid, SurfaceAreaElement):
- def __init__(self, workspace, module, dom):
- FrameworkElement.Guid.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, module, dom)
-
- def Parse(self):
- dom = self._Root
- self.CName = XmlElementData(XmlNode(dom, "/GuidCNames/GuidCName"))
- self.Usage = self.GetUsage(dom)
- self.Archs = self.GetArchList(dom)
- self.Features = self.GetFeatureList(dom)
-
- def Postprocess(self):
- for pd in self._Owner._Elements["PackageDependencies"]:
- if self.CName not in pd.Package.Guids: continue
- self.GuidValue = pd.Package.Guids[self.CName]
-
-class Extern(FrameworkElement.Extern, SurfaceAreaElement):
- def __init__(self, workspace, module, dom):
- FrameworkElement.Extern.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, module, dom)
-
- def Parse(self):
- dom = self._Root
- self.Archs = self.GetArchList(dom)
- self.Features = self.GetFeatureList(dom)
-
- extern = XmlNode(dom, "/Extern/ModuleEntryPoint")
- if extern is not None and extern is not '':
- self.ModuleEntryPoints.append(XmlElementData(extern))
-
- extern = XmlNode(dom, "/Extern/ModuleUnloadImage")
- if extern is not None and extern is not '':
- self.ModuleUnloadImages.append(XmlElementData(extern))
-
- extern = XmlNode(dom, "/Extern/Constructor")
- if extern is not None and extern is not '':
- self.Constructors.append(XmlElementData(extern))
-
- extern = XmlNode(dom, "/Extern/Destructor")
- if extern is not None and extern is not '':
- self.Destructors.append(XmlElementData(extern))
-
- extern = XmlNode(dom, "/Extern/DriverBinding")
- if extern is not None and extern is not '':
- self.DriverBindings.append(XmlElementData(extern))
-
- extern = XmlNode(dom, "/Extern/ComponentName")
- if extern is not None and extern is not '':
- self.ComponentNames.append(XmlElementData(extern))
-
- extern = XmlNode(dom, "/Extern/DriverConfig")
- if extern is not None and extern is not '':
- self.DriverConfigs.append(XmlElementData(extern))
-
- extern = XmlNode(dom, "/Extern/DriverDiag")
- if extern is not None and extern is not '':
- self.DriverDiags.append(XmlElementData(extern))
-
- extern = XmlNode(dom, "/Extern/SetVirtualAddressMapCallBacks")
- if extern is not None and extern is not '':
- self.SetVirtualAddressMapCallBacks.append(XmlElementData(extern))
-
- extern = XmlNode(dom, "/Extern/ExitBootServicesCallBack")
- if extern is not None and extern is not '':
- self.ExitBootServicesCallBacks.append(XmlElementData(extern))
-
-class IndustryStdHeader(FrameworkElement.IncludeFile, SurfaceAreaElement):
- def __init__(self, workspace, package, dom):
- FrameworkElement.IncludeFile.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, package, dom)
-
- def Parse(self):
- dom = self._Root
- self.Path = os.path.normpath(XmlElementData(XmlNode(dom, "/IndustryStdHeader/IncludeHeader")))
- self.Dir = os.path.dirname(self.Path)
- self.Archs = self.GetArchList(dom)
- self.ModuleTypes = self.GetModuleTypeList(dom)
-
-class PackageHeader(FrameworkElement.IncludeFile, SurfaceAreaElement):
- def __init__(self, workspace, package, dom):
- FrameworkElement.IncludeFile.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, package, dom)
-
- def Parse(self):
- dom = self._Root
- self.Path = os.path.normpath(XmlElementData(dom))
- self.Dir = os.path.dirname(self.Path)
- self.ModuleType = XmlAttribute(dom, "ModuleType")
-
-class GuidDeclaration(FrameworkElement.Guid, SurfaceAreaElement):
- def __init__(self, workspace, package, dom):
- FrameworkElement.Guid.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, package, dom)
-
- def Parse(self):
- dom = self._Root
- self.CName = XmlElementData(XmlNode(dom, "/Entry/C_Name"))
- self.GuidValue = XmlElementData(XmlNode(dom, "/Entry/GuidValue")).upper()
- self.Name = XmlAttribute(dom, "Name")
- self.Types = self.GetGuidTypeList(dom)
- self.Archs = self.GetArchList(dom)
- self.ModuleTypes = self.GetModuleTypeList(dom)
-
- def Postprocess(self):
- pass
-
-class ProtocolDeclaration(GuidDeclaration, SurfaceAreaElement):
- pass
-
-class PpiDeclaration(GuidDeclaration, SurfaceAreaElement):
- pass
-
-class PcdDeclaration(FrameworkElement.Pcd, SurfaceAreaElement):
- def __init__(self, workspace, package, dom):
- FrameworkElement.Pcd.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, package, dom)
-
- def Parse(self):
- dom = self._Root
- self.Types = XmlElementData(XmlNode(dom, "/PcdEntry/ValidUsage")).split()
- self.CName = XmlElementData(XmlNode(dom, "/PcdEntry/C_Name"))
- self.Token = XmlElementData(XmlNode(dom, "/PcdEntry/Token"))
- self.TokenSpace = XmlElementData(XmlNode(dom, "/PcdEntry/TokenSpaceGuidCName"))
- self.DatumType = XmlElementData(XmlNode(dom, "/PcdEntry/DatumType"))
- self.Default = XmlElementData(XmlNode(dom, "/PcdEntry/DefaultValue"))
- self.Archs = self.GetArchList(dom)
- self.ModuleTypes= self.GetModuleTypeList(dom)
-
-class LibraryInstance(FrameworkElement.PlatformModule, SurfaceAreaElement):
- def __init__(self, workspace, platformModule, dom):
- FrameworkElement.PlatformModule.__init__(self)
- SurfaceAreaElement.__init__(self, workspace, platformModule, dom)
-
- def Parse(self):
- dom = self._Root
- self.GuidValue = XmlAttribute(dom, "ModuleGuid").upper()
- self.Version = XmlAttribute(dom, "ModuleVersion")
- self._Elements["PackageGuid"] = XmlAttribute(dom, "PackageGuid").upper()
- self._Elements["PackageVersion"] = XmlAttribute(dom, "PackageVersion")
-
- def Postprocess(self):
- self.Module = self._Workspace.GetModule(self.GuidValue, self.Version,
- self._Elements["PackageGuid"], self._Elements["PackageVersion"])
- self.Platform = self._Owner.Platform
- self.Archs = self._Owner.Archs
- self.Pcds = self._Owner.Pcds
- self.BuildType = "lib"
-
-class PlatformModule(FrameworkElement.PlatformModule, SurfaceAreaElement):
- def __init__(self, workspace, platform, dom):
- FrameworkElement.PlatformModule.__init__(self)
- self.Platform = platform
- SurfaceAreaElement.__init__(self, workspace, platform, dom)
-
- def Parse(self):
- dom = self._Root
- self.GuidValue = XmlAttribute(dom, "ModuleGuid").upper()
- self.Version = XmlAttribute(dom, "ModuleVersion")
- self.Archs = self.GetArchList(dom)
-
- self._Elements["PackageGuid"] = XmlAttribute(dom, "PackageGuid").upper()
- self._Elements["PackageVersion"] = XmlAttribute(dom, "PackageVersion")
-
- libraryList = XmlList(dom, "/ModuleSA/Libraries/Instance")
- for lib in libraryList:
- self.Libraries.append(LibraryInstance(self._Workspace, self, lib))
-
- dom = XmlNode(dom, "/ModuleSA/ModuleSaBuildOptions")
- self.FvBindings = self.GetFvBindingList(XmlNode(dom, "/ModuleSaBuildOptions/FvBinding"))
- self.FfsLayouts = XmlElementData(XmlNode(dom, "/ModuleSaBuildOptions/FfsFormatKey")).split()
- self.BuildOptions = self.GetBuildOptionList(XmlNode(dom, "/ModuleSaBuildOptions/Options"))
-
- def Postprocess(self):
- self.Module = self._Workspace.GetModule(self.GuidValue, self.Version,
- self._Elements["PackageGuid"], self._Elements["PackageVersion"])
- if self.Module == "":
- raise Exception("No module found: \n\t\tGUID=%s \n\t\tVERSION=%s \n\t\tPACKAGE_GUID=%s \n\t\tPACKAGE_VERSION=%s" % (
- self.GuidValue, self.Version, self._Elements["PackageGuid"], self._Elements["PackageVersion"]))
-
-## def SetupEnvironment(self):
-## self.Environment = {
-## "ARCH" : "",
-## "MODULE_BUILD_TARGET" : "",
-## "SINGLE_MODULE_BUILD" : "",
-## "PLATFORM_PREBUILD" : "",
-## "PLATFORM_POSTBUILD" : "",
-## "LIBS" : "",
-## "SOURCE_FILES" : "",
-## "ENTRYPOINT" : "_ModuleEntryPoint",
-## } # name/value pairs
-## self.Environment["MODULE_BUILD_TARGET"] = "platform_module_build"
-
-class ModuleSurfaceArea(FrameworkElement.Module, SurfaceAreaElement):
- def __init__(self, workspace, package, path):
- FrameworkElement.Module.__init__(self)
-
- self.Path = os.path.normpath(path)
- self.Dir = os.path.dirname(self.Path)
- self.FileBaseName,_ext = os.path.splitext(os.path.basename(self.Path))
- self.Package = package
- SurfaceAreaElement.__init__(self, workspace, package)
-
- def _MsaHeader(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- self.Name = XmlElementData(XmlNode(dom, "/MsaHeader/ModuleName"))
- self.Type = XmlElementData(XmlNode(dom, "/MsaHeader/ModuleType"))
- self.GuidValue = XmlElementData(XmlNode(dom, "/MsaHeader/GuidValue")).upper()
- self.Version = XmlElementData(XmlNode(dom, "/MsaHeader/Version"))
-
- def _ModuleDefinitions(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- self.Archs = XmlElementData(XmlNode(dom, "/ModuleDefinitions/SupportedArchitectures")).split()
- self.IsBinary = self.GetBoolean(XmlNode(dom, "/ModuleDefinitions/BinaryModule"))
- self.BaseName = XmlElementData(XmlNode(dom, "/ModuleDefinitions/OutputFileBasename"))
-
- def _LibraryClassDefinitions(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- lcList = []
- for lc in XmlList(dom, "/LibraryClassDefinitions/LibraryClass"):
- lcList.append(LibraryClass(self._Workspace, self, lc))
- self._Elements["LibraryClassDefinitions"] = lcList
-
- def _SourceFiles(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- srcList = []
- for f in XmlList(dom, "/SourceFiles/Filename"):
- srcList.append(SourceFile(self._Workspace, self, f))
- self._Elements["SourceFiles"] = srcList
-
- def _NonProcessedFiles(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- for f in XmlList(dom, "/NonProcessedFiles/Filename"):
- self.NonProcessedFiles.append(SourceFile(self._Workspace, self, f))
-
- def _PackageDependencies(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- pdList = []
- for pkg in XmlList(dom, "/PackageDependencies/Package"):
- pdList.append(PackageDependency(self._Workspace, self, pkg))
- self._Elements["PackageDependencies"] = pdList
-
- def _Protocols(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
-
- protocolList = []
- for p in XmlList(dom, "/Protocols/Protocol"):
- protocolList.append(Protocol(self._Workspace, self, p))
- for p in XmlList(dom, "/Protocols/ProtocolNotify"):
- protocolList.append(ProtocolNotify(self._Workspace, self, p))
-
- self._Elements["Protocols"] = protocolList
-
- def _Ppis(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
-
- ppiList = []
- for p in XmlList(dom, "/PPIs/Ppi"):
- ppiList.append(Ppi(self._Workspace, self, p))
- for p in XmlList(dom, "/PPIs/PpiNotify"):
- ppiList.append(PpiNotify(self._Workspace, self, p))
-
- self._Elements["PPIs"] = ppiList
-
- def _Guids(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- guidList = []
- for g in XmlList(dom, "/Guids/GuidCNames"):
- guidList.append(Guid(self._Workspace, self, g))
- self._Elements["Guids"] = guidList
-
- def _Externs(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- self.PcdIsDriver = self.GetBoolean(XmlNode(dom, "/Externs/PcdIsDriver"))
- self.NeedsFlashMap_h = self.GetBoolean(XmlNode(dom, "/Externs/TianoR8FlashMap_h"))
-
- externList = []
- specs = FrameworkElement.Extern()
- specs.Archs = self._Archs
- externList.append(specs)
- for spec in XmlList(dom, "/Externs/Specification"):
- specs.Specifications.append(XmlElementData(spec))
- for ext in XmlList(dom, "/Externs/Extern"):
- externList.append(Extern(self._Workspace, self, ext))
- self._Elements["Externs"] = externList
-
- def _ModuleBuildOptions(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- self.BuildOptions = self.GetBuildOptionList(XmlNode(dom, "/ModuleBuildOptions/Options"))
-
- def _UserExtensions(self, xpath):
- domList = XmlList(self._Root, xpath)
- if domList == []: return
- for extension in domList:
- userId = XmlAttribute(extension, "UserID")
- identifier = XmlAttribute(extension, "Identifier")
- if userId == '' or identifier == '':
- raise Exception("No UserId or Identifier specified")
- if userId != "TianoCore": continue
- if identifier not in self.UserExtensions:
- self.UserExtensions[identifier] = []
-
- contentList = self.UserExtensions[identifier]
- for node in extension.childNodes:
- #print node.nodeType
- contentList.append(node.cloneNode(True))
-
- def Parse(self):
- fileFullPath = self._Workspace.SubPath(os.path.dirname(self.Package.Path), self.Path)
- self._Root = xml.dom.minidom.parse(fileFullPath)
- assert self._Root.documentElement.tagName == "ModuleSurfaceArea"
-
- # print " Parsing...",self.Path
- self._MsaHeader("/ModuleSurfaceArea/MsaHeader")
- self._ModuleDefinitions("/ModuleSurfaceArea/ModuleDefinitions")
- self._PackageDependencies("/ModuleSurfaceArea/PackageDependencies")
- self._LibraryClassDefinitions("/ModuleSurfaceArea/LibraryClassDefinitions")
- self._SourceFiles("/ModuleSurfaceArea/SourceFiles")
- self._NonProcessedFiles("/ModuleSurfaceArea/NonProcessedFiles")
- self._Protocols("/ModuleSurfaceArea/Protocols")
- self._Ppis("/ModuleSurfaceArea/Ppis")
- self._Guids("/ModuleSurfaceArea/Guids")
- self._Externs("/ModuleSurfaceArea/Externs")
- self._ModuleBuildOptions("/ModuleSurfaceArea/ModuleBuildOptions")
- self._UserExtensions("/ModuleSurfaceArea/UserExtensions")
-
- def Postprocess(self):
- # resolve package dependency
- if self._Elements.has_key("PackageDependencies"):
- for pd in self._Elements["PackageDependencies"]:
- package = pd.Package
- if self.Type not in package.PackageIncludes:
- print "! Module type %s is not supported in the package %s" % (self.Type, package.Name)
-
- for arch in pd.Archs:
- if arch not in self.IncludePaths:
- self.IncludePaths[arch] = []
- self.IncludePaths[arch].append(package.SubPath("Include"))
- self.IncludePaths[arch].append(package.SubPath("Include", arch.capitalize()))
-
- if arch not in self.IncludeFiles:
- self.IncludeFiles[arch] = []
- if self.Type in package.PackageIncludes:
- for path in package.PackageIncludes[self.Type]:
- self.IncludeFiles[arch].append(package.SubPath(path))
-
- # resolve library class
- if self._Elements.has_key("LibraryClassDefinitions"):
- for lc in self._Elements["LibraryClassDefinitions"]:
- lc.Interface = self.GetLibraryInterface(lc.Name)
- if "ALWAYS_PRODUCED" in lc.Usage:
- self.IsLibrary = True
- lc.Interface.Instances.append(self)
- else:
- lc.Interface.Consumers.append(self)
-
- for arch in lc.Archs:
- if arch not in self.LibraryClasses:
- self.LibraryClasses[arch] = []
- self.LibraryClasses[arch].append(lc)
-
- # expand source files
- if self._Elements.has_key("SourceFiles"):
- for src in self._Elements["SourceFiles"]:
- for arch in src.Archs:
- if arch not in self.SourceFiles:
- self.SourceFiles[arch] = {}
- if src.Type not in self.SourceFiles[arch]:
- self.SourceFiles[arch][src.Type] = []
- self.SourceFiles[arch][src.Type].append(src)
-
- # expand guids
- if self._Elements.has_key("Guids"):
- for guid in self._Elements["Guids"]:
- for arch in guid.Archs:
- if arch not in self.Guids:
- self.Guids[arch] = []
- self.Guids[arch].append(guid)
-
- # expand protocol
- if self._Elements.has_key("Protocols"):
- for protocol in self._Elements["Protocols"]:
- for arch in protocol.Archs:
- if arch not in self.Protocols:
- self.Protocols[arch] = []
- self.Protocols[arch].append(protocol)
-
- # expand ppi
- if self._Elements.has_key("PPIs"):
- for ppi in self._Elements["PPIs"]:
- for arch in ppi.Archs:
- if arch not in self.Ppis:
- self.Ppis[arch] = []
- self.Ppis[arch].append(ppi)
-
- # expand extern
- if self._Elements.has_key("Externs"):
- for extern in self._Elements["Externs"]:
- for arch in extern.Archs:
- if arch not in self.Externs:
- self.Externs[arch] = []
- self.Externs[arch].append(extern)
-
- def GetLibraryInterface(self, name):
- if name in self.Package.LibraryInterfaces:
- return self.Package.LibraryInterfaces[name]
- for pd in self._Elements["PackageDependencies"]:
- if name in pd.Package.LibraryInterfaces:
- return pd.Package.LibraryInterfaces[name]
- return ""
-## def SetupEnvironment(self):
-## self.Environment["MODULE"] = self.Name
-## self.Environment["MODULE_GUID"] = self.GuidValue
-## self.Environment["MODULE_VERSION"] = self.Version
-## self.Environment["MODULE_TYPE"] = self.Type
-## self.Environment["MODULE_FILE_BASE_NAME"] = os.path.basename(self.Path).split(".")[0]
-## self.Environment["MODULE_RELATIVE_DIR"] = os.path.dirname(self.Path)
-## self.Environment["BASE_NAME"] = self.OutputName
-
-class Workspace(FrameworkElement.Workspace, SurfaceAreaElement):
- _Db = "Tools/Conf/FrameworkDatabase.db"
- _Target = "Tools/Conf/Target.txt"
- _PlatformBuildPath = "Tools/Conf/platform_build_path.txt"
- _ModuleBuildPath = "Tools/Conf/module_build_path.txt"
-
- def __init__(self, path, fpdList=None, msaList=None):
- FrameworkElement.Workspace.__init__(self)
- SurfaceAreaElement.__init__(self, self, None, None, False, False)
- self.Path = os.path.normpath(path)
- self.Dir = os.path.dirname(self.Path)
- self._Elements["PlatformList"] = fpdList
- self._Elements["ModuleList"] = msaList
- self.Parse()
- self.Postprocess()
-
- def _FdbHeader(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- self.Name = XmlElementData(XmlNode(dom, "/FdbHeader/DatabaseName"))
- self.GuidValue = XmlElementData(XmlNode(dom, "/FdbHeader/GuidValue")).upper()
- self.Version = XmlElementData(XmlNode(dom, "/FdbHeader/Version"))
-
- def _PackageList(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
-
- fileList = XmlList(dom, "/PackageList/Filename")
- packages = []
- for f in fileList:
- packages.append(os.path.normpath(XmlElementData(f)))
- self._Elements["PackageList"] = packages
-
- def _PlatformList(self, xpath):
- if len(self._Elements["PlatformList"]) > 0:
- return
-
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
-
- fileList = XmlList(dom, "/PlatformList/Filename")
- platforms = []
- for f in fileList:
- platforms.append(os.path.normpath(XmlElementData(f)))
- self._Elements["PlatformList"] = platforms
-
- def _FarList(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
-
- fileList = XmlList(dom, "/FarList/Filename")
- fars = []
- for f in fileList:
- fars.append(os.path.normpath(XmlElementData(f)))
- self._Elements["FarList"] = fars
-
- def ParseWorkspaceDatabase(self):
- # parse frameworkdatabase.db
- self._Root = xml.dom.minidom.parse(self.SubPath(self._Db))
- assert self._Root.documentElement.tagName == "FrameworkDatabase"
-
- self._FdbHeader("/FrameworkDatabase/FdbHeader")
- self._PackageList("/FrameworkDatabase/PackageList")
- self._PlatformList("/FrameworkDatabase/PlatformList")
- self._FarList("/FrameworkDatabase/FarList")
-
- def ParseConfig(self):
- # parse target.txt
- self.ParseTargetConfig()
- # parse tools_def.txt
- self.ParseToolConfig()
- # parse platform/module_build_path.txt
-
- # active toolchain
- # print self.TargetConfig
- self.ActiveToolchain = self.TargetConfig["TOOL_CHAIN_TAG"]
- if self.ActiveToolchain not in self.ToolConfig.Toolchains:
- raise "Not supported tool chain tag %s" % self.ActiveToolchain
-
- # active toolchain family
- self.ActiveFamilies = []
- for key in self.ToolConfig:
- if self.ActiveToolchain in key and "FAMILY" in key:
- family = self.ToolConfig[key]
- if family not in self.ActiveFamilies:
- self.ActiveFamilies.append(family)
-
-
- def ParsePackage(self, packagePaths=None):
- if packagePaths == None:
- return
-
- for packagePath in packagePaths:
- self.Packages.append(PackageSurfaceArea(self, packagePath))
-
- def ParsePlatform(self, platformPaths=None):
- # Only one active platform is allowed
- activePlatformPath = ""
- if self.TargetConfig["ACTIVE_PLATFORM"] == "":
- if platformPaths != None and len(platformPaths) == 1:
- activePlatformPath = platformPaths[0]
- else:
- raise Exception("No active platform specified or implied!")
- else:
- activePlatformPath = os.path.normpath(self.TargetConfig["ACTIVE_PLATFORM"])
-
- self.ActivePlatform = PlatformSurfaceArea(self, activePlatformPath)
- self.Platforms.append(self.ActivePlatform)
-
- def ParseTargetConfig(self):
- self.TargetConfig = BuildConfig.TargetConfig(self.SubPath(self._Target))
- # print self.TargetConfig
-
- def ParseToolConfig(self):
- self.ToolConfig = BuildConfig.ToolConfig(self.SubPath(self.TargetConfig["TOOL_CHAIN_CONF"]))
-
- def GetModule(self, guid, version, packageGuid, packageVersion):
- moduleGuidIndex = self.ModuleXref["GUID"]
- if guid not in moduleGuidIndex:
- print "! No module has GUID=" + guid
- return ""
-
- moduleVersionList = moduleGuidIndex[guid]
- # print moduleVersionList
- moduleList = []
- module = ""
- if version != "":
- if version in moduleVersionList:
- moduleList = moduleVersionList[version]
- else:
- return ""
- else:
- ## no version given, return the first one
- version = "0.0"
- for ver in moduleVersionList:
- if ver > version: version = ver
- moduleList = moduleVersionList[version]
-
- if packageGuid == "":
- ## if no package GUID given, just return the latest one
- version = "0.0"
- for m in moduleList:
- if m.Package.Version > version:
- version = m.Package.Version
- module = m
- else:
- version = "0.0"
- for m in moduleList:
- if m.Package.GuidValue != packageGuid: continue
- if packageVersion == "":
- ## if no version given, just return the latest
- if m.Package.Version > version:
- version = m.Package.Version
- module = m
- elif packageVersion == m.Package.Version:
- module = m
- break;
-
- return module
-
- def GetModuleByPath(self, path):
- ownerPackage = ""
- ownerPackageFullPath = ""
- for package in self.Packages:
- ownerPackageFullPath = self.SubPath(package.Path)
- if path.startswith(packageFullPath): break
-
- if ownerPackage == "":
- return ""
-
- for module in ownerPackage.Modules:
- moduleFullPath = os.path.join(ownerPackageFullPath, module.Path)
- if moduleFullPath == path:
- return module
-
- return ""
-
- def GetPackage(self, guid, version):
- packageGuidIndex = self.PackageXref["GUID"]
- if guid not in packageGuidIndex:
- # raise Exception("No package has GUID=" + guid)
- return ""
-
- packageList = packageGuidIndex[guid]
- package = ""
- if version != "":
- if version in packageList:
- package = packageList[version]
- else:
- ## no version given, return the latest one
- version = "0.0"
- for ver in packageList:
- if ver > version: version = ver
- package = packageList[version]
-
- return package
-
- def GetPlatform(self, guid, version):
- pass
-
- def GetPlatformByPath(self, path):
- for platform in self.Platforms:
- platformFullPath = self.SubPath(platform.Path)
- if platformFullPath == path:
- return platform
- return ""
-
- def GetLibraryInterface(self, name, package):
- if name not in self.LibraryInterfaceXref["NAME"]:
- return ""
- liList = self.LibraryInterfaceXref["NAME"][name]
- for li in liList:
- if li.Package == package:
- return li
- return ""
-
- def SubPath(self, *relativePathList):
- return os.path.normpath(os.path.join(self.Path, *relativePathList))
-
- def SetupCrossRef(self):
- ##
- ## setup platform cross reference as nest-dict
- ## guid -> {version -> platform}
- ##
- ## platformList = self.Platforms
- ## for p in platformList:
- ## guid = p.GuidValue
- ## version = p.Version
- ## if guid not in self.PlatformIndex:
- ## self.PlatformIndex[guid] = {}
- ## if version in self.PlatformIndex[guid]:
- ## raise Exception("Duplicate platform")
- ## self.PlatformIndex[guid][version] = p
-
- ##
- ## setup package cross reference as nest-dict
- ## guid -> {version -> package}
- ## name -> [package list]
- ## path -> package
- ##
- packageList = self.Packages
- for p in packageList:
- guid = p.GuidValue
- version = p.Version
- packageGuidIndex = self.PackageXref["GUID"]
- if guid not in packageGuidIndex:
- packageGuidIndex[guid] = {}
- if version in packageGuidIndex[guid]:
- raise Exception("Duplicate package: %s-%s [%s]" % p.Name, version, guid)
- packageGuidIndex[guid][version] = p
-
- packageNameIndex = self.PackageXref["NAME"]
- name = p.Name
- if name not in packageNameIndex:
- packageNameIndex[name] = []
- packageNameIndex[name].append(p)
-
- packagePathIndex = self.PackageXref["PATH"]
- path = p.Path
- if path in packagePathIndex:
- raise Exception("Duplicate package: %s %s" % p.Name, p.Path)
- packagePathIndex[path] = p.Path
-
- ##
- ## setup library class cross reference as
- ## library class name -> library class object
- ##
- for lcname in p.LibraryInterfaces:
- if lcname not in self.LibraryInterfaceXref["NAME"]:
- # raise Exception("Duplicate library class: %s in package %s" % (lcname, name))
- self.LibraryInterfaceXref["NAME"][lcname] = []
- lcInterface = p.LibraryInterfaces[lcname]
- self.LibraryInterfaceXref["NAME"][lcname].append(lcInterface)
-
- lcHeader = p.SubPath(lcInterface.Path)
- if lcHeader not in self.LibraryInterfaceXref["PATH"]:
- # raise Exception("Duplicate library class interface: %s in package %s" % (lcInterface, name))
- self.LibraryInterfaceXref["PATH"][lcHeader] = []
- self.LibraryInterfaceXref["PATH"][lcHeader].append(lcInterface)
-
- ##
- ## setup package cross reference as nest-dict
- ## guid -> {version -> [module list]}
- ## name -> [module list]
- ## path -> module
- for p in packageList:
- p.ParseMsaFile()
-
- moduleList = p.Modules
- for m in moduleList:
- name = m.Name
- path = m.Path
- guid = m.GuidValue
- version = m.Version
- moduleGuidIndex = self.ModuleXref["GUID"]
- if guid not in moduleGuidIndex:
- moduleGuidIndex[guid] = {}
- else:
- print "! Duplicate module GUID found:", guid, p.SubPath(path)
- dm = moduleGuidIndex[guid].values()[0][0]
- print " ", dm.GuidValue,\
- dm.Package.SubPath(dm.Path)
-
- if version not in moduleGuidIndex[guid]:
- moduleGuidIndex[guid][version] = []
- if m in moduleGuidIndex[guid][version]:
- raise Exception("Duplicate modules in the same package: %s-%s [%s]" % (name, version, guid))
- moduleGuidIndex[guid][version].append(m)
-
- modulePathIndex = self.ModuleXref["PATH"]
- path = p.SubPath(m.Path)
- if path in modulePathIndex:
- raise Exception("Duplicate modules in the same package: %s %s" % (name, path))
- modulePathIndex[path] = m
-
- moduleNameIndex = self.ModuleXref["NAME"]
- if name not in moduleNameIndex:
- moduleNameIndex[name] = []
- moduleNameIndex[name].append(m)
-
- def GetToolDef(self, toolchain, target, arch, toolcode, attr):
- return self.ToolConfig[(toolchain, target, arch, toolcode, attr)]
-
- def Parse(self):
- self.ParseConfig()
- self.ParseWorkspaceDatabase()
-
- def SetupBuild(self):
- # active archs
- self.ActiveArchs = self.TargetConfig["TARGET_ARCH"].split()
- if self.ActiveArchs == []:
- self.ActiveArchs = self.ActivePlatform.Archs
-
- # active targets
- self.ActiveTargets = self.TargetConfig["TARGET"].split()
- if self.ActiveTargets == []:
- self.ActiveTargets = self.ActivePlatform.Targets
-
-
- # active modules
- for msa in self._Elements["ModuleList"]:
- module = self.GetModuleByPath(msa)
- if module == "":
- raise Exception(msa + " is not in any package!")
- self.ActiveModules.append(module)
- self.IndividualModuleBuild = True
- if self.TargetConfig["MULTIPLE_THREAD"].upper() == "ENABLE":
- self.MultiThreadBuild = True
- if "MAX_CONCURRENT_THREAD_NUMBER" in self.TargetConfig:
- self.ThreadCount = self.TargetConfig["MAX_CONCURRENT_THREAD_NUMBER"]
- else:
- self.ThreadCount = "1"
-
- def Postprocess(self):
- self.ParsePackage(self._Elements["PackageList"])
- self.SetupCrossRef()
- self.ParsePlatform(self._Elements["PlatformList"])
- self.SetupBuild()
-
-## def SetupEnvironment(self):
-## config = BuildConfig.Config(self.SubPath(self._PlatformBuildPath))
-## for name in config:
-## self.Environment[name] = config[name]
-##
-## config = BuildConfig.Config(self.SubPath(self._ModuleBuildPath))
-## for name in config:
-## self.Environment[name] = config[name]
-##
-## multiThread = self.TargetConfig["MULTIPLE_THREAD"].upper()
-## threadNumber = self.TargetConfig["MAX_CONCURRENT_THREAD_NUMBER"]
-## if multiThread == "" or multiThread == "FALSE":
-## self.Environment["MULTIPLE_THREAD"] = False
-## self.Environment["MAX_CONCURRENT_THREAD_NUMBER"] = 1
-## else:
-## self.Environment["MULTIPLE_THREAD"] = True
-## if threadNumber != "":
-## self.Environment["MAX_CONCURRENT_THREAD_NUMBER"] = threadNumber
-## else:
-## self.Environment["MAX_CONCURRENT_THREAD_NUMBER"] = 2
-
-class PackageSurfaceArea(FrameworkElement.Package, SurfaceAreaElement):
- def __init__(self, workspace, path):
- FrameworkElement.Package.__init__(self)
-
- self.Path = os.path.normpath(path)
- self.Dir = os.path.dirname(self.Path)
- SurfaceAreaElement.__init__(self, workspace, workspace, None, True, True)
-
- def _SpdHeader(self, xpath):
- dom = XmlNode(self._Root, xpath)
- self.Name = XmlElementData(XmlNode(dom, "/SpdHeader/PackageName"))
- self.GuidValue = XmlElementData(XmlNode(dom, "/SpdHeader/GuidValue")).upper()
- self.Version = XmlElementData(XmlNode(dom, "/SpdHeader/Version"))
-
- def _PackageDefinitions(self, xpath):
- dom = XmlNode(self._Root, xpath)
- self.ReadOnly = XmlElementData(XmlNode(dom, "/PackageDefinitions/ReadOnly"))
- self.Repackage = XmlElementData(XmlNode(dom, "/PackageDefinitions/RePackage"))
-
- def _LibraryClassDeclarations(self, xpath):
- dom = XmlNode(self._Root, xpath)
- lcdList = XmlList(dom, "/LibraryClassDeclarations/LibraryClass")
- lcds = []
- for lc in lcdList:
- lcds.append(LibraryDeclaration(self._Workspace, self, lc))
- self._Elements["LibraryClassDeclarations"] = lcds
-
- def _IndustryStdIncludes(self, xpath):
- dom = XmlNode(self._Root, xpath)
- headerList = XmlList(dom, "/IndustryStdIncludes/IndustryStdHeader")
- headers = []
- for h in headerList:
- headers.append(IndustryStdHeader(self._Workspace, self, h))
- self._Elements["IndustryStdIncludes"] = headers
-
- def _MsaFiles(self, xpath):
- dom = XmlNode(self._Root, xpath)
- msaFileList = XmlList(dom, "/MsaFiles/Filename")
- msaFiles = []
- for msa in msaFileList:
- filePath = os.path.normpath(XmlElementData(msa))
- msaFiles.append(filePath)
- self._Elements["MsaFiles"] = msaFiles
-
- def _PackageHeaders(self, xpath):
- dom = XmlNode(self._Root, xpath)
- headerList = XmlList(dom, "/PackageHeaders/IncludePkgHeader")
- headers = []
- for h in headerList:
- headers.append(PackageHeader(self._Workspace, self, h))
- self._Elements["PackageHeaders"] = headers
-
- def _GuidDeclarations(self, xpath):
- dom = XmlNode(self._Root, xpath)
- guidList = XmlList(dom, "/GuidDeclarations/Entry")
- guids = []
- for guid in guidList:
- guids.append(GuidDeclaration(self._Workspace, self, guid))
- self._Elements["GuidDeclarations"] = guids
-
- def _ProtocolDeclarations(self, xpath):
- dom = XmlNode(self._Root, xpath)
- protocolList = XmlList(dom, "/ProtocolDeclarations/Entry")
- protocols = []
- for p in protocolList:
- protocols.append(ProtocolDeclaration(self._Workspace, self, p))
- self._Elements["ProtocolDeclarations"] = protocols
-
- def _PpiDeclarations(self, xpath):
- dom = XmlNode(self._Root, xpath)
- ppiList = XmlList(dom, "/PpiDeclarations/Entry")
- ppis = []
- for p in ppiList:
- ppis.append(PpiDeclaration(self._Workspace, self, p))
- self._Elements["PpiDeclarations"] = ppis
-
- def _PcdDeclarations(self, xpath):
- dom = XmlNode(self._Root, xpath)
- pcdList = XmlList(dom, "/PcdDeclarations/PcdEntry")
- pcds = []
- for p in pcdList:
- pcds.append(PcdDeclaration(self._Workspace, self, p))
- self._Elements["PcdDeclarations"] = pcds
-
- def SubPath(self, *relativePathList):
- return os.path.normpath(os.path.join(self.Dir, *relativePathList))
-
- def Parse(self):
- self._Root = xml.dom.minidom.parse(self._Workspace.SubPath(self.Path))
- assert self._Root.documentElement.tagName == "PackageSurfaceArea"
-
- # print "Parsing...",self.Path
- self._SpdHeader("/PackageSurfaceArea/SpdHeader")
- self._PackageDefinitions("/PackageSurfaceArea/PackageDefinitions")
- self._LibraryClassDeclarations("/PackageSurfaceArea/LibraryClassDeclarations")
- self._IndustryStdIncludes("/PackageSurfaceArea/IndustryStdIncludes")
- self._MsaFiles("/PackageSurfaceArea/MsaFiles")
- self._PackageHeaders("/PackageSurfaceArea/PackageHeaders")
- self._GuidDeclarations("/PackageSurfaceArea/GuidDeclarations")
- self._ProtocolDeclarations("/PackageSurfaceArea/ProtocolDeclarations")
- self._PpiDeclarations("/PackageSurfaceArea/PpiDeclarations")
- self._PcdDeclarations("/PackageSurfaceArea/PcdDeclarations")
-
- def Postprocess(self):
- # setup guid, protocol, ppi
- for guid in self._Elements["GuidDeclarations"]:
- if guid.CName in self.Guids:
- print "! Duplicate GUID CName (%s) in package %s" % (guid.CName, self.Path)
- self.Guids[guid.CName] = guid
-
- for protocol in self._Elements["ProtocolDeclarations"]:
- if protocol.CName in self.Protocols:
- print "! Duplicate Protocol CName (%s) in package %s" % (protocol.CName, self.Path)
- self.Protocols[protocol.CName] = protocol
-
- for ppi in self._Elements["PpiDeclarations"]:
- if ppi.CName in self.Ppis:
- print "! Duplicate PPI CName (%s) in package (%s)" % (ppi.CName, self.Path)
- self.Ppis[ppi.CName] = ppi
-
- # package header
- for inc in self._Elements["PackageHeaders"]:
- if inc.ModuleType not in self.PackageIncludes:
- self.PackageIncludes[inc.ModuleType] = []
- self.PackageIncludes[inc.ModuleType].append(inc.Path)
-
- # library class
- for lcd in self._Elements["LibraryClassDeclarations"]:
- if lcd.Name in self.LibraryInterfaces:
- raise "Duplicate library class: " + lcd.Name
- self.LibraryInterfaces[lcd.Name] = lcd
-
- # parse mas files
- # self.ParseMsaFile()
- # resolve RecommendedInstance
-
- def ParseMsaFile(self):
- for msaFilePath in self._Elements["MsaFiles"]:
- self.Modules.append(ModuleSurfaceArea(self._Workspace, self, msaFilePath))
-
-class PlatformSurfaceArea(FrameworkElement.Platform, SurfaceAreaElement):
- def __init__(self, workspace, path):
- FrameworkElement.Platform.__init__(self)
-
- self.Path = os.path.normpath(path)
- self.Dir = os.path.dirname(self.Path)
- SurfaceAreaElement.__init__(self, workspace)
-
- def _PlatformHeader(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- self.Name = XmlElementData(XmlNode(dom, "/PlatformHeader/PlatformName"))
- self.GuidValue = XmlElementData(XmlNode(dom, "/PlatformHeader/GuidValue")).upper()
- self.Version = XmlElementData(XmlNode(dom, "/PlatformHeader/Version"))
-
- def _PlatformDefinitions(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- self.Archs = XmlElementData(XmlNode(dom, "/PlatformDefinitions/SupportedArchitectures")).split()
- if self.Archs == []:
- raise Exception("No ARCH specified in platform " + self.Path)
- self.Targets = XmlElementData(XmlNode(dom, "/PlatformDefinitions/BuildTargets")).split()
- self.OutputPath = os.path.normpath(XmlElementData(XmlNode(dom, "/PlatformDefinitions/OutputDirectory")))
-
- def _Flash(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
-
- def _FrameworkModules(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- moduleList = XmlList(dom, "/FrameworkModules/ModuleSA")
- modules = []
- for m in moduleList:
- modules.append(PlatformModule(self._Workspace, self, m))
- self._Elements["FrameworkModules"] = modules
-
- def _DynamicPcdBuildDefinitions(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
-
- def _BuildOptions(self, xpath):
- dom = XmlNode(self._Root, xpath)
- if dom == '': return
- self.BuildOptions = self.GetBuildOptionList(XmlNode(dom, "/BuildOptions/Options"))
- # print self.BuildOptions
-
- def _UserExtensions(self, xpath):
- domList = XmlList(self._Root, xpath)
- if domList == []: return
- for extension in domList:
- userId = XmlAttribute(extension, "UserID")
- identifier = XmlAttribute(extension, "Identifier")
-
- if userId == '' or identifier == '':
- raise Exception("No UserId or Identifier specified")
- if userId != "TianoCore": continue
- if identifier not in self.UserExtensions:
- self.UserExtensions[identifier] = []
-
- contentList = self.UserExtensions[identifier]
- for node in extension.childNodes:
- # print node.nodeType
- contentList.append(node.cloneNode(True))
-
- def Parse(self):
- self._Root = xml.dom.minidom.parse(self._Workspace.SubPath(self.Path))
- assert self._Root.documentElement.tagName == "PlatformSurfaceArea"
-
- self._PlatformHeader("/PlatformSurfaceArea/PlatformHeader")
- self._PlatformDefinitions("/PlatformSurfaceArea/PlatformDefinitions")
- self._Flash("/PlatformSurfaceArea/Flash")
- self._FrameworkModules("/PlatformSurfaceArea/FrameworkModules")
- self._DynamicPcdBuildDefinitions("/PlatformSurfaceArea/DynamicPcdBuildDefinitions")
- self._BuildOptions("/PlatformSurfaceArea/BuildOptions")
- self._UserExtensions("/PlatformSurfaceArea/UserExtensions")
-
- def Postprocess(self):
- # summarize all library modules for build
- for module in self._Elements["FrameworkModules"]:
- for arch in module.Archs:
- if arch not in self.Modules:
- self.Modules[arch] = []
- self.Modules[arch].append(module)
-
- if arch not in self.Libraries:
- self.Libraries[arch] = []
- for li in module.Libraries:
- if li in self.Libraries[arch]: continue
- self.Libraries[arch].append(li)
-
- # FV
- for fvName in module.FvBindings:
- if fvName not in self.Fvs:
- self.Fvs[fvName] = []
- self.Fvs[fvName].append(module)
- # build options
- # user extension
-
-## def SetupEnvironment(self):
-## self.Environment["PLATFORM"] = self.Name
-## self.Environment["PLATFORM_GUID"] = self.GuidValue
-## self.Environment["PLATFORM_VERSION"] = self.Version
-## self.Environment["PLATFORM_RELATIVE_DIR"] = self.Path
-## self.Environment["PLATFORM_OUTPUT_DIR"] = self.OutputPath
-
-def PrintWorkspace(ws):
- print "\nPlatforms:\n"
- for guid in ws.PlatformXref["GUID"]:
- for ver in ws.PlatformXref["GUID"][guid]:
- platform = ws.PlatformXref["GUID"][guid][ver]
- print " %s %s-%s" % (guid, platform.Name, ver)
- for pm in platform.Modules:
- print " %-40s %-10s <%s-%s>" % (pm.Module.Name+"-"+pm.Module.Version,
- ListString(pm.Archs), pm.Module.Package.Name,
- pm.Module.Package.Version)
- for li in pm.Libraries:
- print " %-47s <%s-%s>" % (li.Module.Name+"-"+li.Module.Version,
- li.Module.Package.Name, li.Module.Package.Version)
- print ""
-
- print "\nPackages:\n"
- for guid in ws.PackageXref["GUID"]:
- for ver in ws.PackageXref["GUID"][guid]:
- print " %s %s-%s" % (guid, ws.PackageXref["GUID"][guid][ver].Name, ver)
-
- print "\nModules:\n"
- for guid in ws.ModuleXref["GUID"]:
- for ver in ws.ModuleXref["GUID"][guid]:
- for module in ws.ModuleXref["GUID"][guid][ver]:
- print " %s %-40s [%s-%s]" % (guid, module.Name+"-"+ver, module.Package.Name, module.Package.Version)
- print " Depending on packages:"
- for arch in module.IncludePaths:
- print " ", arch, ":"
- for path in module.IncludePaths[arch]:
- print " ", path
- print "\n"
-
- for arch in module.IncludeFiles:
- print " ", arch, ":"
- for path in module.IncludeFiles[arch]:
- print " ", path
- print "\n"
-
- print " Source files:"
- for arch in module.SourceFiles:
- print " ", arch, ":"
- for type in module.SourceFiles[arch]:
- for src in module.SourceFiles[arch][type]:
- print " %-40s (%s)" % (src.Path, src.Type)
- print "\n"
- print "\nLibrary Classes:"
- for name in ws.LibraryInterfaceXref["NAME"]:
- lcList = ws.LibraryInterfaceXref["NAME"][name]
- for lc in lcList:
- pkgPath = os.path.dirname(lc.Package.Path)
- print "\n [%s] <%s>" % (lc.Name, pkgPath + os.path.sep + lc.Path)
-
- print " Produced By:"
- for li in lc.Instances:
- print " %-40s <%s>" % (li.Name+"-"+li.Version, li.Package.SubPath(li.Path))
-
- print " Consumed By:"
- for li in lc.Consumers:
- print " %-40s <%s>" % (li.Name+"-"+li.Version, li.Package.SubPath(li.Path))
-
- print "\nActive Platform:"
- for arch in ws.ActivePlatform.Libraries:
- print " Library Instances (%s) (%d libraries)" % (arch , len(ws.ActivePlatform.Libraries[arch]))
- for li in ws.ActivePlatform.Libraries[arch]:
- print " %s-%s (%s-%s)" % (li.Module.Name, li.Module.Version,
- li.Module.Package.Name, li.Module.Package.Version)
-
- for arch in ws.ActivePlatform.Modules:
- print " Driver Modules (%s) (%d modules)" % (arch, len(ws.ActivePlatform.Modules[arch]))
- for m in ws.ActivePlatform.Modules[arch]:
- print " %s-%s (%s-%s)" % (m.Module.Name, m.Module.Version,
- m.Module.Package.Name, m.Module.Package.Version)
-
- for fv in ws.ActivePlatform.Fvs:
- print
- print " Firmware Volume (%s) (%d modules)" % (fv, len(ws.ActivePlatform.Fvs[fv]))
- for m in ws.ActivePlatform.Fvs[fv]:
- print " %s-%s (%s-%s)" % (m.Module.Name, m.Module.Version,
- m.Module.Package.Name, m.Module.Package.Version)
-
-# for test
-if __name__ == "__main__":
- # os.environ["WORKSPACE"]
- workspacePath = os.getenv("WORKSPACE", os.getcwd())
- saFile = ""
- if len(sys.argv) <= 1:
- saFile = os.path.join(workspacePath, "Tools/Conf/FrameworkDatabase.db")
- else:
- saFile = sys.argv[1]
-
- print "Parsing ... %s\n" % saFile
-
- startTime = time.clock()
- sa = Workspace(workspacePath, [], [])
- # sa = PackageSurfaceArea(saFile)
- # sa = PlatformSurfaceArea(saFile)
- # sa = ModuleSurfaceArea(saFile)
- # print sa
-
- PrintWorkspace(sa)
- print "\n[Finished in %fs]" % (time.clock() - startTime)
-
diff --git a/Tools/Python/buildgen/module_build_path.txt b/Tools/Python/buildgen/module_build_path.txt
deleted file mode 100644
index e5c8ed103d..0000000000
--- a/Tools/Python/buildgen/module_build_path.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-BIN_DIR=${PLATFORM_BUILD_DIR}/${ARCH}
-MODULE_BUILD_DIR=${BIN_DIR}/${PACKAGE_RELATIVE_DIR}/${MODULE_RELATIVE_DIR}/${MODULE_FILE_BASE_NAME}
-DEST_DIR_OUTPUT=${MODULE_BUILD_DIR}/OUTPUT
-DEST_DIR_DEBUG=${MODULE_BUILD_DIR}/DEBUG
-
diff --git a/Tools/Python/buildgen/platform_build_path.txt b/Tools/Python/buildgen/platform_build_path.txt
deleted file mode 100644
index 1218ac0ff8..0000000000
--- a/Tools/Python/buildgen/platform_build_path.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-BUILD_DIR=${WORKSPACE_DIR}/${PLATFORM_OUTPUT_DIR}
-PLATFORM_BUILD_DIR=${BUILD_DIR}/${TARGET}_${TOOLCHAIN}
-TARGET_DIR=${PLATFORM_BUILD_DIR}
-FV_DIR=${TARGET_DIR}/FV
-
diff --git a/Tools/Python/far-template b/Tools/Python/far-template
deleted file mode 100644
index 62a54d5a87..0000000000
--- a/Tools/Python/far-template
+++ /dev/null
@@ -1,48 +0,0 @@
-# This file is a template to be used in creating a Framework Archive Manifest.
-# Each entry can be assigned to a string, which is quoted, or to a string that
-# spans mutliple lines, which is triple quoted. Lists of strings are placed
-# inside of square brackets.
-# This file should be passed as a command line argument to the MkFar.py script.
-# It is used to help the user control how the far is created.
-
-# The filename to give the new far.
-far.FileName = "my.far"
-
-# The user readable name to give the far.
-far.FarName = "My Far"
-
-# The version of the far.
-far.Version = "0.3"
-
-# The license terms of the far.
-far.License="""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."""
-
-# Short description.
-far.Abstract = "Its a good far."
-
-# Long description.
-far.Description="""This Package provides headers and libraries that conform to
-my wishes."""
-
-# Copyright string to be placed inside the far.
-far.Copyright="Copyright (c) 2006, My Corporation."
-
-# A list of workspace-relative paths to the .spd files that should be
-# placed inside this far.
-far.SpdFiles=[]
-
-# A list of workspace-relative paths to the .fpd files that should be
-# placed inside this far.
-far.FpdFiles=[]
-
-# A list of workspace-relative paths to the extra files that should be
-# placed inside this far. Extra files are ones that are not part of
-# an spd or msa or fpd.
-far.ExtraFiles=["tools_def_for_this_package.template", "setup.sh"]
-
-# vim:syntax=python
diff --git a/Tools/Tools.spd b/Tools/Tools.spd
deleted file mode 100644
index f5d08878f4..0000000000
--- a/Tools/Tools.spd
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<PackageSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <SpdHeader>
- <PackageName>Tools</PackageName>
- <GuidValue>53f84ca0-53fe-4412-b4e7-dcec602e1d49</GuidValue>
- <Version>2.0</Version>
- <Abstract>TianoCore.org EDK II Tools</Abstract>
- <Description>This package provides the tools needed to create EFI/Framework platform
- binary files (PBF) and EFI/Framework Modules that can be incorporated
- into a PBF. Source Code is provided for all C and Java applications.
- This package also provides the directory structure and templates for
- configuration files.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
- <License>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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </SpdHeader>
- <PackageDefinitions>
- <ReadOnly>false</ReadOnly>
- <RePackage>true</RePackage>
- </PackageDefinitions>
- <MsaFiles>
- <Filename>AllResourceFiles.msa</Filename>
- <Filename>CCode/Source/TianoTools.msa</Filename>
- <Filename>Java/Source/CheckTools/CheckTools.msa</Filename>
- <Filename>Java/Source/Common/Common.msa</Filename>
- <Filename>Java/Source/ContextTool/ContextTool.msa</Filename>
- <Filename>Java/Source/Cpptasks/CppTasks.msa</Filename>
- <Filename>Java/Source/DbTools/DbTools.msa</Filename>
- <Filename>Java/Source/FrameworkTasks/FrameworkTasks.msa</Filename>
- <Filename>Java/Source/FrameworkWizard/FrameworkWizard.msa</Filename>
- <Filename>Java/Source/GenBuild/GenBuild.msa</Filename>
- <Filename>Java/Source/Merge/Merge.msa</Filename>
- <Filename>Java/Source/MigrationTools/MigrationTools.msa</Filename>
- <Filename>Java/Source/PcdTools/PcdTools.msa</Filename>
- <Filename>Java/Source/SurfaceArea/SurfaceArea.msa</Filename>
- </MsaFiles>
-</PackageSurfaceArea>
diff --git a/Tools/XMLSchema/FarManifest.xsd b/Tools/XMLSchema/FarManifest.xsd
deleted file mode 100644
index 744ec58b4e..0000000000
--- a/Tools/XMLSchema/FarManifest.xsd
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Filename: FarManifest.xsd
-
-Copyright (c) 2006, Intel Corp.
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which 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.
-
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.TianoCore.org/2006/Edk2.0" xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <xs:include schemaLocation="FrameworkHeaders.xsd"/>
- <xs:annotation>
- <xs:documentation xml:lang="en">
- The Framework Archive File Format is defined as a Java Archive file, with a special xml file called FrameworkArchiveManifest.xml at the top of the archive. The FrameworkArchiveManifest.xml must be an instance of this schema.
- </xs:documentation>
- </xs:annotation>
- <xs:element name="FrameworkArchiveManifest">
- <xs:annotation>
- <xs:documentation xml:lang="en">
- This schema defines the Framework Archive Manifest.
- </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" ref="FarHeader"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="FarPackageList">
- <xs:annotation>
- <xs:documentation>
- The list of packages in this FAR.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="1" ref="FarPlatformList">
- <xs:annotation>
- <xs:documentation>
- The list of platforms in this FAR.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="1" ref="Contents">
- <xs:annotation>
- <xs:documentation>
- Extra contents that are not part of any Package or Platform. These file paths are WORKSPACE relative. If a file exists in the workspace at this location, then the user should be asked whether to overwrite. When the user removes the far, these should be removed also, unless they have been modified (per md5sum).
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="UserExtensions"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FarPackageList">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="FarPackage"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FarPackage">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="FarFilename">
- <xs:annotation>
- <xs:documentation>
- This is the name of the .spd or file that describes the package. It must exist in the directory identified by DefaultPath.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element ref="GuidValue"></xs:element>
- <xs:element ref="Version"></xs:element>
- <xs:element ref="DefaultPath">
- <xs:annotation>
- <xs:documentation>
- This is the default installation location within the workspace. This also serves as the location within the far itself of the package root. The Contents of the pacakage will be found there. The user may choose some other location within the workspace to install the package, as long as it does not overlap a package that is already installed.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="1" ref="FarPlatformList">
- <xs:annotation>
- <xs:documentation>
- This list of platforms is relative to the package root of the package that they are contained in. If the package that these are bound to is intstalled in some directory other than the default, then these platforms should be stored relative to that.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element ref="Contents">
- <xs:annotation>
- <xs:documentation>
- This is the list of files that belong to the package. They are specified by relative path from the root of the pacakge.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="UserExtensions"></xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FarPlatform">
- <xs:annotation>
- <xs:documentation>
- Platforms are treated separately from packages. A platform is listed in the far if, and only if, it is not part of some package.
- </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="FarFilename">
- <xs:annotation>
- <xs:documentation>
- This is the relative path to the .fpd file that describes the platform.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element ref="GuidValue"></xs:element>
- <xs:element ref="Version"></xs:element>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="UserExtensions"></xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="DefaultPath" type="PathAndFilename"/>
- <xs:element name="FarPlatformList">
- <xs:complexType>
- <xs:sequence>
- <xs:element maxOccurs="unbounded" ref="FarPlatform">
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FarFilename" type="DbPathAndFilename">
- <xs:annotation>
- <xs:documentation>
- The FarFilename is used to build up the Contents list. It has an md5sum attribute for keeping track of whether the file is changed after it is installed. The Md5sum can also be used to check the integrity of a far before it is installed into the workspace.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="GuidValue" type="GuidType">
- <xs:annotation>
- <xs:documentation>
- The purpose of this element is to allow Guids to be assigned to or used by other elements in the schema.
- </xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="Contents">
- <xs:annotation>
- <xs:documentation>
- This tag allows us to specify a tree of files all having a common root. All the files specified are relative to that common root.
- </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element maxOccurs="unbounded" ref="FarFilename"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:annotation>
- <xs:documentation xml:lang="en">
- Definitions and rules for creating, installing, updating and removing fars within the workspace.
- </xs:documentation>
- <xs:documentation>
- 1. A module m is said to depend upon a package p, iff there exists a tuple (PackageGuid, PackageVerion) in the set m->PackageDependencies for which p->Guid==PackageGuid, and if PackageVersion is not empty, then p->Version== PackageVersion.
- </xs:documentation>
- <xs:documentation>
- 2. A far f is said to depend on a far g, iff there is a module in a package in f that depends on a package in g.
- </xs:documentation>
- <xs:documentation>
- 3. A far f is said to depend on a package p, iff there is a module m contained in f that depends on p.
- </xs:documentation>
- <xs:documentation>
- 3.1 A platform q is said to depend on a package p, iff p, or some module m contained in p, is necessary to build q.
- </xs:documentation>
- <xs:documentation>
- 4. A far f may be installed into the workspace w, iff for each module m in f, m's dependencies are met by the packages in w or f.
- </xs:documentation>
- <xs:documentation>
- a. It is supported to "partially" install a far. A partial installation of a far means that 1 or more packages and/or platforms are installed into the workspace from the far. For each package or platform p in f, p's dependencies must be satisfied by a package in the workspace.
- </xs:documentation>
- <xs:documentation>
- 5. A far f may be removed from the workspace w, iff for each module m in w, and for each package p in f, m does not depend on p.
- </xs:documentation>
- <xs:documentation>
- a. It is supported to "partially" remove a far. In this case, one or more of the packages or platforms in the far can be removed, provided that for each package and platform p in the workspace w, there does not exist a module m such that m depends on p.
- </xs:documentation>
- <xs:documentation>
- 6. When installing a far f into workspace w, for each package p in f, allow the user to install in p's default location, or choose a new location l (which must be unoccupied) within the workspace. Record this location l in the database. Each package p in f will be recorded in the database, associated with the GUID of f, as well as the actual install location l. (So we will know which far each package belongs to.)
- </xs:documentation>
- <xs:documentation>
- 7. When installing a far f into workspace w, if there exists a package p in w, and p is in f, then the user must be prompted to choose a location that does not collide with the location of p in workspace w. We will end up with two instances of p in w at two distinct locations. Alternately, the user may elect to partially install the far, leaving out the redundant package.
- </xs:documentation>
- <xs:documentation>
- 8. A far f may replace a far g in the workspace w, iff for each module m contained in w, if m depends on a package p, and p is only contained in g, then there must exist a package q in f, such that m depends on q. The net effect is that g is removed and f is installed, in one operation. The normal rules for installing f still apply--the dependencies of the modules of f must be satisfied. After the replacement, it must be the case that all the modules dependencies in the workspace are satisfied. Note that it is possible to backrev a package in this way.
- </xs:documentation>
- <xs:documentation>
- (If we find that the replace is not permitted, then the user may install f and keep g. Next, he could _port_ every module m in w that depends on g, to f and eventually remove g.)
- </xs:documentation>
- <xs:documentation>
- 9. A special case of the above rule is that a far f may be reinstalled into the workspace. (This would allow the user to get a fresh copy, or change the location in the workspace where one or more of the packages of f are installed.)
- </xs:documentation>
- <xs:documentation>
- 10. When a far f is removed from the workspace w, for each package p in f, we will remove p from w.
- </xs:documentation>
- <xs:documentation>
- 11. If a package or platform p belongs to a far f, then it is legal to remove p from the workspace w iff, there does not exist a module m in w such that m depends on p.
- </xs:documentation>
- <xs:documentation>
- 12. When a far f is removed from the workspace, the we will remove all the files in f from the workspace tree. If a file has been modified from the original as installed from the far (per md5sum) then the user should be asked if he is "sure" he wants to remove it.
- </xs:documentation>
- <xs:documentation>
- 13. When a far is created, a GUID is generated and assigned to the far. If a far is created from the same components at a later time, it would have a different GUID.
- </xs:documentation>
- <xs:documentation>
- 14. If a package p is marked with p->RePackage==false, then p may not be added to a far.
- </xs:documentation>
- <xs:documentation>
- 15. When constructing a far f that contains at least one platform, then f may optionally be constructed such that for each platform q in f, every package p on which q depends should be included in f, unless p->RePackage==false. The far will have all the packages required, and may then be installed as a self-inflating executable that will create a brand new workspace on the developer's workstation.
- </xs:documentation>
- <xs:documentation>
- 16. A far f is identical to a far g, iff f->Guid == g->Guid.
- </xs:documentation>
- <xs:documentation>
- 17. A far f may be installed into the workspace w, iff there is no far g in w such that f->Guid==g->Guid. In that case, it is called "updating" the far in the workspace. The user may select some subset of packages or platforms to reinstall or update, to ensure that the files in the workspace are correct.
- </xs:documentation>
- </xs:annotation>
-</xs:schema>
diff --git a/Tools/XMLSchema/FrameworkDataAttributes.xsd b/Tools/XMLSchema/FrameworkDataAttributes.xsd
deleted file mode 100644
index 2f8b8aff85..0000000000
--- a/Tools/XMLSchema/FrameworkDataAttributes.xsd
+++ /dev/null
@@ -1,297 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://www.TianoCore.org/2006/Edk2.0" targetNamespace="http://www.TianoCore.org/2006/Edk2.0">
- <!--
- Filename: FrameworkDataAttributes.xsd
-
- Copyright (c) 2006, Intel Corp.
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which 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.
-
- -->
- <xs:annotation>
- <xs:documentation xml:lang="en">This schema defines EFI and Framework Attribute. Only attributeGroups are specified in this file. </xs:documentation>
- </xs:annotation>
- <xs:include schemaLocation="NamingConvention.xsd"/>
- <xs:include schemaLocation="FrameworkDataTypes.xsd"/>
- <xs:include schemaLocation="FrameworkPlatformDataTypes.xsd"/>
- <!-- Fix Name data type from xs:string -->
- <xs:attributeGroup name="BlockAttributes">
- <xs:attribute name="Name" type="BlockNameType" use="required"/>
- <xs:attribute name="Size" type="HexAddressType" use="required"/>
- <xs:attribute name="Flags" type="HexAddressType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="BootModeAttributes">
- <xs:attribute name="BootModeName" type="BootModeNames" use="required"/>
- <xs:attribute name="Usage" type="BootModeUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="DataHubAttributes">
- <xs:attribute name="Usage" type="DataHubUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="EventAttributes">
- <xs:attribute name="Usage" type="EventUsage" use="required"/>
- <xs:attribute name="EventGuidCName" type="C_NameType" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="ExternAttributes">
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="FfsAttributes">
- <xs:attribute name="FfsFormatKeyword" type="KeywordType" use="required"/>
- <xs:attribute name="FfsFileType" type="EfiFfsFileTypes" use="optional"/>
- <xs:attribute name="FfsAttribTailPresent" type="xs:boolean" use="optional"/>
- <xs:attribute name="FfsAttribRecovery" type="xs:boolean" use="optional" default="false"/>
- <xs:attribute name="FfsAttribDataAlignment" type="FfsDataAlignmentType" use="optional"/>
- <xs:attribute name="FfsAttribChecksumRequired" type="xs:boolean" use="optional" default="true"/>
- <xs:attribute name="SupModuleList" type="ModuleListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="FilenameAttributes">
- <xs:attribute name="TagName" type="ToolsNameConvention" use="optional"/>
- <xs:attribute name="ToolCode" type="ToolsNameConvention" use="optional"/>
- <xs:attribute name="ToolChainFamily" type="ToolsNameConvention" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="FlashDeviceImageAttributes">
- <xs:attribute name="Name" type="xs:string" use="required"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="FlashDeviceImageFileAttributes">
- <xs:attribute name="Name" type="xs:string" use="required"/>
- <xs:attribute name="Region" type="xs:string" use="required"/>
- <xs:attribute name="SubRegion" type="xs:string" use="optional"/>
- <xs:attribute name="Optional" type="xs:boolean" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="FlashDeviceInfoAttributes">
- <xs:attribute name="Name" type="xs:string" use="required"/>
- <xs:attribute name="Size" type="HexAddressType" use="required"/>
- <xs:attribute name="BaseAddress" type="HexAddressType" use="required"/>
- <xs:attribute name="ErasePolarity" type="Polarity" use="required"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="FvRegionNameAttributes">
- <xs:attribute name="FvBaseAddressPcdCName" type="C_NameType" use="required"/>
- <xs:attribute name="FvRegionSizePcdCName" type="C_NameType" use="required"/>
- <xs:attribute name="FvRegionAlignmentPcdCName" type="C_NameType" use="optional"/>
- <xs:attribute name="FvPcdTokenSpaceGuid" type="GuidType" use="optional"/>
- <xs:attribute name="Alignment" type="xs:positiveInteger" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="GuidAttributes">
- <xs:attribute name="Usage" type="GuidUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="GuidDeclarationAttributes">
- <xs:attribute name="Name" type="UiNameType" use="required"/>
- <xs:attribute name="GuidTypeList" type="GuidListType" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="SupModuleList" type="ModuleListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="HiiPackageAttributes">
- <xs:attribute name="Usage" type="HiiPackageUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="HobAttributes">
- <xs:attribute name="Usage" type="HobUsage" use="required"/>
- <xs:attribute name="HobGuidCName" type="C_NameType" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="IncludeHeaderAttributes">
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- <xs:attribute name="SupModuleList" type="ModuleListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="IndustryStdHeaderAttributes">
- <xs:attribute name="Name" type="KeywordType" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="SupModuleList" type="ModuleListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="LibraryAttributes">
- <!-- LibraryAttributes is used for Libraries / Library elements in FPD files -->
- <xs:attribute name="ModuleGuid" type="GuidType" use="required"/>
- <xs:attribute name="ModuleVersion" type="VersionDataType" use="optional"/>
- <xs:attribute name="PackageGuid" type="GuidType" use="required"/>
- <xs:attribute name="PackageVersion" type="VersionDataType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="LibraryClassAttributes">
- <xs:attribute name="Usage" type="LibraryUsage" use="required"/>
- <xs:attribute name="RecommendedInstanceVersion" type="VersionDataType" use="optional"/>
- <xs:attribute name="RecommendedInstanceGuid" type="GuidType" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- <xs:attribute name="SupModuleList" type="ModuleListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="LibraryClassDeclarationAttributes">
- <xs:attribute name="Name" type="KeywordType" use="required"/>
- <xs:attribute name="RecommendedInstanceVersion" type="VersionDataType" use="optional"/>
- <xs:attribute name="RecommendedInstanceGuid" type="GuidType" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="SupModuleList" type="ModuleListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="MsaGuidAttributes">
- <xs:attribute name="Usage" type="GuidUsage" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="ModuleNameAttributes">
- <xs:attribute name="ModuleGuid" type="GuidType" use="required"/>
- <xs:attribute name="ModuleName" type="UiNameType" use="optional"/>
- <xs:attribute name="ModuleVersion" type="VersionDataType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="MsaAttributes">
- <xs:attribute name="PackageGuid" type="GuidType" use="required"/>
- <xs:attribute name="ModuleGuid" type="GuidType" use="required"/>
- <xs:attribute name="ModuleVersion" type="VersionDataType" use="optional"/>
- <xs:attribute name="PackageVersion" type="VersionDataType" use="optional"/>
- <xs:attribute name="ForceDebug" type="xs:boolean" default="false" use="optional"/>
- <xs:attribute name="BindingOrder" type="xs:int" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="OptionAttributes">
- <xs:attribute name="BuildTargets" type="BuildTargetList" use="optional"/>
- <xs:attribute name="ToolChainFamily" type="ToolsNameConvention" use="optional"/>
- <xs:attribute name="TagName" type="ToolsNameConvention" use="optional"/>
- <xs:attribute name="ToolCode" type="ToolsNameConvention" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PackageHeaderAttributes">
- <xs:attribute name="ModuleType" type="ModuleTypeDef" use="required"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PackageAttributes">
- <!-- Used with the MSA File, PackageDependencies.Package -->
- <xs:attribute name="PackageGuid" type="GuidType" use="required"/>
- <xs:attribute name="PackageVersion" type="VersionDataType" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PackageNameAttributes">
- <!--Used with the FrameworkDatabase PackageList.Packagename -->
- <xs:attribute name="PackageGuid" type="GuidType" use="required"/>
- <xs:attribute name="PackageVersion" type="VersionDataType" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="DynamicBuildPcdAttributes">
- <xs:annotation>
- <xs:documentation xml:lang="en">These attributes are for the Pcds listed in PcdData, PcdEntry and/or PcdBuildData entries.</xs:documentation>
- </xs:annotation>
- <xs:attribute name="ItemType" type="PcdItemTypes" use="required"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PcdBuildDefinitionAttributes">
- <xs:attribute name="ItemType" type="PcdItemTypes" use="required"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PcdCodedAttributes">
- <!-- We need to modify ALL the MSA files that have PcdCoded sections to
- set the PcdUsage. Once we modify all the MSA files and we modify the
- wizard and the build tools, we need to make this required. -->
- <xs:attribute name="Usage" type="PcdUsage" use="optional"/>
- <xs:attribute name="PcdItemType" type="PcdItemTypes" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PcdDeclarationAttributes">
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="SupModuleList" type="ModuleListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PlatformAttributes">
- <xs:attribute name="PlatformGuid" type="GuidType" use="required"/>
- <xs:attribute name="PlatformVersion" type="VersionDataType" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PpiDeclarationAttributes">
- <xs:attribute name="Name" type="UiNameType" use="required"/>
- <xs:attribute name="GuidTypeList" type="GuidListType" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="SupModuleList" type="ModuleListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PpiAttributes">
- <xs:attribute name="Usage" type="PpiUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="PpiNotifyAttributes">
- <xs:attribute name="Usage" type="PpiNotifyUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="ProcessStepAttributes">
- <xs:annotation>
- <xs:documentation xml:lang="en">Attributes are either compressable and/or sequence order binding</xs:documentation>
- </xs:annotation>
- <xs:attribute name="BindingOrder" type="xs:int" use="optional"/>
- <xs:attribute name="SectionType" type="EfiSectionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="ProtocolAttributes">
- <xs:attribute name="Usage" type="ProtocolUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="ProtocolDeclarationAttributes">
- <xs:attribute name="Name" type="UiNameType" use="required"/>
- <xs:attribute name="GuidTypeList" type="GuidListType" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="SupModuleList" type="ModuleListType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="ProtocolNotifyAttributes">
- <xs:attribute name="Usage" type="ProtocolNotifyUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="RawDataAttributes">
- <xs:attribute name="Name" type="xs:string" use="required"/>
- <xs:attribute name="Region" type="xs:string" use="required"/>
- <xs:attribute name="SubRegion" type="xs:string" use="required"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="RegionAttributes">
- <xs:attribute name="Name" type="xs:string" use="required"/>
- <xs:attribute name="Size" type="HexAddressType" use="required"/>
- <xs:attribute name="Flags" type="HexAddressType" use="optional"/>
- <xs:attribute name="Attributes" type="xs:string" use="required"/>
- <xs:attribute name="AreaType" type="EfiFvAreaType" use="required"/>
- <xs:attribute name="Alignment" type="HexAddressType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="SectionsAttributes">
- <xs:annotation>
- <xs:documentation xml:lang="en">Attributes for Sections, EncapsulationTag and EncapsulationType</xs:documentation>
- </xs:annotation>
- <xs:attribute name="BindingOrder" type="xs:nonNegativeInteger" use="optional"/>
- <xs:attribute name="Compressible" type="xs:boolean" default="true" use="optional"/>
- <xs:attribute name="SectionType" type="EfiSectionType" use="optional"/>
- <xs:attribute name="EncapsulationType" type="xs:normalizedString" use="optional"/>
- <xs:attribute name="Alignment" type="xs:string" use="optional"/>
- <xs:attribute name="ToolName" type="xs:string" use="optional"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="SubRegionAttributes">
- <xs:attribute name="CreateHob" type="xs:boolean" use="required"/>
- <xs:attribute name="Name" type="xs:string" use="required"/>
- <xs:attribute name="Size" type="HexAddressType" use="required"/>
- <xs:attribute name="Attributes" type="xs:string" use="required"/>
- <xs:attribute name="AreaType" type="EfiFvAreaType" use="required"/>
- <xs:attribute name="NameGuid" type="xs:string" use="required"/>
- <xs:attribute name="AreaTypeGuid" type="xs:string" use="optional"/>
- <xs:attribute name="FileSystemGuid" type="xs:string" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="SystemTableAttributes">
- <xs:attribute name="Usage" type="SystemTableUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="UrlAttribute">
- <xs:attribute name="Url" type="xs:anyURI"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="VariableAttributes">
- <xs:attribute name="Usage" type="VariableUsage" use="required"/>
- <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
- <xs:attribute name="FeatureFlag" type="FeatureFlagExpressionType" use="optional"/>
- </xs:attributeGroup>
-</xs:schema>
diff --git a/Tools/XMLSchema/FrameworkDataElements.xsd b/Tools/XMLSchema/FrameworkDataElements.xsd
deleted file mode 100644
index 977020829b..0000000000
--- a/Tools/XMLSchema/FrameworkDataElements.xsd
+++ /dev/null
@@ -1,939 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://www.TianoCore.org/2006/Edk2.0" targetNamespace="http://www.TianoCore.org/2006/Edk2.0">
- <!--
- Filename: FrameworkDataElements.xsd
-
- Copyright (c) 2006, Intel Corp.
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which 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.
-
- -->
- <xs:annotation>
- <xs:documentation xml:lang="en"> This schema defines EFI and Framework Data Elements </xs:documentation>
- </xs:annotation>
- <xs:include schemaLocation="NamingConvention.xsd"/>
- <xs:include schemaLocation="FrameworkDataTypes.xsd"/>
- <xs:include schemaLocation="FrameworkPlatformDataTypes.xsd"/>
- <xs:include schemaLocation="FrameworkDataAttributes.xsd"/>
- <xs:element name="Abstract" type="Sentence">
- <xs:annotation>
- <xs:documentation xml:lang="en">Abstract is valid for all Description Files</xs:documentation>
- <xs:documentation xml:lang="en">This section is required. This is a single sentence to describe the module and will be used in sample files as the abstract data in the header comment section.</xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="AntTask">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is a sub-element of UserDefinedAntTasks</xs:documentation>
- <xs:documentation xml:lang="en">Define a file that contains one or more ant tasks that are to be added into or replacing of sequences of build steps. These files will be called using the ant-call task on a file name. These files must be valid apache-ant formatted task files.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="1" name="AntCmdOptions" type="xs:normalizedString"/>
- <xs:element minOccurs="0" maxOccurs="1" name="Filename" type="PathAndFilename"/>
- </xs:sequence>
- <xs:attribute name="Id" type="xs:int" use="required"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="BootModes">
- <xs:annotation>
- <xs:documentation xml:lang="en">BootModes is valid for all Description Files</xs:documentation>
- <xs:documentation xml:lang="en">This is a list of BootModes Supported by the Module</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="BootMode">
- <xs:complexType>
- <xs:sequence minOccurs="0">
- <xs:element name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="BootModeAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="BuildOptions">
- <xs:annotation>
- <xs:documentation xml:lang="en">BuildOptions is valid for FPD files.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="1" ref="UserDefinedAntTasks"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="Options"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="UserExtensions"/>
- <!-- The following sections are legacy and will be removed -->
- <xs:element minOccurs="0" maxOccurs="unbounded" name="Ffs">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="Attribute">
- <xs:complexType>
- <xs:attribute name="Name" type="C_NameType"/>
- <xs:attribute name="Value" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="1" name="Sections">
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element name="Section" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref=" Filenames " minOccurs="0"/>
- <xs:element name="Args" type=" ArgsType " minOccurs="0"/>
- <xs:element name="OutFile" type=" FileNameConvention " minOccurs="0"/>
- <xs:element name="OutputFileExtension" type=" xs:string " minOccurs="0"/>
- <xs:element name="ToolName" type=" ToolType " minOccurs="0"/>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Sections" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element name="Section">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref=" Filenames " minOccurs="0"/>
- <xs:element name="Args" type=" ArgsType " minOccurs="0"/>
- <xs:element name="OutFile" type=" FileNameConvention " minOccurs="0"/>
- <xs:element name="OutputFileExtension" type=" xs:string " minOccurs="0"/>
- <xs:element name="ToolName" type=" ToolType " minOccurs="0"/>
- </xs:sequence>
- <xs:attributeGroup ref="SectionsAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="FfsKey" type="KeywordType" use="optional"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Copyright" type="Paragraph"/>
- <xs:element name="DataHubs">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is a list of DataHubRecord elements.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="DataHubRecord">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="DataHubCName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="DataHubAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="DefaultValue">
- <xs:annotation>
- <xs:documentation xml:lang="en">The default setting of a PCD entry.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:normalizedString"/>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="Description" type="Paragraph">
- <xs:annotation>
- <xs:documentation xml:lang="en">This section is required for new modules and libraries and must contain more information than the Abstract.</xs:documentation>
- </xs:annotation>
- </xs:element>
- <xs:element name="DynamicPcdBuildDefinitions">
- <xs:annotation>
- <xs:documentation xml:lang="en">Child of Framework Platform Description (FPD)</xs:documentation>
- <xs:documentation xml:lang="en">FPD uses this PCD information for Dynamic PCDs Only</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdBuildData">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="C_Name" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="Token" type="TokenDataType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="TokenSpaceGuidCName" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="DatumType" type="PcdDataTypes"/>
- <xs:element minOccurs="0" maxOccurs="1" name="MaxDatumSize" type="DatumSizeLimitation"/>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="SkuInfo">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="SkuId" type="xs:nonNegativeInteger"/>
- <xs:choice>
- <xs:group minOccurs="0" maxOccurs="1" ref="HiiEnable"/>
- <xs:group minOccurs="0" maxOccurs="1" ref="VpdEnable"/>
- <xs:group minOccurs="0" maxOccurs="1" ref="DefaultGroup"/>
- </xs:choice>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attributeGroup ref="DynamicBuildPcdAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Events">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is a list of MSA Events</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="1" name="CreateEvents">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="EventTypes">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="EventType" type="EventTypes"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="EventAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="1" name="SignalEvents">
- <xs:annotation>
- <xs:documentation xml:lang="en">Module has an event that is waiting to be signaled. Event is named by GUID.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="EventTypes">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="EventType" type="EventTypes"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="EventAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Externs">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is a child of MSA files.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element minOccurs="0" maxOccurs="1" name="PcdIsDriver" type="PcdDriverTypes"/>
- <xs:element minOccurs="0" maxOccurs="1" name="TianoR8FlashMap_h" type="xs:boolean" default="false"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="Specification" type="Sentence"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="Extern">
- <xs:complexType>
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation xml:lang="en">Driver Module</xs:documentation>
- </xs:annotation>
- <xs:element minOccurs="0" maxOccurs="1" name="ModuleEntryPoint" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="ModuleUnloadImage" type="C_NameType"/>
- </xs:sequence>
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation xml:lang="en">Library Module</xs:documentation>
- </xs:annotation>
- <xs:element minOccurs="0" maxOccurs="1" name="Constructor" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="Destructor" type="C_NameType"/>
- </xs:sequence>
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation xml:lang="en">Allow multiple entries for DriverBinding, ComponentName, DriverConfig and DriverDiag elements. For ComponentName, DriverConfig and/or DriverDiag - you must have a 1:1 mapping to DriverBinding if the element is defined.</xs:documentation>
- <xs:documentation xml:lang="en">Permit User Defined Extern Tags</xs:documentation>
- </xs:annotation>
- <xs:element minOccurs="1" maxOccurs="1" name="DriverBinding" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="ComponentName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="DriverConfig" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="DriverDiag" type="C_NameType"/>
- </xs:sequence>
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation xml:lang="en"> Module Call Backs</xs:documentation>
- </xs:annotation>
- <xs:element minOccurs="0" maxOccurs="1" name="SetVirtualAddressMapCallBack" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="ExitBootServicesCallBack" type="C_NameType"/>
- </xs:sequence>
- </xs:choice>
- <xs:attributeGroup ref="ExternAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Filename">
- <xs:annotation>
- <xs:documentation xml:lang="en">Describe the valid content of a filename This should extend PathAndFilename - Variable names not allowed here!</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="PathAndFilename">
- <xs:attributeGroup ref="FilenameAttributes"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="Filenames">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is a list of Filenames</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="Filename"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="GuidDeclarations">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is a child of PackageSurfaceArea (SPD) </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="C_Name" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidValue" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="GuidDeclarationAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Guids">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="GuidCNames">
- <xs:annotation>
- <xs:documentation xml:lang="en">Describe the valid content of a GUID element in and MSA file.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidCName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="GuidAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="HiiPackages">
- <xs:annotation>
- <xs:documentation xml:lang="en">Describe the list of a HiiPackage elements</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="HiiPackage">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="HiiCName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="HiiPackageAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Hobs">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="HobTypes">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="HobType" type="HobTypes"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="HobAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="IncludeHeader">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="PathAndFilename">
- <xs:attributeGroup ref="IncludeHeaderAttributes"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="IndustryStdIncludes">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="IndustryStdHeader"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="IndustryStdHeader">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="IncludeHeader" type="PathAndFilename"/>
- <xs:element minOccurs="1" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="IndustryStdHeaderAttributes"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Libraries">
- <xs:annotation>
- <xs:documentation xml:lang="en">Different (Module) Instances of Libraries used ONLY in FPD Files.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Instance">
- <xs:complexType>
- <xs:attributeGroup ref="LibraryAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="LibraryClass">
- <xs:annotation>
- <xs:documentation xml:lang="en">Used in MSA files. This defines what class of library is being supported = produced (library module) or consumed by a module.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="Keyword" type="KeywordType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="LibraryClassAttributes"/>
- </xs:complexType>
- </xs:element>
- <!-- LAH This is SPD LibraryClassDeclarations FINAL version -->
- <xs:element name="LibraryClassDeclarations">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="LibraryClass">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="IncludeHeader" type="PathAndFilename"/>
- <xs:element minOccurs="1" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="LibraryClassDeclarationAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="LibraryClassDefinitions">
- <xs:annotation>
- <xs:documentation xml:lang="en">This section defines what Classes of Library that this library supports. A Library may belong to multiple different library classes.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="LibraryClass"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="License">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="Paragraph">
- <xs:attribute name="URL" type="xs:anyURI" use="optional"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="ModuleBuildOptions">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="1" ref="Options"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="UserExtensions"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="ModuleSaBuildOptions">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="1" name="FvBinding" type="KeywordList"/>
- <!-- The FfsFileNameGuid allows the Platform Integrator to specify a GUID for the FFS File Name GUID -->
- <xs:element minOccurs="0" maxOccurs="1" name="FfsFileNameGuid" type="GuidType"/>
- <!-- If binding is specified, you MUST specify the FfsFormatKey -->
- <xs:element minOccurs="0" maxOccurs="1" name="FfsFormatKey" type="KeywordType"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="Options"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="ModuleDefinitions">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="SupportedArchitectures" type="ArchListType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="BinaryModule" type="xs:boolean" default="false"/>
- <xs:element minOccurs="1" maxOccurs="1" name="OutputFileBasename" type="FileNameConvention"/>
- <xs:element minOccurs="0" maxOccurs="1" name="ClonedFrom">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Cloned">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="PackageGuid" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="PackageVersion" type="VersionDataType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="ModuleGuid" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="ModuleVersion" type="VersionDataType"/>
- </xs:sequence>
- <!-- The Id is a number used to track heritage the first entry will be 0 and increment from then on. -->
- <xs:attribute name="Id" type="xs:nonNegativeInteger" use="required"/>
- <!-- If the original module was installed from a FAR, track the FAR it came from. -->
- <xs:attribute name="FarGuid" type="GuidType" use="optional"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="ModuleType" type="ModuleTypeDef">
- <xs:annotation>
- <xs:documentation xml:lang="en">Describe the valid EFI Phase that the Module is designed to execute under.</xs:documentation>
- </xs:annotation>
- </xs:element>
- <!-- Use in Final -->
- <xs:element name="MsaFiles">
- <xs:annotation>
- <xs:documentation xml:lang="en">MsaFiles is a child of Surface Area Package Description (SPD) files</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename" type="PathAndFilename"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Options">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="Option"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="NonProcessedFiles">
- <xs:complexType>
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element name="Filename" type="PathAndFilename"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Option">
- <!-- This element is used to store flags from the Tools -->
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:normalizedString">
- <xs:attributeGroup ref="OptionAttributes"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="PackageDefinitions">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="ReadOnly" type="xs:boolean" default="false"/>
- <xs:element minOccurs="1" maxOccurs="1" name="RePackage" type="xs:boolean" default="false"/>
- <xs:element minOccurs="0" maxOccurs="1" name="ClonedFrom">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Cloned">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="PackageGuid" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="PackageVersion" type="VersionDataType"/>
- </xs:sequence>
- <!-- The Id is a number used to track heritage the first entry will be 0 and increment from then on. -->
- <xs:attribute name="Id" type="xs:nonNegativeInteger" use="required"/>
- <!-- If the original Package was installed from a FAR, track the FAR it came from. -->
- <xs:attribute name="FarGuid" type="GuidType" use="optional"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="PackageDependencies">
- <xs:annotation>
- <xs:documentation xml:lang="en">This tag is used in the Module Surface Area Description File (MSA) to track package dependencies for a module.</xs:documentation>
- <xs:documentation xml:lang="en">Attributes to PackageName include Required: Usage PackageGuid PackageVesion, Optional: FeatureFlag</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Package">
- <xs:complexType>
- <xs:attributeGroup ref="PackageAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="PackageHeaders">
- <xs:annotation>
- <xs:documentation xml:lang="en">PackageHeaders is a child of PackageSurfaceArea (SPD) </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="IncludePkgHeader">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="PathAndFilename">
- <xs:attributeGroup ref="PackageHeaderAttributes"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="PackageList">
- <!-- Valid for DB usage only! -->
- <xs:annotation>
- <xs:documentation xml:lang="en">This tag is used in the Framework Package Database File to track all packages (SPD files) installed in a workspace. (Database)</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename" type="DbPathAndFilename"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <!-- PcdBuildDefinition is a child of FPD ModuleSA element for FIXED_AT_BUILD, PATCHABLE_IN_MODULE, and FEATURE_FLAG PCDS Only! -->
- <xs:element name="PcdBuildDefinition">
- <xs:annotation>
- <xs:documentation xml:lang="en">Child of FPD ModuleSA element for FIXED_AT_BUILD, PATCHABLE_IN_MODULE, and FEATURE_FLAG PCDS Only!</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdData">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="C_Name" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="Token" type="TokenDataType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="TokenSpaceGuidCName" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="DatumType" type="PcdDataTypes"/>
- <!-- MaxDatumSize is only required if the DatumType is VOID* -->
- <xs:element minOccurs="0" maxOccurs="1" name="MaxDatumSize" type="DatumSizeLimitation"/>
- <xs:element minOccurs="0" maxOccurs="1" name="Value" type="DefaultValueType"/>
- </xs:sequence>
- <xs:attributeGroup ref="PcdBuildDefinitionAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:group name="DefaultGroup">
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="Value" type="DefaultValueType"/>
- </xs:sequence>
- </xs:group>
- <xs:group name="HiiEnable">
- <xs:annotation>
- <xs:documentation xml:lang="en">If HiiEnable group is specified, then HiiEnable is default true</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="VariableName" type="HexWordArrayType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="VariableGuid" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="VariableOffset" type="Hex64BitDataType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="HiiDefaultValue" type="DefaultValueType"/>
- </xs:sequence>
- </xs:group>
- <xs:group name="VpdEnable">
- <xs:annotation>
- <xs:documentation xml:lang="en">If VpdEnable group is specified, then VpdEnable is default true</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="VpdOffset" type="Hex64BitDataType"/>
- </xs:sequence>
- </xs:group>
- <xs:element name="PcdCoded">
- <xs:annotation>
- <xs:documentation xml:lang="en">Child of Module Surface Area Description (MSA)</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="C_Name" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="TokenSpaceGuidCName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="DefaultValue" type="DefaultValueType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <!-- MSA file declares a single usage, and must match one of the entries in what the SPD file declares as the set of possible Item Types. -->
- <xs:attributeGroup ref="PcdCodedAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <!-- LAH This is PcdDeclarations FINAL version -->
- <xs:element name="PcdDeclarations">
- <xs:annotation>
- <xs:documentation xml:lang="en">PcdDeclaratins is a child of Package Surface Area Description (SPD)</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element maxOccurs="unbounded" name="PcdEntry">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="C_Name" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="Token" type="TokenDataType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="TokenSpaceGuidCName" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="DatumType" type="PcdDataTypes"/>
- <xs:element minOccurs="1" maxOccurs="1" name="ValidUsage" type="PcdListType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="DefaultValue" type="DefaultValueType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="PcdDeclarationAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FarList">
- <!-- Valid for DB usage only! -->
- <xs:annotation>
- <xs:documentation xml:lang="en">This tag is used in the Framework Package Database File to track all DISTRIBUTION packages (FAR files) installed in a workspace. (Database)</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename" type="DbPathAndFilename"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FfsFormatDeclarations">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="FfsFormatDeclaration">
- <!-- Required Attributes are the FfsFormatKeyword and SupModuleList -->
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="ProcessStep"/>
- </xs:sequence>
- <xs:attributeGroup ref="FfsAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="PpiDeclarations">
- <xs:annotation>
- <xs:documentation xml:lang="en">PpiDeclarations is a child of PackageSurfaceArea (SPD) </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="C_Name" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidValue" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="PpiDeclarationAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="PPIs">
- <xs:annotation>
- <xs:documentation xml:lang="en">Provide for one or more Ppi or PpiNotify sections. </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element minOccurs="0" maxOccurs="unbounded" name="Ppi">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="PpiCName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="PpiAttributes"/>
- </xs:complexType>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="PpiNotify">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="PpiNotifyCName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="PpiNotifyAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="ProtocolDeclarations">
- <xs:annotation>
- <xs:documentation xml:lang="en">ProtocolDeclarations is a child of PackageSurfaceArea (SPD) </xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="C_Name" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidValue" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="ProtocolDeclarationAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Protocols">
- <xs:annotation>
- <xs:documentation xml:lang="en">If either Protocol or ProtocolNotify sections are needed, one or more of them should be specified within this section</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="Protocol">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="ProtocolCName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="ProtocolAttributes"/>
- </xs:complexType>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="ProtocolNotify">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="ProtocolNotifyCName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="ProtocolNotifyAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="ProcessStep">
- <xs:complexType>
- <xs:sequence>
- <!-- The following is a macro for Apache ANT -->
- <xs:element minOccurs="0" maxOccurs="1" name="MacroDefFile">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="PathAndFilename">
- <xs:attribute name="MacroName" type="KeywordType" use="required"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <!-- The following is for System Executables -->
- <xs:element minOccurs="0" maxOccurs="1" name="ToolName" type="xs:NCName"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="ToolArgs" type="xs:normalizedString"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="InputPattern" type="xs:normalizedString"/>
- <xs:element minOccurs="0" maxOccurs="1" name="OutputPattern" type="xs:normalizedString"/>
- </xs:sequence>
- <xs:attributeGroup ref="ProcessStepAttributes"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="SourceFiles">
- <xs:annotation>
- <xs:documentation xml:lang="en">Multiple Filenames may be specified, and they may also be scoped to a specific Architecture.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="Filename"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="SkuInfo">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="UiSkuName">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="UiNameType">
- <xs:attribute name="SkuID" type="xs:nonNegativeInteger" use="required"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="SystemTables">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is list of System Table elements.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="SystemTableCNames">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="SystemTableCName" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="SystemTableAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="UserDefinedAntTasks">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is a sub-element of BuildOptions</xs:documentation>
- <xs:documentation xml:lang="en">Permit Users to define their own custom ANT tasks.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="AntTask"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="UserExtensions">
- <xs:complexType>
- <xs:sequence>
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
- </xs:sequence>
- <xs:attribute name="UserID" type="xs:NCName" use="required"/>
- <xs:attribute name="Identifier" type="xs:string" use="required"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Variables">
- <xs:annotation>
- <xs:documentation xml:lang="en">An MSA FILE list of EFI Variables described by string pair.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Variable">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is an EFI Variable Entry</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="VariableName" type="HexWordArrayType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidC_Name" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="HelpText" type="Paragraph"/>
- </xs:sequence>
- <xs:attributeGroup ref="VariableAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Version" type="VersionDataType"/>
-</xs:schema>
diff --git a/Tools/XMLSchema/FrameworkDataTypes.xsd b/Tools/XMLSchema/FrameworkDataTypes.xsd
deleted file mode 100644
index c2074ff69f..0000000000
--- a/Tools/XMLSchema/FrameworkDataTypes.xsd
+++ /dev/null
@@ -1,561 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://www.TianoCore.org/2006/Edk2.0" targetNamespace="http://www.TianoCore.org/2006/Edk2.0">
- <!--
- Filename: FrameworkDataTypes.xsd
-
- Copyright (c) 2006, Intel Corp.
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which 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.
-
- -->
- <xs:annotation>
- <xs:documentation xml:lang="en">This schema defines EFI and Framework Data Types. Only simpleType are specified in this file. </xs:documentation>
- </xs:annotation>
- <xs:include schemaLocation="NamingConvention.xsd"/>
- <xs:simpleType name="PrimaryArchListType">
- <xs:list itemType="SupportedArchitectures"/>
- </xs:simpleType>
- <xs:simpleType name="ArchListType">
- <xs:restriction base="PrimaryArchListType">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="BlockNameType">
- <xs:restriction base="UCNameType">
- <xs:pattern value="\s*BLOCK[A-F0-9]{2}\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="BootModeNames">
- <xs:restriction base="UCNameType">
- <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:restriction>
- </xs:simpleType>
- <xs:simpleType name="BootModeUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="BuildTargetList">
- <xs:restriction base="BuildTargetUList">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="BuildTargetUList">
- <xs:list itemType="BrUType"/>
- </xs:simpleType>
- <xs:simpleType name="BrUType">
- <xs:union memberTypes="BrType UCNameType"/>
- </xs:simpleType>
- <xs:simpleType name="BrType">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="DEBUG"/>
- <xs:enumeration value="RELEASE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ComponentExecutionPhase">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="MDE"/>
- <xs:enumeration value="SEC"/>
- <xs:enumeration value="PEI_CORE"/>
- <xs:enumeration value="PEIM"/>
- <xs:enumeration value="DXE_CORE"/>
- <xs:enumeration value="DXE_DRIVER"/>
- <xs:enumeration value="DXE_RUNTIME_DRIVER"/>
- <xs:enumeration value="DXE_SAL_DRIVER"/>
- <xs:enumeration value="DXE_SMM_DRIVER"/>
- <xs:enumeration value="UEFI"/>
- <xs:enumeration value="UEFI_APPLICATION"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="DataHubUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="DatumSizeLimitation">
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:maxExclusive value="13777216"/>
- <xs:pattern value="(\s)*[1-9][0-9]*(\s)*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="DefaultValueType">
- <xs:union memberTypes="xs:normalizedString Hex64BitDataType UnicodeString HexByteArrayType"/>
- </xs:simpleType>
- <xs:simpleType name="EfiSectionType">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="EFI_SECTION_FREEFORM_SUBTYPE_GUID"/>
- <xs:enumeration value="EFI_SECTION_VERSION"/>
- <xs:enumeration value="EFI_SECTION_USER_INTERFACE"/>
- <xs:enumeration value="EFI_SECTION_DXE_DEPEX"/>
- <xs:enumeration value="EFI_SECTION_PEI_DEPEX"/>
- <xs:enumeration value="EFI_SECTION_PE32"/>
- <xs:enumeration value="EFI_SECTION_PIC"/>
- <xs:enumeration value="EFI_SECTION_TE"/>
- <xs:enumeration value="EFI_SECTION_RAW"/>
- <xs:enumeration value="EFI_SECTION_COMPRESSION"/>
- <xs:enumeration value="EFI_SECTION_GUID_DEFINED"/>
- <xs:enumeration value="EFI_SECTION_COMPATIBILITY16"/>
- <xs:enumeration value="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="EventTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="EVENT_GROUP_GUID"/>
- <xs:enumeration value="EVENT_TYPE_PERIODIC_TIMER"/>
- <xs:enumeration value="EVENT_TYPE_RELATIVE_TIMER"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="EventUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ExecutionType">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="REL" id="Relocatable"/>
- <xs:enumeration value="NREL" id="Non-Relocatable"/>
- <xs:enumeration value="XIP" id="Execute_In_Place"/>
- <xs:enumeration value="PIC" id="Position_Independent_Code"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ExternType">
- <xs:restriction base="xs:normalizedString">
- <xs:minLength value="1"/>
- <!--<xs:pattern value="((\w)+(\W)*(\s)*)+"/>-->
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ExternUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FileNameUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FeatureFlagExpressionType">
- <xs:restriction base="xs:normalizedString">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FrameworkComponentListType">
- <xs:list itemType="FrameworkComponentTypes"/>
- </xs:simpleType>
- <xs:simpleType name="FrameworkComponentTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="APRIORI"/>
- <xs:enumeration value="SEC"/>
- <xs:enumeration value="LIBRARY"/>
- <xs:enumeration value="FV_IMAGE_FILE"/>
- <xs:enumeration value="BS_DRIVER"/>
- <xs:enumeration value="RT_DRIVER"/>
- <xs:enumeration value="SAL_RT_DRIVER"/>
- <xs:enumeration value="PE32_PEIM"/>
- <xs:enumeration value="PIC_PEIM"/>
- <xs:enumeration value="COMBINED_PEIM_DRIVER"/>
- <xs:enumeration value="PEI_CORE"/>
- <xs:enumeration value="DXE_CORE"/>
- <xs:enumeration value="BS_DRIVER_EFI"/>
- <xs:enumeration value="SHELLAPP"/>
- <xs:enumeration value="BINARY"/>
- <xs:enumeration value="LOGO"/>
- <xs:enumeration value="USER_DEFINED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FrameworkModuleTypes">
- <xs:restriction base="ModuleTypeDef">
- <xs:enumeration value="BASE"/>
- <xs:enumeration value="SEC"/>
- <xs:enumeration value="PEI_CORE"/>
- <xs:enumeration value="PEIM"/>
- <xs:enumeration value="DXE_CORE"/>
- <xs:enumeration value="DXE_DRIVER"/>
- <xs:enumeration value="DXE_RUNTIME_DRIVER"/>
- <xs:enumeration value="DXE_SAL_DRIVER"/>
- <xs:enumeration value="DXE_SMM_DRIVER"/>
- <xs:enumeration value="UEFI_DRIVER"/>
- <xs:enumeration value="UEFI_APPLICATION"/>
- <xs:enumeration value="USER_DEFINED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FvRegionTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="FV_MAIN"/>
- <xs:enumeration value="FV_MAIN_COMPACT"/>
- <xs:enumeration value="NV_STORAGE"/>
- <xs:enumeration value="FV_RECOVERY"/>
- <xs:enumeration value="FV_RECOVERY_FLOPPY"/>
- <xs:enumeration value="FV_FILE"/>
- <xs:enumeration value="CAPSULE_CARGO"/>
- <xs:enumeration value="NULL"/>
- <xs:enumeration value="USER_DEFINED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PrimaryGuidListType">
- <xs:list itemType="GuidTypes"/>
- </xs:simpleType>
- <xs:simpleType name="GuidListType">
- <xs:restriction base="PrimaryGuidListType">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="GuidTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="DATA_HUB_RECORD"/>
- <xs:enumeration value="EFI_EVENT"/>
- <xs:enumeration value="EFI_SYSTEM_CONFIGURATION_TABLE"/>
- <xs:enumeration value="EFI_VARIABLE"/>
- <xs:enumeration value="GUID"/>
- <xs:enumeration value="HII_PACKAGE_LIST"/>
- <xs:enumeration value="HOB"/>
- <xs:enumeration value="TOKEN_SPACE_GUID"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="GuidUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HexByteArrayListType">
- <xs:restriction base="xs:normalizedString">
- <xs:minLength value="4"/>
- <xs:pattern value="\s*((( )?0x[a-fA-F0-9]{2})(,)?)+( )?"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HexByteArrayType">
- <xs:restriction base="xs:normalizedString">
- <xs:minLength value="4"/>
- <xs:pattern value="((\s)*0x([a-fA-F0-9]){2}(,)?(\s)*)+"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HexWordArrayType">
- <xs:restriction base="xs:normalizedString">
- <xs:minLength value="6"/>
- <xs:pattern value="((\s)*0x([a-fA-F0-9]){4}(,)?(\s)*)+"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HiiPackageUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HobTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="PHIT"/>
- <xs:enumeration value="MEMORY_ALLOCATION"/>
- <xs:enumeration value="RESOURCE_DESCRIPTOR"/>
- <xs:enumeration value="GUID_EXTENSION"/>
- <xs:enumeration value="FIRMWARE_VOLUME"/>
- <xs:enumeration value="CPU"/>
- <xs:enumeration value="POOL"/>
- <xs:enumeration value="CAPSULE_VOLUME"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HobUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="IntermediateOutputType">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="MODULE"/>
- <xs:enumeration value="UNIFIED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="LibraryUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ModuleTypeDef">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="BASE"/>
- <xs:enumeration value="SEC"/>
- <xs:enumeration value="PEI_CORE"/>
- <xs:enumeration value="PEIM"/>
- <xs:enumeration value="DXE_CORE"/>
- <xs:enumeration value="DXE_DRIVER"/>
- <xs:enumeration value="DXE_RUNTIME_DRIVER"/>
- <xs:enumeration value="DXE_SAL_DRIVER"/>
- <xs:enumeration value="DXE_SMM_DRIVER"/>
- <xs:enumeration value="TOOL"/>
- <xs:enumeration value="UEFI_DRIVER"/>
- <xs:enumeration value="UEFI_APPLICATION"/>
- <xs:enumeration value="USER_DEFINED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="Md5sumType">
- <xs:restriction base="xs:normalizedString">
- <xs:pattern value="\s*[a-fA-F0-9]{32}\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PrimaryModuleListType">
- <xs:list itemType="FrameworkModuleTypes"/>
- </xs:simpleType>
- <xs:simpleType name="ModuleListType">
- <xs:restriction base="PrimaryModuleListType">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PackageType">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="SOURCE"/>
- <xs:enumeration value="BINARY"/>
- <xs:enumeration value="MIXED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PackageUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PcdListType">
- <xs:restriction base="PrimaryPcdListType">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PrimaryPcdListType">
- <xs:list itemType="PcdItemTypes"/>
- </xs:simpleType>
- <xs:simpleType name="PcdTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="FIXED_AT_BUILD"/>
- <xs:enumeration value="FEATURE_FLAG"/>
- <xs:enumeration value="PATCHABLE_IN_MODULE"/>
- <xs:enumeration value="DYNAMIC"/>
- <xs:enumeration value="DYNAMIC_EX"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PcdDriverTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="PEI_PCD_DRIVER"/>
- <xs:enumeration value="DXE_PCD_DRIVER"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PcdDataTypes">
- <xs:restriction base="xs:normalizedString">
- <xs:enumeration value="UINT8"/>
- <xs:enumeration value="UINT16"/>
- <xs:enumeration value="UINT32"/>
- <xs:enumeration value="UINT64"/>
- <xs:enumeration value="VOID*"/>
- <xs:enumeration value="BOOLEAN"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PcdFeatureFlagUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PcdItemTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="FEATURE_FLAG"/>
- <xs:enumeration value="FIXED_AT_BUILD"/>
- <xs:enumeration value="PATCHABLE_IN_MODULE"/>
- <xs:enumeration value="DYNAMIC"/>
- <xs:enumeration value="DYNAMIC_EX"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PcdUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PpiNotifyUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PpiUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ProtocolNotifyUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ProtocolUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="TO_START"/>
- <xs:enumeration value="BY_START"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="SkuListType">
- <xs:restriction base="xs:normalizedString">
- <xs:minLength value="1"/>
- <xs:pattern value="\s*(\d)+((,)?(\s)*(\d)+)*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="SupportedArchitectures">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="EBC"/>
- <xs:enumeration value="IA32"/>
- <xs:enumeration value="X64"/>
- <xs:enumeration value="IPF"/>
- <xs:enumeration value="ARM"/>
- <xs:enumeration value="PPC"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="SystemTableUsage">
- <xs:restriction base="UsageTypes">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="TokenDataType">
- <xs:union memberTypes="HexDoubleWordDataType xs:nonNegativeInteger"/>
- </xs:simpleType>
- <xs:simpleType name="ToolChains">
- <xs:restriction base="UCNameType">
- <xs:minLength value="2"/>
- <xs:enumeration value="MSFT"/>
- <xs:enumeration value="INTEL"/>
- <xs:enumeration value="GCC"/>
- <xs:enumeration value="CYGWIN"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="UiNameType">
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:pattern value="[^ ].*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="UnicodeString">
- <xs:restriction base="xs:normalizedString">
- <xs:minLength value="3"/>
- <xs:pattern value="(\s)*L(\:)?&quot;[^&quot;]*&quot;(\s)*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="UsageListType">
- <xs:restriction base="PrimaryUsageList">
- <xs:minLength value="1"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PrimaryUsageList">
- <xs:list itemType="UsageTypes"/>
- </xs:simpleType>
- <!-- UsageTypes describes all of the Usage Attributes that are defined in the Module Surface Area Specification -->
- <xs:simpleType name="UsageTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <xs:enumeration value="TO_START"/>
- <xs:enumeration value="BY_START"/>
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="VariableOffsetValues">
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:pattern value="\s*\d+(:)?\d*\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="VariableUsage">
- <xs:restriction base="UsageTypes">
- <!-- Module requires the variable entry to be set -->
- <xs:enumeration value="ALWAYS_CONSUMED"/>
- <!-- Module will use the variable entry if it's set -->
- <xs:enumeration value="SOMETIMES_CONSUMED"/>
- <!-- Module Always will write the variable -->
- <xs:enumeration value="ALWAYS_PRODUCED"/>
- <!-- Module sometimes writes the variable -->
- <xs:enumeration value="SOMETIMES_PRODUCED"/>
- <!-- Variable is produced and consumed only by this module -->
- <xs:enumeration value="PRIVATE"/>
- </xs:restriction>
- </xs:simpleType>
- <!-- Complex Data Types -->
- <xs:complexType name="DbPathAndFilename">
- <xs:simpleContent>
- <xs:extension base="PathAndFilename">
- <xs:attribute name="FarGuid" type="GuidType" use="optional"/>
- <xs:attribute name="Md5sum" type="Md5sumType"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- <xs:complexType name="ArgsType">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Arg" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="ToolType">
- <xs:sequence>
- <xs:element name="ToolName" type="xs:string"/>
- <xs:element name="ToolArgs" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
-</xs:schema>
diff --git a/Tools/XMLSchema/FrameworkHeaders.xsd b/Tools/XMLSchema/FrameworkHeaders.xsd
deleted file mode 100644
index cee80f2d58..0000000000
--- a/Tools/XMLSchema/FrameworkHeaders.xsd
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.TianoCore.org/2006/Edk2.0" xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <!--
- Filename: FrameworkHeaders.xsd
-
- Copyright (c) 2006, Intel Corp.
-
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which 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.
-
- APPROVED: 14-Jun-2006
- -->
- <xs:include schemaLocation="FrameworkDataElements.xsd"/>
- <xs:element name="FdbHeader">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is the header for the Framework Package Database (DB) file.</xs:documentation>
- <xs:documentation xml:lang="en">The Guid MUST change if backward compatibility breaks caused by a new release of XML Schema.</xs:documentation>
- <xs:documentation xml:lang="en">The Version will change if a minor change to XML Schema has been made, but backward compatiblity is maintained.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="DatabaseName" type="UiNameType" fixed="FrameworkDatabase"/>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidValue" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Version"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Abstract"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Description"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Copyright"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="License"/>
- <xs:element minOccurs="1" maxOccurs="1" name="Specification" type="Sentence" default="FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FarHeader">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is the header for the Framework Archive Manifest file.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="FarName" type="UiNameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidValue" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Version"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Abstract"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Description"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Copyright"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="License"/>
- <xs:element minOccurs="1" maxOccurs="1" name="Specification" type="Sentence" default="FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="MsaHeader">
- <xs:annotation>
- <xs:documentation xml:lang="en">This header is for the Module Surface Area Description (MSA) files</xs:documentation>
- <xs:documentation xml:lang="en">The Guid MUST change if the Module changes break backward compatibility.</xs:documentation>
- <xs:documentation xml:lang="en">The Version MUST change if the Module changes, however, backward compatiblity is maintained.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="ModuleName" type="UiNameType"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="ModuleType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidValue" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Version"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Abstract"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Description"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Copyright"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="License"/>
- <xs:element minOccurs="1" maxOccurs="1" name="Specification" type="Sentence" default="FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="PlatformHeader">
- <xs:annotation>
- <xs:documentation xml:lang="en">This header is for the Framework Platform Description (FPD) files.</xs:documentation>
- <xs:documentation xml:lang="en">The Guid MUST change if the FPD changes break backward compatibility.</xs:documentation>
- <xs:documentation xml:lang="en">The Version MUST change if the FPD changes, however, backward compatiblity is maintained.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="PlatformName" type="UiNameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidValue" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Version"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Abstract"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Description"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Copyright"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="License"/>
- <xs:element minOccurs="1" maxOccurs="1" name="Specification" type="Sentence" default="FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="SpdHeader">
- <xs:annotation>
- <xs:documentation xml:lang="en">This head is for the Surface Area Package Description file (SPD)</xs:documentation>
- <xs:documentation xml:lang="en">The Guid MUST change when the contents of the file undergo MAJOR FUNCTIONALITY changes.</xs:documentation>
- <xs:documentation xml:lang="en">The Version MUST change when the contents of the file undergo MINOR FUNCTIONALITY changes.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="PackageName" type="UiNameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="GuidValue" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Version"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Abstract"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Description"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="Copyright"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="License"/>
- <xs:element minOccurs="1" maxOccurs="1" name="Specification" type="Sentence" default="FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-</xs:schema>
diff --git a/Tools/XMLSchema/FrameworkPlatformDataElements.xsd b/Tools/XMLSchema/FrameworkPlatformDataElements.xsd
deleted file mode 100644
index 85ed426f95..0000000000
--- a/Tools/XMLSchema/FrameworkPlatformDataElements.xsd
+++ /dev/null
@@ -1,437 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://www.TianoCore.org/2006/Edk2.0" targetNamespace="http://www.TianoCore.org/2006/Edk2.0">
- <!--
- Filename: FrameworkPlatformDataElements.xsd
-
- Copyright (c) 2006, Intel Corp.
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which 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.
-
- -->
- <xs:annotation>
- <xs:documentation xml:lang="en"> This schema defines EFI and Framework Platform Data Elements that are specific to platform creation.</xs:documentation>
- </xs:annotation>
- <xs:include schemaLocation="NamingConvention.xsd"/>
- <xs:include schemaLocation="FrameworkDataAttributes.xsd"/>
- <xs:include schemaLocation="FrameworkDataTypes.xsd"/>
- <xs:include schemaLocation="FrameworkDataElements.xsd"/>
- <xs:include schemaLocation="FrameworkPlatformDataTypes.xsd"/>
- <xs:element name="DataArray">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="HexByteArrayType">
- <xs:attribute name="Name" type="xs:normalizedString" use="required"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="DataId">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:NCName">
- <xs:attribute name="Seq" type="xs:nonNegativeInteger" use="required"/>
- <xs:attribute name="SubRegion" type="UCNameType" use="required"/>
- <xs:attribute name="DataSource" type="xs:normalizedString" use="required"/>
- <xs:attribute name="SourceType" type="xs:NCName" use="required"/>
- <xs:attribute name="DataSize" type="HexAddressType" use="optional"/>
- <xs:attribute name="Alignment" type="xs:positiveInteger" use="optional"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="DataRegions">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="FvDataRegion">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="DataId"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="DataArray"/>
- </xs:sequence>
- <xs:attribute name="Name" type="UCNameType" use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Flash">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="1" ref="FlashDefinitionFile"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="FvImages"/>
- </xs:sequence>
- <xs:attribute name="MicrocodeFile" type="PathAndFilename" use="optional"/>
- </xs:complexType>
- </xs:element>
- <!-- Valid Flash Definition Files that can be used for a platform The UiName and Perferred tags are optional, for use with Wizards.-->
- <xs:element name="FlashDefinitionFile">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="PathAndFilename">
- <!-- Id will be required eventually. -->
- <xs:attribute name="Id" type="KeywordType" use="optional"/>
- <xs:attribute name="UiName" type="UiNameType" use="optional"/>
- <xs:attribute name="Preferred" type="xs:boolean" use="optional" default="false"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <!-- For Future Use! -->
- <!-- This describes the physical layout of the hardware device, used by tools to verify different regions fit within a given number of blocks. -->
- <!-- An EFI Region MUST start on a block boundary. A region may span multiple blocks. -->
- <xs:element name="FlashDevice">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="PartNumber" type="xs:NCName"/>
- <xs:choice>
- <xs:sequence minOccurs="0">
- <!-- Use this sequence for a part with fixed block sizes -->
- <xs:element minOccurs="1" maxOccurs="1" name="NumBlocks" type="xs:positiveInteger"/>
- <xs:element minOccurs="1" maxOccurs="1" name="BlockSize" type="HexAddressType"/>
- </xs:sequence>
- <xs:sequence minOccurs="0">
- <!-- Use this sequence for a part with variable block sizes -->
- <xs:element maxOccurs="unbounded" name="VariableBlockSize">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="HexAddressType">
- <xs:attribute name="BlockNum" type="xs:nonNegativeInteger" use="required"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:choice>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FlashDeviceDefinitions">
- <xs:complexType>
- <xs:annotation>
- <xs:documentation xml:lang="en">We allow specifying the FlashMap filename</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="FlashDefinitionFile"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="FvImages"/>
- <!-- DataRegions is for Future Use! -->
- <xs:element minOccurs="0" maxOccurs="1" ref="DataRegions"/>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="FvImageBindingSequence"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FrameworkModules">
- <xs:annotation>
- <xs:documentation xml:lang="en">This is used in a Framework Platform Description (FPD) file</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="ModuleSA"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FvAttribute">
- <xs:complexType>
- <xs:attribute name="Name" type="xs:NCName" use="required"/>
- <xs:attribute name="Value" type="xs:normalizedString" use="required"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="FwImage">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" ref="FvRegionName"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="FvOption"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="FvAttribute"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="FvImageBindingSequence">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="ValidRegionNameListType">
- <xs:attribute name="PartId" type="KeywordType" use="required"/>
- <xs:attribute name="OutputFile" type="PathAndFilename" use="required"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="FvImages">
- <xs:annotation>
- <xs:documentation xml:lang="en">This section allows the user to define specific information regarding the FvImage</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:choice>
- <xs:sequence minOccurs="0">
- <!-- This is the current style -->
- <xs:element minOccurs="0" maxOccurs="unbounded" name="NameValue">
- <xs:complexType>
- <xs:attribute name="Name" type="xs:string" use="required"/>
- <xs:attribute name="Value" type="xs:string" use="required"/>
- </xs:complexType>
- </xs:element>
- <xs:choice>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="FvImage">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="FvImageNames" type="xs:NCName"/>
- <xs:element minOccurs="0" maxOccurs="1" name="FvImageOptions">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="NameValue">
- <xs:complexType>
- <xs:attribute name="Name" type="xs:string" use="required"/>
- <xs:attribute name="Value" type="xs:string" use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="Type" type="FvImageTypes" use="optional"/>
- </xs:complexType>
- </xs:element>
- </xs:choice>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="FvImageName">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="FvImageOptions">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="NameValue">
- <xs:complexType>
- <xs:attribute name="Name" type="xs:string" use="required"/>
- <xs:attribute name="Value" type="xs:string" use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="Name" type="FvRegionTypes" use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:choice>
- </xs:complexType>
- </xs:element>
- <xs:element name="FvRegionName">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="KeywordType">
- <xs:attributeGroup ref="FvRegionNameAttributes"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element name="ModuleSA">
- <xs:annotation>
- <xs:documentation xml:lang="en">This element is used to specify information in the FPD ModuleSA section.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="1" ref="Libraries"/>
- <!-- Only specification is allow here. We need to let this be an addtion OR, if the WORD portion MATCHES, this entry takes precedence.</xs:documentation -->
- <xs:element minOccurs="0" maxOccurs="unbounded" name="Specification" type="Sentence"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="PcdBuildDefinition"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="ModuleSaBuildOptions"/>
- <!-- The following BuildOptions Sections is for Legacy Ffs -->
- <xs:element minOccurs="0" maxOccurs="1" name="BuildOptions">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="1" ref="UserDefinedAntTasks"/>
- <xs:element minOccurs="0" maxOccurs="1" name="ImageEntryPoint" type="C_NameType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="OutputDirectory">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:anyURI">
- <xs:attribute default="UNIFIED" name="IntermediateDirectories" use="optional">
- <xs:simpleType>
- <xs:restriction base="UCNameType">
- <xs:enumeration value="MODULE"/>
- <xs:enumeration value="UNIFIED"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="1" name="Ffs">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="1" name="Attribute">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="Name" type="C_NameType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="Value" type="C_NameType"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element minOccurs="0" maxOccurs="1" name="Sections">
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element name="Section" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref=" Filenames " minOccurs="0"/>
- <xs:element name="Args" type=" ArgsType " minOccurs="0"/>
- <xs:element name="OutFile" type=" FileNameConvention " minOccurs="0"/>
- <xs:element name="OutputFileExtension" type=" xs:string " minOccurs="0"/>
- <xs:element name="ToolName" type=" ToolType " minOccurs="0"/>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Sections" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element name="Section">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref=" Filenames " minOccurs="0"/>
- <xs:element name="Args" type=" ArgsType " minOccurs="0"/>
- <xs:element name="OutFile" type=" FileNameConvention " minOccurs="0"/>
- <xs:element name="OutputFileExtension" type=" xs:string " minOccurs="0"/>
- <xs:element name="ToolName" type=" ToolType " minOccurs="0"/>
- </xs:sequence>
- <xs:attributeGroup ref="SectionsAttributes"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="Sections">
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element name="Section" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref=" Filenames " minOccurs="0"/>
- <xs:element name="Args" type=" ArgsType " minOccurs="0"/>
- <xs:element name="OutFile" type=" FileNameConvention " minOccurs="0"/>
- <xs:element name="OutputFileExtension" type=" xs:string " minOccurs="0"/>
- <xs:element name="ToolName" type=" ToolType " minOccurs="0"/>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Sections" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element name="Section">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref=" Filenames " minOccurs="0"/>
- <xs:element name="Args" type=" ArgsType " minOccurs="0"/>
- <xs:element name="OutFile" type=" FileNameConvention " minOccurs="0"/>
- <xs:element name="OutputFileExtension" type=" xs:string " minOccurs="0"/>
- <xs:element name="ToolName" type=" ToolType " minOccurs="0"/>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attributeGroup ref=" SectionsAttributes "/>
- </xs:complexType>
- </xs:element>
- <xs:element name="Options">
- <xs:complexType>
- <xs:sequence>
- <xs:element name=" Option " minOccurs="1" maxOccurs="unbounded">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base=" xs:normalizedString ">
- <xs:attribute name="BuildTargets" type=" BuildTargetList " use="optional"/>
- <xs:attribute name="ToolChainFamily" type=" ToolsNameConvention " use="optional"/>
- <xs:attribute name="TagName" type=" ToolsNameConvention " use="optional"/>
- <xs:attribute name="ToolCommand" type=" ToolsNameConvention " use="optional"/>
- <xs:attribute name="SupArchList" type=" ArchListType " use="optional"/>
- <xs:attribute name="Platform" type=" UiNameType " use="optional"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <!-- Do not use ToolChain - it is a legacy value -->
- <xs:attribute name="ToolChain" type="ToolChains" use="optional"/>
- <xs:attribute name="BuildTargets" type=" BuildTargetList " use="optional"/>
- <xs:attribute name="ToolChainFamily" type=" ToolsNameConvention " use="optional"/>
- <xs:attribute name="TagName" type=" ToolsNameConvention " use="optional"/>
- <xs:attribute name="ToolCommand" type=" ToolsNameConvention " use="optional"/>
- <xs:attribute name="SupArchList" type=" ArchListType " use="optional"/>
- </xs:complexType>
- </xs:element>
- <!-- The following Externs Section is for Legacy Ffs -->
- <xs:element minOccurs="0" maxOccurs="1" name="Externs">
- <xs:complexType>
- <xs:sequence minOccurs="1">
- <xs:element name="PcdIsDriver" type=" PcdDriverTypes " minOccurs="0" maxOccurs="1"/>
- <xs:element name="Specification" type=" Sentence " minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="Extern" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:choice minOccurs="1">
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:element name=" ModuleEntryPoint " type=" C_NameType " minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name=" ModuleUnloadImage " type=" C_NameType " minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:element name=" Constructor " type=" C_NameType " minOccurs="0" maxOccurs="1"/>
- <xs:element name=" Destructor " type=" C_NameType " minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:element name=" DriverBinding " type=" C_NameType " minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name=" ComponentName " type=" C_NameType " minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name=" DriverConfig " type=" C_NameType " minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name=" DriverDiag " type=" C_NameType " minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:sequence minOccurs="0" maxOccurs="1">
- <xs:element name=" SetVirtualAddressMapCallBack " type=" C_NameType " minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name=" ExitBootServicesCallBack " type=" C_NameType " minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:choice>
- <xs:attributeGroup ref=" ExternAttributes "/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attributeGroup ref="MsaAttributes"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="FvOption">
- <xs:complexType>
- <xs:attribute name="Name" type="xs:NCName" use="required"/>
- <xs:attribute name="Value" type="xs:normalizedString" use="required"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="PlatformList">
- <!-- Valid for DB usage only! -->
- <xs:annotation>
- <xs:documentation xml:lang="en">This is used in the FrameworkDatabase file</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename" type="DbPathAndFilename"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-</xs:schema>
diff --git a/Tools/XMLSchema/FrameworkPlatformDataTypes.xsd b/Tools/XMLSchema/FrameworkPlatformDataTypes.xsd
deleted file mode 100644
index 014289ff5a..0000000000
--- a/Tools/XMLSchema/FrameworkPlatformDataTypes.xsd
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://www.TianoCore.org/2006/Edk2.0" targetNamespace="http://www.TianoCore.org/2006/Edk2.0">
- <!--
- Filename: FrameworkPlatformDataTypes.xsd
-
- Copyright (c) 2006, Intel Corp.
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which 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.
- -->
- <xs:annotation>
- <xs:documentation xml:lang="en"> This schema defines EFI and Framework Platform Data Types.</xs:documentation>
- </xs:annotation>
- <xs:include schemaLocation="NamingConvention.xsd"/>
- <xs:include schemaLocation="FrameworkDataAttributes.xsd"/>
- <xs:include schemaLocation="FrameworkDataTypes.xsd"/>
- <xs:simpleType name="EfiFfsFileTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="EFI_FV_FILETYPE"/>
- <xs:enumeration value="EFI_FV_FILETYPE_ALL"/>
- <xs:enumeration value="EFI_FV_FILETYPE_RAW"/>
- <xs:enumeration value="EFI_FV_FILETYPE_FREEFORM"/>
- <xs:enumeration value="EFI_FV_FILETYPE_SECURITY_CORE"/>
- <xs:enumeration value="EFI_FV_FILETYPE_PEI_CORE"/>
- <xs:enumeration value="EFI_FV_FILETYPE_DXE_CORE"/>
- <xs:enumeration value="EFI_FV_FILETYPE_PEIM"/>
- <xs:enumeration value="EFI_FV_FILETYPE_DRIVER"/>
- <xs:enumeration value="EFI_VF_FILETYPE_COMBINED_PEIM_DRIVER"/>
- <xs:enumeration value="EFI_VF_FILETYPE_APPLICATION"/>
- <xs:enumeration value="EFI_VF_FILETYPE_FIRMWARE_VOLUME_IMAGE"/>
- <xs:enumeration value="EFI_FV_FILETYPE_FFS_PAD"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="EfiFvAreaType">
- <xs:annotation>
- <xs:documentation xml:lang="en">The list of valid EFI Area Types</xs:documentation>
- </xs:annotation>
- <xs:restriction base="UCNameType">
- <xs:enumeration value="EFI_FLASH_AREA_RECOVERY_BIOS"/>
- <xs:enumeration value="EFI_FLASH_AREA_MAIN_BIOS"/>
- <xs:enumeration value="EFI_FLASH_AREA_PAL_B"/>
- <xs:enumeration value="EFI_FLASH_AREA_RESERVED_03"/>
- <xs:enumeration value="EFI_FLASH_AREA_RESERVED_04"/>
- <xs:enumeration value="EFI_FLASH_AREA_DMI_FRU"/>
- <xs:enumeration value="EFI_FLASH_AREA_OEM_BINARY"/>
- <xs:enumeration value="EFI_FLASH_AREA_RESERVED_07"/>
- <xs:enumeration value="EFI_FLASH_AREA_RESERVED_08"/>
- <xs:enumeration value="EFI_FLASH_AREA_RESERVED_09"/>
- <xs:enumeration value="EFI_FLASH_AREA_RESERVED_0A"/>
- <xs:enumeration value="EFI_FLASH_AREA_EFI_VARIABLES"/>
- <xs:enumeration value="EFI_FLASH_AREA_MCA_LOG"/>
- <xs:enumeration value="EFI_FLASH_AREA_SMBIOS_LOG"/>
- <xs:enumeration value="EFI_FLASH_AREA_FTW_BACKUP"/>
- <xs:enumeration value="EFI_FLASH_AREA_FTW_STATE"/>
- <xs:enumeration value="EFI_FLASH_AREA_UNUSED"/>
- <xs:enumeration value="EFI_FLASH_AREA_GUID_DEFINED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="EfiFvAttributeListType">
- <xs:list itemType="EfiFvAttributeType"/>
- </xs:simpleType>
- <xs:simpleType name="EfiFvAttributeType">
- <xs:annotation>
- <xs:documentation xml:lang="en">The list of EFI_FLASH_AREA Attributes</xs:documentation>
- </xs:annotation>
- <xs:restriction base="UCNameType">
- <xs:enumeration value="EFI_FLASH_AREA_FV"/>
- <xs:enumeration value="EFI_FLASH_AREA_MEMMAPPED_FV"/>
- <xs:enumeration value="EFI_FLASH_AREA_SUBFV"/>
- <xs:enumeration value="EFI_FLASH_AREA_REQUIRED"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="EfiNameGuidType">
- <xs:annotation>
- <xs:documentation xml:lang="en">Right now, only EFI_FLASH_MAP_HOB_GUID is defined</xs:documentation>
- </xs:annotation>
- <xs:restriction base="UCNameType">
- <xs:enumeration value="EFI_FLASH_MAP_HOB_GUID"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FfsDataAlignmentType">
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:pattern value="\s*[0-7]{1}\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FfsNameType">
- <xs:annotation>
- <xs:documentation xml:lang="en"> This defines what an FFS Name can consist of.</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*[a-zA-Z][_\-a-zA-Z0-9]*(\.)?[a-zA-Z0-9]*\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FlashSize">
- <xs:restriction base="xs:string">
- <xs:enumeration value="256KB"/>
- <xs:enumeration value="512KB"/>
- <xs:enumeration value="1MB"/>
- <xs:enumeration value="2MB"/>
- <xs:enumeration value="4MB"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FvImageTypes">
- <xs:restriction base="xs:NCName">
- <xs:enumeration value="Attributes"/>
- <xs:enumeration value="Options"/>
- <xs:enumeration value="Components"/>
- <xs:enumeration value="ImageName"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FvSubRegionTypes">
- <xs:restriction base="UCNameType">
- <xs:enumeration value="NV_VARIABLE_STORE"/>
- <xs:enumeration value="MICROCODE"/>
- <xs:enumeration value="NV_FTW_WORKING"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ValidRegionNameListType">
- <xs:list itemType="KeywordType"/>
- </xs:simpleType>
-</xs:schema>
diff --git a/Tools/XMLSchema/NamingConvention.xsd b/Tools/XMLSchema/NamingConvention.xsd
deleted file mode 100644
index 978a365ff4..0000000000
--- a/Tools/XMLSchema/NamingConvention.xsd
+++ /dev/null
@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.TianoCore.org/2006/Edk2.0" xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <!--
- Filename: NamingConvention.xsd
-
- Copyright (c) 2006, Intel Corp.
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which 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.
-
- -->
- <xs:annotation>
- <xs:documentation xml:lang="en"> This schema defines various data types and naming conventions including: base name, filename and directory naming conventions. These are all simple data types.</xs:documentation>
- </xs:annotation>
- <xs:simpleType name="C_NameType">
- <xs:annotation>
- <xs:documentation xml:lang="en"> C_Names must start with either an underscore (_) character followed by one or more alpha characters, followed by any combination of underscore or alphanumeric characters.</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*(_)*[a-zA-Z]+((_)*[a-zA-Z0-9]*)*\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="FileNameConvention">
- <xs:annotation>
- <xs:documentation xml:lang="en"> This defines what a Filename is: Alphanumeric characters and optional underscore (_) or dash (-) characters, followed by a optional dot and more alphanumeric characters. </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*[a-zA-Z](\.?[\-_a-zA-Z0-9]+)*\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="GuidType">
- <xs:annotation>
- <xs:documentation xml:lang="en"> The GUID data was a union of GuidType1 and GuidType2; standardizing on GuidType2. </xs:documentation>
- </xs:annotation>
- <xs:union memberTypes="GuidType2"/>
- </xs:simpleType>
- <xs:simpleType name="GuidType1">
- <xs:annotation>
- <xs:documentation xml:lang="en"> This defines the minimum specification for a GUID Array which is 8 Hex Digits - 4 Hex Digits - 4 Hex Digits - 8 Hex Bytes, the last 16 Hex Digits can be enclosed in sqiggle {} brackets.</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\})?\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="GuidType2">
- <xs:annotation>
- <xs:documentation xml:lang="en"> 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="Hex64BitDataType">
- <xs:annotation>
- <xs:documentation xml:lang="en">Define a Hex 64 Bit Value to be 0x[a-f0-9]{16}</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*(0x)?[a-fA-F0-9]{1,16}\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HexAddressType">
- <xs:annotation>
- <xs:documentation xml:lang="en">Define a Hex Address, 0x[a-fA-F0-9]{1,16}</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*0x[a-fA-F0-9]{1,16}\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HexByteDataType">
- <xs:annotation>
- <xs:documentation xml:lang="en">Define a Hex Byte Value to be 0x[a-f0-9]{2}</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*(0x)?[a-fA-F0-9]{1,2}\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HexDataType">
- <xs:annotation>
- <xs:documentation xml:lang="en">Define a Hex Value to be 0x[a-f0-9]+</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*0x[a-fA-F0-9]+\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HexDigitType">
- <xs:annotation>
- <xs:documentation xml:lang="en">Define a Hex Diget to be 0x[a-f0-9]</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*[a-fA-F0-9]{1}\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HexDoubleWordDataType">
- <xs:annotation>
- <xs:documentation xml:lang="en">Define a Hex Double Word Value to be 0x[a-f0-9]{8}</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*0x[a-fA-F0-9]{1,8}\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HexWordDataType">
- <xs:annotation>
- <xs:documentation xml:lang="en">Define a Hex Word Value to be 0x[a-f0-9]{4}</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*0x[a-fA-F0-9]{1,4}\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="KeywordList">
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:pattern value="\s*[a-zA-Z]+(\ *_*[a-zA-Z0-9]*)*\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="KeywordType">
- <xs:restriction base="xs:normalizedString">
- <xs:pattern value="\s*[a-zA-Z]+(_*[a-zA-Z0-9]*)*\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="Paragraph">
- <xs:annotation>
- <xs:documentation xml:lang="en">This describes the normal text of a paragraph that can be used in a license or description tag.</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string"/>
- </xs:simpleType>
- <xs:simpleType name="PathAndFilename">
- <xs:annotation>
- <xs:documentation xml:lang="en"> Naming convention for a path and file name</xs:documentation>
- </xs:annotation>
- <xs:union memberTypes="xs:normalizedString xs:anyURI"/>
- </xs:simpleType>
- <xs:simpleType name="Polarity">
- <xs:annotation>
- <xs:documentation xml:lang="en">Limit Polarity vaild values to 0 and 1</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:int">
- <xs:pattern value="\s*0|1\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="Sentence">
- <xs:annotation>
- <xs:documentation xml:lang="en"> This data type requires two or more words </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:normalizedString">
- <xs:pattern value="\s*(\w+\W*)+( )+(\W*\w*\W*\s*)*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ToolsNameConvention">
- <xs:annotation>
- <xs:documentation xml:lang="en">This data type is used for ToolCommand, ToolChainFamily and TagName.</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:NCName">
- <xs:pattern value="\s*[a-zA-Z][a-zA-Z0-9]*\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="UCNameType">
- <xs:annotation>
- <xs:documentation xml:lang="en"> Definition of a UpperCase Name, which can be any combination of upper case characters followed by zero or more underscore and/or uppercase alphanumeric characters </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*[A-Z]+(_*[A-Z0-9]*)*\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="VersionDataType">
- <xs:annotation>
- <xs:documentation xml:lang="en"> Definition of a Version Number, which is one or more strings of decimal digits separated by dots. </xs:documentation>
- <xs:documentation>
- The algorithm to compare two versions A and B is as follows. if A==B, then A is the same version as B. Otherwise, say A is a1.a2.a3...an and B is b1.b2.b3...bn. For the first pair (ai, bi), for i less than n and i less than m, where ai is not equal to bi, if ai is less than bi, then A is less than B. If ai is greater than bi, then A is greater than B.
- </xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:string">
- <xs:pattern value="\s*\d+(\.\d+)*\s*"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="Zero">
- <xs:annotation>
- <xs:documentation xml:lang="en">Define Zero as a vaild value</xs:documentation>
- </xs:annotation>
- <xs:restriction base="xs:int">
- <xs:pattern value="\s*0\s*"/>
- </xs:restriction>
- </xs:simpleType>
-</xs:schema>
diff --git a/Tools/XMLSchema/SurfaceArea.xsd b/Tools/XMLSchema/SurfaceArea.xsd
deleted file mode 100644
index d79e574ee0..0000000000
--- a/Tools/XMLSchema/SurfaceArea.xsd
+++ /dev/null
@@ -1,135 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.TianoCore.org/2006/Edk2.0" xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <!--
- Filename: SurfaceArea.xsd
-
- Copyright (c) 2006, Intel Corp.
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which 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.
-
- APPROVED: 14-Jun-2006
- -->
- <xs:include schemaLocation="FrameworkHeaders.xsd"/>
- <xs:include schemaLocation="FrameworkDataElements.xsd"/>
- <xs:include schemaLocation="FrameworkPlatformDataElements.xsd"/>
- <xs:annotation>
- <xs:documentation xml:lang="en">This describes the valid content of a FrameworkDatabase (DB) File.</xs:documentation>
- </xs:annotation>
- <xs:element name="FrameworkDatabase">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" ref="FdbHeader"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="PackageList"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="PlatformList"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="FarList"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="UserExtensions"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:annotation>
- <xs:documentation xml:lang="en">This describes the valid content of a Framework Platform Description (FPD) File.</xs:documentation>
- </xs:annotation>
- <xs:element name="PlatformSurfaceArea">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" ref="PlatformHeader"/>
- <!-- This section will be for new definitions of how we put together the Framework Binary Images -->
- <xs:element minOccurs="0" maxOccurs="1" ref="PlatformDefinitions"/>
- <!-- The Flash section is the legacy implementation of Flash -->
- <xs:element minOccurs="0" maxOccurs="1" ref="Flash"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="FrameworkModules"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="DynamicPcdBuildDefinitions"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="BuildOptions"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="UserExtensions"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:annotation>
- <xs:documentation xml:lang="en">This describes the valid content for a Module Surface Area Description (MSA) file.</xs:documentation>
- </xs:annotation>
- <xs:element name="ModuleSurfaceArea">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" ref="MsaHeader"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="ModuleDefinitions"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="LibraryClassDefinitions"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="SourceFiles"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="NonProcessedFiles"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="PackageDependencies"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="Protocols"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="Events"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="Hobs"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="PPIs"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="Variables"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="BootModes"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="SystemTables"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="DataHubs"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="HiiPackages"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="Guids"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="Externs"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="PcdCoded"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="ModuleBuildOptions"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="UserExtensions"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:annotation>
- <xs:documentation xml:lang="en">This describes the valid content for a Package Surface Area Description (SPD) file.</xs:documentation>
- </xs:annotation>
- <xs:element name="PackageSurfaceArea">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" ref="SpdHeader"/>
- <xs:element minOccurs="1" maxOccurs="1" ref="PackageDefinitions"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="LibraryClassDeclarations"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="IndustryStdIncludes"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="MsaFiles"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="PackageHeaders"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="GuidDeclarations"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="ProtocolDeclarations"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="PpiDeclarations"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="PcdDeclarations"/>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="UserExtensions"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <!-- This element is listed here, only because we are using elements from both the FrameworkDataElements and FrameworkPlatformDataElements files. -->
- <xs:element name="PlatformDefinitions">
- <xs:complexType>
- <xs:sequence>
- <!-- This is the list of ALL architectures that are supported by this Platform -->
- <xs:element minOccurs="1" maxOccurs="1" name="SupportedArchitectures" type="ArchListType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="BuildTargets" type="BuildTargetList"/>
- <xs:element default="UNIFIED" name="IntermediateDirectories" type="IntermediateOutputType"/>
- <xs:element minOccurs="0" maxOccurs="1" name="OutputDirectory" type="xs:anyURI"/>
- <xs:element minOccurs="0" maxOccurs="1" name="ForceDebugTarget" type="KeywordType"/>
- <!-- SkuInfo is only defined if Sku enabled -->
- <xs:element minOccurs="0" maxOccurs="1" ref="SkuInfo"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="FlashDeviceDefinitions"/>
- <xs:element minOccurs="0" maxOccurs="1" ref="FfsFormatDeclarations"/>
- <xs:element minOccurs="0" maxOccurs="1" name="ClonedFrom">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" name="Cloned">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="1" name="PlatformGuid" type="GuidType"/>
- <xs:element minOccurs="1" maxOccurs="1" name="PlatformVersion" type="VersionDataType"/>
- </xs:sequence>
- <!-- The Id is a number used to track heritage the first entry will be 0 and increment from then on. -->
- <xs:attribute name="Id" type="xs:nonNegativeInteger" use="required"/>
- <!-- If the original module was installed from a FAR, track the FAR it came from. -->
- <xs:attribute name="FarGuid" type="GuidType" use="optional"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-</xs:schema>
diff --git a/Tools/XMLSchema/SurfaceArea.xsdconfig b/Tools/XMLSchema/SurfaceArea.xsdconfig
deleted file mode 100644
index aa52361510..0000000000
--- a/Tools/XMLSchema/SurfaceArea.xsdconfig
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2006, Intel Corp.
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which 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.
--->
-<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
- <xb:namespace uri="http://www.TianoCore.org/2006/Edk2.0">
- <xb:package>org.tianocore</xb:package>
- </xb:namespace>
-</xb:config>
-
diff --git a/Tools/bin/ContextTool b/Tools/bin/ContextTool
deleted file mode 100755
index ed11ada8f5..0000000000
--- a/Tools/bin/ContextTool
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2006, 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.
-#
-
-# Run ContextTool
-java -cp "${WORKSPACE}/Tools/Jars/ContextTool.jar" org.tianocore.context.ContextMain $@
diff --git a/Tools/bin/ContextTool.bat b/Tools/bin/ContextTool.bat
deleted file mode 100644
index 75bbb6ce8e..0000000000
--- a/Tools/bin/ContextTool.bat
+++ /dev/null
@@ -1,73 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-
-@echo off
-
-:check_java
-if "%JAVA_HOME%"=="" goto no_jdk
-:check_wks
-if "%WORKSPACE%"=="" goto no_wks
-:check_ant
-if "%ANT_HOME%"=="" goto no_ant
-:check_xmlbeans
-if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
-:check_surfacearea
-if not exist %WORKSPACE%\Tools\Jars\SurfaceArea.jar (
- goto no_surfacearea
-)
-:check_ContextTool
-if not exist %WORKSPACE%\Tools\Jars\ContextTool.jar (
- goto no_ContextTool
-)
-
-@REM Run ContextTool
-java -cp "%WORKSPACE%\Tools\Jars\ContextTool.jar" org.tianocore.context.ContextMain %*
-
-goto end
-
-:no_jdk
-@echo.
-@echo !!! Please set JAVA_HOME !!!
-@echo.
-goto check_wks
-
-:no_wks
-@echo.
-@echo !!! Please set WORKSPACE !!!
-@echo.
-goto check_ant
-
-:no_ant
-@echo.
-@echo !!! Please set ANT_HOME !!!
-@echo.
-goto check_xmlbeans
-
-:no_xmlbeans
-@echo.
-@echo !!! Please set XMLBEANS_HOME !!!
-@echo.
-goto end
-
-:no_surfacearea
-@echo.
-@echo !!! Please run edksetup.bat to build SurfaceArea.jar !!!
-@echo.
-goto end
-
-:no_ContextTool
-@echo.
-@echo !!! Please run edksetup.bat to build ContextTool.jar !!!
-@echo.
-goto end
-
-:end
-@echo on
diff --git a/Tools/bin/FrameworkWizard b/Tools/bin/FrameworkWizard
deleted file mode 100755
index efc650d95e..0000000000
--- a/Tools/bin/FrameworkWizard
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-#
-
-# Run Framework Wizard
-java -Xmx256m -cp "$CLASSPATH:$WORKSPACE/Tools/bin/FrameworkWizard.jar" org.tianocore.frameworkwizard.FrameworkWizardUI $1
diff --git a/Tools/bin/FrameworkWizard.bat b/Tools/bin/FrameworkWizard.bat
deleted file mode 100644
index 056a3312da..0000000000
--- a/Tools/bin/FrameworkWizard.bat
+++ /dev/null
@@ -1,74 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-
-@echo off
-
-:check_java
-if "%JAVA_HOME%"=="" goto no_jdk
-:check_wks
-if "%WORKSPACE%"=="" goto no_wks
-:check_ant
-if "%ANT_HOME%"=="" goto no_ant
-:check_xmlbeans
-if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
-:check_surfacearea
-if not exist %WORKSPACE%\Tools\Jars\SurfaceArea.jar (
- goto no_surfacearea
-)
-:check_frameworkwizard
-if not exist %WORKSPACE%\Tools\bin\FrameworkWizard.jar (
- goto no_frameworkwizard
-)
-
-@REM Run Framework Wizard
-call "java" -Xmx256m org.tianocore.frameworkwizard.FrameworkWizardUI %%1
-
-goto end
-
-:no_jdk
-@echo.
-@echo !!! Please set JAVA_HOME !!!
-@echo.
-goto check_wks
-
-:no_wks
-@echo.
-@echo !!! Please set WORKSPACE !!!
-@echo.
-goto check_ant
-
-:no_ant
-@echo.
-@echo !!! Please set ANT_HOME !!!
-@echo.
-goto check_xmlbeans
-
-:no_xmlbeans
-@echo.
-@echo !!! Please set XMLBEANS_HOME !!!
-@echo.
-goto end
-
-:no_surfacearea
-@echo.
-@echo !!! Please run edksetup.bat to build SurfaceArea.jar !!!
-@echo.
-goto end
-
-:no_frameworkwizard
-@echo.
-@echo !!! Please run edksetup.bat to build FrameworkWizard.jar !!!
-@echo.
-goto end
-
-:end
-@echo on
-
diff --git a/Tools/bin/MigrationTools b/Tools/bin/MigrationTools
deleted file mode 100755
index b16f956dad..0000000000
--- a/Tools/bin/MigrationTools
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-#
-
-# Run Migration Tool
-java -cp "$CLASSPATH:$WORKSPACE/Tools/bin/MigrationTools.jar" org.tianocore.migration.MigrationTool
diff --git a/Tools/bin/MigrationTools.bat b/Tools/bin/MigrationTools.bat
deleted file mode 100644
index a29044144b..0000000000
--- a/Tools/bin/MigrationTools.bat
+++ /dev/null
@@ -1,74 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-
-@echo off
-
-:check_java
-if "%JAVA_HOME%"=="" goto no_jdk
-:check_wks
-if "%WORKSPACE%"=="" goto no_wks
-:check_ant
-if "%ANT_HOME%"=="" goto no_ant
-:check_xmlbeans
-if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
-:check_surfacearea
-if not exist %WORKSPACE%\Tools\Jars\SurfaceArea.jar (
- goto no_surfacearea
-)
-:check_migration
-if not exist %WORKSPACE%\Tools\bin\MigrationTools.jar (
- goto no_migration
-)
-
-@REM Run Migration
-call "java" org.tianocore.migration.MigrationTool
-
-goto end
-
-:no_jdk
-@echo.
-@echo !!! Please set JAVA_HOME !!!
-@echo.
-goto check_wks
-
-:no_wks
-@echo.
-@echo !!! Please set WORKSPACE !!!
-@echo.
-goto check_ant
-
-:no_ant
-@echo.
-@echo !!! Please set ANT_HOME !!!
-@echo.
-goto check_xmlbeans
-
-:no_xmlbeans
-@echo.
-@echo !!! Please set XMLBEANS_HOME !!!
-@echo.
-goto end
-
-:no_surfacearea
-@echo.
-@echo !!! Please run edksetup.bat to build SurfaceArea.jar !!!
-@echo.
-goto end
-
-:no_migration
-@echo.
-@echo !!! Please run edksetup.bat to build MigrationTools.jar !!!
-@echo.
-goto end
-
-:end
-@echo on
-
diff --git a/Tools/bin/SAVerify.bat b/Tools/bin/SAVerify.bat
deleted file mode 100644
index 8260d682e5..0000000000
--- a/Tools/bin/SAVerify.bat
+++ /dev/null
@@ -1,55 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-
-@if "%JAVA_HOME%"=="" goto no_jdk
-@if "%WORKSPACE%"=="" goto no_wks
-
-@if "%1"=="" (goto usage)
-@if "%1"=="-h" (goto usage)
-@if "%1"=="-H" (goto usage)
-@if "%1"=="all" (goto all)
-@if "%1"=="ALL" (goto all) else (goto standalone)
-
-:usage
-@echo off
-@echo.
-@echo Verify SurfaceArea file(s)
-@echo.
-@echo Usage:
-@echo SAVerify.bat "MSA_FILE" - Verify SurfaceArea file named by MSA_FILE
-@echo SAVerify.bat all - Verify all SurfaceArea files under current directory and its sub-directories
-@echo SAVerify.bat -h - Print usage message
-@echo.
-goto end
-
-:all
- @echo off
- @for /R %%a in (*.msa *.fpd *.spd) do @ant -q -f %WORKSPACE%\Tools\Java\Source\SurfaceArea\build.xml validate -DSURFACE_AREA_FILE=%%a
- @echo on
- @goto end
-
-:standalone
- @ant -q -f %WORKSPACE%\Tools\Java\Source\SurfaceArea\build.xml validate -DSURFACE_AREA_FILE=%~f1
- @goto end
-
-:no_jdk
- @echo.
- @echo !!! Please set JAVA_HOME !!!
- @echo.
- @goto end
-
-:no_wks
- @echo.
- @echo !!! Please set WORKSPACE !!!
- @echo.
- @goto end
-
-:end
diff --git a/Tools/bin/build b/Tools/bin/build
deleted file mode 100755
index b8eee97dfb..0000000000
--- a/Tools/bin/build
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-#
-
-nice ant -logger org.tianocore.build.global.GenBuildLogger -f $WORKSPACE/build.xml $*
diff --git a/Tools/bin/build.bat b/Tools/bin/build.bat
deleted file mode 100644
index 778004abc9..0000000000
--- a/Tools/bin/build.bat
+++ /dev/null
@@ -1,39 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-@echo off
-
-set _ARGS=
-:check_arg
-if ""%1""=="""" goto arg_end
-if ""%1""==""-q"" goto ant_arg
-if ""%1""==""-v"" goto ant_arg
-if ""%1""==""-d"" goto ant_arg
-if ""%1""==""-e"" goto ant_arg
-if ""%1""==""-emacs"" goto ant_arg
-
-goto ant_target
-
-:ant_arg
- set _ARGS=%_ARGS% %1
- shift
- goto check_arg
-
-:ant_target
- set _ARGS=%_ARGS% -DBUILD_TARGET=%1
- shift
- goto check_arg
-
-:arg_end
-ant -logger org.tianocore.build.global.GenBuildLogger -f %WORKSPACE%/build.xml %_ARGS%
-
-set _ARGS=
-@echo on
-
diff --git a/Tools/bin/ckt b/Tools/bin/ckt
deleted file mode 100755
index 4a0053f4c7..0000000000
--- a/Tools/bin/ckt
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-#
-
-# Run CheckTools
-java -cp "${WORKSPACE}/Tools/bin/CheckTools.jar" org.tianocore.CheckTools.CheckTools $@
diff --git a/Tools/bin/ckt.bat b/Tools/bin/ckt.bat
deleted file mode 100644
index 651466a8f6..0000000000
--- a/Tools/bin/ckt.bat
+++ /dev/null
@@ -1,73 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-
-@echo off
-
-:check_java
-if "%JAVA_HOME%"=="" goto no_jdk
-:check_wks
-if "%WORKSPACE%"=="" goto no_wks
-:check_ant
-if "%ANT_HOME%"=="" goto no_ant
-:check_xmlbeans
-if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
-:check_surfacearea
-if not exist %WORKSPACE%\Tools\Jars\SurfaceArea.jar (
- goto no_surfacearea
-)
-:check_CheckTools
-if not exist %WORKSPACE%\Tools\bin\CheckTools.jar (
- goto no_CheckTools
-)
-
-@REM Run CheckTools
-call "java" -cp "%WORKSPACE%\Tools\bin\CheckTools.jar" org.tianocore.CheckTools.CheckTools %*
-
-goto end
-
-:no_jdk
-@echo.
-@echo !!! Please set JAVA_HOME !!!
-@echo.
-goto check_wks
-
-:no_wks
-@echo.
-@echo !!! Please set WORKSPACE !!!
-@echo.
-goto check_ant
-
-:no_ant
-@echo.
-@echo !!! Please set ANT_HOME !!!
-@echo.
-goto check_xmlbeans
-
-:no_xmlbeans
-@echo.
-@echo !!! Please set XMLBEANS_HOME !!!
-@echo.
-goto end
-
-:no_surfacearea
-@echo.
-@echo !!! Please run edksetup.bat to build SurfaceArea.jar !!!
-@echo.
-goto end
-
-:no_CheckTools
-@echo.
-@echo !!! Please run edksetup.bat to build CheckTools.jar !!!
-@echo.
-goto end
-
-:end
-@echo on
diff --git a/Tools/bin/dbtool b/Tools/bin/dbtool
deleted file mode 100644
index 311d49de46..0000000000
--- a/Tools/bin/dbtool
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-#
-
-# Run DbTools
-java -cp "${WORKSPACE}/Tools/Jars/DbTools.jar" org.tianocore.DbTools.DbTool $@
diff --git a/Tools/bin/dbtool.bat b/Tools/bin/dbtool.bat
deleted file mode 100644
index 2a2bdab102..0000000000
--- a/Tools/bin/dbtool.bat
+++ /dev/null
@@ -1,73 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-
-@echo off
-
-:check_java
-if "%JAVA_HOME%"=="" goto no_jdk
-:check_wks
-if "%WORKSPACE%"=="" goto no_wks
-:check_ant
-if "%ANT_HOME%"=="" goto no_ant
-:check_xmlbeans
-if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
-:check_surfacearea
-if not exist %WORKSPACE%\Tools\Jars\SurfaceArea.jar (
- goto no_surfacearea
-)
-:check_DbTools
-if not exist %WORKSPACE%\Tools\Jars\DbTools.jar (
- goto no_DbTools
-)
-
-@REM Run Framework Wizard
-call "java" -cp "%WORKSPACE%\Tools\Jars\DbTools.jar" org.tianocore.DbTools.DbTool %*
-
-goto end
-
-:no_jdk
-@echo.
-@echo !!! Please set JAVA_HOME !!!
-@echo.
-goto check_wks
-
-:no_wks
-@echo.
-@echo !!! Please set WORKSPACE !!!
-@echo.
-goto check_ant
-
-:no_ant
-@echo.
-@echo !!! Please set ANT_HOME !!!
-@echo.
-goto check_xmlbeans
-
-:no_xmlbeans
-@echo.
-@echo !!! Please set XMLBEANS_HOME !!!
-@echo.
-goto end
-
-:no_surfacearea
-@echo.
-@echo !!! Please run edksetup.bat to build SurfaceArea.jar !!!
-@echo.
-goto end
-
-:no_DbTools
-@echo.
-@echo !!! Please run edksetup.bat to build DbTools.jar !!!
-@echo.
-goto end
-
-:end
-@echo on
diff --git a/Tools/bin/fixdb b/Tools/bin/fixdb
deleted file mode 100644
index 3865afe99d..0000000000
--- a/Tools/bin/fixdb
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-#
-
-# Run DbTools -f
-java -cp "${WORKSPACE}/Tools/Jars/DbTools.jar" org.tianocore.DbTools.DbTool -f $@
diff --git a/Tools/bin/fixdb.bat b/Tools/bin/fixdb.bat
deleted file mode 100644
index ae0bd8c6d1..0000000000
--- a/Tools/bin/fixdb.bat
+++ /dev/null
@@ -1,73 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-
-@echo off
-
-:check_java
-if "%JAVA_HOME%"=="" goto no_jdk
-:check_wks
-if "%WORKSPACE%"=="" goto no_wks
-:check_ant
-if "%ANT_HOME%"=="" goto no_ant
-:check_xmlbeans
-if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
-:check_surfacearea
-if not exist %WORKSPACE%\Tools\Jars\SurfaceArea.jar (
- goto no_surfacearea
-)
-:check_DbTools
-if not exist %WORKSPACE%\Tools\Jars\DbTools.jar (
- goto no_DbTools
-)
-
-@REM Run Framework Wizard
-call "java" -cp "%WORKSPACE%\Tools\Jars\DbTools.jar" org.tianocore.DbTools.DbTool -f %*
-
-goto end
-
-:no_jdk
-@echo.
-@echo !!! Please set JAVA_HOME !!!
-@echo.
-goto check_wks
-
-:no_wks
-@echo.
-@echo !!! Please set WORKSPACE !!!
-@echo.
-goto check_ant
-
-:no_ant
-@echo.
-@echo !!! Please set ANT_HOME !!!
-@echo.
-goto check_xmlbeans
-
-:no_xmlbeans
-@echo.
-@echo !!! Please set XMLBEANS_HOME !!!
-@echo.
-goto end
-
-:no_surfacearea
-@echo.
-@echo !!! Please run edksetup.bat to build SurfaceArea.jar !!!
-@echo.
-goto end
-
-:no_DbTools
-@echo.
-@echo !!! Please run edksetup.bat to build DbTools.jar !!!
-@echo.
-goto end
-
-:end
-@echo on
diff --git a/Tools/bin/fw b/Tools/bin/fw
deleted file mode 100755
index 505fe7bc28..0000000000
--- a/Tools/bin/fw
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2006, 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.
-#
-
-# Run Framework Wizard
-java -cp "$CLASSPATH:$WORKSPACE/Tools/bin/FrameworkWizard.jar" org.tianocore.frameworkwizard.FrameworkWizardUI $1
diff --git a/Tools/bin/fw.bat b/Tools/bin/fw.bat
deleted file mode 100644
index 056a3312da..0000000000
--- a/Tools/bin/fw.bat
+++ /dev/null
@@ -1,74 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-
-@echo off
-
-:check_java
-if "%JAVA_HOME%"=="" goto no_jdk
-:check_wks
-if "%WORKSPACE%"=="" goto no_wks
-:check_ant
-if "%ANT_HOME%"=="" goto no_ant
-:check_xmlbeans
-if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
-:check_surfacearea
-if not exist %WORKSPACE%\Tools\Jars\SurfaceArea.jar (
- goto no_surfacearea
-)
-:check_frameworkwizard
-if not exist %WORKSPACE%\Tools\bin\FrameworkWizard.jar (
- goto no_frameworkwizard
-)
-
-@REM Run Framework Wizard
-call "java" -Xmx256m org.tianocore.frameworkwizard.FrameworkWizardUI %%1
-
-goto end
-
-:no_jdk
-@echo.
-@echo !!! Please set JAVA_HOME !!!
-@echo.
-goto check_wks
-
-:no_wks
-@echo.
-@echo !!! Please set WORKSPACE !!!
-@echo.
-goto check_ant
-
-:no_ant
-@echo.
-@echo !!! Please set ANT_HOME !!!
-@echo.
-goto check_xmlbeans
-
-:no_xmlbeans
-@echo.
-@echo !!! Please set XMLBEANS_HOME !!!
-@echo.
-goto end
-
-:no_surfacearea
-@echo.
-@echo !!! Please run edksetup.bat to build SurfaceArea.jar !!!
-@echo.
-goto end
-
-:no_frameworkwizard
-@echo.
-@echo !!! Please run edksetup.bat to build FrameworkWizard.jar !!!
-@echo.
-goto end
-
-:end
-@echo on
-
diff --git a/Tools/bin/merge b/Tools/bin/merge
deleted file mode 100755
index 8bd2efdbda..0000000000
--- a/Tools/bin/merge
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2006, 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.
-#
-
-# Run Framework Wizard
-java -cp "${WORKSPACE}/Tools/bin/Merge.jar" org.tianocore.Merge.Merge $@
diff --git a/Tools/bin/merge.bat b/Tools/bin/merge.bat
deleted file mode 100644
index 82e4e10742..0000000000
--- a/Tools/bin/merge.bat
+++ /dev/null
@@ -1,73 +0,0 @@
-@REM
-@REM Copyright (c) 2006, Intel Corporation
-@REM All rights reserved. This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD License
-@REM which accompanies this distribution. The full text of the license may be found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM
-
-@echo off
-
-:check_java
-if "%JAVA_HOME%"=="" goto no_jdk
-:check_wks
-if "%WORKSPACE%"=="" goto no_wks
-:check_ant
-if "%ANT_HOME%"=="" goto no_ant
-:check_xmlbeans
-if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
-:check_surfacearea
-if not exist %WORKSPACE%\Tools\Jars\SurfaceArea.jar (
- goto no_surfacearea
-)
-:check_merge
-if not exist %WORKSPACE%\Tools\bin\Merge.jar (
- goto no_merge
-)
-
-@REM Run Merge
-call "java" -cp "%CLASSPATH%;%WORKSPACE%\Tools\bin\Merge.jar" org.tianocore.Merge.Merge %*
-
-goto end
-
-:no_jdk
-@echo.
-@echo !!! Please set JAVA_HOME !!!
-@echo.
-goto check_wks
-
-:no_wks
-@echo.
-@echo !!! Please set WORKSPACE !!!
-@echo.
-goto check_ant
-
-:no_ant
-@echo.
-@echo !!! Please set ANT_HOME !!!
-@echo.
-goto check_xmlbeans
-
-:no_xmlbeans
-@echo.
-@echo !!! Please set XMLBEANS_HOME !!!
-@echo.
-goto end
-
-:no_surfacearea
-@echo.
-@echo !!! Please run edksetup.bat to build SurfaceArea.jar !!!
-@echo.
-goto end
-
-:no_merge
-@echo.
-@echo !!! Please run edksetup.bat to build Merge.jar !!!
-@echo.
-goto end
-
-:end
-@echo on
diff --git a/Tools/build.xml b/Tools/build.xml
deleted file mode 100644
index 4b02c253f6..0000000000
--- a/Tools/build.xml
+++ /dev/null
@@ -1,246 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Copyright (c) 2006, 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.
--->
-<project name="Tools" default="all" basedir=".">
-
- <taskdef resource="net/sf/antcontrib/antlib.xml"/>
- <property environment="env"/>
-
- <target name="all" depends="C_Code">
- <echo message="The EDK II Tools build has completed!"/>
- </target>
-
- <target name="C_Code" depends="JavaCode">
- <subant target="" inheritall="false">
- <filelist dir="."
- files="
- CCode/Source/build.xml
- "/>
- </subant>
- </target>
-
- <target name="JavaCode" depends="SurfaceArea">
- <subant target="" verbose="true" inheritall="false">
- <!-- Note: this is an ordered list. The projects have dependencies between them. -->
- <filelist dir="."
- files="
- Java/Source/Common/build.xml
- Java/Source/PcdTools/build.xml
- Java/Source/GenBuild/build.xml
- Java/Source/FrameworkTasks/build.xml
- Java/Source/Cpptasks/build.xml
- Java/Source/FrameworkWizard/build.xml
- Java/Source/MigrationTools/build.xml
- Java/Source/ContextTool/build.xml
- Java/Source/Merge/build.xml
- Java/Source/CheckTools/build.xml
- Java/Source/DbTools/build.xml
- "/>
- </subant>
- <echo message="The EDK II Java Tools build has completed!"/>
- </target>
-
- <target name="Wizard" depends="SurfaceArea">
- <subant target="" verbose="true" inheritall="false">
- <!-- Note: this is an ordered list. The projects have dependencies between them. -->
- <filelist dir="."
- files="
- Java/Source/FrameworkWizard/build.xml
- "/>
- </subant>
- </target>
-
- <target name="Merge" depends="SurfaceArea">
- <subant target="" verbose="true" inheritall="false">
- <filelist dir="."
- files="
- Java/Source/Merge/build.xml
- "/>
- </subant>
- </target>
-
- <target name="SurfaceArea" depends="makeCatalog">
- <subant target="" verbose="true" inheritall="false">
- <filelist dir="."
- files="
- Java/Source/SurfaceArea/build.xml
- "/>
- </subant>
- </target>
-
- <target name="makeCatalog">
- <if>
- <not>
- <available file="XMLSchema/catalog.xml"/>
- </not>
- <then>
- <echo file="XMLSchema/catalog.xml"><![CDATA[<?xml version="1.0"?>
-<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.xsd">
-<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
- <rewriteSystem systemIdStartString="http://www.TianoCore.org/2006/Edk2.0/"
- rewritePrefix="file:/]]>${env.WORKSPACE}<![CDATA[/Tools/XMLSchema/"/>
- <rewriteURI uriStartString="http://www.TianoCore.org/2006/Edk2.0/"
- rewritePrefix="file:/]]>${env.WORKSPACE}<![CDATA[/Tools/XMLSchema/"/>
-</catalog>]]>
-</echo>
- </then>
- </if>
- <if>
- <not>
- <available file="Conf/tools_def.txt"/>
- </not>
- <then>
- <copy file="Conf/tools_def.template" tofile="Conf/tools_def.txt"/>
- </then>
- </if>
-
- <if>
- <not>
- <available file="Conf/target.txt"/>
- </not>
- <then>
- <copy file="Conf/target.template" tofile="Conf/target.txt"/>
- </then>
- </if>
-
- <if>
- <not>
- <available file="Conf/FrameworkDatabase.db"/>
- </not>
- <then>
- <copy file="Conf/FrameworkDatabase.template" tofile="Conf/FrameworkDatabase.db"/>
- </then>
- </if>
- </target>
-
- <target name="reconfig">
- <!-- backup all config files -->
- <if>
- <available file="Conf/target.txt"/>
- <then>
- <echo message="Backup Conf/target.txt to Conf/target.txt.bak" />
- <copy file="Conf/target.txt" tofile="Conf/target.txt.bak" overwrite="true" />
- </then>
- </if>
- <if>
- <available file="Conf/tools_def.txt"/>
- <then>
- <echo message="Backup Conf/tools_def.txt to Conf/tools_def.txt.bak" />
- <copy file="Conf/tools_def.txt" tofile="Conf/tools_def.txt.bak" overwrite="true" />
- </then>
- </if>
- <if>
- <available file="Conf/FrameworkDatabase.db"/>
- <then>
- <echo message="Backup Conf/FrameworkDatabase.db to Conf/FrameworkDatabase.db.bak" />
- <copy file="Conf/FrameworkDatabase.db" tofile="Conf/FrameworkDatabase.db.bak" overwrite="true" />
- </then>
- </if>
-
- <if>
- <available file="Conf/tools_def.template"/>
- <then>
- <echo message="Copy file from Conf/tools_def.template to Conf/tools_def.txt" />
- <copy file="Conf/tools_def.template" tofile="Conf/tools_def.txt" overwrite="true" />
- </then>
- </if>
-
- <if>
- <available file="Conf/target.template"/>
- <then>
- <echo message="Copy file from Conf/target.template to Conf/target.txt" />
- <copy file="Conf/target.template" tofile="Conf/target.txt" overwrite="true" />
- </then>
- </if>
-
- <if>
- <available file="Conf/FrameworkDatabase.template"/>
- <then>
- <echo message="Copy file from Conf/FrameworkDatabase.template to Conf/FrameworkDatabase.db" />
- <copy file="Conf/FrameworkDatabase.template" tofile="Conf/FrameworkDatabase.db" overwrite="true" />
- </then>
- </if>
- </target>
-
- <target name="clean">
- <subant target="clean" inheritall="false">
- <filelist dir="."
- files="
- Java/Source/FrameworkWizard/build.xml
- Java/Source/Cpptasks/build.xml
- Java/Source/FrameworkTasks/build.xml
- Java/Source/GenBuild/build.xml
- Java/Source/PcdTools/build.xml
- Java/Source/Common/build.xml
- Java/Source/SurfaceArea/build.xml
- Java/Source/MigrationTools/build.xml
- Java/Source/ContextTool/build.xml
- Java/Source/Merge/build.xml
- Java/Source/CheckTools/build.xml
- Java/Source/DbTools/build.xml
- CCode/Source/build.xml
- "/>
- </subant>
- </target>
-
- <target name="cleanall">
- <echo message="Removing extra ${env.WORKSPACE} history.xml files!"/>
- <if>
- <available file="${env.WORKSPACE}/Tools/bin/history.xml"/>
- <then>
- <delete failonerror="false" quiet="true">
- <fileset file="${env.WORKSPACE}/Tools/bin/history.xml"/>
- </delete>
- </then>
- </if>
- <if>
- <available file="${env.WORKSPACE}/Tools/CCode/Source/Library/history.xml"/>
- <then>
- <delete failonerror="false" quiet="true">
- <fileset file="${env.WORKSPACE}/Tools/CCode/Source/Library/history.xml"/>
- </delete>
- </then>
- </if>
- <available classname="org.tianocore.frameworkwizard.FrameworkWizardUI" property="FrameworkWizardUI.available"/>
- <available classname="org.tianocore.build.GenBuildTask" property="GenBuildTask.available"/>
- <available classname="org.tianocore.framework.tasks.Tool" property="Tool.available"/>
- <available classname="org.tianocore.pcd.action.BuildAction" property="PcdClass.available"/>
- <if>
- <or>
- <isset property="FrameworkWizardUI.available"/>
- <isset property="GenBuildTask.available"/>
- <isset property="Tool.available"/>
- <isset property="PcdClass.available"/>
- </or>
- <then>
- <fail message="Use ant -noclasspath cleanall, to remove all jar files!"/>
- </then>
- </if>
- <subant target="cleanall" inheritall="true">
- <filelist dir="."
- files="
- Java/Source/FrameworkWizard/build.xml
- Java/Source/Cpptasks/build.xml
- Java/Source/FrameworkTasks/build.xml
- Java/Source/GenBuild/build.xml
- Java/Source/PcdTools/build.xml
- Java/Source/Common/build.xml
- Java/Source/SurfaceArea/build.xml
- Java/Source/MigrationTools/build.xml
- Java/Source/ContextTool/build.xml
- Java/Source/Merge/build.xml
- Java/Source/CheckTools/build.xml
- Java/Source/DbTools/build.xml
- CCode/Source/build.xml
- "/>
- </subant>
- </target>
-</project>
diff --git a/Tools/gcc/README.txt b/Tools/gcc/README.txt
deleted file mode 100644
index 9e581f2c3e..0000000000
--- a/Tools/gcc/README.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-You may run these scripts to build a Tiano Cross compiler. They have been
-tested on Cygwin, OS X and Linux. You should expect to hack on these scripts to
-make them work on your system. You may need to install additional tools on your
-system to make the scripts work.
-
-You will need
-
- A recent version (3.0 or later should be fine) of gcc that is able to produce
- executables for the machine that you want to run this compiler on (the host
- machine).
- wget or curl
- tar
- bzip
- gzip
- bash
- and possibly others
-
-CYGWIN Notes
-
-You should setup cygwin to use binmode on all mounts. When you initially
-install cygwin it gives you the choice of Unix file mode (recommended) or DOS
-file mode. Unix mode will cause all the cygwin directories to be mounted in
-binmode, while DOS will mount the dirs in textmode. Here is an example of a
-cygwin install where the dirs are (properly) mounted in binmode.
-
-C:\cygwin\bin on /usr/bin type user (binmode)
-C:\cygwin\lib on /usr/lib type user (binmode)
-c:\workspace on /workspace type system (binmode)
-C:\cygwin on / type user (binmode)
-
-If you use textmode, it is likely that the build will fail in a way that is
-hard to debug.
-
-Cygwin is pretty slow, so it is not recommended for large builds.
-
diff --git a/Tools/gcc/mingw64-gcc-build b/Tools/gcc/mingw64-gcc-build
deleted file mode 100755
index 9045080914..0000000000
--- a/Tools/gcc/mingw64-gcc-build
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/bin/bash
-
-#
-# Build a mingw64 compiler for doing x64 compiles.
-#
-
-###
-### CYGWIN :: Make sure that cygwin is mouting its file systems in binmode.
-###
-
-#
-# Specify the architectures for which the tools are to be built
-#
-TARGS="${TARGS:-x86_64-pc-mingw64 }"
-
-# Let's be nice
-renice 10 -p $$
-
-# If any thing goes wrong, we'll bail out.
-set -e
-
-#
-# Specify the versions
-#
-GCC=gcc-4.1.1
-BINUTILS=binutils-2.17
-W32API=w32api-3.6
-# BINUTILS=binutils-2.16.91-20060119-1
-CYGWIN_SNAP=20060403 # You may need to find a more recent one.
-export PATH=/bin:/usr/bin:/usr/local/bin
-
-#
-# Where to install
-#
-# PREFIX="${PREFIX:-~/tiano/}"
-PREFIX="${PREFIX:-/opt/tiano/}"
-
-#
-# Where to get the GNU tools
-#
-BINUTILS_URL=ftp://ftp.ibiblio.org/pub/mirrors/gnu/ftp/gnu/binutils/${BINUTILS}.tar.bz2
-GCC_URL=ftp://mirrors.kernel.org/gnu/gcc/$GCC/$GCC.tar.bz2
-CYG_LOC=http://cygwin.com/snapshots/cygwin-src-${CYGWIN_SNAP}.tar.bz2
-W32API_LOC=http://superb-west.dl.sourceforge.net/sourceforge/mingw/${W32API}-src.tar.gz
-# export http_proxy=http://proxy.dp.intel.com:911
-# export ftp_proxy=http://proxy.dp.intel.com:911
-
-#
-# Uncomment one of the following depending upon which your system provides
-#
-#GET_COMMAND="curl --remote-name"
-GET_COMMAND="wget -nc --no-directories --retr-symlinks "
-
-#
-# Allow environment to override some programs
-#
-MAKE="${MAKE:-make}"
-export MAKE
-SHELL="${SHELL:-/bin/sh}"
-export SHELL
-
-#
-# Get the source
-# If you don't have curl on your machine, try using
-# wget --passive-ftp --no-directories --retr-symlinks <<url>>
-# If that doesn't work, try without the --passive-ftp option.
-#
-getSource() {
- ${GET_COMMAND} "${BINUTILS_URL}" &
- ${GET_COMMAND} "${GCC_URL}" &
- ${GET_COMMAND} "${CYG_LOC}" &
- ${GET_COMMAND} "${W32API_LOC}" &
- wait
-}
-
-#
-# Unpack the source
-#
-unpackSource() {
- (rm -rf "${BINUTILS}"
- tar jxf "${BINUTILS}.tar.bz2"
- ) &
-
- (rm -rf "${GCC}"
- tar jxf "${GCC}.tar.bz2"
- ) &
-
- (rm -rf cygwin-snapshot-${CYGWIN_SNAP}-1/
- tar jxf cygwin-src-${CYGWIN_SNAP}.tar.bz2
- ) &
-
- (rm -rf ${W32API}
- tar zxf ${W32API}-src.tar.gz
- ) &
-
- wait
-
- # Apply patches
- (cd ${GCC}; patch -p1 < ../gcc_4.1.1.x86_64.061113.diff
- )
-
- (cd ${BINUTILS}; patch -p1 < ../binutils.diff
- )
-
- wait
-}
-
-CONF_SHELL="${CONF_SHELL:-/bin/bash}"
-# CONF_SHELL="${CONF_SHELL:-echo}"
-
-#
-# Build
-#
-build() {
- for targ in $TARGS
- do (
- export pref=${PREFIX}${targ}
- export PATH="${pref}/bin:$PATH"
-
- ( mkdir -p build-binutils-$targ
- cd build-binutils-$targ
- "${CONF_SHELL}" "../${BINUTILS}/configure" \
- --disable-nls "--target=${targ}" "--prefix=${pref}"
- ${MAKE} -j1 -w all
- ${MAKE} -w install
- ) >> ${targ}.log 2>&1
-
- (
- mkdir -p $pref/$targ/sys-include;
- cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/newlib/libc/include/* $pref/$targ/sys-include
- cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/winsup/cygwin/include/* $pref/$targ/sys-include
- )
-
- (
- mkdir -p $pref/$targ/include;
- cp -fr ${W32API}/include/* $pref/$targ/sys-include;
- )
-
- ( mkdir -p build-gcc-$targ
- cd build-gcc-$targ
- "${CONF_SHELL}" "../${GCC}/configure" "--target=${targ}" "--prefix=${pref}" \
- --with-gnu-as --with-gnu-ld --without-headers --with-newlib --verbose \
- --disable-libssp \
- --disable-nls --enable-languages=c
- ${MAKE} -j1 -w all
- ${MAKE} -w install
- ) >> ${targ}.log 2>&1
- ) &
- done
-
- wait
-}
-
-
-
-#
-# Do everything
-#
-# Comment out any activities you wish to omit
-#
-getSource
-unpackSource
-build
diff --git a/Tools/gcc/tianoCross-gcc-4.0 b/Tools/gcc/tianoCross-gcc-4.0
deleted file mode 100644
index 99fceb8086..0000000000
--- a/Tools/gcc/tianoCross-gcc-4.0
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/bin/bash
-
-#
-# Get, build and install the latest cross-development tools and libraries
-#
-
-#
-# Specify the architectures for which the tools are to be built
-# To build for single target: ARCHS="m68k"
-#
-ARCHS="${ARCHS:-i386}"
-
-# Let's be nice
-renice 10 -p $$
-
-# If any thing goes wrong, we'll bail out.
-set -ex
-
-#
-# Specify the versions
-#
-GCC=gcc-4.0.2
-BINUTILS=binutils-2.16.1
-CYGWIN_SNAP=20060120 # You may need to find a more recent one.
-export PATH=/bin:/usr/bin
-
-#
-# Where to install
-#
-PREFIX="${PREFIX:-/opt/tiano/}"
-
-#
-# Where to get the GNU tools
-#
-BINUTILS_URL=ftp://ftp.ibiblio.org/pub/mirrors/gnu/ftp/gnu/binutils/${BINUTILS}.tar.bz2
-GCC_URL=ftp://ftp.ibiblio.org/pub/mirrors/gnu/ftp/gnu/gcc/gcc-4.0.2/${GCC}.tar.bz2
-CYG_LOC=http://cygwin.com/snapshots/cygwin-src-${CYGWIN_SNAP}.tar.bz2
-export http_proxy=http://proxy.dp.intel.com:911
-export ftp_proxy=http://proxy.dp.intel.com:911
-
-#
-# Uncomment one of the following depending upon which your system provides
-#
-GET_COMMAND="curl --remote-name"
-#GET_COMMAND="wget -nc --no-directories --retr-symlinks "
-
-#
-# Allow environment to override some programs
-#
-MAKE="${MAKE:-make}"
-export MAKE
-SHELL="${SHELL:-/bin/sh}"
-export SHELL
-
-#
-# Get the source
-# If you don't have curl on your machine, try using
-# wget --passive-ftp --no-directories --retr-symlinks <<url>>
-# If that doesn't work, try without the --passive-ftp option.
-#
-getSource() {
- ${GET_COMMAND} "${BINUTILS_URL}" &
- ${GET_COMMAND} "${GCC_URL}" &
- ${GET_COMMAND} "${CYG_LOC}" &
- wait
-}
-
-#
-# Unpack the source
-#
-unpackSource() {
- (rm -rf "${BINUTILS}"
- tar jxf "${BINUTILS}.tar.bz2"
- ) &
-
- (rm -rf "${GCC}"
- tar jxf "${GCC}.tar.bz2"
- ) &
-
- (rm -rf cygwin-snapshot-${CYGWIN_SNAP}-1/
- tar jxf cygwin-src-${CYGWIN_SNAP}.tar.bz2
- ) &
-
- wait
-
- # (cd "${GCC}" ; ln -sf "../cygwin-snapshot-20060120-1/newlib" newlib)
-
-}
-
-CONF_SHELL="${CONF_SHELL:-/bin/bash}"
-# CONF_SHELL="${CONF_SHELL:-echo}"
-
-#
-# Build
-#
-build() {
- for arch in $ARCHS
- do (
- export targ=${arch}-tiano-pe
- export pref=${PREFIX}${targ}
- export PATH="${pref}/bin:$PATH"
-
- ( mkdir -p build-binutils-$targ
- cd build-binutils-$targ
- "${CONF_SHELL}" "../${BINUTILS}/configure" \
- --disable-nls "--target=${targ}" "--prefix=${pref}"
- ${MAKE} -j1 -w all
- ${MAKE} -w install
- ) >> ${targ}.log 2>&1
-
- (
- mkdir -p $pref/$targ/sys-include;
- cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/newlib/libc/include/* $pref/$targ/sys-include
- cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/winsup/cygwin/include/* $pref/$targ/sys-include
- )
-
- ( mkdir -p build-gcc-$targ
- cd build-gcc-$targ
- "${CONF_SHELL}" "../${GCC}/configure" "--target=${targ}" "--prefix=${pref}" \
- --with-gnu-as --with-gnu-ld --with-newlib --verbose \
- --disable-nls --enable-languages=c
- ${MAKE} -j1 -w all
- ${MAKE} -w install
- ) >> ${targ}.log 2>&1
- ) &
- done
-
- wait
-}
-
-
-
-#
-# Do everything
-#
-# Comment out any activities you wish to omit
-#
-getSource
-unpackSource
-build
-
diff --git a/Tools/gcc/tianoCross-gcc-4.1 b/Tools/gcc/tianoCross-gcc-4.1
deleted file mode 100644
index bef18436aa..0000000000
--- a/Tools/gcc/tianoCross-gcc-4.1
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/bin/bash
-
-#
-# Get, build and install the latest cross-development tools and libraries
-#
-
-###
-### CYGWIN :: Make sure that cygwin is mouting its file systems in binmode.
-###
-
-#
-# Specify the architectures for which the tools are to be built
-# To build for single target: ARCHS="m68k"
-#
-ARCHS="${ARCHS:-i386}"
-
-# Let's be nice
-renice 10 -p $$
-
-# If any thing goes wrong, we'll bail out.
-set -e
-
-#
-# Specify the versions
-#
-GCC=gcc-4.1.0
-BINUTILS=binutils-2.16.1
-# BINUTILS=binutils-2.16.91-20060119-1
-CYGWIN_SNAP=20060403 # You may need to find a more recent one.
-export PATH=/bin:/usr/bin
-
-#
-# Where to install
-#
-PREFIX="${PREFIX:-/opt/tiano/}"
-
-#
-# Where to get the GNU tools
-#
-BINUTILS_URL=ftp://ftp.ibiblio.org/pub/mirrors/gnu/ftp/gnu/binutils/${BINUTILS}.tar.bz2
-GCC_URL=ftp://mirrors.kernel.org/gnu/gcc/$GCC/$GCC.tar.bz2
-CYG_LOC=http://cygwin.com/snapshots/cygwin-src-${CYGWIN_SNAP}.tar.bz2
-# export http_proxy=http://proxy.dp.intel.com:911
-# export ftp_proxy=http://proxy.dp.intel.com:911
-
-#
-# Uncomment one of the following depending upon which your system provides
-#
-#GET_COMMAND="curl --remote-name"
-GET_COMMAND="wget -nc --no-directories --retr-symlinks "
-
-#
-# Allow environment to override some programs
-#
-MAKE="${MAKE:-make}"
-export MAKE
-SHELL="${SHELL:-/bin/sh}"
-export SHELL
-
-#
-# Get the source
-# If you don't have curl on your machine, try using
-# wget --passive-ftp --no-directories --retr-symlinks <<url>>
-# If that doesn't work, try without the --passive-ftp option.
-#
-getSource() {
- ${GET_COMMAND} "${BINUTILS_URL}" &
- ${GET_COMMAND} "${GCC_URL}" &
- ${GET_COMMAND} "${CYG_LOC}" &
- wait
-}
-
-#
-# Unpack the source
-#
-unpackSource() {
- (rm -rf "${BINUTILS}"
- tar jxf "${BINUTILS}.tar.bz2"
- ) &
-
- (rm -rf "${GCC}"
- tar jxf "${GCC}.tar.bz2"
- ) &
-
- (rm -rf cygwin-snapshot-${CYGWIN_SNAP}-1/
- tar jxf cygwin-src-${CYGWIN_SNAP}.tar.bz2
- ) &
-
- wait
-}
-
-CONF_SHELL="${CONF_SHELL:-/bin/bash}"
-# CONF_SHELL="${CONF_SHELL:-echo}"
-
-#
-# Build
-#
-build() {
- for arch in $ARCHS
- do (
- export targ=${arch}-tiano-pe
- export pref=${PREFIX}${targ}
- export PATH="${pref}/bin:$PATH"
-
- ( mkdir -p build-binutils-$targ
- cd build-binutils-$targ
- "${CONF_SHELL}" "../${BINUTILS}/configure" \
- --disable-nls "--target=${targ}" "--prefix=${pref}"
- ${MAKE} -j1 -w all
- ${MAKE} -w install
- ) >> ${targ}.log 2>&1 &&
-
- (
- mkdir -p $pref/$targ/sys-include;
- cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/newlib/libc/include/* $pref/$targ/sys-include
- cp -fr cygwin-snapshot-${CYGWIN_SNAP}-1/winsup/cygwin/include/* $pref/$targ/sys-include
- ) &&
-
- ( mkdir -p build-gcc-$targ
- cd build-gcc-$targ
- "${CONF_SHELL}" "../${GCC}/configure" "--target=${targ}" "--prefix=${pref}" \
- --with-gnu-as --with-gnu-ld --with-newlib --verbose \
- --disable-libssp \
- --disable-nls --enable-languages=c
- ${MAKE} -j1 -w all
- ${MAKE} -w install
- ) >> ${targ}.log 2>&1
- ) &
- done
-
- wait
-}
-
-
-
-#
-# Do everything
-#
-# Comment out any activities you wish to omit
-#
-getSource
-unpackSource
-build
-
-